📄 ostime_ex.h
字号:
on the semaphore, one of them will be unblocked. The current run time may be rescheduled this function is called.**********************************************************************************/GLOBAL VOID OSSemaphoreSignal( IN HANDLE hSemaphore);#if OS_IS_NOT(OS_VXWORKS | OS_MACOSX | OS_STB | OS_LINUX) /**********************************************************************************Function name : OSCriticalSectionCreateParameters : NoneReturn value : Handle to the created critical section to be passed as parameter for OS functions acting on critical section. Returns NULL on failure.functionality : Creates an instance of a critical section. Returns NULL on failure**********************************************************************************/#ifdef USE_DDKGLOBAL HANDLE OSCriticalSectionCreate();#else#if (PROJECT == PRJ_SDSL) || (PROJECT == PRJ_OCTOLOADER)GLOBAL HANDLE OSCriticalSectionCreate();#else#define OSCriticalSectionCreate() __OSCriticalSectionCreate( __FILE__, __LINE__ )GLOBAL HANDLE __OSCriticalSectionCreate( char *file, int line );#endif#endif/**********************************************************************************Function name : OSCriticalSectionDestroyParameters : hMutex - Handle identifing the mutex.Return value : Nonefunctionality : Destroys a mutex instance. Do not attemt to destroy a mutex while it is acquired.**********************************************************************************/GLOBAL VOID OSCriticalSectionDestroy( IN HANDLE hMutex);/**********************************************************************************Function name : OSCriticalSectionAcquireParameters : hMutex - Handle identifing the mutex.Return value : Nonefunctionality: If the mutex is unowned, the calling run time becomes the owner If a run time other than the calling run time owns the mutex, the calling run time is blocked until the mutex becomes unowned. If the calling run time already owns the mutex, the run time continues execution.**********************************************************************************/GLOBAL VOID OSCriticalSectionAcquire( IN HANDLE hMutex);/**********************************************************************************Function name : OSCriticalSectionReleaseParameters : hMutex - Handle identifing the mutex.Return value : Nonefunctionality: A mutex is initially unowned, and the ownership count is zero. For each call to acquire, there must be a corresponding call to release. Each time acquire is called, the ownership count increments, and each time release is called, the ownership count decrements. Only the run time that owns a mutex may leave it. When the ownership count falls to zero, the mutex becomes unowned. At this point, a run time blocked by the mutex, with the highest priority becomes schedulable.**********************************************************************************/GLOBAL VOID OSCriticalSectionRelease( IN HANDLE hMutex);#endif /** OS_VXWORKS **//**********************************************************************************Function name : OSSetTimeSensitivityParameters : Interval - timer interrupt intervalReturn value : Nonefunctionality: Determines the operatin system timeout interval, to enable timer resolution control. For each call to OSSetTimeSensitivity there should be a matching call to OSRestoreTimeSensitivity with same Interval value**********************************************************************************/GLOBAL VOID OSSetTimeSensitivity( IN UINT32 Interval); /**********************************************************************************Function name : OSRestoreTimeSensitivityParameters : Interval - timer interrupt intervalReturn value : Nonefunctionality : Restores the timer interrupt to the value before OSSetTimeSensitivity was called**********************************************************************************/GLOBAL VOID OSRestoreTimeSensitivity( IN UINT32 Interval); /**********************************************************************************Function name : OSDisableInterruptParameters : NoneReturn value : handle to be passed to OSRestoreInterruptfunctionality : Disables interrupt.**********************************************************************************/GLOBAL HANDLE OSDisableInterrupt(void);/**********************************************************************************Function name : OSRestoreInterruptsParameters : hStatus - handle returned by OSDisableInterruptReturn value : Nonefunctionality : Restores the interrupt status as before the OSDisableInterrupt was called**********************************************************************************/GLOBAL VOID OSRestoreInterrupts( IN HANDLE hStatus);/**********************************************************************************Function name : OsFloatPrefixParameters : NoneReturn value : Nonefunctionality : Treats the FPU in order to enable float operations.**********************************************************************************/GLOBAL int OsFloatPrefix(void);/**********************************************************************************Function name : OsFloatPrefixParameters : NoneReturn value : Nonefunctionality : Restores the FPU after float operations.**********************************************************************************/GLOBAL BOOL OsFloatSuffix(int Id);#if OS_ONE_OF( OS_LINUX | OS_VXWORKS | OS_MACOSX | OS_STB )HANDLE OSCreateTimer(UINT32 msec, PVOID pCBFunc, PVOID pRefData);void OSSetTimer(PVOID pTimer);void OSCancelTimer(PVOID Timer);void OSChangeTimerTimeOut(PVOID Timer, UINT32 msec);void OSDestroyTimer(PVOID pTimer);#endif#if OS_IS_NOT( OS_MACOSX | OS_STB )#define OsLockCreate() OSSemaphoreCreate(1)#endif#if ( OS_TYPE != OS_STB )#define OsLockDestroy OSSemaphoreDestroy#define OsLockLock OSSemaphoreWait#define OsLockUnlock OSSemaphoreSignal#define OsGetSystemTime OSGetSystemTime#elseUINT32 OsGetSystemTime(VOID);#define OSGetSystemTime OsGetSystemTimeBOOL OsHookInterrupt ( HANDLE hDevice, VOID (*InterruptHandler)(VOID*), VOID* pRef);BOOL OsUnhookInterrupt ( HANDLE hDevice);#endifGLOBAL VOID OSImmediateTimeOut ( IN HANDLE hTimeOut); GLOBAL VOID OSCancelPeriodicTimeOut ( IN HANDLE hTimeOut); #if (PROJECT == PRJ_SDSL) || (PROJECT == PRJ_OCTOLOADER)/**********************************************************************************Function name : OSHookInterruptParameters : pResources - Different for each Os - includes resources needed for for connecting to interrupt. pCallBack - Interrupt handler pConext - Contect to be sent to interrupt handlerReturn value : HANDLE to be called to OsUnhookInterruptfunctionality : Registers an ISR to be called on specified interrupt.**********************************************************************************/GLOBAL HANDLE OSHookInterrupt( IN PVOID pResources, IN PISR pISRCallBack, IN PISR pDPCCallBack, IN HANDLE pConext); /**********************************************************************************Function name : OSUnhookInterruptParameters : hHook - Hnadle returned by OsHookInterruptReturn value : Nonefunctionality : Unregisters from an interrupt.**********************************************************************************/GLOBAL VOID OSUnhookInterrupt( IN HANDLE hHook); #endif/********************************************************************//* Utilities *//********************************************************************/BOOL OsAtomicCompareAndSwap (PVOID oldValue, PVOID newValue, PVOID* address);INT32 OsAtomicAdd (INT32 amount, INT32* address);void OsSleep(UINT32 SleepTime);#if (OS_TYPE == OS_WIN_9X)#define __FUNCTION__#endif #if (OS_TYPE == OS_VXWORKS)int OsTaskSpawn(char * name, /* name of new task (stored at pStackBase) */ int priority, /* priority of new task */ int options, /* task option word */ int stackSize, /* size (bytes) of stack needed plus name */ void* entryPt, /* entry point of new task */ int arg1, /* 1st of 10 req'd task args to pass to func */ int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10);BOOL OsTaskDelete(int TaskId);#endif#if (OS_TYPE == OS_LINUX)typedef unsigned long tMuSecTimeStamp;#define GlobalProcessorFreq OsGlobalProcessorFreq#define GetMuSecStartStamp OsGetMuSecStartStamp#define DeltaTimeMuSec OsDeltaTimeMuSec#define BusyLoopMilliSec OsBusyLoopMilliSec#define BusyLoopMuSec OsBusyLoopMuSec#define PerfCntGuardBusyLoop() {}extern DWORD GlobalProcessorFreq; // in MHztMuSecTimeStamp OsGetMuSecStartStamp(void);tMuSecTimeStamp OsDeltaTimeMuSec(tMuSecTimeStamp PrevStamp, tMuSecTimeStamp NextStamp);void OsBusyLoopMilliSec(DWORD DelayInMilliSecs);void OsBusyLoopMuSec(DWORD DelayInMicroSecs);#endif#ifdef __cplusplus}#endif #endif /* _OSTIME_EX_H_ */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -