修改一些代码保证stm32编译通过
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
CodeQL / Analyze (c-cpp) (push) Has been cancelled
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
CodeQL / Analyze (c-cpp) (push) Has been cancelled
This commit is contained in:
@@ -98,16 +98,16 @@ int sys_read (int fhdl, char *buf, size_t count) {
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
// Default logging with on-board UART
|
// Default logging with on-board UART
|
||||||
int sys_write (int fhdl, const char *buf, size_t count) {
|
// int sys_write (int fhdl, const char *buf, size_t count) {
|
||||||
(void) fhdl;
|
// (void) fhdl;
|
||||||
return board_uart_write(buf, (int) count);
|
// return board_uart_write(buf, (int) count);
|
||||||
}
|
// }
|
||||||
|
|
||||||
int sys_read (int fhdl, char *buf, size_t count) {
|
// int sys_read (int fhdl, char *buf, size_t count) {
|
||||||
(void) fhdl;
|
// (void) fhdl;
|
||||||
int rd = board_uart_read((uint8_t*) buf, (int) count);
|
// int rd = board_uart_read((uint8_t*) buf, (int) count);
|
||||||
return (rd > 0) ? rd : -1;
|
// return (rd > 0) ? rd : -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -84,7 +84,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BOARD_DEVICE_RHPORT_SPEED
|
#ifndef BOARD_DEVICE_RHPORT_SPEED
|
||||||
#define BOARD_DEVICE_RHPORT_SPEED PKG_TINYUSB_DEVICE_PORT_SPEED
|
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_DEVICE_RHPORT_NUM == 0
|
#if BOARD_DEVICE_RHPORT_NUM == 0
|
||||||
@@ -103,11 +103,11 @@ extern "C" {
|
|||||||
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
|
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
|
||||||
*/
|
*/
|
||||||
#ifndef CFG_TUSB_MEM_SECTION
|
#ifndef CFG_TUSB_MEM_SECTION
|
||||||
#define CFG_TUSB_MEM_SECTION rt_section(PKG_TINYUSB_MEM_SECTION)
|
#define CFG_TUSB_MEM_SECTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUSB_MEM_ALIGN
|
#ifndef CFG_TUSB_MEM_ALIGN
|
||||||
#define CFG_TUSB_MEM_ALIGN rt_align(PKG_TINYUSB_MEM_ALIGN)
|
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@@ -120,16 +120,20 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
||||||
#define CFG_TUD_ENDPOINT0_SIZE PKG_TINYUSB_EDPT0_SIZE
|
#define CFG_TUD_ENDPOINT0_SIZE 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CFG_TUD_CDC
|
||||||
|
#define CFG_TUD_CDC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CDC FIFO size of TX and RX
|
// CDC FIFO size of TX and RX
|
||||||
#define CFG_TUD_CDC_RX_BUFSIZE PKG_TINYUSB_DEVICE_CDC_RX_BUFSIZE
|
#define CFG_TUD_CDC_RX_BUFSIZE 128
|
||||||
#define CFG_TUD_CDC_TX_BUFSIZE PKG_TINYUSB_DEVICE_CDC_TX_BUFSIZE
|
#define CFG_TUD_CDC_TX_BUFSIZE 128
|
||||||
|
|
||||||
#define CFG_TUD_MSC_EP_BUFSIZE PKG_TINYUSB_DEVICE_MSC_EP_BUFSIZE
|
#define CFG_TUD_MSC_EP_BUFSIZE 32
|
||||||
|
|
||||||
#define CFG_TUD_HID_EP_BUFSIZE PKG_TINYUSB_DEVICE_HID_EP_BUFSIZE
|
#define CFG_TUD_HID_EP_BUFSIZE 32
|
||||||
|
|
||||||
#ifndef PKG_TINYUSB_DEVICE_CDC_STRING
|
#ifndef PKG_TINYUSB_DEVICE_CDC_STRING
|
||||||
#define PKG_TINYUSB_DEVICE_CDC_STRING ""
|
#define PKG_TINYUSB_DEVICE_CDC_STRING ""
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef __RTTHREAD__
|
#ifdef __RTTHREAD__
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
#include "bsp_init.h"
|
||||||
|
|
||||||
#define DBG_TAG "TinyUSB"
|
#define DBG_TAG "TinyUSB"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
@@ -57,13 +58,13 @@ static int init_tinyusb(void)
|
|||||||
{
|
{
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
|
|
||||||
tusb_board_init();
|
// tusb_board_init();
|
||||||
tusb_init();
|
tusb_init();
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
tid = rt_thread_create("tusb", tusb_thread_entry, RT_NULL,
|
tid = rt_thread_create("tusb", tusb_thread_entry, RT_NULL,
|
||||||
PKG_TINYUSB_STACK_SIZE,
|
2048,
|
||||||
PKG_TINYUSB_THREAD_PRIORITY, 10);
|
5, 10);
|
||||||
if (tid == RT_NULL)
|
if (tid == RT_NULL)
|
||||||
#else
|
#else
|
||||||
rt_err_t result;
|
rt_err_t result;
|
||||||
@@ -82,5 +83,6 @@ static int init_tinyusb(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INIT_APP_EXPORT(init_tinyusb);
|
// INIT_APP_EXPORT(init_tinyusb);
|
||||||
|
extern_init(tinyusb, init_tinyusb);
|
||||||
#endif /*__RTTHREAD__*/
|
#endif /*__RTTHREAD__*/
|
||||||
|
@@ -45,27 +45,30 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_task_delay(uint32_t msec) {
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Spinlock API
|
// Spinlock API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
typedef struct rt_spinlock osal_spinlock_t;
|
typedef struct rt_mutex osal_spinlock_t;
|
||||||
|
|
||||||
#define OSAL_SPINLOCK_DEF(_name, _int_set) \
|
#define OSAL_SPINLOCK_DEF(_name, _int_set) \
|
||||||
osal_spinlock_t _name
|
osal_spinlock_t _name
|
||||||
|
|
||||||
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) {
|
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) {
|
||||||
rt_spin_lock_init(ctx);
|
// rt_spin_lock_init(ctx);
|
||||||
|
rt_mutex_init(ctx, "tusb", RT_IPC_FLAG_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr) {
|
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr) {
|
||||||
if (!TUP_MCU_MULTIPLE_CORE && in_isr) {
|
if (!TUP_MCU_MULTIPLE_CORE && in_isr) {
|
||||||
return; // single core MCU does not need to lock in ISR
|
return; // single core MCU does not need to lock in ISR
|
||||||
}
|
}
|
||||||
rt_spin_lock(ctx);
|
// rt_spin_lock(ctx);
|
||||||
|
rt_mutex_take(ctx, RT_WAITING_FOREVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr) {
|
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr) {
|
||||||
if (!TUP_MCU_MULTIPLE_CORE && in_isr) {
|
if (!TUP_MCU_MULTIPLE_CORE && in_isr) {
|
||||||
return; // single core MCU does not need to lock in ISR
|
return; // single core MCU does not need to lock in ISR
|
||||||
}
|
}
|
||||||
rt_spin_unlock(ctx);
|
// rt_spin_unlock(ctx);
|
||||||
|
rt_mutex_release(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@@ -48,11 +48,11 @@ extern "C" {
|
|||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
|
||||||
#include "stm32f4xx.h"
|
#include "stm32f4xx.h"
|
||||||
#define EP_MAX_FS USB_OTG_FS_MAX_IN_ENDPOINTS
|
#define EP_MAX_FS 4
|
||||||
#define EP_FIFO_SIZE_FS USB_OTG_FS_TOTAL_FIFO_SIZE
|
#define EP_FIFO_SIZE_FS 256
|
||||||
|
|
||||||
#define EP_MAX_HS USB_OTG_HS_MAX_IN_ENDPOINTS
|
#define EP_MAX_HS 4
|
||||||
#define EP_FIFO_SIZE_HS USB_OTG_HS_TOTAL_FIFO_SIZE
|
#define EP_FIFO_SIZE_HS 256
|
||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
|
||||||
#include "stm32h7xx.h"
|
#include "stm32h7xx.h"
|
||||||
|
Reference in New Issue
Block a user