fix some calloc bug
1. some calloc fix 2. fix some document error 3. refactor kv API, to be compatible with ota API
This commit is contained in:
@@ -293,7 +293,7 @@ __API__ void tos_task_yield(void);
|
||||
* @brief Get current running task.
|
||||
* Get current running task.
|
||||
*
|
||||
* @attention is kernel is not running, you'll get K_NULL
|
||||
* @attention if kernel is not running, you'll get K_NULL
|
||||
*
|
||||
* @param None
|
||||
*
|
||||
|
@@ -220,7 +220,7 @@ __API__ int tos_ring_q_is_empty(k_ring_q_t *ring_q)
|
||||
TOS_OBJ_VERIFY_RC(ring_q, KNL_OBJ_TYPE_RING_QUEUE, K_FALSE);
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_empty = (ring_q->total == 0);
|
||||
is_empty = (ring_q->total == 0 ? K_TRUE : K_FALSE);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_empty;
|
||||
@@ -235,7 +235,7 @@ __API__ int tos_ring_q_is_full(k_ring_q_t *ring_q)
|
||||
TOS_OBJ_VERIFY_RC(ring_q, KNL_OBJ_TYPE_RING_QUEUE, K_FALSE);
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_full = (ring_q->total == ring_q->item_cnt);
|
||||
is_full = (ring_q->total == ring_q->item_cnt ? K_TRUE : K_FALSE);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_full;
|
||||
|
@@ -250,7 +250,7 @@ __API__ k_err_t tos_task_create_dyn(k_task_t **task,
|
||||
return K_ERR_TASK_PRIO_INVALID;
|
||||
}
|
||||
|
||||
the_task = tos_mmheap_alloc(sizeof(k_task_t));
|
||||
the_task = tos_mmheap_calloc(1, sizeof(k_task_t));
|
||||
if (!the_task) {
|
||||
return K_ERR_TASK_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@@ -142,6 +142,9 @@ __KNL__ void tickless_proc(void)
|
||||
lpwr_mode = pm_cpu_lpwr_mode_get();
|
||||
|
||||
time_sleep = tickless_cpu_sleep_time_get(lpwr_mode); /* in millisecond */
|
||||
if (unlikely(time_sleep == (k_time_t)0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
tickless_enter();
|
||||
tickless_wkup_alarm_setup(lpwr_mode, time_sleep);
|
||||
|
Reference in New Issue
Block a user