Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 207

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

207

task_kill

Description:

int task_kill(

int id);

/* id of the task to be killed */

The

task_kill function kills a task. This function destroys a task and frees its state buffer. ID 0 means current task. It returns a

success/failure code in the accumulator (ACC).

Note: This function does not interact with the socket code. Call the socket

function cleanup() to close all associated sockets.

task_suspend

Description:

int task_suspend(

int id,

/* id of task to be suspended */

int eventmask;

/* eventmask to be satisfied before awakening */

The

task_suspend function suspends a task. It suspends a task until all events in eventmask have been generated. ID 0

means current task. This function returns a success/failure code in the accumulator. Before task suspension, the switch_out()

hook is called. To wake up a task, use task_signal().

task_sleep

Description:

int task_sleep(

int id,

/* id of the task to be put to sleep */

int eventmask;

/* eventmask to be satisfied before awakening */

int milliseconds);

/* number of milliseconds the task must sleep */

The

task_sleep function puts a task to sleep. It suspends a task until at least milliseconds milliseconds have elapsed or the

eventmask has occurred (use eventmask = 0 for regular sleep). ID 0 means current task. Before suspension, the

switch_out()

hook is called. The function returns a success/failure code in the accumulator (ACC).

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

B

R3:R0

id

eventmask

milliseconds

ACC

Success (= 00h) or failure code

Example:

CLR A

MOV B, A ;regular sleep for 10 seconds = 10000ms

MOV R3, #0

MOV R2, #1

MOV R1, #0

MOV R0, #0

ROMCALL task_sleep

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

B

id

eventmask

ACC

Success (= 00h) or failure code

Example:

CLR A

MOV B, #TASK_DHCPSLEEP

ROMCALL task_suspend

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

id

ACC

Success (= 00h) or failure code

Example:

MOV DPTR, #DHCP_TASKID

MOVX A, @DPTR

ROMCALL task_kill

Maxim Integrated

Advertising