完善 Ifx bsp (#7078)

* add uart6 support

* [ifx] add rw007 support

* [ifx] add spi6 support

* [ifx] fix rw007 cs pin

* [ifx] change default console to uart6
This commit is contained in:
guo
2023-03-23 09:40:46 +08:00
committed by GitHub
parent 588f5eb2c9
commit 767c18aafc
9 changed files with 872 additions and 244 deletions
@@ -26,12 +26,27 @@ struct ifx_sw_spi_cs
rt_uint32_t pin;
};
#ifdef BSP_USING_SPI0
static struct rt_spi_bus spi_bus0;
#endif
#ifdef BSP_USING_SPI3
static struct rt_spi_bus spi_bus3;
#endif
#ifdef BSP_USING_SPI6
static struct rt_spi_bus spi_bus6;
#endif
static struct ifx_spi spi_bus_obj[] =
{
#ifdef BSP_USING_SPI0
{
.bus_name = "spi0",
.spi_bus = &spi_bus0,
.sck_pin = GET_PIN(0, 4),
.miso_pin = GET_PIN(0, 3),
.mosi_pin = GET_PIN(0, 2),
},
#endif
#ifdef BSP_USING_SPI3
{
.bus_name = "spi3",
@@ -41,6 +56,15 @@ static struct ifx_spi spi_bus_obj[] =
.mosi_pin = GET_PIN(6, 0),
},
#endif
#ifdef BSP_USING_SPI6
{
.bus_name = "spi6",
.spi_bus = &spi_bus6,
.sck_pin = GET_PIN(12, 2),
.miso_pin = GET_PIN(12, 1),
.mosi_pin = GET_PIN(12, 0),
},
#endif
};
/* private rt-thread spi ops function */
@@ -34,6 +34,9 @@ enum
#ifdef BSP_USING_UART5
UART5_INDEX,
#endif
#ifdef BSP_USING_UART6
UART6_INDEX,
#endif
};
static struct ifx_uart_config uart_config[] =
@@ -56,6 +59,9 @@ static struct ifx_uart_config uart_config[] =
#ifdef BSP_USING_UART5
UART5_CONFIG,
#endif
#ifdef BSP_USING_UART6
UART6_CONFIG,
#endif
};
static struct ifx_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
@@ -154,6 +160,19 @@ void uart5_isr_callback(void)
}
#endif
#ifdef BSP_USING_UART6
/* UART5 Interrupt Hanlder */
void uart6_isr_callback(void)
{
/* enter interrupt */
rt_interrupt_enter();
uart_isr(&uart_obj[UART6_INDEX].serial);
/* leave interrupt */
rt_interrupt_leave();
}
#endif
/*
* UARTHS interface
*/
@@ -68,6 +68,14 @@ extern "C"
};
#endif
#ifdef BSP_USING_UART6
/* UART6 device driver structure */
cy_stc_sysint_t UART6_SCB_IRQ_cfg =
{
.intrSrc = (IRQn_Type)scb_6_interrupt_IRQn,
.intrPriority = (7u),
};
#endif
#if defined(BSP_USING_UART0)
#ifndef UART0_CONFIG
#define UART0_CONFIG \
@@ -177,6 +185,21 @@ extern "C"
#endif /* UART5_CONFIG */
#endif /* BSP_USING_UART5 */
#if defined(BSP_USING_UART6)
#ifndef UART6_CONFIG
#define UART6_CONFIG \
{ \
.name = "uart6", \
.tx_pin = P6_5, \
.rx_pin = P6_4, \
.usart_x = SCB6, \
.intrSrc = scb_6_interrupt_IRQn, \
.userIsr = uart_isr_callback(uart6), \
.UART_SCB_IRQ_cfg = &UART6_SCB_IRQ_cfg, \
}
void uart6_isr_callback(void);
#endif /* UART6_CONFIG */
#endif /* BSP_USING_UART6 */
#ifdef __cplusplus
}
#endif
@@ -114,6 +114,14 @@ menu "On-chip Peripheral Drivers"
bool "Enable SPI3 BUS Sample"
default n
endif
menuconfig BSP_USING_SPI6
bool "Enable SPI6 BUS"
default n
if BSP_USING_SPI6
config BSP_USING_SPI6_SAMPLE
bool "Enable SPI6 BUS Sample"
default n
endif
endif
menuconfig BSP_USING_ADC
File diff suppressed because it is too large Load Diff
@@ -10,9 +10,9 @@ config SOC_CY8C624ALQI_S2D42
menu "Onboard Peripheral Drivers"
config BSP_USING_USB_TO_USART
bool "Enable USB TO USART (uart0)"
bool "Enable USB TO USART (uart6)"
select BSP_USING_UART
select BSP_USING_UART0
select BSP_USING_UART6
default y
endmenu
@@ -46,6 +46,9 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_UART5
bool "Enable UART5"
default n
config BSP_USING_UART6
bool "Enable UART6"
default n
endif
menuconfig BSP_USING_PWM
@@ -106,6 +109,14 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SPI
default n
if BSP_USING_SPI
menuconfig BSP_USING_SPI0
bool "Enable SPI0 BUS"
default n
if BSP_USING_SPI0
config BSP_USING_SPI0_SAMPLE
bool "Enable SPI0 BUS Sample"
default n
endif
menuconfig BSP_USING_SPI3
bool "Enable SPI3 BUS"
default n
@@ -255,6 +266,54 @@ menu "Board extended module Drivers"
config BSP_USING_SLIDER
bool "Enable Slider Demo"
default n
menuconfig BSP_USING_RW007
bool "Enable RW007"
default n
select PKG_USING_RW007
select BSP_USING_SPI
select BSP_USING_SPI0
select RW007_NOT_USE_EXAMPLE_DRIVERS
if BSP_USING_RW007
comment "Notice: P5_7 --> 47; P5_6 -->46; P0_5 --> 5; P0_4 --> 4"
config IFX_RW007_SPI_BUS_NAME
string "RW007 BUS NAME"
default "spi0"
config IFX_RW007_WIFI_SSID
string "Wi-Fi SSID"
default "realthread_VIP"
config IFX_RW007_WIFI_PASSWORD
string "Wi-Fi Password"
default "your wifi password"
config IFX_RW007_CS_PIN
int "(INT)CS pin index"
range 1 113
default 5
config IFX_RW007_BOOT0_PIN
int "(INT)BOOT0 pin index (same as spi clk pin)"
range 1 113
default 4
config IFX_RW007_BOOT1_PIN
int "(INT)BOOT1 pin index (same as spi cs pin)"
range 1 113
default 5
config IFX_RW007_INT_BUSY_PIN
int "(INT)INT/BUSY pin index"
range 1 113
default 47
config IFX_RW007_RST_PIN
int "(INT)RESET pin index"
range 1 113
default 46
endif
endmenu
endmenu
@@ -384,9 +384,9 @@ void init_cycfg_pins(void)
cyhal_hwmgr_reserve(&CYBSP_CSD_RX_obj);
#endif //defined (CY_USING_HAL)
Cy_GPIO_Pin_Init(CYBSP_SWO_PORT, CYBSP_SWO_PIN, &CYBSP_SWO_config);
// Cy_GPIO_Pin_Init(CYBSP_SWO_PORT, CYBSP_SWO_PIN, &CYBSP_SWO_config);
#if defined (CY_USING_HAL)
cyhal_hwmgr_reserve(&CYBSP_SWO_obj);
// cyhal_hwmgr_reserve(&CYBSP_SWO_obj);
#endif //defined (CY_USING_HAL)
Cy_GPIO_Pin_Init(CYBSP_SWDIO_PORT, CYBSP_SWDIO_PIN, &CYBSP_SWDIO_config);
File diff suppressed because it is too large Load Diff
@@ -47,7 +47,7 @@
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0"
#define RT_CONSOLE_DEVICE_NAME "uart6"
#define RT_VER_NUM 0x50000
#define RT_USING_CPU_FFS
#define ARCH_ARM
@@ -166,6 +166,11 @@
/* peripheral libraries and drivers */
/* sensors drivers */
/* touch drivers */
/* Kendryte SDK */
@@ -173,6 +178,9 @@
/* AI packages */
/* Signal Processing and Control Algorithm Packages */
/* miscellaneous packages */
/* project laboratory */
@@ -186,16 +194,43 @@
/* Arduino libraries */
/* Sensor libraries */
/* Projects */
/* Display libraries */
/* Sensors */
/* Timing libraries */
/* Display */
/* Project libraries */
/* Timing */
/* Data Processing */
/* Data Storage */
/* Communication */
/* Device Control */
/* Other */
/* Signal IO */
/* Uncategorized */
/* Privated Packages of RealThread */
/* Network Utilities */
/* RT-Thread Smart */
#define SOC_FAMILY_IFX
#define SOC_SERIES_IFX_PSOC62
@@ -212,7 +247,7 @@
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART0
#define BSP_USING_UART6
/* Board extended module Drivers */