Trying to get a handle on the 'new' CMSIS Keil RTX5 RTOS2 and am currently working with MessageQueue. Specifically, I am creating my own osMessageQueueAttr_t so I have the ability to use my own static memory for messaging rather than using the MemoryPool option. However, the documentation is a bit lacking on the declaration of the elements within the Attr structure. So, stepped through rtx_msgsqueue.c function os_svcMessageQueueNew() and think I have a proper grasp on these elements but would like a confirmation that I am not uses too much memory in my declarations. Note the gaps are due to the code pasted from different areas of the same file. Thanks...
// Task MessageQueue sizes #define TASK1_MSGQSIZE 10 #define TASK2_MSGQSIZE 10 // NOTE: os_message_t/os_message_queue_t structs are found in rtx_os.h // from rtx_msgqueue.c: 0s_MemoryAlloc(os_Info.mem.common, sizeof(os_message_queue_t), 1U); #define TASK1CB_MEMSIZE sizeof(os_message_queue_t) uint32_t Task1CBMemBlock[TASK1CB_MEMSIZE]; // from rtx_msgqueue.c: (msg_count * (msg_size + sizeof(os_message_t))) = 160 (0xA0) #define TASK1MQ_MEMSIZE (TASK1_MSGQSIZE*(sizeof(uint32_t)+sizeof(os_message_t))) uint32_t Task1MQMemBlock[TASK1MQ_MEMSIZE]; Trying to get a handle on the 'new' CMSIS RTOS2 osMessageQueueAttr_t Task1MsgAttr = { .name = "T1MsgQ", // .attr_bits = 0, // NOT a CLUE what these are.... .cb_mem = &Task1CBMemBlock[0], // .cb_size = TASK1CB_MEMSIZE, .mq_mem = &Task1MQMemBlock[0], // data memory (rtx_msgqueue.c line 307) .mq_size = TASK1MQ_MEMSIZE }; if ((Task1MsgQId = osMessageQueueNew(TASK1_MSGQSIZE, sizeof(uint32_t), NULL)) == NULL) while(1);