📄 ostime_ex.h
字号:
/* * Copyright (c) 2003-2004 Linuxant inc. * Copyright (c) 2001-2004 Conexant Systems, Inc. * * 1. Permitted use. Redistribution and use in source and binary forms, * without modification, are only permitted under the terms set forth herein. * * 2. Disclaimer of Warranties. LINUXANT, ITS SUPPLIERS, AND OTHER CONTRIBUTORS * MAKE NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. * IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTIES OF ANY KIND. * LINUXANT AND OTHER CONTRIBUTORS DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE, GOOD TITLE AND AGAINST INFRINGEMENT. * * This software has not been formally tested, and there is no guarantee that * it is free of errors including, but not limited to, bugs, defects, * interrupted operation, or unexpected results. Any use of this software is * at user's own risk. * * 3. No Liability. * * (a) Linuxant, its suppliers, or contributors shall not be responsible for * any loss or damage to users, customers, or any third parties for any reason * whatsoever, and LINUXANT, ITS SUPPLIERS OR CONTRIBUTORS SHALL NOT BE LIABLE * FOR ANY ACTUAL, DIRECT, INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL, OR * CONSEQUENTIAL (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED, WHETHER IN CONTRACT, STRICT OR OTHER LEGAL THEORY OF * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * (b) User agrees to hold Linuxant, its suppliers, and contributors harmless * from any liability, loss, cost, damage or expense, including attorney's fees, * as a result of any claims which may be made by any person, including * but not limited to User, its agents and employees, its customers, or * any third parties that arise out of or result from the manufacture, * delivery, actual or alleged ownership, performance, use, operation * or possession of the software furnished hereunder, whether such claims * are based on negligence, breach of contract, absolute liability or any * other legal theory. * * 4. Notices. User hereby agrees not to remove, alter or destroy any * copyright, trademark, credits, other proprietary notices or confidential * legends placed upon, contained within or associated with the Software, * and shall include all such unaltered copyright, trademark, credits, * other proprietary notices or confidential legends on or in every copy of * the Software. * * 5. Reverse-engineering. User hereby agrees not to reverse engineer, * decompile, or disassemble the portions of this software provided solely * in object form, nor attempt in any manner to obtain their source-code. * * 6. Redistribution. Redistribution of this software is only permitted * for exact copies (without modification) of versions explicitly marked * and officially released by Linuxant with the word "free" in their name. * Redistribution or disclosure of other versions, derivatives or license key * information is expressly prohibited without explicit written approval signed * by an authorized Linuxant officer. * * 7. Performance. V.92 modems are designed to be capable of receiving data at * up to 56Kbps with compatible phone line and server equipment, and transmitting * data at up to 31.2Kbps. V.90 modems are designed to be capable of receiving * data at up to 56 Kbps from a compatible service provider and transmitting data * at up to about 28.8 Kbps. Public networks currently limit download speeds to * about 53Kbps. The free version of the drivers is limited to 14.4Kbps. * Actual speeds vary and are often less than the maximum possible. * * */#include "osservices.h"#if 0#ifndef _OSTIME_EX_H_#define _OSTIME_EX_H_ #include "comtypes.h"#if (PRJ_FLAVOUR!=PRJFLVR_HSF)#include "rtmgr_ex.h"#endif#ifdef __cplusplusextern "C"{#endif #if (OS_TYPE == OS_VXWORKS)#define OSCriticalSectionCreate() OSSemaphoreCreate(1)#define OSCriticalSectionDestroy OSSemaphoreDestroy#define OSCriticalSectionAcquire OSSemaphoreWait#define OSCriticalSectionRelease OSSemaphoreSignal#define OsSetPeriodicTimer OSSetPeriodicTimeOut#define OsDestroyPeriodicTimer OSDestroyPeriodicTimeOut#define OsCallOnMyStack OSCallOnMyStack#endif#if OS_ONE_OF(OS_MACOSX | OS_STB | OS_LINUX)#define HLOCK HANDLEHANDLE OsLockCreate(VOID);VOID OsLockDestroy(HLOCK hLock); VOID OsLockLock(HLOCK hLock);VOID OsLockUnlock(HLOCK hLock);#define OSCriticalSectionCreate OsLockCreate#define OSCriticalSectionDestroy OsLockDestroy#define OSCriticalSectionAcquire OsLockLock#define OSCriticalSectionRelease OsLockUnlock#define OSSetPeriodicTimer OsSetPeriodicTimer#define OSDestroyPeriodicTimer OsDestroyPeriodicTimer#define OSCallOnMyStack OsCallOnMyStack#define OSCreateTimer OsCreateTimer#define OSSetTimer OsSetTimer#define OSCancelTimer OsCancelTimer#define OSChangeTimerTimeOut OsChangeTimerTimeOut#define OSDestroyTimer OsDestroyTimer#endif /**********************************************************************************Function name : OsCreatePeriodicTimerParameters : InitialTimeOut - initial interval between 2 timeout callbacks pTimeOutCallBack - Callback to be periodically called back pFuncAlloc - wrapper function for allocations pFuncFree - wrapper function for deallocations pRefData - Reference Data to be passed to wrapper functionsReturn 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. **********************************************************************************/HANDLE OsCreatePeriodicTimer ( IN UINT32 InitialTimeOut, IN PCBFUNC pTimeOutCallBack, IN PALLOC_FUNC pFuncAlloc, IN PFREE_FUNC pFuncFree, IN PVOID pRefData, OUT HANDLE* pThreadId);/**********************************************************************************Function name : OSDestroyPeriodicTimerParameters : hTimeOut - Handle to the periodic time out returned by OSCreatePeriodicTimeOut.Return value : nonefunctionality : destroys a periodic timeout resource.**********************************************************************************/GLOBAL VOID OSDestroyPeriodicTimer ( IN HANDLE hTimeOut);/**********************************************************************************Function name : OSSetPeriodicTimerParameters : 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.**********************************************************************************/GLOBAL BOOL OSSetPeriodicTimer ( IN HANDLE hTimeOut, IN UINT32 NewTimeOut);#if (OS_TYPE != OS_LINUX)/**********************************************************************************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.**********************************************************************************/GLOBAL 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/**********************************************************************************Function name : OSGetSystemTimeParameters : NoneReturn value : returns timestamp in millisecondsfunctionality The function returnes a milliseconds timestamp.**********************************************************************************//* returns time stamp in milli-seconds */GLOBAL UINT32 OSGetSystemTime( VOID );/* initialize epoch to reduce wrap around risk; all values returned by * OSGetSystemTime() will be relative to the time OSInitTime() was called */GLOBAL VOID OSInitTime( VOID ); /**********************************************************************************Function name : OSSemaphoreCreateParameters : InitCount - specifies the initial token count for the semaphoreReturn value : Handle to the created semaphore to be passed as parameter for OS functions acting on semaphores. Returns NULL on failure.functionality The tokenCount should correspond to the number of clients that can simultaneously acquire the resource the semaphore controls**********************************************************************************/GLOBAL HANDLE OSSemaphoreCreate( IN int InitCount);/**********************************************************************************Function name : OSSemaphoreDestroyParameters : hSemaphore - Handle identifing the semaphore.Return value : Nonefunctionality : Destroys a semaphore. Any tasks currently locked by the semaphore become reschedules.**********************************************************************************/GLOBAL VOID OSSemaphoreDestroy( IN HANDLE hSemaphore);/**********************************************************************************Function name : OSSemaphoreWaitParameters : hSemaphore - Handle identifing the semaphore.Return value : Nonefunctionality Blocks the calling run time if all the tokens of the semaphore are currently claimed. If the number of clients that currently hold the controlled resource is less than the initial token count, then wait returns immediately and the caller holds the resource. Otherwise, the client is blocked until another client releases the resource.**********************************************************************************/GLOBAL VOID OSSemaphoreWait( IN HANDLE hSemaphore);/**********************************************************************************Function name : OSSemaphoreSignalParameters : hSemaphore - Handle identifing the semaphore.Return value : Nonefunctionality : increments the token count of the semaphore. If run times are waiting
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -