From 1f39ec285da7566386b559138d8789cde965e1ed Mon Sep 17 00:00:00 2001 From: chinky Date: Thu, 2 Jan 2025 23:26:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[AT]=20=E4=BD=BF=E7=94=A8=20SERIAL=5FV2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/include/at.h | 1 + components/net/at/src/at_client.c | 5 +++++ components/net/at/src/at_server.c | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 2d9e7e51db3..ae61733e25e 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -14,6 +14,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 5d665fee661..2e7b495626a 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -960,6 +960,10 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz, rt_size_t send_bu RT_ASSERT(client->device->type == RT_Device_Class_Char); rt_device_set_rx_indicate(client->device, at_client_rx_ind); + +#ifdef RT_USING_SERIAL_V2 + open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_RX_NON_BLOCKING); +#else /* using DMA mode first */ open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_DMA_RX); /* using interrupt mode when DMA mode not supported */ @@ -967,6 +971,7 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz, rt_size_t send_bu { open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX); } +#endif // RT_USING_SERIAL_V2 RT_ASSERT(open_result == RT_EOK); } else diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index de67001e170..ad969f9776a 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -565,6 +565,10 @@ int at_server_init(void) RT_ASSERT(at_server_local->device->type == RT_Device_Class_Char); rt_device_set_rx_indicate(at_server_local->device, at_rx_ind); + +#ifdef RT_USING_SERIAL_V2 + open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_RX_NON_BLOCKING); +#else /* using DMA mode first */ open_result = rt_device_open(at_server_local->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_DMA_RX); /* using interrupt mode when DMA mode not supported */ @@ -572,6 +576,7 @@ int at_server_init(void) { open_result = rt_device_open(at_server_local->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX); } +#endif /* RT_USING_SERIAL_V2 */ RT_ASSERT(open_result == RT_EOK); } else From e7f382ad42f1a7eb408c6b7cd4bdc6f2eeda14df Mon Sep 17 00:00:00 2001 From: chinky Date: Thu, 2 Jan 2025 23:46:36 +0800 Subject: [PATCH 2/3] format --- components/net/at/include/at.h | 2 +- components/net/at/src/at_client.c | 3 ++- components/net/at/src/at_server.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index ae61733e25e..bfd4550d2a7 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2025, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 2e7b495626a..3b5fd40f399 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2023, RT-Thread Development Team + * Copyright (c) 2006-2025, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -10,6 +10,7 @@ * 2018-08-17 chenyong multiple client support * 2021-03-17 Meco Man fix a buf of leaking memory * 2021-07-14 Sszl fix a buf of leaking memory + * 2025-01-02 dongly support SERIAL_V2 */ #include diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index ad969f9776a..78173729483 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2025, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,6 +7,7 @@ * Date Author Notes * 2018-03-30 chenyong first version * 2018-04-14 chenyong modify parse arguments + * 2025-01-02 dongly support SERIAL_V2 */ #include @@ -565,7 +566,7 @@ int at_server_init(void) RT_ASSERT(at_server_local->device->type == RT_Device_Class_Char); rt_device_set_rx_indicate(at_server_local->device, at_rx_ind); - + #ifdef RT_USING_SERIAL_V2 open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_RX_NON_BLOCKING); #else From 3c62099b3481e21e5895ec81a1b56a0a7f403458 Mon Sep 17 00:00:00 2001 From: chinky Date: Fri, 3 Jan 2025 11:24:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E7=94=A8=20/*=20*/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/src/at_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 3b5fd40f399..81879d84021 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -972,7 +972,7 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz, rt_size_t send_bu { open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX); } -#endif // RT_USING_SERIAL_V2 +#endif /* RT_USING_SERIAL_V2 */ RT_ASSERT(open_result == RT_EOK); } else