#ident "$Id: ios.h,v 1.13 2006/03/21 02:26:02 wheeler Exp $"
/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */
#ifndef __IOS_H__
#define __IOS_H__
#include <iostypes.h>

#define DEFAULT_SDK_LOC  "/opt/iop-sdk/"
#define DEFAULT_BIN_LOC  "/usr/bin/iose/"

#if defined(_LANGUAGE_C)
#define IOS_ThreadExit(X)  IOS_DestroyThread(0, NULL)

IOSTimerId IOS_CreateTimer(IOSTime, IOSTime, IOSMessageQueueId, IOSMessage);
IOSError  IOS_DestroyTimer(IOSTimerId id);
u32  IOS_GetTimer(void);


IOSThreadId  IOS_CreateThread(IOSEntryProc entry, void *arg, void *stack, u32 stackSize, u32 priority, u32 attributes);
IOSError  IOS_JoinThread(IOSThreadId id, void **val);
IOSError  IOS_DestroyThread(IOSThreadId id, void *val);
IOSThreadId IOS_GetThreadId(void);
IOSProcessId IOS_GetProcessId(void);
IOSError IOS_StartThread(IOSThreadId id);
IOSError IOS_StopThread(IOSThreadId id);
void IOS_YieldThread(void);
u32 IOS_GetThreadPriority(IOSThreadId id);
IOSError IOS_SetThreadPriority(IOSThreadId id, u32 priority);

IOSMessageQueueId IOS_CreateMessageQueue(IOSMessage * msgarray, u32 count);
IOSError IOS_DestroyMessageQueue(IOSMessageQueueId id);
IOSError IOS_SendMessage(IOSMessageQueueId mq, IOSMessage msg, u32 flag);
IOSError IOS_JamMessage(IOSMessageQueueId mq, IOSMessage msg, u32 flag);
IOSError IOS_ReceiveMessage(IOSMessageQueueId mq, IOSMessage * msg, u32 flag);

IOSError IOS_HandleEvent(IOSEvent event, IOSMessageQueueId mq, IOSMessage mesg);
IOSError IOS_UnhandleEvent(IOSEvent event);

IOSError IOS_ShareRegion(void *ptr, u32 size, u32 pIdMask);
IOSError IOS_UnshareRegion(void *ptr, u32 size, u32 pIdMask);
void *IOS_Alloc(u32 size);
IOSError IOS_Free(void *ptr);


/* Don't use. For shell's use only */
IOSThreadId IOS_Fork(IOSEntryProc entry, void *arg, void *stack,
			   u32 stackSize, u32 priority);
void IOS_EmuStartProg(const char *prog, u32 pri);
void IOS_DebugMemDump(void);
void IOS_DebugTimerListDump(void);

void  IOS_DebugDumpIobFreeBufsList(u32 pool, u32 size);
void  IOS_DebugDumpIobFreeHdrsList(void);

#endif /* _LANGUAGE_C */

#endif /*__IOS_H__*/
