#ifndef STORMPROTOS_POWERPC_SPROTOS_H
#define STORMPROTOS_POWERPC_SPROTOS_H

#ifdef __PPC__

/*
Attention: The names for this PPC functions (all have a suffix "_" 
	   are subject to change. As soon as the StormC PPC compiler 
	   is able to add the "struct Library *" by default for 
	   shared library functions the names will loose the suffix.

	   Please use the __inline functions from the end of this file.           
*/

extern "library=PowerPCBase" {

	/* *** call 68K */
	ULONG Run68K_(struct Library *, struct PPCArgs *);
	ULONG WaitFor68K_(struct Library *, struct PPCArgs *);

	/* *** debugging */
	VOID SPrintF_(struct Library *, STRPTR, APTR);

	/* *** memory */
	APTR AllocVecPPC_(struct Library *, ULONG, ULONG, ULONG);
	LONG FreeVecPPC_(struct Library *, APTR);

	/* *** time measurement */
	VOID GetSysTimePPC_(struct Library*, struct timeval *);
	VOID AddTimePPC_(struct Library*, struct timeval *, struct timeval *);
	VOID SubTimePPC_(struct Library*, struct timeval *, struct timeval *);
	LONG CmpTimePPC_(struct Library*, struct timeval *, struct timeval *);

#ifndef POWERPCLIB_V7
	/* *** more debugging */
	ULONG SnoopTask_(struct Library *, struct TagItem *);
/*      ULONG SnoopTaskTags_(struct Library *, Tag tag1, ...); */
	VOID EndSnoopTask_(struct Library *, ULONG);

	/* *** more memory */
	VOID FreeAllMem_(struct Library *);
	VOID CopyMemPPC_(struct Library *, APTR, APTR, ULONG);
	VOID* CreatePoolPPC_(struct Library*, ULONG, ULONG, ULONG);
	VOID DeletePoolPPC_(struct Library*, VOID*);
	VOID* AllocPooledPPC_(struct Library*, VOID*, ULONG);
	VOID FreePooledPPC_(struct Library*, VOID*, VOID*, ULONG);

	/* *** lists */
	VOID AddHeadPPC_(struct Library *, struct List *, struct Node *);
	VOID AddTailPPC_(struct Library *, struct List *, struct Node *);
	VOID EnqueuePPC_(struct Library *, struct List *, struct Node *);
	struct Node *FindNamePPC_(struct Library *, struct List *, STRPTR);
	VOID InsertPPC_(struct Library *, struct List *, struct Node *, struct Node *);
	struct Node *RemHeadPPC_(struct Library *, struct List *);
	VOID RemovePPC_(struct Library *, struct Node *);
	struct Node *RemTailPPC_(struct Library *, struct Node *);
	VOID NewListPPC_(struct Library *, struct List*);

	/* *** semaphores */
	VOID AddSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	LONG AttemptSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	struct SignalSemaphorePPC *FindSemaphorePPC_(struct Library *, STRPTR);
	VOID FreeSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	LONG InitSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	VOID ObtainSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	VOID ReleaseSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	VOID RemSemaphorePPC_(struct Library *, struct SignalSemaphorePPC *);
	LONG TrySemaphorePPC_(struct Library *, struct SignalSemaphorePPC *, ULONG);
	VOID ObtainSemaphoreSharedPPC_(struct Library *, struct SignalSemaphorePPC *);
	LONG AttemptSemaphoreSharedPPC_(struct Library *, struct SignalSemaphorePPC *);
	VOID ProcurePPC_(struct Library *, struct SignalSemaphorePPC *, struct SemaphoreMessage *);
	VOID VacatePPC_(struct Library *, struct SignalSemaphorePPC *, struct SemaphoreMessage *);

	/* *** signals */
	LONG AllocSignalPPC_(struct Library *, LONG);
	VOID FreeSignalPPC_(struct Library *, LONG);
	ULONG SetSignalPPC_(struct Library *, ULONG, ULONG);
	VOID SignalPPC_(struct Library *, struct TaskPPC *, ULONG);
	ULONG WaitPPC_(struct Library *, ULONG);
	ULONG WaitTime_(struct Library *, ULONG, ULONG);
	ULONG SetExceptPPC_(struct Library *, ULONG, ULONG, ULONG);

	/* *** tasks */
	struct TaskPPC *CreateTaskPPC_(struct Library *, struct TagItem *);
/*      struct TaskPPC *CreateTaskPPCTags_(struct Library *, Tag tag1, ...); */
	VOID DeleteTaskPPC_(struct Library *, struct TaskPPC *);
	struct TaskPPC *FindTaskPPC_(struct Library *, STRPTR);
	struct TaskPtr *LockTaskList_(struct Library *);
	LONG SetTaskPriPPC_(struct Library *, struct TaskPPC *, LONG);
	VOID UnLockTaskList_(struct Library *);
	struct TaskPPC *FindTaskByID_(struct Library *, LONG);
	LONG SetNiceValue_(struct Library *, struct TaskPPC *, LONG);

	/* *** ports */
	VOID AddPortPPC_(struct Library *, struct MsgPortPPC *);
	struct MsgPortPPC *CreateMsgPortPPC_(struct Library *);
	VOID DeleteMsgPortPPC_(struct Library *, struct MsgPortPPC *);
	struct MsgPortPPC *FindPortPPC_(struct Library *, STRPTR);
	struct Message *GetMsgPPC_(struct Library *, struct MsgPortPPC *);
	VOID PutMsgPPC_(struct Library *, struct MsgPortPPC *, struct Message *);
	struct Message *WaitPortPPC_(struct Library *, struct MsgPortPPC *);
	VOID RemPortPPC_(struct Library *, struct MsgPortPPC *);
	VOID ReplyMsgPPC_(struct Library *, struct Message *);
	struct Message *AllocXMsgPPC_(struct Library *, ULONG, struct MsgPortPPC *);
	VOID FreeXMsgPPC_(struct Library *, struct Message *);
	VOID PutXMsgPPC_(struct Library *, struct MsgPort *, struct Message *);
	struct MsgPortPPC *SetReplyPortPPC_(struct Library *, struct Message *, struct MsgPortPPC *);

	/* *** tag items */
	struct TagItem *FindTagItemPPC_(struct Library *, ULONG, struct TagItem *);
	ULONG GetTagDataPPC_(struct Library *, ULONG, ULONG, struct TagItem *);
	struct TagItem *NextTagItemPPC_(struct Library *, struct TagItem **);

	/* *** hardware */
	VOID ChangeMMU_(struct Library *, ULONG);
	VOID GetInfo_(struct Library *, struct TagItem *);
	VOID SetCache_(struct Library *, ULONG, APTR, ULONG);
	ULONG SetHardware_(struct Library *, ULONG, APTR);
	VOID GetHALInfo_(struct Library *, struct TagItem *);
	VOID SetScheduling_(struct Library *, struct TagItem *);

	/* *** exceptions */
	VOID ModifyFPExc_(struct Library *, ULONG);
	VOID RemExcHandler_(struct Library *, APTR);
	APTR SetExcHandler_(struct Library *, struct TagItem *);
/*      APTR SetExcHandlerTags_(struct Library *, Tag tag1, ...); */
	VOID SetExcMMU_(struct Library *);
	VOID ClearExcMMU_(struct Library *);
	VOID CauseInterrupt_(struct Library *);

	/* *** supervisor */
	ULONG Super_(struct Library *);
	VOID User_(struct Library *, ULONG);

	/* *** 68K connection */
	VOID Signal68K_(struct Library *, struct Task *, ULONG);

	/* *** formatting */
	APTR RawDoFmtPPC_(struct Library *, STRPTR, APTR, void (*)(), APTR);


#endif /* POWERPCLIB_V7 */
};

__inline ULONG Run68K(struct PPCArgs *a1) 
{ 
	extern struct Library *PowerPCBase;
	return Run68K_(PowerPCBase,a1); 
}
__inline ULONG WaitFor68K(struct PPCArgs *a1)
{
	extern struct Library *PowerPCBase;
	return WaitFor68K_(PowerPCBase,a1);
}
__inline VOID SPrintF(STRPTR a1, APTR a2)
{
	extern struct Library *PowerPCBase;
	SPrintF_(PowerPCBase,a1,a2);
}
__inline APTR AllocVecPPC(ULONG a1, ULONG a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	return AllocVecPPC_(PowerPCBase,a1,a2,a3);
}
__inline VOID GetSysTimePPC(struct timeval *a1)
{
	extern struct Library *PowerPCBase;
	GetSysTimePPC_(PowerPCBase,a1);
}

__inline VOID AddTimePPC(struct timeval *a1, struct timeval *a2)
{
	extern struct Library *PowerPCBase;
	AddTimePPC_(PowerPCBase,a1,a2);
}

__inline VOID SubTimePPC(struct timeval *a1, struct timeval *a2)
{
	extern struct Library *PowerPCBase;
	SubTimePPC_(PowerPCBase,a1,a2);
}

__inline LONG CmpTimePPC(struct timeval *a1, struct timeval *a2)
{
	extern struct Library *PowerPCBase;
	return CmpTimePPC_(PowerPCBase,a1,a2);
}

__inline VOID FreeVecPPC(APTR a1)
{
	extern struct Library *PowerPCBase;
	FreeVecPPC_(PowerPCBase,a1);
}

#ifndef POWERPCLIB_V7
__inline ULONG SnoopTask(struct TagItem *a1)
{
	extern struct Library *PowerPCBase;
	return SnoopTask_(PowerPCBase,a1);
}
__inline ULONG SnoopTaskTags(Tag tag1, ...)
{
	extern struct Library *PowerPCBase;
	return SnoopTask_(PowerPCBase,(struct TagItem *) &tag1);
}
__inline VOID EndSnoopTask(ULONG a1)
{
	extern struct Library *PowerPCBase;
	EndSnoopTask_(PowerPCBase,a1);
}
__inline VOID FreeAllMem()
{
	extern struct Library *PowerPCBase;
	FreeAllMem_(PowerPCBase);
}
__inline VOID CopyMemPPC(APTR a1, APTR a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	CopyMemPPC_(PowerPCBase,a1,a2,a3);
}
__inline VOID* CreatePoolPPC(ULONG a1, ULONG a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	return CreatePoolPPC_(PowerPCBase,a1,a2,a3);
}
__inline VOID DeletePoolPPC(VOID* a1)
{
	extern struct Library *PowerPCBase;
	DeletePoolPPC_(PowerPCBase,a1);
}
__inline VOID* AllocPooledPPC(VOID* a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	return AllocPooledPPC_(PowerPCBase,a1,a2);
}
__inline VOID FreePooledPPC(VOID* a1, VOID* a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	FreePooledPPC_(PowerPCBase,a1,a2,a3);
}
__inline VOID AddHeadPPC(struct List *a1, struct Node *a2)
{
	extern struct Library *PowerPCBase;
	AddHeadPPC_(PowerPCBase,a1,a2);
}
__inline VOID AddTailPPC(struct List *a1, struct Node *a2)
{
	extern struct Library *PowerPCBase;
	AddTailPPC_(PowerPCBase,a1,a2);
}
__inline VOID EnqueuePPC(struct List *a1, struct Node *a2)
{
	extern struct Library *PowerPCBase;
	EnqueuePPC_(PowerPCBase,a1,a2);
}
__inline struct Node *FindNamePPC(struct List *a1, STRPTR a2)
{
	extern struct Library *PowerPCBase;
	return FindNamePPC_(PowerPCBase,a1,a2);
}
__inline VOID InsertPPC(struct List *a1, struct Node *a2, struct Node *a3)
{
	extern struct Library *PowerPCBase;
	InsertPPC_(PowerPCBase,a1,a2,a3);
}
__inline struct Node *RemHeadPPC(struct List *a1)
{
	extern struct Library *PowerPCBase;
	return RemHeadPPC_(PowerPCBase,a1);
}
__inline VOID RemovePPC(struct Node *a1)
{
	extern struct Library *PowerPCBase;
	RemovePPC_(PowerPCBase,a1);
}
__inline struct Node *RemTailPPC(struct Node *a1)
{
	extern struct Library *PowerPCBase;
	return RemTailPPC_(PowerPCBase,a1);
}
__inline void NewListPPC(struct List *a1)
{
	extern struct Library *PowerPCBase;
	NewListPPC_(PowerPCBase,a1);
}
__inline VOID AddSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	AddSemaphorePPC_(PowerPCBase,a1);
}
__inline LONG AttemptSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	return AttemptSemaphorePPC_(PowerPCBase,a1);
}
__inline struct SignalSemaphorePPC *FindSemaphorePPC(STRPTR a1)
{
	extern struct Library *PowerPCBase;
	return FindSemaphorePPC_(PowerPCBase,a1);
}
__inline VOID FreeSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	FreeSemaphorePPC_(PowerPCBase,a1);
}
__inline LONG InitSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	return InitSemaphorePPC_(PowerPCBase,a1);
}
__inline VOID ObtainSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	ObtainSemaphorePPC_(PowerPCBase,a1);
}
__inline VOID ReleaseSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	ReleaseSemaphorePPC_(PowerPCBase,a1);
}
__inline VOID RemSemaphorePPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	RemSemaphorePPC_(PowerPCBase,a1);
}
__inline LONG TrySemaphorePPC(struct SignalSemaphorePPC *a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	return TrySemaphorePPC_(PowerPCBase,a1,a2);
}
__inline VOID ObtainSemaphoreSharedPPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	ObtainSemaphoreSharedPPC_(PowerPCBase,a1);
}
__inline LONG AttemptSemaphoreSharedPPC(struct SignalSemaphorePPC *a1)
{
	extern struct Library *PowerPCBase;
	return AttemptSemaphoreSharedPPC_(PowerPCBase,a1);
}
__inline VOID ProcurePPC(struct SignalSemaphorePPC *a1, struct SemaphoreMessage *a2)
{
	extern struct Library *PowerPCBase;
	ProcurePPC_(PowerPCBase,a1,a2);
}
__inline VOID VacatePPC(struct SignalSemaphorePPC *a1, struct SemaphoreMessage *a2)
{
	extern struct Library *PowerPCBase;
	VacatePPC_(PowerPCBase,a1,a2);
}
__inline LONG AllocSignalPPC(LONG a1)
{
	extern struct Library *PowerPCBase;
	return AllocSignalPPC_(PowerPCBase,a1);
}
__inline VOID FreeSignalPPC(LONG a1)
{
	extern struct Library *PowerPCBase;
	FreeSignalPPC_(PowerPCBase,a1);
}
__inline ULONG SetSignalPPC(ULONG a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	return SetSignalPPC_(PowerPCBase,a1,a2);
}
__inline VOID SignalPPC(struct TaskPPC *a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	SignalPPC_(PowerPCBase,a1,a2);
}
__inline ULONG WaitPPC(ULONG a1)
{
	extern struct Library *PowerPCBase;
	return WaitPPC_(PowerPCBase,a1);
}
__inline ULONG WaitTime(ULONG a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	return WaitTime_(PowerPCBase,a1,a2);
}
__inline ULONG SetExceptPPC(ULONG a1, ULONG a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	return SetExceptPPC_(PowerPCBase,a1,a2,a3);
}
__inline struct TaskPPC *CreateTaskPPC(struct TagItem *a1)
{
	extern struct Library *PowerPCBase;
	return CreateTaskPPC_(PowerPCBase,a1);
}
__inline struct TaskPPC *CreateTaskPPCTags(Tag tag1, ...)
{
	extern struct Library *PowerPCBase;
	return CreateTaskPPC_(PowerPCBase,(struct TagItem *) &tag1);
}
__inline VOID DeleteTaskPPC(struct TaskPPC *a1)
{
	extern struct Library *PowerPCBase;
	DeleteTaskPPC_(PowerPCBase,a1);
}
__inline struct TaskPPC *FindTaskPPC(STRPTR a1)
{
	extern struct Library *PowerPCBase;
	return FindTaskPPC_(PowerPCBase,a1);
}
__inline struct TaskPtr *LockTaskList()
{
	extern struct Library *PowerPCBase;
	return LockTaskList_(PowerPCBase);
}
__inline LONG SetTaskPriPPC(struct TaskPPC *a1, LONG a2)
{
	extern struct Library *PowerPCBase;
	return SetTaskPriPPC_(PowerPCBase,a1,a2);
}
__inline VOID UnLockTaskList()
{
	extern struct Library *PowerPCBase;
	UnLockTaskList_(PowerPCBase);
}
__inline struct TaskPPC *FindTaskByID(LONG a1)
{
	extern struct Library *PowerPCBase;
	return FindTaskByID_(PowerPCBase,a1);
}
__inline LONG SetNiceValue(struct TaskPPC *a1, LONG a2)
{
	extern struct Library *PowerPCBase;
	return SetNiceValue_(PowerPCBase,a1,a2);
}
__inline VOID AddPortPPC(struct MsgPortPPC *a1)
{
	extern struct Library *PowerPCBase;
	AddPortPPC_(PowerPCBase,a1);
}
__inline struct MsgPortPPC *CreateMsgPortPPC()
{
	extern struct Library *PowerPCBase;
	return CreateMsgPortPPC_(PowerPCBase);
}
__inline VOID DeleteMsgPortPPC(struct MsgPortPPC *a1)
{
	extern struct Library *PowerPCBase;
	DeleteMsgPortPPC_(PowerPCBase,a1);
}
__inline struct MsgPortPPC *FindPortPPC(STRPTR a1)
{
	extern struct Library *PowerPCBase;
	return FindPortPPC_(PowerPCBase,a1);
}
__inline struct Message *GetMsgPPC(struct MsgPortPPC *a1)
{
	extern struct Library *PowerPCBase;
	return GetMsgPPC_(PowerPCBase,a1);
}
__inline VOID PutMsgPPC(struct MsgPortPPC *a1, struct Message *a2)
{
	extern struct Library *PowerPCBase;
	PutMsgPPC_(PowerPCBase,a1,a2);
}
__inline VOID RemPortPPC(struct MsgPortPPC *a1)
{
	extern struct Library *PowerPCBase;
	RemPortPPC_(PowerPCBase,a1);
}
__inline VOID ReplyMsgPPC(struct Message *a1)
{
	extern struct Library *PowerPCBase;
	ReplyMsgPPC_(PowerPCBase,a1);
}
__inline struct Message *AllocXMsgPPC(ULONG a1, struct MsgPortPPC *a2)
{
	extern struct Library *PowerPCBase;
	return AllocXMsgPPC_(PowerPCBase,a1,a2);
}
__inline VOID FreeXMsgPPC(struct Message *a1)
{
	extern struct Library *PowerPCBase;
	FreeXMsgPPC_(PowerPCBase,a1);
}
__inline VOID PutXMsgPPC(struct MsgPort *a1, struct Message *a2)
{
	extern struct Library *PowerPCBase;
	PutXMsgPPC_(PowerPCBase,a1,a2);
}
__inline struct MsgPortPPC *SetReplyPortPPC(struct Message *a1, struct MsgPortPPC *a2)
{
	extern struct Library *PowerPCBase;
	return SetReplyPortPPC_(PowerPCBase,a1,a2);
}
__inline struct TagItem *FindTagItemPPC(ULONG a1, struct TagItem *a2)
{
	extern struct Library *PowerPCBase;
	return FindTagItemPPC_(PowerPCBase,a1,a2);
}
__inline ULONG GetTagDataPPC(ULONG a1, ULONG a2, struct TagItem *a3)
{
	extern struct Library *PowerPCBase;
	return GetTagDataPPC_(PowerPCBase,a1,a2,a3);
}
__inline struct TagItem *NextTagItemPPC(struct TagItem **a1)
{
	extern struct Library *PowerPCBase;
	return NextTagItemPPC_(PowerPCBase,a1);
}
__inline VOID ChangeMMU(ULONG a1)
{
	extern struct Library *PowerPCBase;
	ChangeMMU_(PowerPCBase,a1);
}
__inline VOID GetInfo(struct TagItem *a1)
{
	extern struct Library *PowerPCBase;
	GetInfo_(PowerPCBase,a1);
}
__inline VOID SetCache(ULONG a1, APTR a2, ULONG a3)
{
	extern struct Library *PowerPCBase;
	SetCache_(PowerPCBase,a1,a2,a3);
}
__inline ULONG SetHardware(ULONG a1, APTR a2)
{
	extern struct Library *PowerPCBase;
	return SetHardware_(PowerPCBase,a1,a2);
}
__inline VOID GetHALInfo(struct TagItem *a1)
{
	extern struct Library *PowerPCBase;
	GetHALInfo_(PowerPCBase,a1);
}
__inline VOID SetScheduling(struct TagItem * a1)
{
	extern struct Library *PowerPCBase;
	SetScheduling_(PowerPCBase,a1);
}
__inline VOID ModifyFPExc(ULONG a1)
{
	extern struct Library *PowerPCBase;
	ModifyFPExc_(PowerPCBase,a1);
}
__inline VOID RemExcHandler(APTR a1)
{
	extern struct Library *PowerPCBase;
	RemExcHandler_(PowerPCBase,a1);
}
__inline APTR SetExcHandler(struct TagItem *a1)
{
	extern struct Library *PowerPCBase;
	return SetExcHandler_(PowerPCBase,a1);
}
__inline APTR SetExcHandlerTags(Tag tag1, ...)
{
	extern struct Library *PowerPCBase;
	return SetExcHandler_(PowerPCBase,(struct TagItem *) &tag1);
}
__inline VOID SetExcMMU()
{
	extern struct Library *PowerPCBase;
	SetExcMMU_(PowerPCBase);
}
__inline VOID ClearExcMMU()
{
	extern struct Library *PowerPCBase;
	ClearExcMMU_(PowerPCBase);
}
__inline VOID CauseInterrupt()
{
	extern struct Library *PowerPCBase;
	CauseInterrupt_(PowerPCBase);
}
__inline ULONG Super()
{
	extern struct Library *PowerPCBase;
	return Super_(PowerPCBase);
}
__inline VOID User(ULONG a1)
{
	extern struct Library *PowerPCBase;
	User_(PowerPCBase,a1);
}
__inline VOID Signal68K(struct Task *a1, ULONG a2)
{
	extern struct Library *PowerPCBase;
	Signal68K_(PowerPCBase,a1,a2);
}
__inline APTR RawDoFmtPPC(STRPTR a1, APTR a2, void (*a3)(), APTR a4)
{
	extern struct Library *PowerPCBase;
	return RawDoFmtPPC_(PowerPCBase,a1,a2,a3,a4);
}



#endif /* POWERPCLIB_V7 */
#endif /* __PPC__ */

#endif /* STORMPROTOS_POWERPC_SPROTOS_H */
