finish nimble blehr porting and do some kernel improve

This commit is contained in:
SheldonDai
2019-10-09 12:15:59 +08:00
parent 45c18c896c
commit aad1564e09
663 changed files with 314162 additions and 68 deletions

View File

@@ -29,6 +29,7 @@ typedef enum k_err_en {
K_ERR_MSG_QUEUE_FULL = 900u,
K_ERR_MSG_QUEUE_EMPTY,
K_ERR_MSG_QUEUE_MSG_NOT_EXIST,
K_ERR_MUTEX_NOT_OWNER = 1000u,
K_ERR_MUTEX_NESTING,
@@ -43,9 +44,11 @@ typedef enum k_err_en {
K_ERR_QUEUE_EMPTY = 1500u,
K_ERR_QUEUE_FULL,
K_ERR_QUEUE_MSG_NOT_EXIST,
K_ERR_PEND_NOWAIT = 1600u,
K_ERR_PEND_SCHED_LOCKED,
K_ERR_PEND_IN_IRQ,
K_ERR_PEND_ABNORMAL,
K_ERR_PEND_TIMEOUT,
K_ERR_PEND_DESTROY,
@@ -77,6 +80,7 @@ typedef enum k_err_en {
K_ERR_TIMER_INVALID_STATE,
K_ERR_TIMER_INVALID_OPT,
K_ERR_TIMER_STOPPED,
K_ERR_TIMER_RUNNING,
} k_err_t;
#endif /* _TOS_ERR_H_ */

View File

@@ -79,6 +79,21 @@ __API__ k_err_t tos_msg_queue_get(k_msg_queue_t *msg_queue, void **msg_addr, siz
*/
__API__ k_err_t tos_msg_queue_put(k_msg_queue_t *msg_queue, void *msg_addr, size_t msg_size, k_opt_t opt);
/**
* @brief Remove one message from the message queue.
* Remove one message with certain address from the message queue.
*
* @attention None
*
* @param[IN] msg_queue the pointer to the handler of the message queue.
* @param[IN] msg_addr the address of the message.
*
* @return errcode.
* @retval #K_ERR_MSG_QUEUE_MSG_NOT_EXIST message to remove is not existed
* @retval #K_ERR_NONE return successfully
*/
__API__ k_err_t tos_msg_queue_remove(k_msg_queue_t *msg_queue, void *msg_addr);
/**
* @brief Flush all of the messages.
* Flush all of the messages in the queue.

View File

@@ -5,7 +5,7 @@
typedef struct k_queue_st {
pend_obj_t pend_obj;
k_msg_queue_t msg_queue;
k_msg_queue_t msg_queue;
} k_queue_t;
/**
@@ -34,19 +34,6 @@ __API__ k_err_t tos_queue_create(k_queue_t *queue);
*/
__API__ k_err_t tos_queue_destroy(k_queue_t *queue);
/**
* @brief Flush a queue.
* flush a queue, clear all the msg in the queue.
*
* @attention None
*
* @param[in] queue pointer to the handler of the queue.
*
* @return errcode
* @retval #K_ERR_NONE return successfully.
*/
__API__ k_err_t tos_queue_flush(k_queue_t *queue);
/**
* @brief Pend a queue.
* pend a queue.
@@ -55,8 +42,8 @@ __API__ k_err_t tos_queue_flush(k_queue_t *queue);
* that means you DONNOT need to alloc memory for msg_addr, msg_addr can just be a pointer.
*
* @param[in] queue pointer to the handler of the queue.
* @param[OUT] msg_addr a pointer point to the message we wanna recive.
* @param[OUT] msg_size pointer to the message size returned.
* @param[out] msg_addr a pointer point to the message we wanna recive.
* @param[out] msg_size pointer to the message size returned.
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
*
* @return errcode
@@ -96,6 +83,34 @@ __API__ k_err_t tos_queue_post(k_queue_t *queue, void *msg_addr, size_t msg_size
*/
__API__ k_err_t tos_queue_post_all(k_queue_t *queue, void *msg_addr, size_t msg_size);
/**
* @brief Flush a queue.
* flush a queue, clear all the msg in the queue.
*
* @attention None
*
* @param[in] queue pointer to the handler of the queue.
*
* @return errcode
* @retval #K_ERR_NONE return successfully.
*/
__API__ k_err_t tos_queue_flush(k_queue_t *queue);
/**
* @brief Remove one message from the queue.
* Remove one message with certain address from the queue.
*
* @attention None
*
* @param[in] queue pointer to the handler of the queue.
* @param[in] msg_addr the address of the message.
*
* @return errcode
* @retval #K_ERR_QUEUE_MSG_NOT_EXIST message to remove is not existed.
* @retval #K_ERR_NONE return successfully.
*/
__API__ k_err_t tos_queue_remove(k_queue_t *queue, void *msg_addr);
#endif
#endif /* _TOS_QUEUE_H_ */

View File

@@ -9,6 +9,11 @@
// if we want the timer run periodically, this option should be passed to tos_timer_create.
#define TOS_OPT_TIMER_PERIODIC (k_opt_t)(0x0002u)
typedef enum timer_change_type_en {
TIMER_CHANGE_TYPE_DELAY,
TIMER_CHANGE_TYPE_PERIOD,
} timer_change_type_t;
/**
* state for timer
*/
@@ -110,6 +115,39 @@ __API__ k_err_t tos_timer_start(k_timer_t *tmr);
*/
__API__ k_err_t tos_timer_stop(k_timer_t *tmr);
/**
* @brief Change a timer's delay.
*
* @attention None
*
* @param[in] tmr pointer to the handler of the timer.
* @param[in] delay new delay of the timer.
*
* @return errcode
* @retval #K_ERR_TIMER_INACTIVE the timer is not active yet.
* @retval #K_ERR_TIMER_RUNNING the timer is running.
* @retval #K_ERR_TIMER_INVALID_DELAY the delay is invalid.
* @retval #K_ERR_NONE return successfully.
*/
__API__ k_err_t tos_timer_delay_change(k_timer_t *tmr, k_tick_t delay);
/**
* @brief Change a timer's period.
*
* @attention None
*
* @param[in] tmr pointer to the handler of the timer.
* @param[in] period new period of the timer.
*
* @return errcode
* @retval #K_ERR_TIMER_INACTIVE the timer is not active yet.
* @retval #K_ERR_TIMER_RUNNING the timer is running.
* @retval #K_ERR_TIMER_INVALID_PERIOD the period is invalid.
* @retval #K_ERR_NONE return successfully.
*/
__API__ k_err_t tos_timer_period_change(k_timer_t *tmr, k_tick_t period);
#if TOS_CFG_TIMER_AS_PROC > 0u
/**