[bsp][Infineon] Update the peripherals of XMC7100D

This commit is contained in:
hydevcode 2025-04-27 14:09:44 +08:00 committed by Rbb666
parent 8b968c3761
commit b4e051a890
7 changed files with 132 additions and 2 deletions

View File

@ -7,6 +7,7 @@
* Date Author Notes * Date Author Notes
* 2022-07-18 Rbb666 first version * 2022-07-18 Rbb666 first version
* 2023-03-30 Rbb666 update spi driver * 2023-03-30 Rbb666 update spi driver
* 2025-04-27 Hydevcode update spi driver
*/ */
#include <drv_spi.h> #include <drv_spi.h>
@ -28,6 +29,9 @@
#ifdef BSP_USING_SPI3 #ifdef BSP_USING_SPI3
static struct rt_spi_bus spi_bus3; static struct rt_spi_bus spi_bus3;
#endif #endif
#ifdef BSP_USING_SPI5
static struct rt_spi_bus spi_bus5;
#endif
#ifdef BSP_USING_SPI6 #ifdef BSP_USING_SPI6
static struct rt_spi_bus spi_bus6; static struct rt_spi_bus spi_bus6;
#endif #endif
@ -50,6 +54,14 @@ static struct ifx_spi_handle spi_bus_obj[] =
.mosi_pin = GET_PIN(6, 0), .mosi_pin = GET_PIN(6, 0),
}, },
#endif #endif
#if defined(BSP_USING_SPI5)
{
.bus_name = "spi5",
.sck_pin = GET_PIN(7, 2),
.miso_pin = GET_PIN(7, 0),
.mosi_pin = GET_PIN(7, 1),
},
#endif
#if defined(BSP_USING_SPI6) #if defined(BSP_USING_SPI6)
{ {
.bus_name = "spi6", .bus_name = "spi6",

View File

@ -7,3 +7,10 @@ Drivers.I2C:
kconfig: kconfig:
- CONFIG_BSP_USING_I2C=y - CONFIG_BSP_USING_I2C=y
- CONFIG_BSP_USING_HW_I2C1=y - CONFIG_BSP_USING_HW_I2C1=y
# ------ Peripheral CI ------
Peripheral.tfcard:
kconfig:
- CONFIG_BSP_USING_TF_CARD=y
Peripheral.qmi8658:
kconfig:
- CONFIG_BSP_USING_QMI8658=y

View File

@ -15,6 +15,24 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_UART select BSP_USING_UART
select BSP_USING_UART4 select BSP_USING_UART4
default y default y
menuconfig BSP_USING_TF_CARD
bool "Enable TF_CARD"
select BSP_USING_SPI
select RT_USING_SPI_MSD
select RT_USING_DFS
select RT_USING_DFS_DEVFS
select RT_USING_DFS_ELMFAT
default n
if BSP_USING_TF_CARD
config BSP_USING_SPI_FLASH
bool "Using SPI TO SDCARD"
default y
endif
config BSP_USING_QMI8658
bool "Enable QMI8658"
select BSP_USING_I2C
select PKG_USING_QMI8658
default n
endmenu endmenu
menu "On-chip Peripheral Drivers" menu "On-chip Peripheral Drivers"
@ -47,7 +65,7 @@ menu "On-chip Peripheral Drivers"
if BSP_USING_I2C if BSP_USING_I2C
menuconfig BSP_USING_HW_I2C1 menuconfig BSP_USING_HW_I2C1
bool "Enable BSP_USING_HW_I2C1" bool "Enable BSP_USING_HW_I2C1"
default n default y
if BSP_USING_HW_I2C1 if BSP_USING_HW_I2C1
config BSP_I2C1_SCL_PIN config BSP_I2C1_SCL_PIN
int "BSP_I2C1_SCL_PIN number(18,2)" int "BSP_I2C1_SCL_PIN number(18,2)"
@ -59,7 +77,15 @@ menu "On-chip Peripheral Drivers"
default 145 default 145
endif endif
endif endif
menuconfig BSP_USING_SPI
bool "Enable SPI"
default n
select RT_USING_SPI
if BSP_USING_SPI
config BSP_USING_SPI5
bool "Enable BSP_USING_SPI5"
default y
endif
endmenu endmenu
endmenu endmenu

View File

@ -58,4 +58,9 @@ CPPDEFINES = ['XMC7100D_F144K4160',
'TARGET_APP_KIT_XMC71_EVK_LITE_V2'] 'TARGET_APP_KIT_XMC71_EVK_LITE_V2']
group = DefineGroup('Drivers', src, depend=[''], CPPPATH=path, CPPDEFINES=CPPDEFINES) group = DefineGroup('Drivers', src, depend=[''], CPPPATH=path, CPPDEFINES=CPPDEFINES)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group') Return('group')

View File

@ -0,0 +1,19 @@
import os
from building import *
objs = []
cwd = GetCurrentDir()
# add general drivers
src = []
path = [cwd]
if GetDepend(['BSP_USING_SPI_FLASH']):
src += Glob('spi_flash_init.c')
if GetDepend(['BSP_USING_TF_CARD']):
src += Glob('drv_filesystem.c')
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
Return('group')

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-04-27 Hydevcode first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <dfs_fs.h>
#define DBG_TAG "app.filesystem"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifdef BSP_USING_TF_CARD
static int filesystem_mount(void)
{
//elm-fat
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
{
LOG_I("Filesystem initialized!");
}
else
{
LOG_E("Failed to initialize filesystem!");
}
return 0;
}
INIT_APP_EXPORT(filesystem_mount);
#endif /*BSP_USING_TF_CARD*/

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-04-27 Hydevcode first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "drv_spi.h"
#include "dev_spi_msd.h"
#include <dfs_fs.h>
#ifdef BSP_USING_SPI_FLASH
static int rt_spi_flash_init(void)
{
rt_hw_spi_device_attach("spi5", "spi30", GET_PIN(7, 3));
if (RT_NULL == msd_init("sd0", "spi30"))
{
return -RT_ERROR;
}
return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_spi_flash_init);
#endif /* BSP_USING_SPI_FLASH */