【SMART】【BSP】【allwinner】Fix smart serial_v2 bypass compile error issue (#10524)

* Modify the reference path of the header file in the middle section

* format

* Fix smart serial_v2 bypass compile error issue

* add allwinner/d1s ci
This commit is contained in:
rcitach
2025-08-01 20:59:08 +08:00
committed by GitHub
parent d82dd71aef
commit ae50e406da
7 changed files with 573 additions and 490 deletions

View File

@@ -490,6 +490,13 @@
"SUB_RTT_BSP": [
"xuantie/virt64/c906"
]
},
{
"RTT_BSP": "allwinner-smart",
"RTT_TOOL_CHAIN": "sourcery-riscv64-general-toolchain",
"SUB_RTT_BSP": [
"allwinner/d1s"
]
}
]
}

View File

@@ -163,6 +163,14 @@ jobs:
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
- name: Install Riscv64 rt-thread smart general toolchain
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv64-general-toolchain' && success() }}
run: |
wget -q https://github.com/RT-Thread/rt-thread/releases/download/v5.2.0/riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu_252938-345d8b6e45.tar.bz2
sudo tar xjf riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu_252938-345d8b6e45.tar.bz2 -C /opt
/opt/riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc --version
echo "RTT_EXEC_PATH=/opt/riscv64gc-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
- name: Install Xuantie-900-gcc-elf-newlib Tools
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-Xuantie-900-gcc-elf-newlib' && success() }}
run: |

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ extern "C"
#include <stdint.h>
#include <stddef.h>
#include <interrupt.h>
#include "../../../libos/include/interrupt.h"
typedef enum hal_irqreturn {
HAL_IRQ_OK = (0 << 0),

View File

@@ -333,6 +333,9 @@ struct rt_serial_device
struct rt_spinlock spinlock;
#ifdef RT_USING_SERIAL_BYPASS
struct rt_serial_bypass* bypass;
#endif
struct rt_device_notify rx_notify;
};

View File

@@ -152,10 +152,10 @@ extern "C" {
#include "drivers/dev_serial_v2.h"
#else
#include "drivers/dev_serial.h"
#endif /* RT_USING_SERIAL_V2 */
#ifdef RT_USING_SERIAL_BYPASS
#include "drivers/serial_bypass.h"
#endif /* RT_USING_SERIAL_BYPASS */
#endif
#endif /* RT_USING_SERIAL */
#ifdef RT_USING_I2C

View File

@@ -41,7 +41,11 @@ rt_err_t rt_serial_bypass_init(struct rt_serial_device* serial)
{
serial->bypass = rt_malloc(sizeof(struct rt_serial_bypass));
rt_memset(serial->bypass, 0, sizeof(struct rt_serial_bypass));
#ifdef RT_USING_SERIAL_V2
serial->bypass->pipe = rt_ringbuffer_create(serial->config.rx_bufsz);
#else
serial->bypass->pipe = rt_ringbuffer_create(serial->config.bufsz);
#endif
serial->bypass->mutex = rt_mutex_create("serial_bypass", RT_IPC_FLAG_FIFO);
return RT_EOK;
@@ -140,6 +144,22 @@ static inline rt_err_t _bypass_getchar_form_serial_fifo(struct rt_serial_device*
level = rt_spin_lock_irqsave(&(serial->spinlock));
/* there's no data: */
#ifdef RT_USING_SERIAL_V2
rt_size_t ringbuf_date_stat;
ringbuf_date_stat = rt_ringbuffer_data_len(&rx_fifo->rb);
if(!ringbuf_date_stat)
{
/* no data, enable interrupt and break out */
rt_spin_unlock_irqrestore(&(serial->spinlock), level);
return -RT_EEMPTY;
}
if(!rt_ringbuffer_getchar(&rx_fifo->rb, (rt_uint8_t *)ch))
{
/* Failed to read data */
rt_spin_unlock_irqrestore(&(serial->spinlock), level);
return -RT_EOK;
}
#else
if ((rx_fifo->get_index == rx_fifo->put_index) && (rx_fifo->is_full == RT_FALSE))
{
/* no data, enable interrupt and break out */
@@ -156,7 +176,7 @@ static inline rt_err_t _bypass_getchar_form_serial_fifo(struct rt_serial_device*
{
rx_fifo->is_full = RT_FALSE;
}
#endif
/* enable interrupt */
rt_spin_unlock_irqrestore(&(serial->spinlock), level);