CooCox 1.1.4 on mbed with simple blinky example

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

CoOS.h File Reference

CoOS.h File Reference

API header file of CooCox CoOS. More...

Go to the source code of this file.

Functions

void CoInitOS (void)
 Initialize OS.
void CoStartOS (void)
 Start multitask.
void CoEnterISR (void)
 Enter a ISR.
void CoExitISR (void)
 Exit a ISR.
void CoSchedLock (void)
 Lock schedule.
void CoSchedUnlock (void)
 Unlock schedule.
OS_VER CoGetOSVersion (void)
 Get OS version.
void CoExitTask (void)
 Exit Task.
OS_TID CoGetCurTaskID (void)
 Get current task id.
StatusType CoDelTask (OS_TID taskID)
 Delete Task.
StatusType CoActivateTask (OS_TID taskID, void *argv)
 Activate Task.
StatusType CoAwakeTask (OS_TID taskID)
 Awake Task.
StatusType CoSuspendTask (OS_TID taskID)
 Suspend Task.
StatusType CoSetPriority (OS_TID taskID, U8 priority)
 Change task priority.
OS_TID CreateTask (FUNCPtr task, void *argv, U32 parameter, OS_STK *stk)
 Create a task.
U64 CoGetOSTime (void)
 Get current ticks.
StatusType CoTickDelay (U32 ticks)
 Delay current task for specify ticks number.
StatusType CoResetTaskDelayTick (OS_TID taskID, U32 ticks)
 Reset task delay ticks.
StatusType CoTimeDelay (U8 hour, U8 minute, U8 sec, U16 millsec)
 Delay current task for detail time.
StatusType CoDelTmr (OS_TCID tmrID)
 Delete a timer.
StatusType CoStopTmr (OS_TCID tmrID)
 Stop countering for a spcify timer.
StatusType CoStartTmr (OS_TCID tmrID)
 Start counter.
U32 CoGetCurTmrCnt (OS_TCID tmrID, StatusType *perr)
 Get current counter of specify timer.
StatusType CoSetTmrCnt (OS_TCID tmrID, U32 tmrCnt, U32 tmrReload)
 Setting for a specify timer.
OS_TCID CoCreateTmr (U8 tmrType, U32 tmrCnt, U32 tmrReload, vFUNCPtr func)
 Create a timer.
void * CoKmalloc (U32 size)
 Allocation size bytes of memory block from kernel heap.
void CoKfree (void *memBuf)
 Release memory block to kernel heap.
void * CoGetMemoryBuffer (OS_MMID mmID)
 Get a memory buffer from memory partition.
StatusType CoDelMemoryPartition (OS_MMID mmID)
 Delete a memory partition.
StatusType CoFreeMemoryBuffer (OS_MMID mmID, void *buf)
 Free a memory buffer to memory partition.
U32 CoGetFreeBlockNum (OS_MMID mmID, StatusType *perr)
 Get free block number in a memory partition.
OS_MMID CoCreateMemPartition (U8 *memBuf, U32 blockSize, U32 blockNum)
 Create a memory partition.
OS_MutexID CoCreateMutex (void)
 Create a mutex.
StatusType CoEnterMutexSection (OS_MutexID mutexID)
 Enter a critical area.
StatusType CoLeaveMutexSection (OS_MutexID mutexID)
 Leave from a critical area.
StatusType CoPostSem (OS_EventID id)
 Post a semaphore.
StatusType CoAcceptSem (OS_EventID id)
 Accept a semaphore without waitting.
StatusType isr_PostSem (OS_EventID id)
 Post a semaphore in ISR.
StatusType CoDelSem (OS_EventID id, U8 opt)
 Delete a semaphore.
StatusType CoPendSem (OS_EventID id, U32 timeout)
 wait for a semaphore
OS_EventID CoCreateSem (U16 initCnt, U16 maxCnt, U8 sortType)
 Create a semaphore.
OS_EventID CoCreateMbox (U8 sortType)
 Create a mailbox.
StatusType CoDelMbox (OS_EventID id, U8 opt)
 Delete a mailbox.
StatusType CoPostMail (OS_EventID id, void *pmail)
 Post a mailbox.
StatusType isr_PostMail (OS_EventID id, void *pmail)
 Post a mailbox in ISR.
void * CoAcceptMail (OS_EventID id, StatusType *perr)
 Accept a mailbox.
void * CoPendMail (OS_EventID id, U32 timeout, StatusType *perr)
 Wait for a mailbox.
StatusType CoDelQueue (OS_EventID id, U8 opt)
 Delete a queue.
StatusType CoPostQueueMail (OS_EventID id, void *pmail)
 Post a mail to queue.
StatusType isr_PostQueueMail (OS_EventID id, void *pmail)
 Post a mail to queue in ISR.
void * CoAcceptQueueMail (OS_EventID id, StatusType *perr)
 Accept a mail from queue.
OS_EventID CoCreateQueue (void **qStart, U16 size, U8 sortType)
 Create a queue.
void * CoPendQueueMail (OS_EventID id, U32 timeout, StatusType *perr)
 Pend for a mail.
StatusType CoSetFlag (OS_FlagID id)
 Set a flag.
StatusType CoClearFlag (OS_FlagID id)
 Clear a Flag.
StatusType isr_SetFlag (OS_FlagID id)
 Set a flag in ISR.
StatusType CoDelFlag (OS_FlagID id, U8 opt)
 Delete a flag.
StatusType CoAcceptSingleFlag (OS_FlagID id)
 AcceptSingleFlag.
StatusType CoWaitForSingleFlag (OS_FlagID id, U32 timeout)
 WaitForSingleFlag.
OS_FlagID CoCreateFlag (BOOL bAutoReset, BOOL bInitialState)
 Create a flag.
U32 CoAcceptMultipleFlags (U32 flags, U8 waitType, StatusType *perr)
 AcceptMultipleFlags.
U32 CoWaitForMultipleFlags (U32 flags, U8 waitType, U32 timeout, StatusType *perr)
 WaitForMultipleFlags.
StatusType CoTimeToTick (U8 hour, U8 minute, U8 sec, U16 millsec, U32 *ticks)
 Convert time to tick.
void CoTickToTime (U32 ticks, U8 *hour, U8 *minute, U8 *sec, U16 *millsec)
 Convert tick number to time.
void CoIdleTask (void *pdata)
 IDLE task of OS.
void CoStkOverflowHook (OS_TID taskID)
 Hook for stack overflow.

Detailed Description

API header file of CooCox CoOS.

Version:
V1.1.4
Date:
2011.04.20

This file including all API functions's declare of CooCox CoOS.

INTERNAL FILE,DON'T PUBLIC.

© COPYRIGHT 2009 CooCox

Definition in file CoOS.h.


Function Documentation

void* CoAcceptMail ( OS_EventID  id,
StatusType *  perr 
)

Accept a mailbox.

Parameters:
[in]idEvent ID.
[out]perrA pointer to error code.
Return values:
Co_NULL
Apointer to mailbox accepted.
Description

This function is called to accept a mailbox.

Note:

Definition at line 103 of file mbox.c.

U32 CoAcceptMultipleFlags ( U32  flags,
U8  waitType,
StatusType *  perr 
)

AcceptMultipleFlags.

Parameters:
[in]flagsFlags that waiting to active task.
[in]waitTypeFlags wait type.
[out]perrA pointer to error code.
Return values:
0
springFlag
Description

This fucntion is called to accept multiple flags.

Note:

Definition at line 202 of file flag.c.

void* CoAcceptQueueMail ( OS_EventID  id,
StatusType *  perr 
)

Accept a mail from queue.

Parameters:
[in]idEvent ID.
[out]perrA pointer to error code.
Return values:
Co_NULL
Apointer to mail accepted.
Description

This function is called to accept a mail from queue.

Note:

Definition at line 151 of file queue.c.

StatusType CoAcceptSem ( OS_EventID  id )

Accept a semaphore without waitting.

Parameters:
[in]idEvent ID
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_SEM_EMPTYNo semaphore exist.
E_OKGet semaphore successful.
Description

This function is called accept a semaphore without waitting.

Definition at line 119 of file sem.c.

StatusType CoAcceptSingleFlag ( OS_FlagID  id )

AcceptSingleFlag.

Parameters:
[in]idFlag ID.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_FLAG_NOT_READYFlag is not in ready state.
E_OKThe call was successful and your task owns the Flag.
Description

This fucntion is called to accept single flag

Note:

Definition at line 160 of file flag.c.

StatusType CoActivateTask ( OS_TID  taskID,
void *  argv 
)

Activate Task.

Parameters:
[in]taskIDTask ID
[in]argvTask argv
[out]None
Return values:
E_INVALID_IDInvalid task ID.
E_OKActivate task successful.
Description

This function is called to activate current task.

Definition at line 1074 of file task.c.

StatusType CoAwakeTask ( OS_TID  taskID )

Awake Task.

Parameters:
[in]taskIDID of task that will been awaked.
[out]None
Return values:
E_OKTask awake successful.
E_INVALID_IDInvalid task ID.
E_TASK_NOT_WAITINGTask now not in waiting state.
E_TASK_WAIT_OTHERTask now waiting other awake event.
E_PROTECTED_TASKIdle task mustn't be awaked.
Description

This function is called to awake current task.

Definition at line 1198 of file task.c.

StatusType CoClearFlag ( OS_FlagID  id )

Clear a Flag.

Parameters:
[in]idFlag ID.
[out]None
Return values:
E_OKEvent deleted successful.
E_INVALID_IDInvalid event ID.
Description

This function is called to clear a flag.

Note:

Definition at line 466 of file flag.c.

OS_FlagID CoCreateFlag ( BOOL  bAutoReset,
BOOL  bInitialState 
)

Create a flag.

Parameters:
[in]bAutoResetReset mode,Co_TRUE(Auto Reset) FLASE(Manual Reset).
[in]bInitialStateInitial state.
[out]None
Return values:
E_CREATE_FAILCreate flag fail.
othersCreate flag successful.
Description

This function use to create a event flag.

Note:

Definition at line 45 of file flag.c.

OS_EventID CoCreateMbox ( U8  sortType )

Create a mailbox.

Parameters:
[in]sortTypeMail box waiting list sort type.
[out]None
Return values:
E_CREATE_FAILCreate mailbox fail.
othersCreate mailbox successful.
Description

This function is called to create a mailbox.

Note:

Definition at line 36 of file mbox.c.

OS_MMID CoCreateMemPartition ( U8 *  memBuf,
U32  blockSize,
U32  blockNum 
)

Create a memory partition.

Parameters:
[in]memBufSpecify memory partition head address.
[in]blockSizeSpecify memory block size.
[in]blockNumSpecify memory block number.
[out]None
Return values:
E_CREATE_FAILCreate memory partition fail.
othersCreate memory partition successful.
Description

This function is called to create a memory partition.

Definition at line 40 of file mm.c.

OS_MutexID CoCreateMutex ( void   )

Create a mutex.

Parameters:
[in]None
[out]None
Return values:
E_CREATE_FAILCreate mutex fail.
othersCreate mutex successful.
Description

This function is called to create a mutex.

Note:

Definition at line 43 of file mutex.c.

OS_EventID CoCreateQueue ( void **  qStart,
U16  size,
U8  sortType 
)

Create a queue.

Parameters:
[in]qStartPointer to mail pointer buffer.
[in]sizeThe length of queue.
[in]sortTypeMail queue waiting list sort type.
[out]None
Return values:
E_CREATE_FAILCreate queue fail.
othersCreate queue successful.
Description

This function is called to create a queue.

Note:

Definition at line 42 of file queue.c.

OS_EventID CoCreateSem ( U16  initCnt,
U16  maxCnt,
U8  sortType 
)

Create a semaphore.

Parameters:
[in]initCntSemaphore valid counter.
[in]maxCntSemaphore max initialize counter.
[in]sortTypeSemaphore sort type.
[out]None
Return values:
E_CREATE_FAILCreate semaphore fail.
othersCreate semaphore successful.
Description

This function is called to create a semaphore.

Definition at line 36 of file sem.c.

OS_TCID CoCreateTmr ( U8  tmrType,
U32  tmrCnt,
U32  tmrReload,
vFUNCPtr  func 
)

Create a timer.

Parameters:
[in]tmrTypeSpecify timer's type.
[in]tmrCntSpecify timer initial counter value.
[in]tmrReloadSpecify timer reload value.
[in]funcSpecify timer callback function entry.
[out]None
Return values:
E_CREATE_FAILCreate timer fail.
othersCreate timer successful.
Description

This function is called to create a timer.

Definition at line 168 of file timer.c.

StatusType CoDelFlag ( OS_FlagID  id,
U8  opt 
)

Delete a flag.

Parameters:
[in]idFlag ID.
[in]optDelete option.
[out]None
Return values:
E_CALLError call in ISR.
E_INVALID_IDInvalid event ID.
E_TASK_WAITTINGTasks waitting for the event,delete fail.
E_OKEvent deleted successful.
Description

This function is called to delete a event flag.

Note:

Definition at line 84 of file flag.c.

StatusType CoDelMbox ( OS_EventID  id,
U8  opt 
)

Delete a mailbox.

Parameters:
[in]idEvent ID.
[in]optDelete option.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_INVALID_PARAMETERInvalid parameter.
E_TASK_WAITTINGTasks waitting for the event,delete fail.
E_OKEvent deleted successful.
Description

This function is called to delete a mailbox.

Note:

Definition at line 68 of file mbox.c.

StatusType CoDelMemoryPartition ( OS_MMID  mmID )

Delete a memory partition.

Parameters:
[in]mmIDSpecify memory partition that want to delete.
[out]None
Return values:
E_INVALID_IDThe memory partition id passed was invalid,delete fail.
E_OKDelete successful.
Description

This function is called to Delete a memory partition.

Definition at line 105 of file mm.c.

StatusType CoDelQueue ( OS_EventID  id,
U8  opt 
)

Delete a queue.

Parameters:
[in]idEvent ID.
[in]optDelete option.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_INVALID_PARAMETERInvalid parameter.
E_TASK_WAITTINGTasks waitting for the event,delete fail.
E_OKEvent deleted successful.
Description

This function is called to delete a queue.

Note:

Definition at line 102 of file queue.c.

StatusType CoDelSem ( OS_EventID  id,
U8  opt 
)

Delete a semaphore.

Parameters:
[in]idEvent ID which to be deleted.
[in]optDelete option.

  • == OPT_DEL_ANYWAY Delete semaphore always
  • == OPT_DEL_NO_PEND Delete semaphore only when no task pending on.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_INVALID_PARAMETERInvalid parameter.
E_TASK_WAITTINGTasks waitting for the event,delete fail.
E_OKEvent deleted successful.
Description

This function is called to delete a semaphore.

Note:

Definition at line 82 of file sem.c.

StatusType CoDelTask ( OS_TID  taskID )

Delete Task.

Parameters:
[in]taskIDTask ID
[out]None
Return values:
E_INVALID_IDInvalid task ID.
E_PROTECTED_TASKProtected task in OS.
E_OKDelete successful.
Description

This function is called to delete assign task.

Definition at line 946 of file task.c.

StatusType CoDelTmr ( OS_TCID  tmrID )

Delete a timer.

Parameters:
[in]tmrIDSpecify a timer which deleted.
[out]None
Return values:
E_INVALID_IDThe timer id passed was invalid,deleted failure.
E_OKDelete a timer successful.
Description

This function is called to delete a timer which created before.

Definition at line 292 of file timer.c.

void CoEnterISR ( void   )

Enter a ISR.

Enter a ISR

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called to notify OS when enter to an ISR.

Note:
When you call API in ISR,you must call CoEnterISR() before your interrupt handler code,and call CoExitISR() after your handler code and before exiting from ISR.

Definition at line 40 of file core.c.

StatusType CoEnterMutexSection ( OS_MutexID  mutexID )

Enter a critical area.

Parameters:
[in]mutexIDSpecify mutex.
[out]None
Return values:
E_INVALID_IDInvalid mutex id.
E_CALLError call in ISR.
E_OKEnter critical area successful.
Description

This function is called when entering a critical area.

Note:

Definition at line 83 of file mutex.c.

void CoExitISR ( void   )

Exit a ISR.

Exit a ISR

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called when exit from a ISR.

Note:

Definition at line 59 of file core.c.

void CoExitTask ( void   )

Exit Task.

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called to exit current task.

Definition at line 1054 of file task.c.

StatusType CoFreeMemoryBuffer ( OS_MMID  mmID,
void *  buf 
)

Free a memory buffer to memory partition.

Parameters:
[in]mmIDSpecify memory partition.
[in]bufSpecify memory buffer that want to free.
[out]None
Return values:
E_INVALID_IDThe memory partition id passed was invalid.
E_INVALID_PARAMETERThe parameter passed was invalid.
E_OKFree successful.
Description

This function is called to Delete a memory partition.

Definition at line 232 of file mm.c.

OS_TID CoGetCurTaskID ( void   )

Get current task id.

Parameters:
[in]None
[out]None
Return values:
IDof the current task.
Description

This function is called to get current task id.

Definition at line 1116 of file task.c.

U32 CoGetCurTmrCnt ( OS_TCID  tmrID,
StatusType *  perr 
)

Get current counter of specify timer.

Parameters:
[in]tmrIDSpecify timer by ID.
[out]E_INVALID_IDInvalid ID was passed and get counter failure.
[out]E_OKGet current counter successful.
Return values:
Currentcounter of a timer which specify by id.
Description

This function is called to obtain current counter of specify timer.

Definition at line 326 of file timer.c.

U32 CoGetFreeBlockNum ( OS_MMID  mmID,
StatusType *  perr 
)

Get free block number in a memory partition.

Parameters:
[in]mmIDSpecify memory partition.
[out]E_INVALID_IDInvalid ID was passed and get counter failure.
[out]E_OKGet current counter successful.
Return values:
fbNumThe number of free block.
Description

This function is called to get free block number in a memory partition.

Definition at line 145 of file mm.c.

void* CoGetMemoryBuffer ( OS_MMID  mmID )

Get a memory buffer from memory partition.

Parameters:
[in]mmIDSpecify memory partition that want to assign buffer.
[out]None
Return values:
Co_NULLAssign buffer fail.
othersAssign buffer successful,and return the buffer pointer.
Description

This function is called to Delete a memory partition.

Definition at line 189 of file mm.c.

U64 CoGetOSTime ( void   )

Get current ticks.

Parameters:
[in]None
[out]None
Return values:
Returncurrent system tick counter.
Description

This function is called to obtain current system tick counter.

Definition at line 155 of file time.c.

OS_VER CoGetOSVersion ( void   )

Get OS version.

Get OS version value

Parameters:
[in]None
[out]None
Return values:
Thevalue is version of OS mutipled by 100.
Description

This function is used to return the version number of CooCox OS. the return value corresponds to CooCox's version number multiplied by 100. In other words, version 1.02 would be returned as 102.

Definition at line 234 of file core.c.

void CoIdleTask ( void *  pdata )

IDLE task of OS.

Parameters:
[in]pdataThe parameter passed to IDLE task.
[out]None
Return values:
None
Description

This function is system IDLE task code.

Definition at line 31 of file hook.c.

void CoInitOS ( void   )

Initialize OS.

Initialize OS

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called to initialize OS.

Note:
You must call this function first,before any other OS API function
 There is a example for useage of this function,as follows: 
        e.g.                                                             
            ...                   // Your target initial code. 
                
            OsInit();             // Initial OS.                
            CreateTask(...);      // Create tasks.              
            ...
            OsStart();            // Start multitask.

Definition at line 173 of file core.c.

void CoKfree ( void *  memBuf )

Release memory block to kernel heap.

Parameters:
[in]memBufPointer to memory block.
[out]None
Return values:
None
Description

This function is called to release memory block.

Definition at line 182 of file kernelHeap.c.

void* CoKmalloc ( U32  size )

Allocation size bytes of memory block from kernel heap.

Parameters:
[in]sizeLength of menory block.
[out]None
Return values:
Co_NULLAllocate fail.
othersPointer to memory block.
Description

This function is called to allocation size bytes of memory block.

Definition at line 64 of file kernelHeap.c.

StatusType CoLeaveMutexSection ( OS_MutexID  mutexID )

Leave from a critical area.

Parameters:
[in]mutexIDSpecify mutex id.
[out]None
Return values:
E_INVALID_IDInvalid mutex id.
E_CALLError call in ISR.
E_OKExit a critical area successful.
Description

This function must be called when exiting from a critical area.

Note:

Definition at line 198 of file mutex.c.

void* CoPendMail ( OS_EventID  id,
U32  timeout,
StatusType *  perr 
)

Wait for a mailbox.

Parameters:
[in]idEvent ID.
[in]timeoutThe longest time for writting mail.
[out]perrA pointer to error code.
Return values:
Co_NULL
Apointer to mailbox accept.
Description

This function is called to wait a mailbox.

Note:

Definition at line 157 of file mbox.c.

void* CoPendQueueMail ( OS_EventID  id,
U32  timeout,
StatusType *  perr 
)

Pend for a mail.

Parameters:
[in]idEvent ID.
[in]timeoutThe longest time for writting mail.
[out]perrA pointer to error code.
Return values:
Co_NULL
Apointer to mail accept.
Description

This function is called to wait for a mail.

Note:

Definition at line 212 of file queue.c.

StatusType CoPendSem ( OS_EventID  id,
U32  timeout 
)

wait for a semaphore

Parameters:
[in]idEvent ID.
[in]timeoutThe longest time for writting semaphore. 0 0x1~0xff
[out]None
Return values:
E_CALLError call in ISR.
E_INVALID_IDInvalid event ID.
E_TIMEOUTSemaphore was not received within the specified 'timeout' time.
E_OKThe call was successful and your task owns the resource,or the event you are waiting for occurred.
Description

This function is called to waits for a semaphore.

Note:
IF this function is called in ISR,nothing to do and return immediately.

Definition at line 171 of file sem.c.

StatusType CoPostMail ( OS_EventID  id,
void *  pmail 
)

Post a mailbox.

Parameters:
[in]idEvent ID.
[in]pmailPointer to mail that want to send.
[out]None
Return values:
E_INVALID_ID
E_OK
Description

This function is called to post a mail.

Note:

Definition at line 254 of file mbox.c.

StatusType CoPostQueueMail ( OS_EventID  id,
void *  pmail 
)

Post a mail to queue.

Parameters:
[in]idEvent ID.
[in]pmailPointer to mail that want to send.
[out]None
Return values:
E_OK
E_INVALID_ID
E_QUEUE_FULL
Description

This function is called to post a mail to queue.

Note:

Definition at line 316 of file queue.c.

StatusType CoPostSem ( OS_EventID  id )

Post a semaphore.

Parameters:
[in]idid of event control block associated with the desired semaphore.
[out]None
Return values:
E_INVALID_IDParameter id passed was invalid event ID.
E_SEM_FULLSemaphore full.
E_OKSemaphore had post successful.
Description

This function is called to post a semaphore to corresponding event.

Note:

Definition at line 252 of file sem.c.

StatusType CoResetTaskDelayTick ( OS_TID  taskID,
U32  ticks 
)

Reset task delay ticks.

Parameters:
[in]ptcbTask that want to insert into DELAY list.
[in]ticksSpecify system tick number which will delay .
[out]None
Return values:
E_CALLError call in ISR.
E_INVALID_IDInvalid task id.
E_NOT_IN_DELAY_LISTTask not in delay list.
E_OKThe current task was inserted to DELAY list successful,it will delay for specify time.
Description

This function delay specify ticks for current task.

Definition at line 216 of file time.c.

void CoSchedLock ( void   )

Lock schedule.

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called in application code to lock schedule.

Note:

Definition at line 125 of file core.c.

void CoSchedUnlock ( void   )

Unlock schedule.

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called in APP to unlock schedule.

Note:

Definition at line 144 of file core.c.

StatusType CoSetFlag ( OS_FlagID  id )

Set a flag.

Parameters:
[in]idFlag ID.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_OKEvent deleted successful.
Description

This function is called to set a flag.

Note:

Definition at line 499 of file flag.c.

StatusType CoSetPriority ( OS_TID  taskID,
U8  priority 
)

Change task priority.

Parameters:
[in]taskIDSpecify task id.
[in]priorityNew priority.
[out]None
Return values:
E_OKChange priority successful.
E_INVALID_IDInvalid id,change priority fail.
E_PROTECTED_TASKCan't change idle task priority.
Description

This function is called to change priority for a specify task.

Definition at line 575 of file task.c.

StatusType CoSetTmrCnt ( OS_TCID  tmrID,
U32  tmrCnt,
U32  tmrReload 
)

Setting for a specify timer.

Parameters:
[in]tmrIDSpecify timer by ID.
[in]tmrCntSpecify timer counter which need to be set.
[in]tmrReloadSpecify timer reload value which need to be set.
[out]None
Return values:
E_INVALID_IDThe ID passed was invalid,set fail.
E_OKSet timer counter successful.
Description

This function is called to set timer counter and reload value.

Definition at line 359 of file timer.c.

void CoStartOS ( void   )

Start multitask.

Start multitask

Parameters:
[in]None
[out]None
Return values:
None
Description

This function is called to start multitask.After it is called, OS start schedule task by priority or/and time slice.

Note:
This function must be called to start OS when you use CoOS,and must call after CoOsInit().

Definition at line 211 of file core.c.

StatusType CoStartTmr ( OS_TCID  tmrID )

Start counter.

Parameters:
[in]tmrIDSpecify a timer which startted.
[out]None
Return values:
E_INVALID_IDThe timer id passed was invalid,can't start timer
E_OKInsert a timer to timer list and start it successful.
Description

This function is called to make a timer start countering.

Definition at line 216 of file timer.c.

void CoStkOverflowHook ( OS_TID  taskID )

Hook for stack overflow.

Parameters:
[in]taskIDPiont to the task which lead to stack overflow.
[out]None
Return values:
None
Description

This function is a hook for stack overflow.

Definition at line 52 of file hook.c.

StatusType CoStopTmr ( OS_TCID  tmrID )

Stop countering for a spcify timer.

Parameters:
[in]tmrIDSpecify a timer which stopped.
[out]None
Return values:
E_INVALID_IDThe timer id passed was invalid, stop failure.
E_OKStop a timer countering successful.
Description

This function is called to stop a timer from counting.

Definition at line 254 of file timer.c.

StatusType CoSuspendTask ( OS_TID  taskID )

Suspend Task.

Parameters:
[in]taskIDID of task that want to suspend.
[out]None
Return values:
E_OKTask suspend successful.
E_INVALID_IDInvalid event ID.
E_PROTECTED_TASKCan't suspend idle task.
E_ALREADY_IN_WAITINGTask now in waiting state.
Description

This function is called to exit current task.

Definition at line 1137 of file task.c.

StatusType CoTickDelay ( U32  ticks )

Delay current task for specify ticks number.

Parameters:
[in]ticksSpecify system tick number which will delay.
[out]None
Return values:
E_CALLError call in ISR.
E_OKThe current task was insert to DELAY list successful,it will delay specify time.
Description

This function delay specify ticks for current task.

Note:
This function be called in ISR,do nothing and return immediately.

Definition at line 175 of file time.c.

void CoTickToTime ( U32  ticks,
U8 *  hour,
U8 *  minute,
U8 *  sec,
U16 *  millsec 
)

Convert tick number to time.

Parameters:
[in]ticksSpecifies the systerm tick numbers that will be converted.
[out]hourHours which converted.
[out]minuteminutes which converted.
[out]secseconds which converted.
[out]millsecmillseconds which converted.
Return values:
None
Description

This function is called to convert specify ticks to time format.

Definition at line 38 of file utility.c.

StatusType CoTimeDelay ( U8  hour,
U8  minute,
U8  sec,
U16  millsec 
)

Delay current task for detail time.

Parameters:
[in]hourSpecify the number of hours.
[in]minuteSpecify the number of minutes.
[in]secSpecify the number of seconds.
[in]millsecSpecify the number of millseconds.
[out]None
Return values:
E_CALLError call in ISR.
E_INVALID_PARAMETERParameter passed was invalid,delay fail.
E_OKThe current task was inserted to DELAY list successful,it will delay for specify time.
Description

This function delay specify time for current task.

Note:
If this function called in ISR,do nothing and return immediately.

Definition at line 275 of file time.c.

StatusType CoTimeToTick ( U8  hour,
U8  minute,
U8  sec,
U16  millsec,
U32 *  ticks 
)

Convert time to tick.

Parameters:
[in]hourSpecifies the number of hours.
[in]minuteSpecifies the number of minutes.
[in]secSpecifies the number of seconds.
[in]millsecSpecifies the number of millseconds.
[out]ticksTick numbers that converted.
Return values:
E_INVALID_PARAMETERInvalid parameter be passed and convert fail.
E_OKConvert successful.
Description

This function is called to convert specify time to tick number.

Definition at line 71 of file utility.c.

U32 CoWaitForMultipleFlags ( U32  flags,
U8  waitType,
U32  timeout,
StatusType *  perr 
)

WaitForMultipleFlags.

Parameters:
[in]flagsFlags that waiting to active task.
[in]waitTypeFlags wait type.
[in]timeoutThe longest time for writting flag.
[out]perrA pointer to error code.
Return values:
0
springFlag
Description

This function is called to pend a task for waitting multiple flag.

Note:

Definition at line 360 of file flag.c.

StatusType CoWaitForSingleFlag ( OS_FlagID  id,
U32  timeout 
)

WaitForSingleFlag.

Parameters:
[in]idFlag ID.
[in]timeoutThe longest time for writting flag.
[out]None
Return values:
E_CALLError call in ISR.
E_INVALID_IDInvalid event ID.
E_TIMEOUTFlag wasn't received within 'timeout' time.
E_OKThe call was successful and your task owns the Flag, or the event you are waiting for occurred.
Description

This function is called to wait for only one flag, (1) if parameter "timeout" == 0,waiting until flag be set; (2) when "timeout" != 0,if flag was set or wasn't set but timeout occured,the task will exit the waiting list,convert to READY or RUNNING state.

Note:

Definition at line 266 of file flag.c.

OS_TID CreateTask ( FUNCPtr  task,
void *  argv,
U32  parameter,
OS_STK *  stk 
)

Create a task.

Parameters:
[in]taskTask code entry.
[in]argvThe parameter passed to task.
[in]parameterTask priority + stack size + time slice + isWaitting.
[in]stkPointer to stack top of task.
[out]None
Return values:
E_CREATE_FAILFail to create a task .
othersValid task id.
Description

This function is called by application to create a task,return a id to mark this task.

Definition at line 822 of file task.c.

StatusType isr_PostMail ( OS_EventID  id,
void *  pmail 
)

Post a mailbox in ISR.

Parameters:
[in]idEvent ID.
[in]pmailPointer to mail that want to send.
[out]None
Return values:
E_INVALID_ID
E_OK
Description

This function is called to post a mail in ISR.

Note:

Definition at line 302 of file mbox.c.

StatusType isr_PostQueueMail ( OS_EventID  id,
void *  pmail 
)

Post a mail to queue in ISR.

Parameters:
[in]idEvent ID.
[in]pmailPointer to mail that want to send.
[out]None
Return values:
E_OK
E_INVALID_ID
E_QUEUE_FULL
Description

This function is called in ISR to post a mail to queue.

Note:

Definition at line 372 of file queue.c.

StatusType isr_PostSem ( OS_EventID  id )

Post a semaphore in ISR.

Parameters:
[in]ididentifier of event control block associated with the desired semaphore.
[out]None
Return values:
E_INVALID_IDParameter id passed was invalid event ID.
E_NO_TASK_WAITTINGThere are one more tasks waitting for the event.
E_OKSemaphore had signaled successful.
Description

This function is called in ISR to post a semaphore to corresponding event.

Note:

Definition at line 301 of file sem.c.

StatusType isr_SetFlag ( OS_FlagID  id )

Set a flag in ISR.

Parameters:
[in]idFlag ID.
[out]None
Return values:
E_INVALID_IDInvalid event ID.
E_OKEvent deleted successful.
Description

This function is called in ISR to set a flag.

Note:

Definition at line 575 of file flag.c.