remove the uart_rx_lock in AT framework,update tos version to 2.2.1
This commit is contained in:
@@ -410,7 +410,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>examples</GroupName>
|
<GroupName>examples</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
@@ -1254,6 +1254,18 @@
|
|||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>12</GroupNumber>
|
||||||
|
<FileNumber>77</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\..\..\..\devices\ec600s\ec600s.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>ec600s.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
@@ -1264,7 +1276,7 @@
|
|||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>13</GroupNumber>
|
<GroupNumber>13</GroupNumber>
|
||||||
<FileNumber>77</FileNumber>
|
<FileNumber>78</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
@@ -1284,7 +1296,7 @@
|
|||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>14</GroupNumber>
|
<GroupNumber>14</GroupNumber>
|
||||||
<FileNumber>78</FileNumber>
|
<FileNumber>79</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
@@ -339,7 +339,7 @@
|
|||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define>USE_HAL_DRIVER,STM32L431xx,WITH_TOS_NET_ADAPTER</Define>
|
<Define>USE_HAL_DRIVER,STM32L431xx,WITH_TOS_NET_ADAPTER</Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath>..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\kernel\core\include;..\..\TOS-CONFIG;..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\BSP\Hardware\DHT11;..\..\BSP\Hardware\OLED;..\..\BSP\Hardware\BH1750;..\..\..\..\devices\esp8266;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\..\..\net\sal_module_wrapper;..\..\..\..\devices\ec20;..\..\..\..\devices\ec200s;..\..\..\..\devices\air724;..\..\..\..\devices\l610</IncludePath>
|
<IncludePath>..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\kernel\core\include;..\..\TOS-CONFIG;..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\BSP\Hardware\DHT11;..\..\BSP\Hardware\OLED;..\..\BSP\Hardware\BH1750;..\..\..\..\devices\esp8266;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\..\..\net\sal_module_wrapper;..\..\..\..\devices\ec20;..\..\..\..\devices\ec200s;..\..\..\..\devices\air724;..\..\..\..\devices\l610;..\..\..\..\devices\ec600s</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Cads>
|
</Cads>
|
||||||
<Aads>
|
<Aads>
|
||||||
@@ -818,6 +818,11 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\..\..\..\devices\l610\l610.c</FilePath>
|
<FilePath>..\..\..\..\devices\l610\l610.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>ec600s.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\..\..\..\devices\ec600s\ec600s.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
//#define USE_EC200S
|
//#define USE_EC200S
|
||||||
//#define USE_AIR724
|
//#define USE_AIR724
|
||||||
//#define USE_L610
|
//#define USE_L610
|
||||||
|
//#define USE_EC600S
|
||||||
|
|
||||||
#ifdef USE_ESP8266
|
#ifdef USE_ESP8266
|
||||||
#include "esp8266.h"
|
#include "esp8266.h"
|
||||||
@@ -38,6 +39,10 @@
|
|||||||
#include "l610.h"
|
#include "l610.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_EC600S
|
||||||
|
#include "ec600s.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TCP_TEST_TASK0_STK_SIZE 4096
|
#define TCP_TEST_TASK0_STK_SIZE 4096
|
||||||
void tcp_test0(void);
|
void tcp_test0(void);
|
||||||
osThreadDef(tcp_test0, osPriorityNormal, 1, TCP_TEST_TASK0_STK_SIZE);
|
osThreadDef(tcp_test0, osPriorityNormal, 1, TCP_TEST_TASK0_STK_SIZE);
|
||||||
@@ -114,6 +119,8 @@ void application_entry(void *arg)
|
|||||||
air724_sal_init(HAL_UART_PORT_0);
|
air724_sal_init(HAL_UART_PORT_0);
|
||||||
#elif defined(USE_L610)
|
#elif defined(USE_L610)
|
||||||
l610_sal_init(HAL_UART_PORT_0);
|
l610_sal_init(HAL_UART_PORT_0);
|
||||||
|
#elif defined(USE_EC600S)
|
||||||
|
ec600s_sal_init(HAL_UART_PORT_0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
socket_id_0 = tos_sal_module_connect("117.50.111.72", "8080", TOS_SAL_PROTO_TCP);
|
socket_id_0 = tos_sal_module_connect("117.50.111.72", "8080", TOS_SAL_PROTO_TCP);
|
||||||
|
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#define TOS_VERSION_MAJOR 0x02
|
#define TOS_VERSION_MAJOR 0x02
|
||||||
#define TOS_VERSION_MINOR 0x02
|
#define TOS_VERSION_MINOR 0x02
|
||||||
#define TOS_VERSION_PATCH 0x00
|
#define TOS_VERSION_PATCH 0x01
|
||||||
#define TOS_VERSION "2.2.0"
|
#define TOS_VERSION "2.2.1"
|
||||||
|
|
||||||
#endif /* _TOS_VERSION_H_ */
|
#endif /* _TOS_VERSION_H_ */
|
||||||
|
|
||||||
|
@@ -122,7 +122,7 @@ typedef struct at_agent_st {
|
|||||||
|
|
||||||
hal_uart_t uart;
|
hal_uart_t uart;
|
||||||
k_mutex_t uart_tx_lock;
|
k_mutex_t uart_tx_lock;
|
||||||
k_mutex_t uart_rx_lock;
|
// k_mutex_t uart_rx_lock;
|
||||||
k_sem_t uart_rx_sem;
|
k_sem_t uart_rx_sem;
|
||||||
k_chr_fifo_t uart_rx_fifo;
|
k_chr_fifo_t uart_rx_fifo;
|
||||||
uint8_t *uart_rx_fifo_buffer;
|
uint8_t *uart_rx_fifo_buffer;
|
||||||
|
@@ -14,6 +14,15 @@
|
|||||||
* as the other licenses applicable to the third-party components included
|
* as the other licenses applicable to the third-party components included
|
||||||
* within TencentOS.
|
* within TencentOS.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note:
|
||||||
|
If you find that the AT framework occasionally loses characters,
|
||||||
|
this may be caused by the unnecessary critical section of at_channel,
|
||||||
|
so you can remove the critical section of ring_queue in tos_ring_queue.c.
|
||||||
|
Once you remove, ring queue becomes only a data structure,
|
||||||
|
you must use critical section or mutex to protect the data in ring_queue.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "tos_at.h"
|
#include "tos_at.h"
|
||||||
|
|
||||||
@@ -39,6 +48,7 @@ __API__ int tos_at_global_lock_post(void)
|
|||||||
|
|
||||||
__STATIC__ int at_uart_getchar(uint8_t *data, k_tick_t timeout)
|
__STATIC__ int at_uart_getchar(uint8_t *data, k_tick_t timeout)
|
||||||
{
|
{
|
||||||
|
TOS_CPU_CPSR_ALLOC();
|
||||||
k_err_t err;
|
k_err_t err;
|
||||||
|
|
||||||
tos_stopwatch_delay(1);
|
tos_stopwatch_delay(1);
|
||||||
@@ -46,14 +56,24 @@ __STATIC__ int at_uart_getchar(uint8_t *data, k_tick_t timeout)
|
|||||||
if (tos_sem_pend(&AT_AGENT->uart_rx_sem, timeout) != K_ERR_NONE) {
|
if (tos_sem_pend(&AT_AGENT->uart_rx_sem, timeout) != K_ERR_NONE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tos_mutex_pend(&AT_AGENT->uart_rx_lock) != K_ERR_NONE) {
|
/*
|
||||||
return -1;
|
the uart_rx_fifo is only read by at_parser task,
|
||||||
}
|
and it will be written in usart interrupt handler,
|
||||||
|
so it is more effective to use critical sections.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// if (tos_mutex_pend(&AT_AGENT->uart_rx_lock) != K_ERR_NONE) {
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
TOS_CPU_INT_DISABLE();
|
||||||
|
|
||||||
err = tos_chr_fifo_pop(&AT_AGENT->uart_rx_fifo, data);
|
err = tos_chr_fifo_pop(&AT_AGENT->uart_rx_fifo, data);
|
||||||
|
|
||||||
|
TOS_CPU_INT_ENABLE();
|
||||||
|
|
||||||
tos_mutex_post(&AT_AGENT->uart_rx_lock);
|
// tos_mutex_post(&AT_AGENT->uart_rx_lock);
|
||||||
|
|
||||||
return err == K_ERR_NONE ? 0 : -1;
|
return err == K_ERR_NONE ? 0 : -1;
|
||||||
}
|
}
|
||||||
@@ -469,11 +489,11 @@ __API__ int tos_at_cmd_exec(at_echo_t *echo, uint32_t timeout, const char *cmd,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (tos_sem_create(&echo->__status_set_notify, 0) != K_ERR_NONE) {
|
if (!echo) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!echo) {
|
if (tos_sem_create(&echo->__status_set_notify, 0) != K_ERR_NONE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,9 +903,9 @@ __API__ int tos_at_init(hal_uart_port_t uart_port, at_event_t *event_table, size
|
|||||||
goto errout3;
|
goto errout3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tos_mutex_create(&AT_AGENT->uart_rx_lock) != K_ERR_NONE) {
|
// if (tos_mutex_create(&AT_AGENT->uart_rx_lock) != K_ERR_NONE) {
|
||||||
goto errout4;
|
// goto errout4;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (tos_mutex_create(&AT_AGENT->uart_tx_lock) != K_ERR_NONE) {
|
if (tos_mutex_create(&AT_AGENT->uart_tx_lock) != K_ERR_NONE) {
|
||||||
goto errout5;
|
goto errout5;
|
||||||
@@ -917,9 +937,9 @@ errout6:
|
|||||||
tos_mutex_destroy(&AT_AGENT->uart_tx_lock);
|
tos_mutex_destroy(&AT_AGENT->uart_tx_lock);
|
||||||
|
|
||||||
errout5:
|
errout5:
|
||||||
tos_mutex_destroy(&AT_AGENT->uart_rx_lock);
|
// tos_mutex_destroy(&AT_AGENT->uart_rx_lock);
|
||||||
|
|
||||||
errout4:
|
//errout4:
|
||||||
tos_sem_destroy(&AT_AGENT->uart_rx_sem);
|
tos_sem_destroy(&AT_AGENT->uart_rx_sem);
|
||||||
|
|
||||||
errout3:
|
errout3:
|
||||||
|
Reference in New Issue
Block a user