Coma FW-C2800 User's Guide Page 152

  • Download
  • Add to my manuals
  • Print
  • Page
    / 276
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 151
Tasks
Thread Scheduling 4-47
Two functions, TSK_checkstacks, and TSK_stat, can be used to watch stack
size. The structure returned by TSK_stat contains both the size of its stack
and the maximum number of MADUs ever used on its stack, so this code
segment could be used to warn of a nearly full stack:
TSK_Stat statbuf; /* declare buffer */
TSK_stat(TSK_self(), &statbuf); /* call func to get status */
if (statbuf.used > (statbuf.attrs.stacksize * 9 / 10)) {
LOG_printf(&trace, "Over 90% of task's stack is in use.\n")
}
See the TSK_stat and TSK_checkstacks sections in the TMS320 DSP/BIOS
API Reference Guide for your platform, for a description and examples of
their use.
4.4.4 Task Hooks
An application may specify functions to be called for various task-related
events. Such functions are called hook functions. Hook functions can be
called for program initialization, task creation (TSK_create), task deletion
(TSK_delete), task exits (TSK_exit), task readying, and task context switches
(TSK_sleep, SEM_pend, etc.). Such functions can be used to extend a task’s
context beyond the basic processor register set.
A single set of hook functions can be specified for the TSK module manager.
To create additional sets of hook functions, use the HOOK module. For
example, an application that integrates third-party software may need to
perform both its own hook functions and the hook functions required by the
third-party software. In addition, each HOOK object can maintain a private
data environment for each task.
When you create the initial HOOK object with the Configuration Tool, any TSK
module hook functions you have specified are automatically placed in a
HOOK object called HOOK_KNL. To set any properties of this object other
than the Initialization function, use the TSK module properties. To set the
Initialization function property of the HOOK_KNL object, use the HOOK
object properties. If you configure only a single set of hook functions using the
TSK module, the HOOK module is not used.
Functions written in C must be specified with a leading underscore ( _ ) in the
Configuration Tool.
For details about hook functions, see the TSK Module and HOOK Module
topics in the TMS320 DSP/BIOS API Reference Guide for your platform.
Page view 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 275 276

Comments to this Manuals

No comments