/** | |
* @file oss_kernel.h | |
* @brief ²Ù×÷ϵͳÊÊÅä²ã½Ó¿ÚÍ·Îļþ | |
* | |
* Copyright (C) 2017 Sanechips Technology Co., Ltd. | |
* | |
* | |
*/ | |
#ifndef _OSS_KERNEL_H | |
#define _OSS_KERNEL_H | |
/******************************************************************************* | |
* Include header files * | |
******************************************************************************/ | |
#ifdef __cplusplus | |
extern "C" | |
{ | |
#endif | |
/******************************************************************************* | |
* Macro definitions * | |
******************************************************************************/ | |
/* ¶ÏÑÔ */ | |
/** | |
* @brief assert¶ÏÑÔ | |
* @param _EXP Èë²Î£¬Òì³£±í´ïʽ | |
*/ | |
#ifdef _DEBUG | |
# if defined _OS_WIN | |
# define zOss_ASSERT(_EXP) do {if(!(_EXP)) EXP_Handler(#_EXP, __FILE__, NULL, __LINE__);} while(0) | |
# else | |
# define zOss_ASSERT(_EXP) do {if(!(_EXP)) EXP_Handler(#_EXP, NULL, NULL, __LINE__);} while(0) | |
# endif | |
#else | |
# define zOss_ASSERT(_EXP) | |
#endif | |
/** | |
* @brief ´ø·µ»ØÖµµÄassert¶ÏÑÔ | |
* @param _EXP Èë²Î£¬Òì³£±í´ïʽ | |
* @param _RET Èë²Î£¬·µ»ØÖµ | |
*/ | |
#define zOss_AssertEx(_EXP, _RET) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); return (_RET);}} while(0) | |
/** | |
* @brief ´ø·µ»ØÖµºÍ¸½¼ÓÖ´ÐвÙ×÷µÄassert¶ÏÑÔ | |
* @param _EXP Èë²Î£¬Òì³£±í´ïʽ | |
* @param _ACT Èë²Î£¬¸½¼ÓÖ´ÐвÙ×÷ | |
* @param _RET Èë²Î£¬·µ»ØÖµ | |
*/ | |
#define zOss_AssertExA(_EXP, _ACT, _RET) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); _ACT; return (_RET);}} while(0) | |
/** | |
* @brief ²»´ø·µ»ØÖµµÄassert¶ÏÑÔ | |
* @param _EXP Èë²Î£¬Òì³£±í´ïʽ | |
*/ | |
#define zOss_AssertExN(_EXP) do {if(!(_EXP)) {zOss_ASSERT((_EXP)); return;}} while(0) | |
/* ³£Ó÷µ»ØÖµ */ | |
/** | |
* @brief ZOSS_SUCCESSºê¶¨Òå | |
*/ | |
#define ZOSS_SUCCESS 0x0 | |
/** | |
* @brief ZOSS_ERRORºê¶¨Òå | |
*/ | |
#define ZOSS_ERROR 0xffffffff | |
/** | |
* @brief ZOSS_NULLºê¶¨Òå | |
*/ | |
#define ZOSS_NULL NULL | |
/** | |
* @brief ÎÞЧÏß³ÌIDºê¶¨Òå | |
*/ | |
#define ZOSS_INVALID_THREAD_ID NULL | |
/** | |
* @brief ÎÞЧÈÎÎñIDºê¶¨Òå | |
*/ | |
#define ZOSS_INVALID_TASK_ID NULL | |
/** | |
* @brief ÎÞЧ¶¨Ê±Æ÷IDºê¶¨Òå | |
*/ | |
#define ZOSS_INVALID_TIMER_ID NULL | |
/** | |
* @brief Ïß³ÌÃû×î´ó³¤¶È | |
*/ | |
#define MAX_THREADNAME_LEN 63 | |
/** | |
* @brief ¼ÆÊýÐźÅÁ¿Ãû³Æ×î´ó³¤¶È | |
*/ | |
#define MAX_SEMNAME_LEN 63 | |
/** | |
* @brief »¥³âÐźÅÁ¿Ãû³Æ×î´ó³¤¶È | |
*/ | |
#define MAX_MUTEXNAME_LEN 63 | |
/** | |
* @brief µÈ´ý³¬Ê±ÊôÐÔ£¬²»µÈ´ý | |
*/ | |
#define ZOSS_NO_WAIT 0x0 | |
/** | |
* @brief µÈ´ý³¬Ê±ÊôÐÔ£¬Ò»Ö±µÈ´ýÏÂÈ¥ | |
*/ | |
#define ZOSS_WAIT_FOREVER 0xffffffff | |
/** | |
* @brief »¥³âÌåÊôÐÔ£¬°´ÓÅÏȼ¶»ñÈ¡ | |
*/ | |
#define ZOSS_INHERIT 0x1 | |
/** | |
* @brief »¥³âÌåÊôÐÔ£¬°´Ë³Ðò»ñÈ¡ | |
*/ | |
#define ZOSS_NO_INHERIT 0x0 | |
#ifdef _OS_LINUX | |
# define ZOSS_PREEMPT_IRQ_THREAD (0xffffffff) | |
#endif | |
/******************************************************************************* | |
* Type definitions * | |
******************************************************************************/ | |
/** | |
* @brief ÐźÅÁ¿IDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_SEMAPHORE_ID; | |
/** | |
* @brief »¥³âÌåIDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_MUTEX_ID; | |
/** | |
* @brief ¶¨Ê±Æ÷IDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_TIMER_ID; | |
/** | |
* @brief Ïß³ÌIDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_THREAD_ID; | |
/** | |
* @brief ÈÎÎñIDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_TASK_ID; | |
/** | |
* @brief ¶ÓÁÐIDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_QUEUE_ID; | |
/** | |
* @brief ʼþIDÊý¾ÝÀàÐͶ¨Òå | |
*/ | |
typedef VOID *ZOSS_EVENT_ID; | |
/** | |
* @brief Ï̺߳¯ÊýÀàÐͶ¨Òå | |
*/ | |
typedef VOID (*ZOSS_THREAD_FUN)(SINT32); | |
/** | |
* @brief ¶¨Ê±Æ÷»Øµ÷º¯ÊýÀàÐͶ¨Òå | |
*/ | |
typedef VOID (*ZOSS_TIMER_FUN)(SINT32); | |
/** | |
* @brief Ï̹߳³×Óº¯ÊýÀàÐͶ¨Òå | |
*/ | |
typedef UINT32 (*THREAD_MSG_HOOK)(UINT32 msg_id, VOID *p_buf, UINT32 buf_size, UINT8 dire); | |
#ifndef DOXYGEN_SHOULD_SKIP_THIS | |
/* Ï̹߳ÜÀí */ | |
/** | |
* @brief Ï̹߳ÜÀí½á¹¹ | |
* @param threadid Ïß³Ìid | |
* @param threadname Ïß³ÌÃû³Æ | |
* @param runstatus Ïß³ÌÔËÐÐ״̬ | |
* @param priority Ïß³ÌÓÅÏȼ¶ | |
* @param maxstack Ïß³ÌÕ»×î´óջʹÓÃÂÊ | |
* @param cpupercent Ïß³ÌCPUÕ¼ÓÃÂÊ | |
* @param stacksize Ï̶߳ÑÕ»´óС | |
* @param cputime Ïß³ÌCPUÕ¼ÓÃÂÊʱ¼ä | |
* @param topstack Ïß³ÌÕ»¶¥µØÖ· | |
* @param runtime Ïß³ÌÔËÐÐʱ¼ä | |
* @param RunTimeInMs | |
* @param msgnum Ïß³ÌÏûÏ¢¶ÓÁÐÏûÏ¢Êý | |
* @param runcount Ïß³ÌÔËÐдÎÊý | |
* @param curpath Ï̵߳±Ç°Â·¾¶£¬ÓëosÓÐ¹Ø | |
* @param ptrf µ÷ÊÔÏ̵߳ǼDZí | |
* @param curtaskid µ±Ç°ÈÎÎñID | |
* @param heapsize Ïß³ÌÉêÇë¶ÑÄÚ´æ´óС | |
* @param ubsize Ïß³ÌÉêÇëÄÚ´æ³Ø´óС | |
* @param psmCpuTime Ïß³Ìpsm¼ÆÊ±Ê±¼ä | |
* @param sleepTimerId Ïß³Ì˯Ãßʱ´´½¨µÄ¶¨Ê±Æ÷ID | |
* @param sleepsem Ïß³Ì˯Ãßʱ´´½¨µÄÐźÅÁ¿ID | |
*/ | |
typedef struct | |
{ | |
ZOSS_THREAD_ID threadid; /* Ïß³ÌID */ | |
CHAR threadname[MAX_THREADNAME_LEN + 1]; /* Ïß³ÌÃû */ | |
UINT8 runstatus; /* Ïß³ÌÔËÐÐ״̬ */ | |
UINT8 priority; /* Ïß³ÌÓÅÏȼ¶ */ | |
UINT8 maxstack; /* Ïß³ÌÕ»×î´óջʹÓÃÂÊ */ | |
FLOAT cpupercent; /* Ïß³ÌCPUÕ¼ÓÃÂÊ */ | |
UINT32 stacksize; /* Ï̶߳ÑÕ»´óС */ | |
UINT32 cputime; /* Ïß³ÌCPUÕ¼ÓÃÂÊʱ¼ä */ | |
UINT32 topstack; /* Ïß³ÌÕ»¶¥µØÖ· */ | |
UINT32 runtime; /* Ïß³ÌÔËÐÐʱ¼ä */ | |
UINT32 RunTimeInMs; | |
UINT32 msgnum; /* Ïß³ÌÏûÏ¢¶ÓÁÐÏûÏ¢Êý */ | |
UINT32 runcount; /* Ïß³ÌÔËÐдÎÊý */ | |
CHAR *curpath; /* Ï̵߳±Ç°Â·¾¶£¬ÓëosÓÐ¹Ø */ | |
VOID *ptrf; /* µ÷ÊÔÏ̵߳ǼDZí */ | |
VOID *curtaskid; /* µ±Ç°ÈÎÎñID */ | |
UINT32 heapsize; /* Ïß³ÌÉêÇë¶ÑÄÚ´æ´óС */ | |
UINT32 ubsize; /* Ïß³ÌÉêÇëÄÚ´æ³Ø´óС */ | |
UINT32 psmCpuTime; /* Ïß³Ìpsm¼ÆÊ±Ê±¼ä */ | |
ZOSS_TIMER_ID sleepTimerId; /* Ïß³Ì˯Ãßʱ´´½¨µÄ¶¨Ê±Æ÷ID */ | |
ZOSS_SEMAPHORE_ID sleepsem; /* Ïß³Ì˯Ãßʱ´´½¨µÄÐźÅÁ¿ID */ | |
}T_ZOsa_ThreadUserArea; /* Ïß³ÌÓû§¿Õ¼ä */ | |
#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS | |
/******************************************************************************* | |
* Global variable declarations * | |
******************************************************************************/ | |
/******************************************************************************* | |
* Global function declarations * | |
******************************************************************************/ | |
/* Ï̹߳ÜÀí */ | |
/** | |
* @brief »ñÈ¡ÓÅÏȼ¶Öµ½Ó¿Ú | |
* @param offset Èë²Î£¬È¡Öµ0~31 | |
* @return Èô³É¹¦£¬·µ»ØÓÅÏȼ¶ÊýÖµ£»·ñÔò·µ»ØZOSS_ERROR | |
* @retval ÓÅÏȼ¶ÊýÖµ ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetPrioCfg(UINT8 offset); | |
/** | |
* @brief ´´½¨Ïß³Ì½Ó¿Ú | |
* @param thread_name Èë²Î£¬Ïß³ÌÃû³Æ | |
* @param entry Èë²Î£¬Ïß³ÌÈë¿ÚʵÌ庯Êý | |
* @param arg Èë²Î£¬Ïß³ÌʵÌ庯ÊýµÄ²ÎÊý | |
* @param stack_size Èë²Î£¬Ïß³ÌÓµÓеĶÑÕ»´óС | |
* @param priority Èë²Î£¬Ï̵߳ÄÓÅÏȵȼ¶0~31 | |
* @param preempt Èë²Î£¬Í¬ÓÅÏȼ¶Ïß³ÌÊÇ·ñÔÊÐíÇÀÕ¼£¬·Ç0ֵΪÇÀÕ¼Ị̈߳¬·ñÔòΪ²»¿ÉÇÀÕ¼Ị̈߳¬¼´Ö´ÐÐʱ¼äƬµ÷¶È | |
* @param auto_start Èë²Î£¬´´½¨Ï̺߳óÊÇ·ñ×Ô¶¯Ö´ÐÐ | |
* @return Èç¹û´´½¨³É¹¦·µ»ØÏß³ÌID£¬Ê§°Ü·µ»ØZOSS_INVALID_THREAD_ID | |
* @retval ZOSS_THREAD_IDÀàÐ͵ÄÏß³Ìid ³É¹¦ | |
* @retval ZOSS_INVALID_THREAD_ID ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
ZOSS_THREAD_ID zOss_CreateThread(const CHAR *thread_name, VOID (*entry)(SINT32), SINT32 arg, UINT32 stack_size, UINT32 priority, UINT32 preempt, UINT32 auto_start); | |
/** | |
* @brief Í˳öµ±Ç°Ïß³Ì½Ó¿Ú | |
* @param void | |
* @return void | |
* @note | |
* @warning | |
*/ | |
VOID zOss_ExitThread(VOID); | |
/** | |
* @brief Ïß³Ì¹ÒÆð½Ó¿Ú | |
* @param thread_id Èë²Î£¬ÐèÒª¹ÒÆðµÄÏß³Ìid | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note ±¾º¯Êý¿ÉÒÔÓÃÓÚÏ̵߳Ä×ÔÎÒ¹ÒÆð | |
* @warning | |
*/ | |
UINT32 zOss_SuspendThread(ZOSS_THREAD_ID thread_id); | |
/** | |
* @brief Ïָ̻߳´½Ó¿Ú | |
* @param thread_id Èë²Î£¬ÐèÒª»Ö¸´µÄÏß³Ìid | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_ResumeThread(ZOSS_THREAD_ID thread_id); | |
/** | |
* @brief Ïß³Ì˯Ãß½Ó¿Ú | |
* @param time_in_ms Èë²Î£¬Ï߳̽«ÒªË¯ÃßµÄʱ¼ä£¬µ¥Î»£ºms | |
* @return void | |
* @note | |
* @warning | |
*/ | |
VOID zOss_Sleep(UINT32 time_in_ms); | |
/** | |
* @brief Ïß³Ìɾ³ý½Ó¿Ú | |
* @param thread_id Èë²Î£¬±»É¾³ýµÄÏß³Ìid | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note zOss_CreateThreadº¯ÊýÖÐÉêÇëµÄÏß³ÌÕ»¿Õ¼äºÍÏ߳̿ØÖÆ¿é½á¹¹¿Õ¼ä»áÔÚ | |
* Cyg_Thread::exitº¯ÊýÖÐÊÍ·Å£¬ÒòΪÔÚcyg_thread_deleteº¯ÊýÖ´ÐÐÍêºó£¬ | |
* ºóÃæµÄËùÓдúÂëËæ×ű¾Ï̵߳ÄÏûÍö¶ø±äµÃÎÞЧÁË¡£ | |
* @warning | |
*/ | |
UINT32 zOss_DeleteThread(ZOSS_THREAD_ID thread_id); | |
/** | |
* @brief »ñÈ¡µ±Ç°Ïß³Ìid½Ó¿Ú | |
* @param void | |
* @return µ±Ç°Ïß³Ìid | |
* @note | |
* @warning | |
*/ | |
ZOSS_THREAD_ID zOss_GetCurThreadID(VOID); | |
/** | |
* @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³ÌÃû³Æ£¬²éÕÒ¸ÃÏ̵߳ÄÏß³Ìid | |
* @param thread_name Èë²Î£¬Ïß³ÌÃû³Æ | |
* @return Èô²éÕҳɹ¦£¬·µ»ØÏ̵߳ÄÓÐЧÏß³Ìid£»·ñÔòϵͳ¶ÏÑÔ | |
* @note | |
* @warning | |
*/ | |
ZOSS_THREAD_ID zOss_GetThreadIDByName(const CHAR *thread_name); | |
/** | |
* @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÃû³Æ | |
* @param thread_id Èë²Î£¬´ý»ñÈ¡Ïß³ÌÃû³ÆµÄÏß³Ìid | |
* @param thread_name ³ö²Î£¬Ïß³ÌÃû³Æ´æ·ÅµØÖ· | |
* @return Èô³É¹¦£¬·µ»ØÏß³ÌÃû³ÆÖ¸Õ룻·ñÔòϵͳ¶ÏÑÔ»ò·µ»Ø¿ÕÖ¸Õë | |
* @retval Ïß³ÌÃû³ÆÖ¸Õë ³É¹¦ | |
* @retval NULL ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
CHAR *zOss_GetThreadName(ZOSS_THREAD_ID thread_id, CHAR *thread_name); | |
/** | |
* @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÐÅÏ¢ | |
* @param thread_id Èë²Î£¬´ý»ñÈ¡Ïß³ÌÐÅÏ¢µÄÏß³Ìid | |
* @param thread_name ³ö²Î£¬Ïß³ÌÃû³Æ´æ·ÅµØÖ· | |
* @param stat ³ö²Î£¬Ïß³Ì״̬´æ·ÅµØÖ· | |
* @param priority ³ö²Î£¬Ïß³ÌÓÅÏȼ¶´æ·ÅµØÖ· | |
* @param preempt ³ö²Î£¬Ï߳̿ÉÇÀÕ¼´æ·ÅµØÖ· | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetThreadInfo(ZOSS_THREAD_ID thread_id, CHAR *thread_name, UINT32 *stat, UINT32 *priority, UINT32 *preempt); | |
/** | |
* @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬ÉèÖøÃÏ̵߳ÄÏß³ÌÓÅÏȼ¶ | |
* @param thread_id Èë²Î£¬´ýÉèÖÃÓÅÏȼ¶µÄÏß³Ìid | |
* @param priority Èë²Î£¬Ï߳̽«±»ÉèÖõÄÓÅÏȼ¶ | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_SetThreadPri(ZOSS_THREAD_ID thread_id, UINT32 priority); | |
/** | |
* @brief ¸ù¾Ý²ÎÊýÌṩµÄÏß³Ìid£¬»ñÈ¡¸ÃÏ̵߳ÄÏß³ÌÓÅÏȼ¶ | |
* @param thread_id Èë²Î£¬´ýÉèÖÃÓÅÏȼ¶µÄÏß³Ìid | |
* @param priority ³ö²Î£¬»ñÈ¡µÄÏß³ÌÓÅÏȼ¶´æ·ÅµØÖ· | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetThreadPri(ZOSS_THREAD_ID thread_id, UINT32 *priority); | |
/** | |
* @brief ÑéÖ¤Ò»¸öÏß³ÌÊÇ·ñÓÐЧ | |
* @param threadID Èë²Î£¬´ýÑéÖ¤µÄÏß³Ìid | |
* @return ÈôÏß³ÌÓÐЧ£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_IdentifyThread(ZOSS_THREAD_ID threadID); | |
/* Ïß³ÌÏûÏ¢¹ÜÀíÄ£¿é */ | |
/** | |
* @brief ´ÓÄÚ´æ³ØÉêÇëÏûϢͷ+»º³åÇø£¬²¢·µ»Ø»º³åÇøÖ¸Õë | |
* @param size Èë²Î£¬»º³åÇø´óС | |
* @return »º³åÇøÖ¸Õë | |
* @note ¸ÃÉêÇë½Ó¿Ú£¬»á´ø×ÅÏûϢͷһÆðÉêÇ룬µ«·µ»Ø¸øÓû§µÄÊǰþÀëÁËÏûϢͷµÄÓû§Ê¹ÓÃ¿Õ¼äµØÖ· | |
* @warning ±ØÐëºÍzOss_ThreadRetMsgBufÅä¶ÔʵÏÖ | |
*/ | |
VOID *zOss_ThreadGetMsgBuf(UINT32 size); | |
/** | |
* @brief ÏòÄÚ´æ³ØÊÍ·ÅÏûϢͷ+»º³åÇø | |
* @param p_buf Èë²Î£¬»º³åÇøÖ¸Õë | |
* @return void | |
* @note ¸ÃÊÍ·Å½Ó¿Ú»á´ø×ÅÏûϢͷһÆðÊÍ·Å | |
* @warning ±ØÐëºÍzOss_ThreadGetMsgBufÅä¶ÔʵÏÖ | |
*/ | |
VOID zOss_ThreadRetMsgBuf(VOID *p_buf); | |
/** | |
* @brief Ïòthread_idÏ̷߳¢ËÍÏûÏ¢ | |
* @param msg_id Èë²Î£¬ÏûÏ¢id | |
* @param p_buf Èë²Î£¬»º³åÇøÖ¸Õë | |
* @param buf_size Èë²Î£¬»º³åÇø´óС | |
* @param thread_id Èë²Î£¬Ä¿±êÏß³Ìid | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note ±ØÐëºÍzOss_ThreadRecvMsgÅä¶ÔʵÏÖ | |
* @warning | |
*/ | |
UINT32 zOss_ThreadSendMsg(UINT32 msg_id, VOID *p_buf, UINT16 buf_size, ZOSS_THREAD_ID thread_id); | |
/** | |
* @brief Ï߳̽ÓÊÕÏûÏ¢ | |
* @param p_msg_id Èë²Î£¬ÏûÏ¢idµÄ´æ·ÅµØÖ· | |
* @param p_buf Èë²Î£¬ÏûÏ¢Ö¸ÕëµÄ´æ·ÅµØÖ· | |
* @param p_buf_size Èë²Î£¬ÏûÏ¢´óСµÄ´æ·ÅµØÖ· | |
* @param timeout Èë²Î£¬½ÓÊÕÏûÏ¢µÄ³¬Ê±Ê±¼ä | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note ±ØÐëºÍzOss_ThreadSendMsgÅä¶ÔʵÏÖ | |
* @warning | |
*/ | |
UINT32 zOss_ThreadRecvMsg(UINT32 *p_msg_id, VOID **p_buf, UINT32 *p_buf_size, UINT32 timeout); | |
/** | |
* @brief ×¢²áÏß³ÌÏûÏ¢¹³×Óº¯Êý | |
* @param thread_id Èë²Î£¬Ïß³Ìid | |
* @param type Èë²Î£¬¹³×Óº¯ÊýÀàÐÍ | |
* @param dire Èë²Î£¬¹³×Óº¯ÊýÅäÖà | |
* @param func Èë²Î£¬¹³×Óº¯ÊýÖ¸Õë | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_RegThreadMsgHook(ZOSS_THREAD_ID thread_id, UINT8 type, UINT8 dire, THREAD_MSG_HOOK func); | |
/* ÏûϢͨѶ */ | |
/** | |
* @brief ÏòÖ¸¶¨µÄÏ̷߳¢ËÍÏûÏ¢ | |
* @param thread_id Èë²Î£¬Ä¿±êÏ̵߳ÄÏß³Ìid | |
* @param msg_ptr Èë²Î£¬ÏûÏ¢Êý¾ÝµÄÖ¸Õë | |
* @param size Èë²Î£¬ÏûÏ¢µÄ´óС | |
* @param timeout Èë²Î£¬·¢ËÍÏûÏ¢µÄ³¬Ê±Ê±¼ä | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£» | |
Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£» | |
·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬ | |
³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê± | |
* @warning | |
*/ | |
UINT32 zOss_SendMsg(ZOSS_THREAD_ID thread_id, VOID *msg_ptr, UINT32 size, UINT32 timeout); | |
/** | |
* @brief ½ÓÊÕÏûÏ¢ | |
* @param msg_ptr ³ö²Î£¬ÏûÏ¢Ö¸ÕëµÄ´æ·ÅµØÖ· | |
* @param size ³ö²Î£¬ÏûÏ¢Êý¾Ý´óСµÄ´æ·ÅµØÖ· | |
* @param timeout Èë²Î£¬½ÓÊÕÏûÏ¢µÄ³¬Ê±Ê±¼ä | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£» | |
Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£» | |
·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬ | |
³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê± | |
* @warning | |
*/ | |
UINT32 zOss_RecvMsg(VOID **msg_ptr, UINT32 *size, UINT32 timeout); | |
/* ¼ÆÊýÐźÅÁ¿ */ | |
/** | |
* @brief ´´½¨ÐźÅÁ¿ | |
* @param name_ptr Èë²Î£¬ÐźÅÁ¿µÄÃû³Æ | |
* @param initial_count Èë²Î£¬ÐźÅÁ¿µÄ³õʼ¼ÆÊýÖµ | |
* @return ´´½¨³É¹¦£¬·µ»ØÐźÅÁ¿µÄ¾ä±ú£»·ñÔòϵͳ¶ÏÑÔ | |
* @note | |
* @warning | |
*/ | |
ZOSS_SEMAPHORE_ID zOss_CreateSemaphore(const CHAR *name_ptr, UINT32 initial_count); | |
/** | |
* @brief »ñÈ¡ÐźÅÁ¿ | |
* @param sem_id Èë²Î£¬ÕýÔÚ»ñÈ¡µÄÐźÅÁ¿id | |
* @param timeout Èë²Î£¬³¬Ê±¼ÆÊý | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note Èô²ÎÊýtimeoutÊÇZOSS_WAIT_FOREVER£¬ÔòÒ»Ö±µÈ´ýÏûÏ¢·¢Ëͳɹ¦ÔÙ·µ»Ø£» | |
Èô²ÎÊýtimeoutÊÇZOSS_NO_WAIT£¬Ôò³¢ÊÔ·¢ËÍÏûÏ¢£¬·¢ËÍʧ°Ü£¬Ö±½Ó·µ»Ø£» | |
·ñÔòtimeoutÊdz¬Ê±µÄʱ¼ä£¬¼ÆËã·½·¨Êǽ«µ±Ç°ÏµÍ³Ê±¼äºÍtimeoutÏà¼Ó£¬ | |
³ÉΪabs_timeout,È»ºóÆô¶¯Ò»¸ö¶¨Ê±Æ÷£¬Ö±ÖÁÏûÏ¢·¢Ëͳɹ¦»ò³¬Ê± | |
* @warning | |
*/ | |
UINT32 zOss_GetSemaphore(ZOSS_SEMAPHORE_ID sem_id, UINT32 timeout); | |
/** | |
* @brief ÊÍ·ÅÐźÅÁ¿ | |
* @param sem_id Èë²Î£¬ÕýÔÚÊͷŵÄÐźÅÁ¿id | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_PutSemaphore(ZOSS_SEMAPHORE_ID sem_id); | |
/** | |
* @brief »ñÈ¡ÐźÅÁ¿µÄµ±Ç°¼ÆÊýÖµ | |
* @param sem_id Èë²Î£¬ÕýÔÚ±»»ñÈ¡¼ÆÊýÖµµÄÐźÅÁ¿id | |
* @return ¸ÃÐźÅÁ¿µÄµ±Ç°¼ÆÊýÖµ | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetSemaphoreCount(ZOSS_SEMAPHORE_ID sem_id); | |
/** | |
* @brief ɾ³ýÐźÅÁ¿ | |
* @param sem_id Èë²Î£¬±»É¾³ýµÄÐźÅÁ¿id | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_DeleteSemaphore(ZOSS_SEMAPHORE_ID sem_id); | |
/* »¥³âÐźÅÁ¿ */ | |
/** | |
* @brief ´´½¨»¥³âÌå | |
* @param name_ptr Èë²Î£¬»¥³âÌåÃû³Æ | |
* @param priority_inherit Èë²Î£¬»¥³âÌåÊôÐÔ£¬Èç¹ûÊÇZOSS_INHERIT£¬ÔòÏß³ÌÖ®¼ä°´ | |
ÓÅÏȼ¶Ë³Ðò»ñÈ¡»¥³âÌ壻Èç¹ûÊÇZOSS_NO_INHERIT£¬Ôò°´µÈ´ýµÄ˳Ðò»ñÈ¡ | |
»¥³âÌå | |
* @return Èô³É¹¦£¬·µ»Ø´´½¨µÄ»¥³âÌå¾ä±ú£»·ñÔòϵͳ¶ÏÑÔ | |
* @note | |
* @warning | |
*/ | |
ZOSS_MUTEX_ID zOss_CreateMutex(const CHAR *name_ptr, UINT32 priority_inherit); | |
/** | |
* @brief »ñÈ¡»¥³âÌå | |
* @param mutex_id Èë²Î£¬´ý»ñÈ¡µÄ»¥³âÌåid | |
* @param timeout Èë²Î£¬»ñÈ¡µÄ³¬Ê±Ê±¼ä | |
* @return ³É¹¦£¬·µ»ØZOSS_SUCCESS£¬·ñÔò·µ»ØZOSS_ERROR | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetMutex(ZOSS_MUTEX_ID mutex_id, UINT32 timeout); | |
/** | |
* @brief ÊÍ·Å»¥³âÌå | |
* @param mutex_id Èë²Î£¬´ýÊͷŵĻ¥³âÌåid | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_PutMutex(ZOSS_MUTEX_ID mutex_id); | |
/** | |
* @brief Ïú»Ù»¥³âÌå | |
* @param mutex_id Èë²Î£¬´ýÏú»ÙµÄ»¥³âÌåid | |
* @return Èô³É¹¦£¬·µ»ØZOSS_SUCCESS£»·ñÔòϵͳ¶ÏÑÔ | |
* @retval ZOSS_SUCCESS ³É¹¦ | |
* @retval ZOSS_ERROR ʧ°Ü | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_DeleteMutex(ZOSS_MUTEX_ID mutex_id); | |
/* ʱ¼ä */ | |
/** | |
* @brief »ñÈ¡²Ù×÷ϵͳµÄµ±Ç°µÎ´ðÊý | |
* @param void | |
* @return ·µ»Ø²Ù×÷ϵͳµÄµ±Ç°µÎ´ðÊý | |
* @retval µÎ´ðÊý | |
* @note | |
* @warning | |
*/ | |
UINT32 zOss_GetTickCount(VOID); | |
#ifndef DOXYGEN_SHOULD_SKIP_THIS | |
/* CPUʹÓÃÂÊͳ¼Æ */ | |
UINT8 zOss_GetCPU(VOID); | |
/* Òì³£´¦Àí */ | |
VOID EXP_Handler(const CHAR *pExp, const CHAR *pcFileName, const CHAR *pcFuncName, SINT32 dwLineNum); | |
#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS | |
/******************************************************************************* | |
* Inline function implementations * | |
******************************************************************************/ | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif // #ifndef _OSS_KERNEL_H | |