Users Guide: Network Microcontroller Supplement User Manual

High-Speed Microcontroller Users
Guide: Network Microcontroller
Supplement
208
task_signal
Description: int task_signal(
int id, /* id of task to send signal */
int eventmask); /* eventmask containing event(s) to signal */
The task_signal function signals a task. This function sends event(s) in eventmask to a task. If the task is waiting for no other
events, it wakes up and is electable to be run by the task switcher
. ID 0 means current task. This function returns a
success/failure code in the accumulator (ACC). It wakes up tasks that have been suspended by task_suspend().
TASK SCHEDULER USER HOOKS
To allow the user to expand upon implemented task scheduler, i.e., to save and restore additional properties of a task, the task sched-
uler calls hook functions. The user must make sure to preserve all of the parameters passed across the hook function call.
task_create
The task_create function is called when the very first task block is created by task_genesis. The DS80C400 silicon software imple-
mentation of this function does nothing. The parameters automatically passed to task_create by task_genesis are defined as follows.
task_duplicate
The task_duplicate function is called by the task_fork function. The DS80C400 silicon software implementation of this function does
nothing. The parameters automatically passed to task_duplicate by task_fork are defined as follows.
task_destroy
The task_destroy function is called when a task is destroyed by task_kill. The DS80C400 silicon software implementation of this func-
tion does nothing. The parameters automatically passed to task_destroy by task_kill are defined as follows.
rom_task_switch_in
The rom_task_switch_in function is called by the scheduler before a task is switched in. The DS80C400 silicon software implemen-
tation of this function r
estores the state buffer (stack and SFRs). This function is exported by the DS80C400 silicon software and also
serves as the default taskswitchin in the function redirect table.
Note: This function does not return. However, it returns to the caller of rom_task_switch_out with ACC = 0. The parameters passed
to rom_task_switch_in are defined as follows.
INPUT DESCRIPTION OUTPUT DESCRIPTION
DPTR0 TCB of task to be switched in User-defined
INPUT DESCRIPTION OUTPUT DESCRIPTION
DPTR0 TCB of task to be removed User-defined
INPUT DESCRIPTION OUTPUT DESCRIPTION
R1: R0
R7
DPTR0
savesize
priority
Newly allocated TCB
User-defined
INPUT DESCRIPTION OUTPUT DESCRIPTION
R1: R0
DPTR0
savesize
Newly allocated TCB
User-defined
INPUT DESCRIPTION OUTPUT DESCRIPTION
ACC
B
id
eventmask
ACC
Success (= 00h) or failure code
Example: MOV A, … ;regular sleep for 10 seconds = 10000ms
MOV B, #TASK_USER0 ;user defined event
ROMCALL task_signal
Maxim Integrated