📄 osservices.h
字号:
#undef OsStrnCat#define OsStrnCat strncat#undef OsStrCmp#define OsStrCmp strcmp#undef OsStrnCmp#define OsStrnCmp strncmp#undef OsStrLen#define OsStrLen strlen#else__shimcall__PVOID OsMemSet (PVOID pBuf, UINT8 c, UINT32 Count);__shimcall__PVOID OsMemCpy (PVOID pDest, PVOID pSrc, UINT32 Count);__shimcall__PVOID OsMemMove (PVOID pDest, PVOID pSrc, UINT32 Count);__shimcall__int OsMemCmp (PVOID pBuff1, PVOID pBuff2, UINT32 Count);__shimcall____shimcall__PVOID OsStrCpy (LPSTR szDest, LPCSTR szSrc);__shimcall__PVOID OsStrnCpy (LPSTR szDest, LPCSTR szSrc, int MaxSize);__shimcall__LPSTR OsStrCat (LPSTR szDest, LPCSTR szSrc);__shimcall__LPSTR OsStrnCat (LPSTR szDest, LPCSTR szSrc, int MaxSize);__shimcall__int OsStrCmp (LPCSTR szStr1, LPCSTR szStr2);__shimcall__int OsStrnCmp (LPCSTR szStr1, LPCSTR szStr2, UINT32 Count);__shimcall__int OsStrLen (LPCSTR szStr);#endif__shimcall__int OsAtoi (LPCSTR szStr);__shimcall__int OsToupper (int c);__shimcall__int OsTolower (int c);__shimcall__int OsIsDigit (int c);#ifndef TARGET_HCF_STARFISH_VXWORKS#include <stdarg.h>__shimcall__int OsSprintf (LPSTR buffer, LPCSTR format, ...);__shimcall__int OsVSprintf (LPSTR buffer, LPCSTR format, va_list valist);#else#define OsSprintf sprintf#define OsVSprintf vsprintf#endiftypedef struct{ int dummy;} *HOSTIMER;/********************************************************************************** Misc utilities**********************************************************************************//**********************************************************************************Function name : OsGetSystemTimeParameters : NoneReturn value : returns timestamp in millisecondsFunctionality The function returnes a milliseconds timestamp.Interrupt safe: yes**********************************************************************************/__shimcall__UINT32 OsGetSystemTime(void);/**********************************************************************************Function name : OsSleepParameters : Time in milliseconds to put the thread to sleepReturn value : NoneFunctionality Put the executing thread to sleepInterrupt safe: no**********************************************************************************/__shimcall__void OsSleep (UINT32 sleepTime);/**********************************************************************************Function name : OsGetCurrentThreadParameters : NoneReturn value : Thread ID of the active threadFunctionality: Returns thread ID of the thread running the codeInterrupt safe: no**********************************************************************************/#if ( OS_TYPE == OS_MACOSX )#define HTHREAD HANDLE#elsetypedef struct tagHTHREAD{ int dummy;} *HTHREAD;#endif__shimcall__HTHREAD OsGetCurrentThread(void);/**********************************************************************************Function name : OsCallOnMyStackParameters : pFunc - function to be called lParam - parameter to pass for pFunc pTopOfStack - Pointer to stack StackSizeBytes - stack size in bytes.Return value : NoneFunctionality : Temporarily switches a stack to a different locked block of memory. This function is intended to be used in an environment with limited stack size given to an interrupt service routine. Interrupt safe: yes**********************************************************************************/#if (OS_TYPE != OS_LINUX)void OsCallOnMyStack ( IN PCBFUNC pFunc, IN UINT32 lParam, IN PUINT32 pTopOfStack, IN UINT32 StackSizeBytes);#else#define OsCallOnMyStack(pFunc, lParam, pTopOfStack, StackSizeBytes) (pFunc)((PVOID)(lParam))#endif/**************************************************************************************** Timer****************************************************************************************//**********************************************************************************Function name : OsCreatePeriodicTimeOutParameters : InitialTimeOut - initial interval in milliseconds between 2 timeout callbacks pTimeOutCallBack - Pointer to a fucntion that will be called at the specified interval pRefData - Reference Data to be passed to callback functionReturn value : Returns a handle to the periodic timeout. This handle is to be passed to OS functions acting on periodic timeout. Returns NULL on failure.Functionality : Creates a periodic timeout of InitialTimeOut interval. pTimeOutCallBack function will be called on each timer interval. Interrupt safe: no**********************************************************************************/__shimcall__HOSTIMER OsCreatePeriodicTimer ( IN UINT32 InitialTimeOut, IN PCBFUNC pTimeOutCallBack, IN PALLOC_FUNC pFuncAlloc, IN PFREE_FUNC pFuncFree, IN PVOID pRefData, OUT HTHREAD* pThreadId);/**********************************************************************************Function name : OsDestroyPeriodicTimeOutParameters : hTimeOut - Handle to the periodic time out returned by OsCreatePeriodicTimeOut.Return value : noneFunctionality : destroys a periodic timeout resource.Interrupt safe: no**********************************************************************************/__shimcall__void OsDestroyPeriodicTimer (IN HOSTIMER hTimeOut);/**********************************************************************************Function name : OsSetPeriodicTimeOutParameters : hTimeOut - Handle to the periodic timeout NewTimeOut - New timeout intervalReturn value : returns TRUE when the timeout interval was successfully changed to NewTimeOutFunctionality : resets the timeout inteval to a new value.Interrupt safe: no**********************************************************************************/__shimcall__BOOL OsSetPeriodicTimer ( IN HOSTIMER hTimeOut, IN UINT32 NewTimeOut);/**********************************************************************************Function name : OsImmediateTimeOutParameters : hTimeOut - Handle to the periodic timeoutReturn value : noneFunctionality : Schedules call of the callback function as soon as non-interrupt context becomes available.Interrupt safe: yes**********************************************************************************/__shimcall__void OsImmediateTimeOut (IN HOSTIMER hTimeOut);/********************************************************************************** Debug utilities**********************************************************************************/__shimcall__void OsRawVPrintf (LPCSTR szFormat, PVOID args, BOOL addnl);__shimcall__void OsRawNLPrintf (LPCSTR szFormat, ...)#ifdef __GNUC__ __attribute__ ((format (printf, 1, 2)))#endif ;__shimcall__void OsRawPrintf (LPCSTR szFormat, ...)#ifdef __GNUC__ __attribute__ ((format (printf, 1, 2)))#endif ;__shimcall__void OsErrorVPrintf (LPCSTR szFormat, PVOID args);__shimcall__void OsErrorPrintf (LPCSTR szFormat, ...)#ifdef __GNUC__ __attribute__ ((format (printf, 1, 2)))#endif ;__shimcall__void OsDebugVPrintf (LPCSTR szFormat, PVOID args);__shimcall__void OsDebugPrintf (LPCSTR szFormat, ...)#ifdef __GNUC__ __attribute__ ((format (printf, 1, 2)))#endif ;__shimcall__void OsDebugBreakpoint (LPCSTR szMsg );/*void OsDebugDumpData(PUINT8 data, UINT32 len);*/#define OsSwapUINT16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))#define OsSwapUINT32(x) ((OsSwapUINT16(x) << 16) | (OsSwapUINT16((x) >> 16)))//Event handling functionstypedef struct tagHOSEVENT{ void *dummy;} OSEVENT, *HOSEVENT;typedef enum OSEVENT_WAIT_RESULT_ENUM{ OSEVENT_WAIT_OK, OSEVENT_WAIT_TIMEOUT, OSEVENT_WAIT_ERROR} OSEVENT_WAIT_RESULT;__shimcall__ HOSEVENT OsEventCreate(void);__shimcall__ void OsEventDestroy(HOSEVENT hEvent);__shimcall__ void OsEventInit(HOSEVENT hEvent);__shimcall__ long OsEventSet(HOSEVENT hEvent);__shimcall__ long OsEventClear(HOSEVENT hEvent);__shimcall__ long OsEventState(HOSEVENT hEvent);__shimcall__ void OsEventWait(HOSEVENT hEvent);__shimcall__ OSEVENT_WAIT_RESULT OsEventWaitTime(HOSEVENT hEvent, UINT32 timeout);__shimcall__void OsErrorPrintf ( LPCSTR szFormat, ...);/**********************************************************************************Function name : OsFloatPrefixParameters : NoneReturn value : Nonefunctionality : Treats the FPU in order to enable float operations.**********************************************************************************/__shimcall__GLOBAL int OsFloatPrefix(void);/**********************************************************************************Function name : OsFloatPrefixParameters : NoneReturn value : Nonefunctionality : Restores the FPU after float operations.**********************************************************************************/__shimcall__GLOBAL BOOL OsFloatSuffix(int Id);__shimcall__HANDLE OsCreateTimer(UINT32 msec, PVOID pCBFunc, PVOID pRefData);__shimcall__void OsSetTimer(PVOID pTimer);__shimcall__void OsCancelTimer(PVOID Timer);__shimcall__void OsChangeTimerTimeOut(PVOID Timer, UINT32 msec);__shimcall__void OsDestroyTimer(PVOID pTimer);#if (OS_TYPE == OS_LINUX)__shimcall__GLOBAL DWORD OsGetProcessorFreq(void);#define GlobalProcessorFreq OsGetProcessorFreq()__shimcall__UINT32 OsReadCpuCnt(void);typedef struct _OSTHRD OSTHRD, *POSTHRD;__shimcall__POSTHRD OsThreadCreate(const char *name, BOOLEAN highestprio, int *pid);__shimcall__void OsThreadDestroy(POSTHRD osthrd);typedef struct tagHOSSCHED{ unsigned char dummy[8*sizeof(PVOID)];} OSSCHED, *HOSSCHED;__shimcall__void OsThreadScheduleInit(HOSSCHED hWorkStorage, __kernelcall__ void (*func)(void *), void * data);__shimcall__int OsThreadSchedule(POSTHRD osthrd, HOSSCHED hWorkStorage);__shimcall__voidOsThreadScheduleDone(void);__shimcall__intOsForkWait(char *program_path, char *argv[], char *envp[]);__shimcall__BOOLOsKernelUsesRegParm(void);extern POSTHRD OsMdmThread;#endif#ifdef __cplusplus}#endif#endif /* #ifndef __OSSERVICES_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -