4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-19 12:53:30 +08:00

[AT] AT_Device 适配 SERIAL_V2 (#9860)

AT_Device 适配 SERIAL_V2
This commit is contained in:
dongly 2025-01-03 13:00:33 +08:00 committed by GitHub
parent f76b97e0c1
commit b81a44bf74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -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" {

View File

@ -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

View File

@ -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