Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMSIS/RTOS/RTX/SRC/rt_CMSIS.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,12 +2141,20 @@ osStatus osMailFree (osMailQId queue_id, void *mail) {

/// Put a mail to a queue
osStatus osMailPut (osMailQId queue_id, void *mail) {
void *pool;

if (queue_id == NULL) {
return osErrorParameter;
}
if (mail == NULL) {
return osErrorValue;
}

pool = *(((void **)queue_id) + 1);
if (rt_check_box (pool, mail) == 0) {
return osErrorValue;
}

return osMessagePut(*((void **)queue_id), (uint32_t)mail, 0U);
}

Expand Down
10 changes: 10 additions & 0 deletions CMSIS/RTOS/RTX/SRC/rt_MemBox.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ U32 rt_free_box (void *box_mem, void *box) {
return (0U);
}

/*--------------------------- rt_free_box -----------------------------------*/

U32 rt_check_box (void *box_mem, void *box) {
if ((box < box_mem) || (box >= ((P_BM) box_mem)->end)) {
return (0U);
} else {
return (1U);
}
}

/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
1 change: 1 addition & 0 deletions CMSIS/RTOS/RTX/SRC/rt_MemBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern U32 _init_box (void *box_mem, U32 box_size, U32 blk_size);
extern void *rt_alloc_box (void *box_mem);
extern void * _calloc_box (void *box_mem);
extern U32 rt_free_box (void *box_mem, void *box);
extern U32 rt_check_box (void *box_mem, void *box);

/*----------------------------------------------------------------------------
* end of file
Expand Down