more board_api.h rename

This commit is contained in:
hathach
2023-08-03 15:50:52 +07:00
parent cf91660cee
commit a5768f52b4
56 changed files with 80 additions and 88 deletions

View File

@@ -24,11 +24,11 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#ifndef _BSP_BOARD_H_ #ifndef _BOARD_API_H_
#define _BSP_BOARD_H_ #define _BOARD_API_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdint.h> #include <stdint.h>
@@ -62,40 +62,36 @@ uint32_t board_button_read(void);
// Get characters from UART // Get characters from UART
// Return number of read bytes // Return number of read bytes
int board_uart_read(uint8_t* buf, int len); int board_uart_read(uint8_t *buf, int len);
// Send characters to UART // Send characters to UART
// Return number of sent bytes // Return number of sent bytes
int board_uart_write(void const * buf, int len); int board_uart_write(void const *buf, int len);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_NONE
// Get current milliseconds, must be implemented when no RTOS is used // Get current milliseconds, must be implemented when no RTOS is used
uint32_t board_millis(void); uint32_t board_millis(void);
#elif CFG_TUSB_OS == OPT_OS_FREERTOS #elif CFG_TUSB_OS == OPT_OS_FREERTOS
static inline uint32_t board_millis(void) static inline uint32_t board_millis(void) {
{ return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ );
return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ ); }
}
#elif CFG_TUSB_OS == OPT_OS_MYNEWT #elif CFG_TUSB_OS == OPT_OS_MYNEWT
static inline uint32_t board_millis(void) static inline uint32_t board_millis(void) {
{ return os_time_ticks_to_ms32( os_time_get() );
return os_time_ticks_to_ms32( os_time_get() ); }
}
#elif CFG_TUSB_OS == OPT_OS_PICO #elif CFG_TUSB_OS == OPT_OS_PICO
#include "pico/time.h" #include "pico/time.h"
static inline uint32_t board_millis(void) static inline uint32_t board_millis(void) {
{ return to_ms_since_boot(get_absolute_time());
return to_ms_since_boot(get_absolute_time()); }
}
#elif CFG_TUSB_OS == OPT_OS_RTTHREAD #elif CFG_TUSB_OS == OPT_OS_RTTHREAD
static inline uint32_t board_millis(void) static inline uint32_t board_millis(void) {
{ return (((uint64_t)rt_tick_get()) * 1000 / RT_TICK_PER_SECOND);
return (((uint64_t)rt_tick_get()) * 1000 / RT_TICK_PER_SECOND); }
}
#else #else
#error "board_millis() is not implemented for this OS" #error "board_millis() is not implemented for this OS"
@@ -104,22 +100,18 @@ int board_uart_write(void const * buf, int len);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Helper functions // Helper functions
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
static inline void board_led_on(void) static inline void board_led_on(void) {
{
board_led_write(true); board_led_write(true);
} }
static inline void board_led_off(void) static inline void board_led_off(void) {
{
board_led_write(false); board_led_write(false);
} }
// TODO remove // TODO remove
static inline void board_delay(uint32_t ms) static inline void board_delay(uint32_t ms) {
{
uint32_t start_ms = board_millis(); uint32_t start_ms = board_millis();
while (board_millis() - start_ms < ms) while ( board_millis() - start_ms < ms ) {
{
#if CFG_TUD_ENABLED #if CFG_TUD_ENABLED
// take chance to run usb background // take chance to run usb background
tud_task(); tud_task();
@@ -131,7 +123,7 @@ static inline void board_delay(uint32_t ms)
int board_getchar(void); int board_getchar(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "broadcom/cpu.h" #include "broadcom/cpu.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "broadcom/cpu.h" #include "broadcom/cpu.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include <ft900.h> #include <ft900.h>

View File

@@ -28,7 +28,7 @@
#include "debug_uart.h" #include "debug_uart.h"
#include "ch32v30x.h" #include "ch32v30x.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include <hal/hal_gpio.h> #include <hal/hal_gpio.h>
#include <mcu/mcu.h> #include <mcu/mcu.h>

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include <hal/hal_gpio.h> #include <hal/hal_gpio.h>
#include <mcu/mcu.h> #include <mcu/mcu.h>

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "esp_rom_gpio.h" #include "esp_rom_gpio.h"

View File

@@ -28,7 +28,7 @@
#include <malloc.h> #include <malloc.h>
#include <irqflags.h> #include <irqflags.h>
#include <f1c100s-irq.h> #include <f1c100s-irq.h>
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
extern void sys_uart_putc(char c); extern void sys_uart_putc(char c);

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
// Suppress warning caused by mcu driver // Suppress warning caused by mcu driver

View File

@@ -25,7 +25,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"
#include "fsl_port.h" #include "fsl_port.h"

View File

@@ -25,7 +25,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"
#include "fsl_port.h" #include "fsl_port.h"

View File

@@ -25,7 +25,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "fsl_smc.h" #include "fsl_smc.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"

View File

@@ -23,7 +23,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "fsl_device_registers.h" #include "fsl_device_registers.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "chip.h" #include "chip.h"
#include "bsp/board.h" #include "bsp/board_api.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler // Forward USB interrupt events to TinyUSB IRQ Handler

View File

@@ -25,7 +25,7 @@
*/ */
#include "chip.h" #include "chip.h"
#include "bsp/board.h" #include "bsp/board_api.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler // Forward USB interrupt events to TinyUSB IRQ Handler

View File

@@ -25,7 +25,7 @@
*/ */
#include "chip.h" #include "chip.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -25,7 +25,7 @@
*/ */
#include "chip.h" #include "chip.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#ifdef BOARD_TUD_RHPORT #ifdef BOARD_TUD_RHPORT

View File

@@ -25,7 +25,7 @@
*/ */
#include "chip.h" #include "chip.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -30,7 +30,7 @@
#include "fsl_iocon.h" #include "fsl_iocon.h"
#include "fsl_usart.h" #include "fsl_usart.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#ifdef BOARD_TUD_RHPORT #ifdef BOARD_TUD_RHPORT

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "fsl_device_registers.h" #include "fsl_device_registers.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "fsl_device_registers.h" #include "fsl_device_registers.h"
#include "fsl_gpio.h" #include "fsl_gpio.h"
#include "fsl_lpuart.h" #include "fsl_lpuart.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "msp430.h" #include "msp430.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "msp.h" #include "msp.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
// Suppress warning caused by mcu driver // Suppress warning caused by mcu driver

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "NuMicro.h" #include "NuMicro.h"
#include "clk.h" #include "clk.h"
#include "sys.h" #include "sys.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "NuMicro.h" #include "NuMicro.h"
#include "clk.h" #include "clk.h"
#include "sys.h" #include "sys.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "NuMicro.h" #include "NuMicro.h"
#include "clk.h" #include "clk.h"
#include "sys.h" #include "sys.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "NUC100Series.h" #include "NUC100Series.h"
#include "clk.h" #include "clk.h"
#include "sys.h" #include "sys.h"

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "NUC505Series.h" #include "NUC505Series.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -45,7 +45,7 @@
#include "r_ioport_api.h" #include "r_ioport_api.h"
#include "renesas.h" #include "renesas.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
/* Key code for writing PRCR register. */ /* Key code for writing PRCR register. */

View File

@@ -52,7 +52,7 @@
* regarding downloading. * regarding downloading.
*/ */
#include "../board.h" #include "bsp/board_api.h"
#include "iodefine.h" #include "iodefine.h"
#include "interrupt_handlers.h" #include "interrupt_handlers.h"

View File

@@ -50,7 +50,7 @@
* regarding downloading. * regarding downloading.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "iodefine.h" #include "iodefine.h"
#include "interrupt_handlers.h" #include "interrupt_handlers.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"

View File

@@ -24,7 +24,7 @@
*/ */
#include <sam.h> #include <sam.h>
#include "bsp/board.h" #include "bsp/board_api.h"
#include <hal/include/hal_gpio.h> #include <hal/include/hal_gpio.h>

View File

@@ -24,7 +24,7 @@
*/ */
#include <sam.h> #include <sam.h>
#include "bsp/board.h" #include "bsp/board_api.h"
#include <hal/include/hal_gpio.h> #include <hal/include/hal_gpio.h>

View File

@@ -24,7 +24,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "peripheral_clk_config.h" #include "peripheral_clk_config.h"
#include "hpl/usart/hpl_usart_base.h" #include "hpl/usart/hpl_usart_base.h"

View File

@@ -24,7 +24,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "peripheral_clk_config.h" #include "peripheral_clk_config.h"
#include "hpl/usart/hpl_usart_base.h" #include "hpl/usart/hpl_usart_base.h"

View File

@@ -24,7 +24,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "peripheral_clk_config.h" #include "peripheral_clk_config.h"
#include "hal/include/hal_init.h" #include "hal/include/hal_init.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "sam.h" #include "sam.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"

View File

@@ -29,7 +29,7 @@
#include <arch/board/board.h> #include <arch/board/board.h>
#include <arch/chip/pin.h> #include <arch/chip/pin.h>
#include "bsp/board.h" #include "bsp/board_api.h"
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* MACRO TYPEDEF CONSTANT ENUM /* MACRO TYPEDEF CONSTANT ENUM

View File

@@ -25,7 +25,7 @@
*/ */
#include "stm32f0xx_hal.h" #include "stm32f0xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -25,7 +25,7 @@
*/ */
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "bsp/board.h" #include "bsp/board_api.h"
#include "stm32f2xx_hal.h" #include "stm32f2xx_hal.h"

View File

@@ -25,7 +25,7 @@
*/ */
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -27,7 +27,7 @@
*/ */
#include "stm32f7xx_hal.h" #include "stm32f7xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -26,7 +26,7 @@
*/ */
#include "stm32g0xx_hal.h" #include "stm32g0xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -27,7 +27,7 @@
#include "stm32g4xx_hal.h" #include "stm32g4xx_hal.h"
#include "stm32g4xx_ll_bus.h" #include "stm32g4xx_ll_bus.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -28,7 +28,7 @@
*/ */
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -25,7 +25,7 @@
*/ */
#include "stm32l0xx_hal.h" #include "stm32l0xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -26,7 +26,7 @@
*/ */
#include "stm32u5xx_hal.h" #include "stm32u5xx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -25,7 +25,7 @@
*/ */
#include "stm32wbxx_hal.h" #include "stm32wbxx_hal.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -1,5 +1,5 @@
#include "TM4C123.h" #include "TM4C123.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -28,7 +28,7 @@
#include "xmc_scu.h" #include "xmc_scu.h"
#include "xmc_uart.h" #include "xmc_uart.h"
#include "bsp/board.h" #include "bsp/board_api.h"
#include "board.h" #include "board.h"