A mail queue is very similar to a message queue, but the information being transferred consists of memory blocks that need to be allocated before putting data in and need to be freed after taking data out (
Figure 20.11). Memory blocks can hold more information, for example, a data structure, whereas a message queue can only transfer a 32-bit value or a pointer.
Mail queue object is defined using “
osMailQDef(name, queue_size, type).” When referencing a mail queue using CMSIS-RTOS API, we need to use the “
osMailQ(name)” macro. Each mail queue also has an ID value that is needed by some of the mail queue functions.
Table 20.11 lists the CMSIS-RTOS functions for mail queue operations.
The following example shows how to use a mail ...