Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

void  OSTaskRegSet (OS_TCB     *p_tcb,

...

                    OS_REG_ID   id,

...

                    OS_REG      value,

...

                    OS_ERR     *p_err)

...

...

File

...

Called from

...

...

Code enabled by

...

...

os_task.c

...

Task only

...

OS_CFG_TASK_REG_TBL_SIZE > 0

...

µC/OS-III allows the user to store task-specific values in task registers. Task registers are different than CPU registers and are used to save such information as “errnoerrno,” which are common in software components. Task registers can also store task-related data to be associated with the task at run time such as I/O register settings, configuration values, etc. A task may have as many as OS_CFG_TASK_REG_TBL_SIZE registers, and all registers have a data type of OS_REG. However, OS_REG can be declared at compile time to be nearly anything (8-, 16-, 32-, 64-bit signed or unsigned integer, or floating-point). Anchor10052431005243

As shown below, a task register is changed by calling OSTaskRegSet(), and read by calling OSTaskRegGet(). The desired task register is specified as an argument to these functions and can take a value between 0 and OS_CFG_TASK_REG_TBL_SIZE-1.

Anchor10692541069254 Image Removed Anchor10052471005247 Arguments Anchor10052481005248Image Added

Arguments

p_tcb Anchor10052491005249

is a pointer to the TCB of the task you are setting. A NULL pointer indicates that the user wants to set the value of a task register of the calling task.

...

id Anchor10052511005251

is the identifier of the task register and valid values are from 0 to OS_CFG_TASK_REG_TBL_SIZE-1.

...

1005252value Anchor10052531005253

is the new value of the task register specified by id.

...

p_err Anchor10052551005255

is a pointer to a variable that will contain an error code returned by this function.

...

...

OS_ERR_NONE

...

classWebWorks_Indent_2

...

...

if the call was successful, and the function set the value of the desired task register.

...

classWebWorks_Indent_1

...

OS_ERR_REG_ID_INVALID

...

classWebWorks_Indent_2

...

if OS_CFG_ARG_CHK_EN is set to 1 in os_cfg.h: if a valid task register identifier is not specified.

...

Returned Value

...

1005261None Anchor10052621005262

Notes/Warnings

...

None Anchor10053101005310

Example

...

rowspan14

...