Published 03 Dec 2010, by
Eric Ebert
CoOS,
rtos
task management implementation code of CooCox CoOS kernel.
More...
Go to the source code of this file.
Detailed Description
task management implementation code of CooCox CoOS kernel.
- Version:
- V1.1.3
- Date:
- 2010.04.26
INTERNAL FILE,DON'T PUBLIC.
© COPYRIGHT 2009 CooCox
Definition in file task.c.
Function Documentation
| void ActiveTaskPri |
( |
U8 |
pri ) |
|
Active priority in queue.
- Parameters:
-
| [in] | pri | Task priority |
| [in] | None | |
| [out] | None | |
- Return values:
-
- Description
This function is called in Binary-Scheduling Algorithm to active priority in queue, if this priority had been in activation, increate the task num for this priority.
Definition at line 296 of file task.c.
| static P_OSTCB AssignTCB |
( |
void |
) |
[static] |
Assign a TCB to task being created.
- Parameters:
-
- Return values:
-
- Description
This function is called to assign a task control block for task being created.
Definition at line 788 of file task.c.
| StatusType CoActivateTask |
( |
OS_TID |
taskID, |
|
|
void * |
argv |
|
) |
| |
Activate Task.
- Parameters:
-
| [in] | taskID | Task ID |
| [in] | argv | Task argv |
| [out] | None | |
- Return values:
-
| E_INVALID_ID | Invalid task ID. |
| E_OK | Activate 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] | taskID | Task ID |
| [out] | None | |
- Return values:
-
| E_INVALID_ID | Invalid task ID. |
| E_PROTECTED_TASK | Protected task in OS. |
| E_OK | Delete successful. |
- Description
This function is called to delete assign task.
Definition at line 946 of file task.c.
Exit Task.
- Parameters:
-
- Return values:
-
- 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:
-
- Return values:
-
- Description
This function is called to get current task id.
Definition at line 1116 of file task.c.
| OS_TID CreateTask |
( |
FUNCPtr |
task, |
|
|
void * |
argv, |
|
|
U32 |
parameter, |
|
|
OS_STK * |
stk |
|
) |
| |
Create a task.
- Parameters:
-
| [in] | task | Task code entry. |
| [in] | argv | The parameter passed to task. |
| [in] | parameter | Task priority + stack size + time slice + isWaitting. |
| [in] | stk | Pointer to stack top of task. |
| [out] | None | |
- Return values:
-
| E_CREATE_FAIL | Fail to create a task . |
| others | Valid 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.
| void CreateTCBList |
( |
void |
) |
|
Create a TCB list.
- Parameters:
-
- Return values:
-
- Description
This function is called by CoOSInit() to initial the empty list of OS_TCBS,supply a pointer to free TCB.
Definition at line 55 of file task.c.
| void DeleteTaskPri |
( |
U8 |
pri ) |
|
Delete priority in queue.
- Parameters:
-
| [in] | pri | Task priority |
| [in] | None | |
| [out] | None | |
- Return values:
-
- Description
This function is called in Binary-Scheduling Algorithm to decrease the task num for this priority, if the num goto 0, remove the priority for queue.
Definition at line 335 of file task.c.
| static BOOL GetPrioSeqNumStatus |
( |
U8 |
seqNum ) |
[static] |
Get the ready status for assign sequence number.
- Parameters:
-
| [in] | seqNum | Assign sequence number |
| [out] | None | |
- Return values:
-
| TRUE | This priority has ready task FALSE This priority doesn't have ready task |
- Description
This function is called in Binary-Scheduling Algorithm to get the ready status for assign sequence number.
Definition at line 249 of file task.c.
| static BOOL GetPriSeqNum |
( |
U8 |
pri, |
|
|
OS_TID * |
SequenceNum |
|
) |
| [static] |
Get sequence number for Assign priority.
- Parameters:
-
| [in] | pri | Assign priority |
| [out] | SequenceNum | priority number |
- Return values:
-
| TRUE | Assign priority in priority queue. FALSE Assign priority not in priority queue. |
- Description
This function is called in Binary-Scheduling Algorithm to get sequence number for Assign priority.
Definition at line 104 of file task.c.
| static U8 GetRdyPriSeqNum |
( |
U8 |
seqNum ) |
[static] |
Get the nearest ready priority sequence number for Assign number.
- Parameters:
-
| [in] | seqNum | Assign sequence number |
| [out] | None | |
- Return values:
-
| INVALID_ID | Cannot find higher ready priority. Others Nearest ready priority sequence number |
- Description
This function is called in Binary-Scheduling Algorithm to get the nearest ready priority sequence number.
Definition at line 147 of file task.c.
| void InsertToTCBRdyList |
( |
P_OSTCB |
tcbInsert ) |
|
Insert a task to the ready list.
- Parameters:
-
| [in] | tcbInsert | A pointer to task will be inserted. |
| [out] | None | |
- Return values:
-
- Description
This function is called to insert a task to the READY list.
Definition at line 368 of file task.c.
| static void PrioRemap |
( |
OS_TID |
seqNum ) |
[static] |
Remap the ready status of priority queue from Assign sequence number.
- Parameters:
-
| [in] | seqNum | Assign sequence number |
| [out] | None | |
- Return values:
-
- Description
This function is called in Binary-Scheduling Algorithm to Remap the ready status for priority queue.
Definition at line 208 of file task.c.
| void RemoveFromTCBRdyList |
( |
P_OSTCB |
ptcb ) |
|
Remove a task from the READY list.
- Parameters:
-
| [in] | ptcb | A pointer to task which be removed. |
| [out] | None | |
- Return values:
-
- Description
This function is called to remove a task from the READY list.
Definition at line 491 of file task.c.
Schedule function.
- Parameters:
-
- Return values:
-
- Description
This function is called by every where need to switch context, It is schedule function of OS kernel.
Definition at line 710 of file task.c.
| static void SetPrioSeqNumStatus |
( |
U8 |
seqNum, |
|
|
BOOL |
isRdy |
|
) |
| [static] |
Set the ready status for assign sequence number.
- Parameters:
-
| [in] | seqNum | Assign sequence number |
| [in] | isRdy | Ready statues for assign sequence number |
| [out] | None | |
- Return values:
-
- Description
This function is called in Binary-Scheduling Algorithm to set the ready status for assign sequence number.
Definition at line 272 of file task.c.
Variable Documentation
pointer to free TCB
Definition at line 28 of file task.c.
The counter of system tick.
Definition at line 32 of file task.c.
Poniter to task that next scheduled by OS
Definition at line 30 of file task.c.
Pointer to the READY list.
Definition at line 29 of file task.c.
Pointer to TCB that current running task.
Definition at line 31 of file task.c.
< Table use to save TCB pointer. The stack of IDLE task.
Definition at line 23 of file task.c.