CooCox 1.1.4 on mbed with simple blinky example

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

flag.c File Reference

flag.c File Reference

Flag management implementation code of coocox CoOS kernel. More...

Go to the source code of this file.

Functions

static void FlagBlock (P_FLAG_NODE pnode, U32 flags, U8 waitType)
 Block a task to wait a flag event.
static P_FLAG_NODE RemoveFromLink (P_FLAG_NODE pnode)
 Remove a flag node from list.
OS_FlagID CoCreateFlag (BOOL bAutoReset, BOOL bInitialState)
 Create a flag.
StatusType CoDelFlag (OS_FlagID id, U8 opt)
 Delete a flag.
StatusType CoAcceptSingleFlag (OS_FlagID id)
 AcceptSingleFlag.
U32 CoAcceptMultipleFlags (U32 flags, U8 waitType, StatusType *perr)
 AcceptMultipleFlags.
StatusType CoWaitForSingleFlag (OS_FlagID id, U32 timeout)
 WaitForSingleFlag.
U32 CoWaitForMultipleFlags (U32 flags, U8 waitType, U32 timeout, StatusType *perr)
 WaitForMultipleFlags.
StatusType CoClearFlag (OS_FlagID id)
 Clear a Flag.
StatusType CoSetFlag (OS_FlagID id)
 Set a flag.
StatusType isr_SetFlag (OS_FlagID id)
 Set a flag in ISR.
void RemoveLinkNode (P_FLAG_NODE pnode)
 Remove a flag node from list.

Variables

FCB FlagCrl = {0}

Detailed Description

Flag management implementation code of coocox CoOS kernel.

Version:
V1.1.4
Date:
2011.04.20

INTERNAL FILE,DON'T PUBLIC.

© COPYRIGHT 2009 CooCox

Definition in file flag.c.


Function Documentation

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.

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 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.

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 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.

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.

static void FlagBlock ( P_FLAG_NODE  pnode,
U32  flags,
U8  waitType 
) [static]

Block a task to wait a flag event.

Parameters:
[in]pnodeA node that will link into flag waiting list.
[in]flagsFlag(s) that the node waiting for.
[in]waitTypeWaiting type of the node.
[out]None
Return values:
None
Description

This function is called to block a task to wait a flag event.

Note:

Definition at line 610 of file flag.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.

static P_FLAG_NODE RemoveFromLink ( P_FLAG_NODE  pnode ) [static]

Remove a flag node from list.

Parameters:
[in]pnodeA node that will remove from flag waiting list.
[out]None
Return values:
pnodeNext node of the node that have removed out.
Description

This function is called to remove a flag node from the wait list.

Note:

Definition at line 648 of file flag.c.

void RemoveLinkNode ( P_FLAG_NODE  pnode )

Remove a flag node from list.

Parameters:
[in]pnodeA node that will remove from flag waiting list.
[out]None
Return values:
None
Description

This function is called to remove a flag node from the wait list.

Note:

Definition at line 686 of file flag.c.


Variable Documentation

FCB FlagCrl = {0}

Flags list struct

Definition at line 24 of file flag.c.