Search Code
About CoOS

Published 03 Dec 2010.

Last change message: Some basic LED-Flashing works in the CoOS-RTOS using Tasks

Import this program

CoOS

Published 03 Dec 2010, by   user Eric Ebert   tag CoOS, rtos
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.

Defines

#define OPT_WAIT_ALL   0
#define OPT_WAIT_ANY   1
#define OPT_WAIT_ONE   2
#define OPT_DEL_NO_PEND   0
#define OPT_DEL_ANYWAY   1

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.
OS_TID CreateTask (FUNCPtr task, void *argv, U32 parameter, OS_STK *stk)
 Create a task.
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.3
Date:
2010.04.26

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

INTERNAL FILE,DON'T PUBLIC.

© COPYRIGHT 2009 CooCox

Definition in file CoOS.h.


Define Documentation

#define OPT_DEL_ANYWAY   1

Delete always.

Definition at line 89 of file CoOS.h.

#define OPT_DEL_NO_PEND   0

Delete when no task waitting for

Definition at line 88 of file CoOS.h.

#define OPT_WAIT_ALL   0

Wait for all flags.

Definition at line 82 of file CoOS.h.

#define OPT_WAIT_ANY   1

Wait for any one of flags.

Definition at line 83 of file CoOS.h.

#define OPT_WAIT_ONE   2

Waot for one flag.

Definition at line 84 of file CoOS.h.


Function Documentation

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

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.

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.

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.

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

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.

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.

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.