mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
【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:
7
.github/ALL_BSP_COMPILE.json
vendored
7
.github/ALL_BSP_COMPILE.json
vendored
@@ -490,6 +490,13 @@
|
|||||||
"SUB_RTT_BSP": [
|
"SUB_RTT_BSP": [
|
||||||
"xuantie/virt64/c906"
|
"xuantie/virt64/c906"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RTT_BSP": "allwinner-smart",
|
||||||
|
"RTT_TOOL_CHAIN": "sourcery-riscv64-general-toolchain",
|
||||||
|
"SUB_RTT_BSP": [
|
||||||
|
"allwinner/d1s"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
8
.github/workflows/bsp_buildings.yml
vendored
8
.github/workflows/bsp_buildings.yml
vendored
@@ -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
|
/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
|
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
|
- name: Install Xuantie-900-gcc-elf-newlib Tools
|
||||||
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-Xuantie-900-gcc-elf-newlib' && success() }}
|
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-Xuantie-900-gcc-elf-newlib' && success() }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ extern "C"
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <interrupt.h>
|
#include "../../../libos/include/interrupt.h"
|
||||||
|
|
||||||
typedef enum hal_irqreturn {
|
typedef enum hal_irqreturn {
|
||||||
HAL_IRQ_OK = (0 << 0),
|
HAL_IRQ_OK = (0 << 0),
|
||||||
|
|||||||
@@ -333,6 +333,9 @@ struct rt_serial_device
|
|||||||
|
|
||||||
struct rt_spinlock spinlock;
|
struct rt_spinlock spinlock;
|
||||||
|
|
||||||
|
#ifdef RT_USING_SERIAL_BYPASS
|
||||||
|
struct rt_serial_bypass* bypass;
|
||||||
|
#endif
|
||||||
struct rt_device_notify rx_notify;
|
struct rt_device_notify rx_notify;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -152,10 +152,10 @@ extern "C" {
|
|||||||
#include "drivers/dev_serial_v2.h"
|
#include "drivers/dev_serial_v2.h"
|
||||||
#else
|
#else
|
||||||
#include "drivers/dev_serial.h"
|
#include "drivers/dev_serial.h"
|
||||||
|
#endif /* RT_USING_SERIAL_V2 */
|
||||||
#ifdef RT_USING_SERIAL_BYPASS
|
#ifdef RT_USING_SERIAL_BYPASS
|
||||||
#include "drivers/serial_bypass.h"
|
#include "drivers/serial_bypass.h"
|
||||||
#endif /* RT_USING_SERIAL_BYPASS */
|
#endif /* RT_USING_SERIAL_BYPASS */
|
||||||
#endif
|
|
||||||
#endif /* RT_USING_SERIAL */
|
#endif /* RT_USING_SERIAL */
|
||||||
|
|
||||||
#ifdef RT_USING_I2C
|
#ifdef RT_USING_I2C
|
||||||
|
|||||||
@@ -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));
|
serial->bypass = rt_malloc(sizeof(struct rt_serial_bypass));
|
||||||
rt_memset(serial->bypass, 0, 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);
|
serial->bypass->pipe = rt_ringbuffer_create(serial->config.bufsz);
|
||||||
|
#endif
|
||||||
serial->bypass->mutex = rt_mutex_create("serial_bypass", RT_IPC_FLAG_FIFO);
|
serial->bypass->mutex = rt_mutex_create("serial_bypass", RT_IPC_FLAG_FIFO);
|
||||||
|
|
||||||
return RT_EOK;
|
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));
|
level = rt_spin_lock_irqsave(&(serial->spinlock));
|
||||||
|
|
||||||
/* there's no data: */
|
/* 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))
|
if ((rx_fifo->get_index == rx_fifo->put_index) && (rx_fifo->is_full == RT_FALSE))
|
||||||
{
|
{
|
||||||
/* no data, enable interrupt and break out */
|
/* 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;
|
rx_fifo->is_full = RT_FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* enable interrupt */
|
/* enable interrupt */
|
||||||
rt_spin_unlock_irqrestore(&(serial->spinlock), level);
|
rt_spin_unlock_irqrestore(&(serial->spinlock), level);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user