a bugfix for mail queue and printf clipping switch
1. add TOS_CFG_LIBC_PRINTF_EN 1: enable printf to implement tos_kprintf when you call tos_kprintf(actually currently it's a MACRO rather than a function) , the libc will be invloved into the image, most of the time it means a larger image size. 0: disable printf, means tos_kprintf is defined as an empty MACRO most of the time, means you will not get a log output from the uart(currently we donnot have a console yet) but a smaller image size. 2. fix a bug of tos_mail_q and tos_priority_mail_q if we are post-ing a mail and there is[are] task[s] just pend-ing for the mail queue, the mail delivered to the pend-er will be a pointer, and probably it's a pointer to the local variable on the stack. Actually we should do a memcpy rather than a pointer assignment. for more details, see the patch.
This commit is contained in:
@@ -69,9 +69,8 @@ __KERNEL__ void mutex_release(k_mutex_t *mutex)
|
||||
|
||||
__API__ k_err_t tos_mutex_create(k_mutex_t *mutex)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
|
||||
TOS_IN_IRQ_CHECK();
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&mutex->knl_obj, KNL_OBJ_TYPE_MUTEX);
|
||||
@@ -90,8 +89,8 @@ __API__ k_err_t tos_mutex_destroy(k_mutex_t *mutex)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_IN_IRQ_CHECK();
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_OBJ_VERIFY(mutex, KNL_OBJ_TYPE_MUTEX);
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
@@ -120,8 +119,8 @@ __API__ k_err_t tos_mutex_pend_timed(k_mutex_t *mutex, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_IN_IRQ_CHECK();
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_OBJ_VERIFY(mutex, KNL_OBJ_TYPE_MUTEX);
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
@@ -176,8 +175,8 @@ __API__ k_err_t tos_mutex_post(k_mutex_t *mutex)
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_task_t *pending_task;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_IN_IRQ_CHECK();
|
||||
TOS_PTR_SANITY_CHECK(mutex);
|
||||
TOS_OBJ_VERIFY(mutex, KNL_OBJ_TYPE_MUTEX);
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
Reference in New Issue
Block a user