fix bug in cmsis_os2
This commit is contained in:
@@ -174,7 +174,7 @@ osThreadId_t osThreadNew(osThreadFunc_t func,
|
|||||||
} else {
|
} else {
|
||||||
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
|
#if TOS_CFG_TASK_DYNAMIC_CREATE_EN > 0u
|
||||||
k_task_t* task;
|
k_task_t* task;
|
||||||
err = tos_task_create_dyn(&task, attr->name, (k_task_entry_t)func,
|
err = tos_task_create_dyn(&task, (char*)attr->name, (k_task_entry_t)func,
|
||||||
argument, prio, stack_size, 0);
|
argument, prio, stack_size, 0);
|
||||||
taskId = err == K_ERR_NONE ? task : NULL;
|
taskId = err == K_ERR_NONE ? task : NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -623,11 +623,14 @@ osMutexId_t osMutexNew(const osMutexAttr_t* attr) {
|
|||||||
if (attr) {
|
if (attr) {
|
||||||
if (attr->cb_mem) {
|
if (attr->cb_mem) {
|
||||||
err = tos_mutex_create((k_mutex_t*)attr->cb_mem);
|
err = tos_mutex_create((k_mutex_t*)attr->cb_mem);
|
||||||
mutexId = err == K_ERR_NONE ? attr->cb_mem : NULL;
|
mutexId = (err == K_ERR_NONE) ? attr->cb_mem : NULL;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err = tos_mutex_create_dyn(&mutexId);
|
||||||
|
mutexId = (err == K_ERR_NONE) ? mutexId : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (osEventFlagsId_t)mutexId;
|
return (osMutexId_t)mutexId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* osMutexGetName(osMutexId_t mutex_id) {
|
const char* osMutexGetName(osMutexId_t mutex_id) {
|
||||||
@@ -673,11 +676,14 @@ osSemaphoreId_t osSemaphoreNew(uint32_t max_count,
|
|||||||
err =
|
err =
|
||||||
tos_sem_create_max((k_sem_t*)attr->cb_mem, (k_sem_cnt_t)initial_count,
|
tos_sem_create_max((k_sem_t*)attr->cb_mem, (k_sem_cnt_t)initial_count,
|
||||||
(k_sem_cnt_t)max_count);
|
(k_sem_cnt_t)max_count);
|
||||||
semId = err == K_ERR_NONE ? attr->cb_mem : NULL;
|
semId = (err == K_ERR_NONE) ? attr->cb_mem : NULL;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err = tos_sem_create_max_dyn(&semId, (k_sem_cnt_t)initial_count, (k_sem_cnt_t)max_count);
|
||||||
|
semId = (err == K_ERR_NONE) ? semId: NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (osEventFlagsId_t)semId;
|
return (osSemaphoreId_t)semId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* osSemaphoreGetName(osSemaphoreId_t semaphore_id) {
|
const char* osSemaphoreGetName(osSemaphoreId_t semaphore_id) {
|
||||||
|
Reference in New Issue
Block a user