📄 rom400_task.h
字号:
* \param task_id Task PID to signal.
* \param event_mask Bitmap of events to signal
*
* \return 0 for Success, non-zero for failure
*
* \sa #task_sleep
* \sa #task_suspend
*/
//---------------------------------------------------------------------------
unsigned char task_signal(unsigned char task_id, unsigned char event_mask);
/**
* \brief 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 <i>#TIME</i> structure
* is used.
*
* This is a redirected function. The ROM includes a default
* process scheduler implementation. See the
* <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
* DS80C400 User's Guide</a> 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.
*
* \param t pointer to a structure of type #TIME (a 5-byte structure). The
* result is written to this pointer, MSB first.
*
* \sa #TIME
*/
//---------------------------------------------------------------------------
void task_gettimemillis(struct TIME* t);
/**
* \brief 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 <i>ROM Redirect
* Function Table</i> 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.
*
* \return default implementation returns 0x01
*/
//---------------------------------------------------------------------------
unsigned char task_getthreadid();
/**
* \brief 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 <i>task</i>.
*
* For more information on redirected functions, see the section <i>ROM Redirect
* Function Table</i> 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.
*
* \param thread thread ID to resume
* \param task ID of the process that <i>thread</i> belongs to
*
* \return 0 for Success, non-zero for failure
*
* \sa #task_threadiosleep
* \sa #task_threadiosleepnc
*/
//---------------------------------------------------------------------------
unsigned char task_threadresume(unsigned char thread, unsigned char task);
/**
* \brief 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 <i>ROM Redirect
* Function Table</i> in the DS80C400 User's Guide at
* http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
*
* \warning This function is not multi-process safe. If two processes
* try to call this function at the same time, its parameters
* may be destroyed, yielding unpredictable results.
*
* \param infinite 0 for non-infinite timeout, non-zero for infinite timeout (until woken)
* \param timeout amount of time to sleep (if infinite==0)
*
* \return 0 for Success, non-zero for failure
*
* \sa #task_threadiosleepnc
* \sa #task_threadresume
*/
//---------------------------------------------------------------------------
unsigned char task_threadiosleep(unsigned char infinite, unsigned long timeout);
/**
* \brief 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 <i>ROM Redirect
* Function Table</i> in the DS80C400 User's Guide at
* http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
*
* \warning This function is not multi-process safe. If two processes
* try to call this function at the same time, its parameters
* may be destroyed, yielding unpredictable results.
*
* \param infinite 0 for non-infinite timeout, non-zero for infinite timeout (until woken)
* \param timeout amount of tuime to sleep (if infinite==0)
*
* \return 0 for Success, non-zero for failure
*
* \sa #task_threadiosleep
* \sa #task_threadresume
* \sa #task_entercritsection
*/
//---------------------------------------------------------------------------
unsigned char task_threadiosleepnc(unsigned char infinite, unsigned long timeout);
/**
* \brief 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
* <i>#task_threadrestore</i>. 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 <i>ROM Redirect
* Function Table</i> 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.
*
* \sa #task_threadrestore
*/
//---------------------------------------------------------------------------
void task_threadsave(void);
/**
* \brief 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 <i>#task_threadsave</i>. 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 <i>ROM Redirect
* Function Table</i> 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.
*
* \sa #task_threadsave
*/
//---------------------------------------------------------------------------
void task_threadrestore(void);
/**
* \brief 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 <i>#task_wait</i>.
*
* For more information on redirected functions, see the section <i>ROM Redirect
* Function Table</i> in the DS80C400 User's Guide at
* http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
*
* This "function" is now multi-process safe. If two processes try to call
* this function at the same time, its parameters will not be destroyed.
* This "function" is now a macro that actually calls <i>#task_synch_sleep</i>.
*
* \param task task ID to put to sleep. A value of zero means put the current
* task to sleep.
* \param timeout amount of time to put 'task' to sleep for
*
* \sa #task_wait
* \sa #task_synch_wait
* \sa #task_synch_sleep
*/
//---------------------------------------------------------------------------
#define task_sleep(task,timeout) task_synch_sleep(((long)(timeout))>>16,(timeout),(task));
//unsigned char task_sleep(unsigned char task, unsigned long timeout);
/**
* \brief 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 <i>#task_wait</i>.
*
* For more information on redirected functions, see the section <i>ROM Redirect
* Function Table</i> in the DS80C400 User's Guide at
* http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf
*
* This function <b>IS</b> multi-process safe. Two processes may safely
* call this function at the same time.
*
* \param timeout_h high 16 bits of amount of time to put 'task' to sleep for
* \param timeout_l low 16 bits of amount of time to put 'task' to sleep for
* \param task task ID to put to sleep. A value of zero means put the current
* task to sleep.
*
* \sa #task_wait
* \sa #task_synch_wait
* \sa #task_sleep
*/
//---------------------------------------------------------------------------
unsigned char task_synch_sleep(unsigned int timeout_h, unsigned int timeout_l, unsigned char task);
/**
* \brief 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 <i>#task_getcurrent</i>.
*
* For more information on redirected functions, see the section <i>ROM Redirect
* Function Table</i> 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.
*
* \return Task Id of the current task.
*
* \sa #task_getcurrent
*/
//---------------------------------------------------------------------------
unsigned char task_gettaskid();
/**
* \brief Enters a critical section.
*
* Enters a critical section, which disallows process swapping until the
* critical section is left. Calls to <i>#task_entercritsection</i> should be
* balanced with calls to <i>#task_leavecritsection</i> (or <i>#task_threadiosleepnc</i>).
*
* This function is safe to be called from multiple processes at the same
* time.
*
* \sa #task_leavecritsection
* \sa #task_threadiosleepnc
*/
//---------------------------------------------------------------------------
void task_entercritsection(void);
/**
* \brief Leaves a critical section.
*
* Leaves a critical section, which allows process swapping to continue.
* Calls to <i>#task_leavecritsection</i> should have a matching call to
* <i>#task_entercritsection</i>.
*
* This function is safe to be called from multiple processes at the same
* time.
*
* \sa #task_entercritsection
* \sa #task_threadiosleepnc
*/
//---------------------------------------------------------------------------
void task_leavecritsection(void);
/**
* \brief 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 <i>#task_gettimemillis</i> 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.
*
* \sa #task_settickreload
* \sa #task_gettimemillis
*/
//---------------------------------------------------------------------------
unsigned int task_gettickreload(void);
/**
* \brief 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 <i>#task_gettimemillis</i> 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 <i>#init_rom</i> has
* been called. If you do not have a 1-Wire device attached for MAC address
* storage, you should call <i>#init_setclock</i> or <i>#init_setfrequency</i>
* before calling <i>#init_rom</i> to initialize the system with a good clock
* reload value.
*
* \param reload New value for the system's millisecond reload timer.
* Some reloads for common crystal frequencies include
* #RELOAD_14_746, #RELOAD_18_432, #RELOAD_29_491,
* #RELOAD_36_864, #RELOAD_58_982, and #RELOAD_73_728.
* Values for other crystals (and crystal settings) can
* also be used. See the <a
* href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
* High Speed Microcontroller's User Guide</a> for more
* information on timers and timer settings.
*
* \sa #init_setclock
* \sa #init_setfrequency
* \sa #task_gettickreload
* \sa #task_gettimemillis
*/
//---------------------------------------------------------------------------
void task_settickreload(unsigned int reload);
/**
* \brief Returns the version number of this process scheduling library.
*
* This function is safe to be called from multiple processes at the same
* time.
*
* \return Version number of this TASK library.
*/
//---------------------------------------------------------------------------
unsigned int task_version(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -