Task scheduler functions – Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 205

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

205

tftp_next

Description:

int tftp_next(

int ack_only);

/* flag to signal when ack_only should be sent */

The

tftp_next function acknowledges a TFTP data block and waits for data. tftp_next(0) returns subsequent data blocks (until

the returned length is less than 512). Use ack_only <>0 (i.e.,

tftp_next(1)) to acknowledge the last data block without waiting

for additional data.

tftp_close

Description:

int tftp_close(void);

This function closes a tftp socket allocated by

tftp_first(). tftp_close(). It frees the socket handle allocated by tftp_first() and

should be called when a tftp data transfer has finished (or when a tftp data transfer has failed).

TASK SCHEDULER FUNCTIONS

task_genesis

Description:

void task_genesis(

int savesize);

/* buffer of savesize allocated to hold task state */

The

task_genesis function sets up primordial and idle threads. This function creates the running task list and assigns the task

ID 1 to the current flow of execution. It calls

malloc to allocate a buffer of savesize, which is used to save and restore the task

state.

Note: This function does not change or enable the timer interrupt. Interrupt handlers must be installed and

corresponding interrupts must be enabled before calling this function.

task_getcurrent

Description:

int task_getcurrent(void);

The

task_getcurrent function returns the current task’s ID.

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

Task ID

Example:

ROMCALL task_getcurrent

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

R1:R0

savesize

Example:

MOV R1, #high(SAVESIZE)

MOV R0, #low(SAVESIZE)

ROMCALL task_genesis

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

return value (=0 for success)

Example:

ROMCALL

tftp_close

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

ack_only

ACC

R1:R0

Return value (= 0 for success)

#bytes read

Example:

MOV A, #0h

ROMCALL tftp_next

Maxim Integrated

Advertising