Skip to content

Commit b81a44b

Browse files
authored
[AT] AT_Device 适配 SERIAL_V2 (#9860)
AT_Device 适配 SERIAL_V2
1 parent f76b97e commit b81a44b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

components/net/at/include/at.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2021, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -14,6 +14,7 @@
1414

1515
#include <stddef.h>
1616
#include <rtthread.h>
17+
#include <rtdevice.h>
1718

1819
#ifdef __cplusplus
1920
extern "C" {

components/net/at/src/at_client.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2023, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -10,6 +10,7 @@
1010
* 2018-08-17 chenyong multiple client support
1111
* 2021-03-17 Meco Man fix a buf of leaking memory
1212
* 2021-07-14 Sszl fix a buf of leaking memory
13+
* 2025-01-02 dongly support SERIAL_V2
1314
*/
1415

1516
#include <at.h>
@@ -960,13 +961,18 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz, rt_size_t send_bu
960961
RT_ASSERT(client->device->type == RT_Device_Class_Char);
961962

962963
rt_device_set_rx_indicate(client->device, at_client_rx_ind);
964+
965+
#ifdef RT_USING_SERIAL_V2
966+
open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_RX_NON_BLOCKING);
967+
#else
963968
/* using DMA mode first */
964969
open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_DMA_RX);
965970
/* using interrupt mode when DMA mode not supported */
966971
if (open_result == -RT_EIO)
967972
{
968973
open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
969974
}
975+
#endif /* RT_USING_SERIAL_V2 */
970976
RT_ASSERT(open_result == RT_EOK);
971977
}
972978
else

components/net/at/src/at_server.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (c) 2006-2021, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
66
* Change Logs:
77
* Date Author Notes
88
* 2018-03-30 chenyong first version
99
* 2018-04-14 chenyong modify parse arguments
10+
* 2025-01-02 dongly support SERIAL_V2
1011
*/
1112

1213
#include <at.h>
@@ -565,13 +566,18 @@ int at_server_init(void)
565566
RT_ASSERT(at_server_local->device->type == RT_Device_Class_Char);
566567

567568
rt_device_set_rx_indicate(at_server_local->device, at_rx_ind);
569+
570+
#ifdef RT_USING_SERIAL_V2
571+
open_result = rt_device_open(client->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_RX_NON_BLOCKING);
572+
#else
568573
/* using DMA mode first */
569574
open_result = rt_device_open(at_server_local->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_DMA_RX);
570575
/* using interrupt mode when DMA mode not supported */
571576
if (open_result == -RT_EIO)
572577
{
573578
open_result = rt_device_open(at_server_local->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
574579
}
580+
#endif /* RT_USING_SERIAL_V2 */
575581
RT_ASSERT(open_result == RT_EOK);
576582
}
577583
else

0 commit comments

Comments
 (0)