osp.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:2k
- #ifndef __OSP_H__
- #define __OSP_H__
- #include "gendef.h"
- typedef enum
- {
- Ret_OK,
- Ret_NoMem,
- Ret_ParErr,
-
- Ret_Timeout,
- Ret_Fail
- }KB_OSPRet;
- typedef enum
- {
- KB_Wait,
- KD_NoWait
- }KB_OSPWaitMode;
- typedef enum
- {
- J_OSP_WAIT_FIFO,
- J_OSP_WAIT_PRIO
- }KB_OSPQueMode;
- typedef struct
- {
- UINT32 Word1;
- UINT32 Word2;
- UINT32 Word3;
- UINT32 Word4;
- }KB_OSPMsgNode;
- typedef struct T_TaskInfo_st OSP_TaskInfo;
- struct T_TaskInfo_st
- {
- task_t *pTask;
- tdesc_t *pTaskDesc;
- UINT8 *pTaskStack;
- OSP_TaskInfo *pNext;
- };
- typedef struct T_QueueInfo_st T_OSP_QueueInfo;
- struct T_QueueInfo_st
- {
- message_queue_t *pQueueId;
- void *pQueueBuf;
- T_OSP_QueueInfo *pNext;
- };
- #ifdef ST_OS21
- #define MS_TO_TICKS(X) ((X)*(time_ticks_per_sec()/1000))
- #else
- #define MS_TO_TICKS(X) ((X)*(ST_GetClocksPerSecond()/1000))
- #endif
- KB_OSPRet KB_OSPInit(void);
- KB_OSPRet KB_OSPTaskInit(const char* pName,UINT32 dStackSize,void (*entryPoint)(void*),
- INT32 dPriority,void *pPara,UINT32 *pTaskId);
- KB_OSPRet KB_OSPTaskDel(UINT32 dTaskId);
- KB_OSPRet KB_OSPTaskSetPri(UINT32 dTaskId, INT32 dPriority);
- UINT32 KB_OSPTaskGetID(void);
- KB_OSPRet KB_OSPTaskDelay(UINT32 dMilliSeconds);
- KB_OSPRet KB_OSPTaskSus(UINT32 dTaskId);
- KB_OSPRet KB_OSPTaskRes(UINT32 dTaskId);
- KB_OSPRet KB_OSPQueInit(const char* pName,UINT32 dMaxMessages,UINT32 *pQueueId);
- KB_OSPRet KB_OSPSemDel(UINT32 nSemId);
- KB_OSPRet KB_OSPQueDel(UINT32 nQueID);
- KB_OSPRet KB_OSPMsgSend(UINT32 nQueID,KB_OSPMsgNode *pMsgNode);
- KB_OSPRet KB_OSPSemSet(UINT32 nSemId);
- KB_OSPRet KB_OSPMsgGet(UINT32 nQueID,KB_OSPWaitMode nWaitMode,UINT32 nTime,KB_OSPMsgNode *pMsgNode);
- KB_OSPRet KB_OSPSemInit(const char* pName,UINT32 nSemMax,KB_OSPQueMode nQueMode,UINT32 *pSemID);
- KB_OSPRet KB_OSPSemGet(UINT32 nSemId,KB_OSPWaitMode nWaitMode,UINT32 nTime);
- void* KB_OSPMalloc(UINT32 dSize);
- KB_OSPRet KB_OSPFree(void *pFree);
- void InserQueueNode(T_OSP_QueueInfo *node);
- #endif
- /*EOF*/