From 96d6da4e252b06dcfdc041e7df23e86161c33007 Mon Sep 17 00:00:00 2001 From: rihab kouki Date: Tue, 28 Jul 2020 11:24:49 +0100 Subject: Official ARM version: v5.6.0 --- docs/RTOS2/html/group__CMSIS__RTOS__Message.html | 66 +++++++++++++----------- 1 file changed, 35 insertions(+), 31 deletions(-) (limited to 'docs/RTOS2/html/group__CMSIS__RTOS__Message.html') diff --git a/docs/RTOS2/html/group__CMSIS__RTOS__Message.html b/docs/RTOS2/html/group__CMSIS__RTOS__Message.html index 3684b6d..bfc5f42 100644 --- a/docs/RTOS2/html/group__CMSIS__RTOS__Message.html +++ b/docs/RTOS2/html/group__CMSIS__RTOS__Message.html @@ -362,67 +362,71 @@ size of provided memory for data storage

The size (in bytes) of memory block

  • osOK: the message has been put into the queue.
  • osErrorTimeout: the message could not be put into the queue in the given time (wait-timed semantics).
  • osErrorResource: not enough space in the queue (try semantics).
  • -
  • osErrorParameter: the parameter mq_id is incorrect, non-zero timeout specified in an ISR.
  • +
  • osErrorParameter: parameter mq_id is NULL or invalid, non-zero timeout specified in an ISR.
  • Note
    May be called from Interrupt Service Routines if the parameter timeout is set to 0.

    Code Example:

    -
    #include "cmsis_os2.h" // CMSIS RTOS header file
    +
    #include "cmsis_os2.h" // CMSIS RTOS header file
    /*----------------------------------------------------------------------------
    * Message Queue creation & usage
    *---------------------------------------------------------------------------*/
    -
    -
    void Thread_MsgQueue1 (void *argument); // thread function 1
    -
    void Thread_MsgQueue2 (void *argument); // thread function 2
    -
    osThreadId_t tid_Thread_MsgQueue1; // thread id 1
    -
    osThreadId_t tid_Thread_MsgQueue2; // thread id 2
    -
    #define MSGQUEUE_OBJECTS 16 // number of Message Queue Objects
    +
    #define MSGQUEUE_OBJECTS 16 // number of Message Queue Objects
    -
    typedef struct { // object data type
    +
    typedef struct { // object data type
    uint8_t Buf[32];
    uint8_t Idx;
    } MSGQUEUE_OBJ_t;
    -
    osMessageQueueId_t mid_MsgQueue; // message queue id
    +
    osMessageQueueId_t mid_MsgQueue; // message queue id
    +
    +
    osThreadId_t tid_Thread_MsgQueue1; // thread id 1
    +
    osThreadId_t tid_Thread_MsgQueue2; // thread id 2
    +
    +
    void Thread_MsgQueue1 (void *argument); // thread function 1
    +
    void Thread_MsgQueue2 (void *argument); // thread function 2
    int Init_MsgQueue (void) {
    -
    +
    mid_MsgQueue = osMessageQueueNew(MSGQUEUE_OBJECTS, sizeof(MSGQUEUE_OBJ_t), NULL);
    -
    if (!mid_MsgQueue) {
    +
    if (mid_MsgQueue == NULL) {
    ; // Message Queue object not created, handle failure
    }
    -
    -
    tid_Thread_MsgQueue1 = osThreadNew (Thread_MsgQueue1, NULL, NULL);
    -
    if (!tid_Thread_MsgQueue1) return(-1);
    -
    tid_Thread_MsgQueue2 = osThreadNew (Thread_MsgQueue2, NULL, NULL);
    -
    if (!tid_Thread_MsgQueue2) return(-1);
    -
    +
    +
    tid_Thread_MsgQueue1 = osThreadNew(Thread_MsgQueue1, NULL, NULL);
    +
    if (tid_Thread_MsgQueue1 == NULL) {
    +
    return(-1);
    +
    }
    +
    tid_Thread_MsgQueue2 = osThreadNew(Thread_MsgQueue2, NULL, NULL);
    +
    if (tid_Thread_MsgQueue2 == NULL) {
    +
    return(-1);
    +
    }
    +
    return(0);
    }
    void Thread_MsgQueue1 (void *argument) {
    MSGQUEUE_OBJ_t msg;
    -
    +
    while (1) {
    ; // Insert thread code here...
    -
    msg.Buf[0] = 0x55; // do some work...
    -
    msg.Idx = 0;
    -
    osMessageQueuePut (mid_MsgQueue, &msg, 0, NULL);
    -
    osThreadYield (); // suspend thread
    +
    msg.Buf[0] = 0x55U; // do some work...
    +
    msg.Idx = 0U;
    +
    osMessageQueuePut(mid_MsgQueue, &msg, 0U, 0U);
    +
    osThreadYield(); // suspend thread
    }
    }
    void Thread_MsgQueue2 (void *argument) {
    -
    MSGQUEUE_OBJ_t msg;
    osStatus_t status;
    -
    +
    while (1) {
    ; // Insert thread code here...
    -
    status = osMessageQueueGet (mid_MsgQueue, &msg, NULL, NULL); // wait for message
    +
    status = osMessageQueueGet(mid_MsgQueue, &msg, NULL, 0U); // wait for message
    if (status == osOK) {
    -
    ; // process data
    +
    ; // process data
    }
    }
    }
    @@ -486,7 +490,7 @@ size of provided memory for data storage

    The size (in bytes) of memory block

  • osOK: the message has been retrieved from the queue.
  • osErrorTimeout: the message could not be retrieved from the queue in the given time (timed-wait semantics).
  • osErrorResource: nothing to get from the queue (try semantics).
  • -
  • osErrorParameter: the parameter mq_id is incorrect, non-zero timeout specified in an ISR.
  • +
  • osErrorParameter: parameter mq_id is NULL or invalid, non-zero timeout specified in an ISR.
  • Note
    May be called from Interrupt Service Routines if the parameter timeout is set to 0.

    Code Example

    @@ -619,7 +623,7 @@ size of provided memory for data storage

    The size (in bytes) of memory block

    • osOK: the message queue has been rest.
    • osErrorParameter: parameter mq_id is NULL or invalid.
    • -
    • osErrorResource: the message queue specified by parameter mq_id is in an invalid message queue state.
    • +
    • osErrorResource: the message queue is in an invalid state.
    • osErrorISR: osMessageQueueReset cannot be called from interrupt service routines.
    Note
    This function cannot be called from Interrupt Service Routines.
    @@ -651,7 +655,7 @@ size of provided memory for data storage

    The size (in bytes) of memory block

    • osOK: the message queue object has been deleted.
    • osErrorParameter: parameter mq_id is NULL or invalid.
    • -
    • osErrorResource: the message queue specified by parameter mq_id is in an invalid message queue state.
    • +
    • osErrorResource: the message queue is in an invalid state.
    • osErrorISR: osMessageQueueDelete cannot be called from interrupt service routines.
    Note
    This function cannot be called from Interrupt Service Routines.
    @@ -663,7 +667,7 @@ size of provided memory for data storage

    The size (in bytes) of memory block