I am working on porting lwIP into RTX-RTOS. In lwIP's "sys_arch.c" file, I need to implement functions to free up semaphores, mutexes and mailboxes. RTX-RTOS does not have any functions for this.
Since a mailbox is a pointer to a block of memory, can "_free_box" be used to free a mailbox?
How about for a semaphore or a mutex?
Thanks,
Willy
RTX from version 4.2 and up implements CMSIS-RTOS API which also has functions for deleting objects.
http://www.keil.com/pack/doc/CMSIS/RTOS/html/index.html
I would recommend the latest RTX v5 which is based on CMSIS-RTOS2.
http://www.keil.com/pack/doc/CMSIS/RTOS2/html/index.html
Mutex management (including osMutexDelete): www.keil.com/.../group__CMSIS__RTOS__MutexMgmt.html
Semaphores (including osSemaphoreDelete): www.keil.com/.../group__CMSIS__RTOS__SemaphoreMgmt.html
Message Queue: www.keil.com/.../group__CMSIS__RTOS__Message.html
Take a look at MDK5 Software pack for lwIP: http://www.keil.com/dd2/pack/
It is already ported to CMSIS-RTOS2 and can be used with RTX5.
Thanks for your response. However, I am using a legacy MCU (RM48L950), and cannot use CMSIS-RTOS2. I am required to use RTX-RTOX ("rtl.h"). Is there a way to do this with the older version of the RTOS?
Is that even an ARM at all?
or any architecture supported by Keil?
Yes, it is a TI Hercules Arm Cortex-R4F.
The legacy RTX4 does not allocate memory for OS objects (semaphores, mutex, mailbox) but rather leaves this to the user. Therefore explicit free functions are not needed and do not exist.
Semaphore example:
OS_SEM semaphore1; // typedef U32 OS_SEM[2]; __task void task1 (void) { .. os_sem_init (&semaphore1, 0); os_sem_send (&semaphore1); .. }
The user allocates the memory for semaphore control block and then just initializes it. Since there is no allocation done by RTX also a free is not needed.
It is similar for mutex and mailbox.