diff --git a/board/TencentOS_tiny_EVB_LX/BSP/LoRaWAN/lora_demo.c b/board/TencentOS_tiny_EVB_LX/BSP/LoRaWAN/lora_demo.c index 158d6e50..cf677da6 100644 --- a/board/TencentOS_tiny_EVB_LX/BSP/LoRaWAN/lora_demo.c +++ b/board/TencentOS_tiny_EVB_LX/BSP/LoRaWAN/lora_demo.c @@ -95,7 +95,8 @@ uint8_t pool[DATA_CNT]; void application_entry(void *arg) { int i = 0; - + int ret = 0; + int send_failed_count = 0; rhf76_lora_init(HAL_UART_PORT_1); tos_lora_module_recvcb_register(recv_callback); @@ -113,7 +114,20 @@ void application_entry(void *arg) } printf("\n\n"); - tos_lora_module_send(&dev_data.data, mail_size); + ret = tos_lora_module_send(&dev_data.data, mail_size); + if (ret < 0 ) + { + printf("LoRa Send data faild! count is %d\r\n",send_failed_count); + send_failed_count++; + if (send_failed_count > 10) + { + eclic_system_reset();// when lora send faied more than 10 times , cpu reset to reconnect. + } + } + else + { + send_failed_count = 0; + } } } diff --git a/board/TencentOS_tiny_EVB_MX_Plus/BSP/LoRaWAN/lora_demo.c b/board/TencentOS_tiny_EVB_MX_Plus/BSP/LoRaWAN/lora_demo.c index 77998e71..d88f2fce 100644 --- a/board/TencentOS_tiny_EVB_MX_Plus/BSP/LoRaWAN/lora_demo.c +++ b/board/TencentOS_tiny_EVB_MX_Plus/BSP/LoRaWAN/lora_demo.c @@ -95,7 +95,8 @@ uint8_t pool[DATA_CNT]; void application_entry(void *arg) { int i = 0; - + int ret = 0; + int send_failed_count = 0; rhf76_lora_init(HAL_UART_PORT_0); tos_lora_module_recvcb_register(recv_callback); @@ -113,7 +114,20 @@ void application_entry(void *arg) } printf("\n\n"); - tos_lora_module_send(&dev_data.data, mail_size); + ret = tos_lora_module_send(&dev_data.data, mail_size); + if (ret < 0 ) + { + printf("LoRa Send data faild!, count is %d\r\n",send_failed_count); + send_failed_count++; + if (send_failed_count > 10) + { + NVIC_SystemReset();// when lora send faied more than 10 times , cpu reset to reconnect. + } + } + else + { + send_failed_count = 0; + } } } diff --git a/devices/rhf76_lora/RHF76.c b/devices/rhf76_lora/RHF76.c index 567d8cb8..85eef1e7 100644 --- a/devices/rhf76_lora/RHF76.c +++ b/devices/rhf76_lora/RHF76.c @@ -526,12 +526,12 @@ static int rhf76_send(const void *buf, size_t len) snprintf(cmd, sizeof(cmd), RHF76_ATCMD_FMT_SEND_CMSGHEX, str_buf); cmd[sizeof(cmd) - 1] = '\0'; tos_mmheap_free(str_buf); - tos_at_echo_create(&echo, NULL, 0, "+CMSG: ACK Received"); + tos_at_echo_create(&echo, NULL, 0, "+CMSGHEX: ACK Received"); tos_at_cmd_exec(&echo, 6000, cmd); if (echo.status == AT_ECHO_STATUS_OK || echo.status == AT_ECHO_STATUS_EXPECT) { - return -1; + return len; } - return len; + return -1; } static int rhf76_send_unconfirmed(const void *buf, size_t len) @@ -552,9 +552,9 @@ static int rhf76_send_unconfirmed(const void *buf, size_t len) tos_at_echo_create(&echo, NULL, 0, "+MSGHEX: Done"); tos_at_cmd_exec(&echo, 6000, cmd); if (echo.status == AT_ECHO_STATUS_OK || echo.status == AT_ECHO_STATUS_EXPECT) { - return -1; + return len; } - return len; + return -1; } static int rhf76_close(void) diff --git a/doc/19.TencentOS_Tiny_Simulator_Use_MDK.md b/doc/19.TencentOS_Tiny_Simulator_Use_MDK.md index ce7da0af..7ce32593 100644 --- a/doc/19.TencentOS_Tiny_Simulator_Use_MDK.md +++ b/doc/19.TencentOS_Tiny_Simulator_Use_MDK.md @@ -32,7 +32,7 @@ int fputc(int ch, FILE *f) return(ch); } ``` -添加完毕后,在MDK工程上打开option选项,选择debug选项开,调试方式选择User Simulator,并修改调试参数,如下图: +添加完毕后,在MDK工程上打开option选项,选择debug选项,调试方式选择User Simulator,并修改调试参数,如下图: ![](image/MDK_Simulator_Guide/set_simulator_para.png) 完成软件仿真参数配置后,就可以点击debug按钮开始调试了,打开调试窗口后,选择view->Serial windows->debug 就可以打开调试日志窗口了,如图,可以看到TencentOS Tiny内核的两个任务输出的日志信息。 diff --git a/examples/event_driven_at_module/at_evtdrv/include/tos_at_evtdrv.h b/examples/event_driven_at_module/at_evtdrv/include/tos_at_evtdrv.h index 25656119..deebf379 100644 --- a/examples/event_driven_at_module/at_evtdrv/include/tos_at_evtdrv.h +++ b/examples/event_driven_at_module/at_evtdrv/include/tos_at_evtdrv.h @@ -15,8 +15,8 @@ * within TencentOS. *---------------------------------------------------------------------------*/ -#ifndef _TOS_AT_H_ -#define _TOS_AT_H_ +#ifndef _TOS_AT_EVTDRV_H_ +#define _TOS_AT_EVTDRV_H_ #include "tos_evtdrv.h" #include "tos_at_utils_evtdrv.h" @@ -53,8 +53,8 @@ typedef struct at_cache_st { uint8_t *buffer; size_t buffer_size; size_t recv_len; - size_t curr_len; - size_t last_data; + size_t curr_len; + size_t last_data; } at_cache_t; typedef enum at_parse_status_en { @@ -95,8 +95,8 @@ typedef struct at_echo_st { char *buffer; size_t buffer_size; char *echo_expect; - evtdrv_task_id_t module_task_id; - evtdrv_event_flag_t event_flags; + evtdrv_task_id_t module_task_id; + evtdrv_event_flag_t event_flags; int line_num; at_echo_status_t status; size_t __w_idx; @@ -401,5 +401,5 @@ const char *tos_at_agent_channel_port_get(int channel_id); evtdrv_event_flag_t tos_at_evtdrv_task(evtdrv_event_flag_t event); -#endif /* __AT_AGENT_H_ */ +#endif /* _TOS_AT_EVTDRV_H_ */ diff --git a/examples/event_driven_at_module/at_evtdrv/include/tos_at_utils_evtdrv.h b/examples/event_driven_at_module/at_evtdrv/include/tos_at_utils_evtdrv.h index 46e7a094..d69e8ea9 100644 --- a/examples/event_driven_at_module/at_evtdrv/include/tos_at_utils_evtdrv.h +++ b/examples/event_driven_at_module/at_evtdrv/include/tos_at_utils_evtdrv.h @@ -1,5 +1,5 @@ -#ifndef _TOS_AT_UTILS_H_ -#define _TOS_AT_UTILS_H_ +#ifndef _TOS_AT_UTILS_EVTDRV_H_ +#define _TOS_AT_UTILS_EVTDRV_H_ typedef struct at_timer_st { evtdrv_tick_t end_time; @@ -19,5 +19,5 @@ evtdrv_tick_t at_timer_remain(at_timer_t *tmr); void at_timer_init(at_timer_t *tmr); -#endif +#endif//_TOS_AT_UTILS_EVTDRV_H_ diff --git a/examples/event_driven_at_module/esp8266_evtdrv/esp8266_evtdrv.h b/examples/event_driven_at_module/esp8266_evtdrv/esp8266_evtdrv.h index e02ac0a2..995767a0 100644 --- a/examples/event_driven_at_module/esp8266_evtdrv/esp8266_evtdrv.h +++ b/examples/event_driven_at_module/esp8266_evtdrv/esp8266_evtdrv.h @@ -15,8 +15,8 @@ * within TencentOS. *---------------------------------------------------------------------------*/ -#ifndef __ESP8266_H__ -#define __ESP8266_H__ +#ifndef __ESP8266_EVTDRV_H__ +#define __ESP8266_EVTDRV_H__ #include "tos_evtdrv.h" #include "tos_hal.h" @@ -50,14 +50,14 @@ typedef struct esp8266_event_header_st { evtdrv_event_flag_t event; - evtdrv_task_id_t sender_id; + evtdrv_task_id_t sender_id; } esp8266_event_hdr_t; typedef struct esp8266_in_msg_init_st { esp8266_event_hdr_t header; hal_uart_port_t uart_port; - evtdrv_task_id_t at_task_id; - evtdrv_task_id_t esp8266_task_id; + evtdrv_task_id_t at_task_id; + evtdrv_task_id_t esp8266_task_id; } esp8266_imsg_init_t; typedef struct esp8266_in_msg_join_ap_st { @@ -130,5 +130,5 @@ int esp8266_join_ap(const char *ssid, const char *pwd); evtdrv_event_flag_t esp8266_task(evtdrv_event_flag_t event); -#endif /* __ESP8266_H__ */ +#endif /* __ESP8266_EVTDRV_H__ */ diff --git a/kernel/core/include/tos_barrier.h b/kernel/core/include/tos_barrier.h index 14dbba96..6fc500fe 100644 --- a/kernel/core/include/tos_barrier.h +++ b/kernel/core/include/tos_barrier.h @@ -44,12 +44,11 @@ typedef struct k_barrier_st { __API__ k_err_t tos_barrier_create(k_barrier_t *barrier, k_barrier_cnt_t count); /** - * @brief Create a thread barrier. + * @brief Destroy a thread barrier. * - * @attention the count must be greater then zero. + * @attention * * @param[in] barrier the barrier. - * @param[in] count the number of threads(task) must call tos_barrier_pend before any of them successfully return from the call. * * @return errcode * @retval #K_ERR_NONE return successfully. diff --git a/kernel/core/include/tos_completion.h b/kernel/core/include/tos_completion.h index bbaae49a..dac660f2 100644 --- a/kernel/core/include/tos_completion.h +++ b/kernel/core/include/tos_completion.h @@ -83,7 +83,6 @@ __API__ k_err_t tos_completion_pend_timed(k_completion_t *completion, k_tick_t t * @attention None * * @param[in] completion pointer to the handler of the completion. - * @param[in] timeout how much time(in k_tick_t) we would like to wait. * * @return errcode * @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked. diff --git a/kernel/core/include/tos_countdownlatch.h b/kernel/core/include/tos_countdownlatch.h index 9cc0f339..b9beb85d 100644 --- a/kernel/core/include/tos_countdownlatch.h +++ b/kernel/core/include/tos_countdownlatch.h @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ #ifndef _TOS_COUNTDOWNLATCH_H_ -#define _TOS_COUNTDOWNLATCH_H_ +#define _TOS_COUNTDOWNLATCH_H_ __CDECLS_BEGIN @@ -108,6 +108,7 @@ __API__ k_err_t tos_countdownlatch_post(k_countdownlatch_t *countdownlatch); * @attention None. * * @param[in] countdownlatch pointer to the handler of the countdown-latch. + * @param[in] count the count to wait of the countdown-latch. * * @return errcode * @retval #K_ERR_NONE return successfully. diff --git a/kernel/core/include/tos_mmblk.h b/kernel/core/include/tos_mmblk.h index 4761444b..2fd8f4de 100644 --- a/kernel/core/include/tos_mmblk.h +++ b/kernel/core/include/tos_mmblk.h @@ -68,15 +68,13 @@ __API__ k_err_t tos_mmblk_pool_create(k_mmblk_pool_t *mbp, void *pool_start, siz __API__ k_err_t tos_mmblk_pool_destroy(k_mmblk_pool_t *mbp); /** - * @brief Create a memory manage block pool. - * Create a memory manage block pool. + * @brief Allocate a memory manage block. + * Allocate a memory manage block. * * @attention None * * @param[in] mbp pointer to the memory block pool handler. - * @param[in] pool_start start address of the pool. - * @param[in] blk_num number of the blocks in the pool. - * @param[in] blk_size size of each block in the pool. + * @param[in] blk start address of the memory manage block. * * @return errcode * @retval #K_ERR_MMBLK_POOL_EMPTY the pool is empty. @@ -85,15 +83,13 @@ __API__ k_err_t tos_mmblk_pool_destroy(k_mmblk_pool_t *mbp); __API__ k_err_t tos_mmblk_alloc(k_mmblk_pool_t *mbp, void **blk); /** - * @brief Create a memory manage block pool. - * Create a memory manage block pool. + * @brief Free a memory manage block. + * Free a memory manage block. * * @attention None * * @param[in] mbp pointer to the memory block pool handler. - * @param[in] pool_start start address of the pool. - * @param[in] blk_num number of the blocks in the pool. - * @param[in] blk_size size of each block in the pool. + * @param[in] blk start address of the memory manage block. * * @return errcode * @retval #K_ERR_MMBLK_POOL_FULL the pool is full. diff --git a/kernel/core/include/tos_priority_queue.h b/kernel/core/include/tos_priority_queue.h index 4c75ebc1..729cc841 100644 --- a/kernel/core/include/tos_priority_queue.h +++ b/kernel/core/include/tos_priority_queue.h @@ -106,8 +106,6 @@ __API__ k_err_t tos_prio_q_destroy(k_prio_q_t *prio_q); * @attention if we wanna create a priority queue, we should offer a manager array buffer of which the size can be calculated by TOS_PRIO_Q_MGR_ARRAY_SIZE. * * @param[in] prio_q pointer to the handler of the priority queue. - * @param[in] mgr_array manager array buffer of the priority queue. - * @param[in] pool pool buffer of the priority queue. * @param[in] item_cnt item count of the priority queue. * @param[in] item_size size of each item of the priority queue. * diff --git a/kernel/core/include/tos_rwlock.h b/kernel/core/include/tos_rwlock.h index 6225e8d9..1c56c65b 100644 --- a/kernel/core/include/tos_rwlock.h +++ b/kernel/core/include/tos_rwlock.h @@ -69,6 +69,7 @@ __API__ k_err_t tos_rwlock_destroy(k_rwlock_t *rwlock); * and no writers can hold the write-lock. * * @param[in] rwlock the read-write lock. + * @param[in] timeout how much time(in k_tick_t) we would like to wait. * * @return errcode * @retval #K_ERR_NONE return successfully. @@ -110,6 +111,7 @@ __API__ k_err_t tos_rwlock_rpend_try(k_rwlock_t *rwlock); * and no readers can hold the read-lock. * * @param[in] rwlock the read-write lock. + * @param[in] timeout how much time(in k_tick_t) we would like to wait. * * @return errcode * @retval #K_ERR_NONE return successfully. diff --git a/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h b/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h index 507338da..3b9ab7bf 100644 --- a/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h +++ b/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h @@ -217,7 +217,6 @@ int tos_tf_module_mqtt_state_get(mqtt_state_t *state); * @attention None * * @param[in] log_level device information - * @param[in] tls_mode tls mode * * @return errcode */