This library contains functions for starting, suspending, killing, and managing tasks using the ROM's process scheduler.
For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.
Go to the source code of this file.
Data Structures | |
| struct | TIME |
| struct | FARPTR |
| struct | TCB |
Defines | |
| #define | ROM400_TASK_VERSION 9 |
| #define | ROM400_SCHED_VERSION ROM400_TASK_VERSION |
| Included for legacy reasons. Please use ROM400_TASK_VERSION instead. | |
| #define | RELOAD_14_746 0xfb33 |
| #define | RELOAD_18_432 0xfa00 |
| #define | RELOAD_29_491 0xfd99 |
| #define | RELOAD_36_864 0xfd00 |
| #define | RELOAD_58_982 0xfecc |
| #define | RELOAD_73_728 0xfe80 |
| #define | MIN_PRIORITY 1 |
| #define | NORM_PRIORITY 128 |
| #define | MAX_PRIORITY 255 |
| #define | FLAG_SLEEPING 1 |
| #define | FLAG_IO_WAIT 2 |
| #define | FLAG_DHCP_WAIT 4 |
| #define | FLAG_USER0 8 |
| #define | FLAG_USER1 0x10 |
| #define | FLAG_USER2 0x20 |
| #define | FLAG_USER3 0x40 |
| #define | FLAG_USER4 0x80 |
| #define | ROM_SAVESIZE 384 |
Functions | |
| void | task_genesis (unsigned int savesize) |
| Initializes the process scheduler. | |
| unsigned char | task_getcurrent (void) |
| Gets the process ID for the current task. | |
| unsigned char | task_getpriority (unsigned char task_id) |
| Gets the priority level for the given task. | |
| unsigned char | task_setpriority (unsigned char task_id, unsigned char priority) |
| Sets the priority level for a given task. | |
| unsigned int | task_fork (unsigned char priority, unsigned int savesize) |
| Creates a new task. | |
| unsigned char | task_kill (unsigned char task_id) |
| Kills the specified task. | |
| unsigned char | task_suspend (unsigned char task_id, unsigned char event_mask) |
| Suspends the specified task. | |
| unsigned char | task_wait (unsigned char task_id, unsigned char event_mask, long millis) |
| Puts the specified task to sleep. | |
| unsigned char | task_signal (unsigned char task_id, unsigned char event_mask) |
| Posts events to the specified task. | |
| void | task_gettimemillis (struct TIME *t) |
| Returns the system tick count. | |
| unsigned char | task_getthreadid () |
| Redirected function to return the current thread's ID number. | |
| unsigned char | task_threadresume (unsigned char thread, unsigned char task) |
| Redirected function to resume the specified thread. | |
| unsigned char | task_threadiosleep (unsigned char infinite, unsigned long timeout) |
| Redirected function to put the current thread to sleep. | |
| unsigned char | task_threadiosleepnc (unsigned char infinite, unsigned long timeout) |
| Redirected function to put the current thread (which is already in a critical section) to sleep. | |
| void | task_threadsave (void) |
| Redirected function to save the state of the current thread in anticipation of a task/thread swap. | |
| void | task_threadrestore (void) |
| Redirected function to restore the state of a thread. | |
| unsigned char | task_sleep (unsigned char task, long timeout) |
| Redirected function to put a specified task to sleep for a number of milliseconds. | |
| unsigned char | task_gettaskid () |
| Redirected function to get the ID of the current task. | |
| void | task_entercritsection (void) |
| Enters a critical section. | |
| void | task_leavecritsection (void) |
| Leaves a critical section. | |
| unsigned int | task_gettickreload (void) |
| Gets the current reload value for the system's millisecond ticker. | |
| void | task_settickreload (unsigned int reload) |
| Sets the current reload value for the system's millisecond ticker. | |
| unsigned int | task_version (void) |
| Returns the version number of this process scheduling library. | |
| void xdata * | task_reentrant_stack (unsigned int size) |
| Rerserves space on the reentrant stack. | |
|
|
Event flag for putting a task to sleep. Reserved by the system.
|
|
|
Event flag for putting a task to sleep. Reserved by the system.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Event flag for putting a task to sleep.
|
|
|
Maximum priority level assignable to a task.
|
|
|
Minimum priority level assignable to a task.
|
|
|
Normal priority for a task. This is the default priority for the default task.
|
|
|
Timer reload value for 14.746 MHz crystal.
|
|
|
Timer reload value for 18.432 MHz crystal.
|
|
|
Timer reload value for 29.491 MHz crystal.
|
|
|
Timer reload value for 36.864 MHz crystal.
|
|
|
Timer reload value for 58.982 MHz crystal.
|
|
|
Timer reload value for 73.728 MHz crystal.
|
|
|
Version number associated with this header file. Should be the same as the version number returned by the task_version function.
|
|
|
Default size for task switching buffer.
|
|
|
Enters a critical section. Enters a critical section, which disallows process swapping until the critical section is left. Calls to task_entercritsection should be balanced with calls to task_leavecritsection (or task_threadiosleepnc). This function is safe to be called from multiple processes at the same time. NOTE: An application should not stay in a critical section for extended periods of time. 100-200us should be considered the maximum time.
|
|
||||||||||||
|
Creates a new task. Spawns a new task, returning the process ID of the new task to the parent task. Note that because of the way the Keil compiler assigns variables, calls to task_fork should be wrapped inside a critical section. Make sure the child's process ID is stored in a secure location before exiting the critical section. Note that only the parent need leave the critical section, the child will not run until the parent has left it. This function is safe to be called from multiple processes at the same time.
|
|
|
Initializes the process scheduler. Note that calling the function init_rom from the initialization library is the preferred way of initializing the ROM. This function is safe to be called from multiple processes at the same time.
|
|
|
Gets the process ID for the current task. Returns the process ID for the current task, which can be used to manage that task. This function is safe to be called from multiple processes at the same time.
|
|
|
Gets the priority level for the given task. Given the process ID of a task, return the priority level for that task. Use a task_id of 0 for the current task. This function is safe to be called from multiple processes at the same time.
|
|
|
Redirected function to get the ID of the current task. This is a redirected function that should be used to get the process ID of the current task. The default implementation of this function calls the function task_getcurrent. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf This function is safe to be called from multiple processes at the same time.
|
|
|
Redirected function to return the current thread's ID number. This is a redirected function that should be used to retrieve the current thread's ID number. However, the DS80C400 ROM does not support threads, so the default implementation of this function always returns 0x01. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf. This function is safe to be called from multiple processes at the same time.
|
|
|
Gets the current reload value for the system's millisecond ticker. Gets the current reload value for the system's millisecond ticker. When initialized, this reload value may not be correct for the system, and calls to task_gettimemillis may show the resulting inaccuracy (for example, wall time may record 10 seconds while the DS80C400 thinks 12 seconds have passes). Use this function to verify the system's current system millisecond ticker reload value. This function is safe to be called from multiple processes at the same time.
|
|
|
Returns the system tick count. The default implementation of this function returns the approximate number of milliseconds since the system started. Note that the largest raw data structure supported by Keil is 4 bytes, yet the DS80C400's tick counter is 5 bytes, therefore the special TIME structure is used. This is a redirected function. The ROM includes a default process scheduler implementation. See the DS80C400 User's Guide for information on replacing the default process scheduler with your own. This function is safe to be called from multiple processes at the same time.
|
|
|
Kills the specified task. Kill the specified task. Use a task_id of 0 to indicate the current task. This function does not close or clean up any sockets. Use the socket library function cleanup to clean any sockets owned by the task before any more processes are created. This function is safe to be called from multiple processes at the same time.
|
|
|
Leaves a critical section. Leaves a critical section, which allows process swapping to continue. Calls to task_leavecritsection should have a matching call to task_entercritsection. This function is safe to be called from multiple processes at the same time. NOTE: An application should not stay in a critical section for extended periods of time. 100-200us should be considered the maximum time.
|
|
|
Rerserves space on the reentrant stack. This function reserves the specified amount of space on the reentrant stack. Any task that uses functions declared "reentrant" MUST call task_reentrant_stack. Note that space on the reentrant stack is NOT freed when a task is killed. An function called from an interrupt uses the reentrant stack of the foreground process. Note that the reentrant stack is part of XDATA. You can adjust the top of the reentrant stack in startup400.a51.
|
|
||||||||||||
|
Sets the priority level for a given task. Given the process ID of a task, set the priority level for that task. Use a task_id of 0 for the current task. This function is safe to be called from multiple processes at the same time.
|
|
|
Sets the current reload value for the system's millisecond ticker. Sets the current reload value for the system's millisecond ticker. When initialized, this reload value may not be correct for the system, and calls to task_gettimemillis may show the resulting inaccuracy (for example, wall time may record 10 seconds while the DS80C400 thinks 12 seconds have passes). Use this function to set the system's current system millisecond ticker reload value. This function is safe to be called from multiple processes at the same time. This function should only be called after init_rom has been called. If you do not have a 1-Wire device attached for MAC address storage, you should call init_setclock or init_setfrequency before calling init_rom to initialize the system with a good clock reload value.
|
|
||||||||||||
|
Posts events to the specified task. Sends the event(s) in event_mask to process task_id. If the task is waiting for no other events, it will wake up and be electable to run by the task scheduler. Use the event flags FLAG_USER0 through FLAG_USER4 or a bitwise OR of these flags. For tasks suspended in task_wait, FLAG_SLEEPING should also be specified, otherwise the task will sleep until the sleep time has elapsed. FLAG_SLEEPING can also be posted to prematurely wake a task suspended in task_sleep. This function is safe to be called from multiple processes at the same time.
|
|
||||||||||||
|
Redirected function to put a specified task to sleep for a number of milliseconds. This is a redirected function that should be used to put a task to sleep for some known period of time. The default implementation of this function calls the function task_wait. The task can be woken up prematurely using task_signal. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf This function is safe to be called from multiple processes at the same time.
|
|
||||||||||||
|
Suspends the specified task. Suspends the execution of the specified task until all specified events have occurred. Use the function task_signal to wake the task up. Use the event flags FLAG_USER0 through FLAG_USER4 or a bitwise OR of these flags only, all other bits are system reserved. This function is safe to be called from multiple processes at the same time.
|
|
||||||||||||
|
Redirected function to put the current thread to sleep. This is a redirected function that should be used to put a thread to sleep. However, the DS80C400 does not support threads, so the default implementation of this function puts the current task to sleep. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
|
|
||||||||||||
|
Redirected function to put the current thread (which is already in a critical section) to sleep. This is a redirected function that should be used to put a thread to sleep, when the thread has already entered a critical section. However, the DS80C400 does not support threads, so the default implementation of this function puts the current task to sleep (which is assumed to be operating within a critical section). For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
|
|
|
Redirected function to restore the state of a thread. This is a redirected function that should be used to restore the state of a thread that was earlier saved with a call to task_threadsave. However, the DS80C400 does not support threads, so the default implementation of this function does nothing. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf This function is safe to be called from multiple processes at the same time.
|
|
||||||||||||
|
Redirected function to resume the specified thread. This is a redirected function that should be used to resume a suspended or sleeping thread. However, the DS80C400 ROM does not support threads, so the default implementation of this function resumes the task with a process ID matching task. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf This function is safe to be called from multiple processes at the same time.
|
|
|
Redirected function to save the state of the current thread in anticipation of a task/thread swap. This is a redirected function that should be used to save the state of the current thread so it may be executed again later, after a call to task_threadrestore. However, the DS80C400 does not support threads, so the default implementation of this function does nothing. For more information on redirected functions, see the section ROM Redirect Function Table in the DS80C400 User's Guide at http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf This function is safe to be called from multiple processes at the same time.
|
|
|
Returns the version number of this process scheduling library. This function is safe to be called from multiple processes at the same time.
|
|
||||||||||||||||
|
Puts the specified task to sleep. Suspends the execution of the specified task until all specified events have occurred, and/or until a set amount of time has elapsed. When calling task_wait, use the event flags FLAG_USER0 through FLAG_USER4 or a bitwise OR of these flags only, all other bits are system reserved. Use the function task_signal to wake the task up. To properly wake a task, specify FLAG_SLEEPING in the call to task_signal as well as the user event flag(s). This function is safe to be called from multiple processes at the same time.
|
| Copyright 2005 Dallas Semiconductor, Inc.. | Documentation generated by Doxygen. |