Task Definition

This MotoHawk™ block allows a task to be declared.

Block ID

Task Defn

Library

motohawk_tasking_lib/Task Blocks

Description

This MotoHawk™ block allows a task to be declared. Tasks are used to allow the application to prioritize the importance of the work. Work assigned to a task of higher relative priority will execute in preference to work assigned to a lower priority task. Work is assigned to a task via a triggers. The Common Event Trigger block is an example.

The Understanding ControlCore Task Scheduling help topic provides a more indepth discussion on tasking and concepts like pre-emption.

Operation with Default Tasking

An application uses default tasking when the Use Advanced OS Configuration option of the Target Definition is not checked. Default tasking pre-defines a number of tasks that will be used by the MotoHawk™ application. These tasks include:

This block can be used within this default tasking environment, though the name and priority chosen for the task shouldn't match any of the above pre-defined tasks. The higher numbers are a higher priority.

Stand Alone Operation

This block must be used to specify all of the tasks that will exist in the application when a block like the ControlCore OS Definition block is in use. This gives the developer the flexibility to only define the tasks that the application will require. To use a block like the ControlCore OS Definition block will require the Use Advanced OS Configuration option of the Target Definition block to be checked.

Block Parameters

Main

Attributes that need to be defined based upon the functionality of the application that is to execute within the constrains of the ControlCore OS.

Parameter Field Values Comments/Description
Task Name Single quote enclosed alpha numeric The name that will be assigned to the Task that will be created by this block. The assigned name must be C-legal and is used by other blocks to access attributes associated with the task's operation or to associate something like a Common Event Trigger with this task.
Target OS Dropdown Select the target OS that this task is intended to operate under. This will define what other attributes are available for configuration.

An error will result if the selection does not match the target OS selected for the Target
Execution Priority is Dropdown Configures whether the execution priority of this task is defined as an Absolute value or Relative to another task.
Execution Priority Integer Defines the absolute execution priority of the task. Tasks with a higher value will execute in preference to tasks with a lower execution priority. Tasks with a higher value that have work to execute will pre-empt tasks with a lower value. A pre-empted task must wait until all the higher priority work has been completed before it can finish its own work.

Only visible when Execution Priority is Absolute.
Priority Relative to this Task Single quote enclosed alpha numeric The task name of a different task that the execution priority of this task shall be determined from.

Only visible when Execution Priority is Relative.
The Task's Priority is Dropdown Defines whether this task is to have more or less priority that the referenced task.

Only visible when Execution Priority is Relative.
Task is private (worker) Checkbox A task that is designated as private is not able to service triggers like the Common Event Trigger block. Private tasks are typically referenced by specific systems that use the task in a dedicated fashion. It is an error to designate a task as private that is not later referenced by another block within the model. It is the reference that will ultimately define the form of the underyling task's execution.

Stack

Parameter Field Values Comments/Description
Stack Size [bytes] Non-zero integer Specifies the size of the tasks's stack. The stack is used to hold the temporary variables and execution context associated with the task. Indeterminate operation and/or module reset can result if a stack of insufficient size is declared.
Stack Margin [bytes] Integer 0 or higher Defines the allowed margin of the task's stack. Certain systems may take action if the number of free bytes on the stack is smaller than this value.
Expose Stack Metrics to Instrumentation Checkbox Check to have MotoHawk automatically expose stack performance metric variables to Instrumentation.
Read Access Level Dropdown Defines the access level of the automatically exposed stack performance metrics.

Only visible when Expose Stack Metrics to Instrumentation is checked.
Instrumentation Group Single quote enclosed alphanumeric Defines the instrumentation group that will be associated to any stack metrics exposed to instrumentation.

Only visible when Expose Stack Metrics to Instrumentation is checked.

Metrics

Parameter Field Values Comments/Description
Calculate Execution Metrics Checkbox Some target operating systems allow the execution performance monitors associated with a task to be disabled, which can save a little CPU performance and memory. Uncheck this option if the application does not require the task's performance monitors to be refreshed.
Expose Execution Metrics to Instrumentation Checkbox Check to have MotoHawk automatically refresh expose performance metric variable.
Read Access Level Dropdown Defines the access level of the automatically exposed execution metrics.

Only visible when Expose Execution Metrics to Instrumentation is checked.
Instrumentation Group Single quote enclosed alphanumeric Defines the instrumentation group that will be associated to any execution metrics exposed to instrumentation.

Only visible when Expose Execution Metrics to Instrumentation is checked.

Multicore

Parameter Field Values Comments/Description
Allowed to execute on core Nx1 boolean vector
N=cores in use
Define a vector of boolean values where a true value specifies that this task is allowed to execute on the core that corresponds to that element. A false specifies that the corresponding core shall not be allowed to execute the task. The first element represents the first core in the system (Core 0), the second element represents the second core (Core 1) and so forth.

For example, [1 1 0] specifies that Core 0 and Core 1 can execute the task, but Core 2 may not. Conversely, [1 0 1] specifies that Core 0 and Core 2 may execute the task, but not Core 1 and [0 1 0] specifies that only Core 1 may execute the task.

An OS definition block such as the ControlCore OS Definition block will need to exist in the model if a task is to execute on a core that is not Core 0.

The ControlCore OS exclusive task execution may prevent a task from being assigned to execute on more than a single task.