Skip to content

Commit b4e051a

Browse files
hydevcodeRbb666
authored andcommitted
[bsp][Infineon] Update the peripherals of XMC7100D
1 parent 8b968c3 commit b4e051a

File tree

7 files changed

+132
-2
lines changed

7 files changed

+132
-2
lines changed

bsp/Infineon/libraries/HAL_Drivers/drv_spi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Date Author Notes
88
* 2022-07-18 Rbb666 first version
99
* 2023-03-30 Rbb666 update spi driver
10+
* 2025-04-27 Hydevcode update spi driver
1011
*/
1112

1213
#include <drv_spi.h>
@@ -28,6 +29,9 @@
2829
#ifdef BSP_USING_SPI3
2930
static struct rt_spi_bus spi_bus3;
3031
#endif
32+
#ifdef BSP_USING_SPI5
33+
static struct rt_spi_bus spi_bus5;
34+
#endif
3135
#ifdef BSP_USING_SPI6
3236
static struct rt_spi_bus spi_bus6;
3337
#endif
@@ -50,6 +54,14 @@ static struct ifx_spi_handle spi_bus_obj[] =
5054
.mosi_pin = GET_PIN(6, 0),
5155
},
5256
#endif
57+
#if defined(BSP_USING_SPI5)
58+
{
59+
.bus_name = "spi5",
60+
.sck_pin = GET_PIN(7, 2),
61+
.miso_pin = GET_PIN(7, 0),
62+
.mosi_pin = GET_PIN(7, 1),
63+
},
64+
#endif
5365
#if defined(BSP_USING_SPI6)
5466
{
5567
.bus_name = "spi6",

bsp/Infineon/xmc7100d-f144k4160aa/.ci/attachconfig/ci.attachconfig.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ Drivers.I2C:
77
kconfig:
88
- CONFIG_BSP_USING_I2C=y
99
- CONFIG_BSP_USING_HW_I2C1=y
10+
# ------ Peripheral CI ------
11+
Peripheral.tfcard:
12+
kconfig:
13+
- CONFIG_BSP_USING_TF_CARD=y
14+
Peripheral.qmi8658:
15+
kconfig:
16+
- CONFIG_BSP_USING_QMI8658=y

bsp/Infineon/xmc7100d-f144k4160aa/board/Kconfig

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ menu "Onboard Peripheral Drivers"
1515
select BSP_USING_UART
1616
select BSP_USING_UART4
1717
default y
18+
menuconfig BSP_USING_TF_CARD
19+
bool "Enable TF_CARD"
20+
select BSP_USING_SPI
21+
select RT_USING_SPI_MSD
22+
select RT_USING_DFS
23+
select RT_USING_DFS_DEVFS
24+
select RT_USING_DFS_ELMFAT
25+
default n
26+
if BSP_USING_TF_CARD
27+
config BSP_USING_SPI_FLASH
28+
bool "Using SPI TO SDCARD"
29+
default y
30+
endif
31+
config BSP_USING_QMI8658
32+
bool "Enable QMI8658"
33+
select BSP_USING_I2C
34+
select PKG_USING_QMI8658
35+
default n
1836
endmenu
1937

2038
menu "On-chip Peripheral Drivers"
@@ -47,7 +65,7 @@ menu "On-chip Peripheral Drivers"
4765
if BSP_USING_I2C
4866
menuconfig BSP_USING_HW_I2C1
4967
bool "Enable BSP_USING_HW_I2C1"
50-
default n
68+
default y
5169
if BSP_USING_HW_I2C1
5270
config BSP_I2C1_SCL_PIN
5371
int "BSP_I2C1_SCL_PIN number(18,2)"
@@ -59,7 +77,15 @@ menu "On-chip Peripheral Drivers"
5977
default 145
6078
endif
6179
endif
62-
80+
menuconfig BSP_USING_SPI
81+
bool "Enable SPI"
82+
default n
83+
select RT_USING_SPI
84+
if BSP_USING_SPI
85+
config BSP_USING_SPI5
86+
bool "Enable BSP_USING_SPI5"
87+
default y
88+
endif
6389
endmenu
6490

6591
endmenu

bsp/Infineon/xmc7100d-f144k4160aa/board/SConscript

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ CPPDEFINES = ['XMC7100D_F144K4160',
5858
'TARGET_APP_KIT_XMC71_EVK_LITE_V2']
5959
group = DefineGroup('Drivers', src, depend=[''], CPPPATH=path, CPPDEFINES=CPPDEFINES)
6060

61+
list = os.listdir(cwd)
62+
for item in list:
63+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
64+
group = group + SConscript(os.path.join(item, 'SConscript'))
65+
6166
Return('group')
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
from building import *
3+
4+
objs = []
5+
cwd = GetCurrentDir()
6+
7+
# add general drivers
8+
src = []
9+
path = [cwd]
10+
11+
if GetDepend(['BSP_USING_SPI_FLASH']):
12+
src += Glob('spi_flash_init.c')
13+
14+
if GetDepend(['BSP_USING_TF_CARD']):
15+
src += Glob('drv_filesystem.c')
16+
17+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
18+
19+
Return('group')
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2025-04-27 Hydevcode first version
9+
*/
10+
#include <rtthread.h>
11+
#include <rtdevice.h>
12+
#include <dfs_fs.h>
13+
14+
#define DBG_TAG "app.filesystem"
15+
#define DBG_LVL DBG_INFO
16+
#include <rtdbg.h>
17+
18+
#ifdef BSP_USING_TF_CARD
19+
static int filesystem_mount(void)
20+
{
21+
//elm-fat
22+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
23+
{
24+
LOG_I("Filesystem initialized!");
25+
}
26+
else
27+
{
28+
LOG_E("Failed to initialize filesystem!");
29+
}
30+
return 0;
31+
}
32+
INIT_APP_EXPORT(filesystem_mount);
33+
#endif /*BSP_USING_TF_CARD*/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2025-04-27 Hydevcode first version
9+
*/
10+
#include <rtthread.h>
11+
#include <rtdevice.h>
12+
#include "drv_spi.h"
13+
#include "dev_spi_msd.h"
14+
#include <dfs_fs.h>
15+
16+
#ifdef BSP_USING_SPI_FLASH
17+
static int rt_spi_flash_init(void)
18+
{
19+
rt_hw_spi_device_attach("spi5", "spi30", GET_PIN(7, 3));
20+
if (RT_NULL == msd_init("sd0", "spi30"))
21+
{
22+
return -RT_ERROR;
23+
}
24+
25+
return RT_EOK;
26+
}
27+
INIT_COMPONENT_EXPORT(rt_spi_flash_init);
28+
#endif /* BSP_USING_SPI_FLASH */

0 commit comments

Comments
 (0)