Versions Compared

Key

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

...

Files

os.h/os_q.c

Prototype

Code Block
void  OSQPost (OS_Q         *p_q,
               void         *p_void,
               OS_MSG_SIZE   msg_size,
               OS_OPT        opt,
               OS_ERR       *p_err)

Arguments

p_q

is a pointer to the message queue being posted to.

...

  1. Queues must be created before they are used.
  2. Possible combinations of options are: 
    OS_OPT_POST_FIFO
    OS_OPT_POST_LIFO
    OS_OPT_POST_FIFO + OS_OPT_POST_ALL
    OS_OPT_POST_LIFO + OS_OPT_POST_ALL
    OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED
    OS_OPT_POST_LIFO + OS_OPT_POST_NO_SCHED
    OS_OPT_POST_FIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED
    OS_OPT_POST_LIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED
  3. Although the example below shows calling OSQPost() from a task, it can also be called from an ISR.

Example Usage

Code Block
titleOSQPost() example usage
          OS_Q         CommQ;
          CPU_INT08U   CommRxBuf[100];
           
           
          void CommTaskRx (void *p_arg)
          {
              OS_ERR  err;
           
           
              (void)&p_arg;
              while (DEF_ON) {
                  :
                  :
                  OSQPost(&CommQ,
                          &CommRxBuf[0],
                           sizeof(CommRxBuf),
                           OS_OPT_POST_FIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED,
                          &err);
                  /* Check "err" */
                  :
                  :
              }
          }