diff options
| author | dongly <[email protected]> | 2025-01-03 13:00:33 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-01-03 13:00:33 +0800 |
| commit | b81a44bf744524744b17f4351b3b5a2d4209593e (patch) | |
| tree | fea277bbc4a97bf829876e84d2672912ccd08b68 | |
| parent | f76b97e0c155c27e08a78543b5614c2ac56851a6 (diff) | |
[AT] AT_Device 适配 SERIAL_V2 (#9860)
AT_Device 适配 SERIAL_V2
| -rw-r--r-- | components/net/at/include/at.h | 3 | ||||
| -rw-r--r-- | components/net/at/src/at_client.c | 8 | ||||
| -rw-r--r-- | components/net/at/src/at_server.c | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 2d9e7e51db..bfd4550d2a 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 * @@ -14,6 +14,7 @@ #include <stddef.h> #include <rtthread.h> +#include <rtdevice.h> #ifdef __cplusplus extern "C" { diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 5d665fee66..81879d8402 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 <at.h> @@ -960,6 +961,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 +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 */ 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 de67001e17..7817372948 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 <at.h> @@ -565,6 +566,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 +577,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 |
