Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
OS_REG_ID  OSTaskRegGet (OS_ERR  *p_err)

...

File

...

Called from

...

Code enabled by

...

os_task.c

...

Task only

...

Description

OSTaskRegGetID() allows  allows your application to assign task register IDs dynamically. In other words, instead of using using #define constants  constants to establish a task register number (or index) into the the .TaskReg[] shown  shown below, you should always use use OSTaskRegGetID(), assign the ID to a variable and use this ID when calling calling OSTaskRegGet() or  or OSTaskRegSet().

If successful, OSTaskRegGetID() will  will return an ID between between 0 and  and OS_CFG_TASK_REG_TBL_SIZE-1.

Image Added

Files

os.h/os_task.Image Removedc

Prototype

Code Block
OS_REG_ID  OSTaskRegGetID (OS_ERR  *p_err)

Arguments

p_err

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

...

If you already called OSTaskRegGetID() OS_CFG_TASK_REG_TBL_SIZE (see os_cfg.h) times and thus there are no more IDs available to be assigned.

Returned Value

The next available task register ID or OS_CFG_TASK_REG_TBL_SIZE if all the IDs have already been assigned.

Required Configuration

OS_CFG_TASK_REG_TBL_SIZE must be greater than 0 in os_cfg.h. Refer to µC-OS-III Configuration Manual.

Callers

Application.

Notes/Warnings

None

Example Usage

Code Block
titleOSTaskRegGetID() example usage
          OS_REG_ID  MyTaskRegID;
           
           
          void main (void)
          {
              OS_ERR  err;
           
              :
              OSInit(&err);
              :
              MyTaskRegID = OSTaskRegGetID(&err);
              /* Check "err" */
              :
              :
              OSStart(&err);
          }