[bsp][renesas][stm32]Fix some bsp probelm in 5.1.x.

This commit is contained in:
Rbb666 2024-04-18 15:28:52 +08:00 committed by Meco Man
parent 204c3253be
commit 3c9b7b1f96
6 changed files with 104 additions and 18 deletions

View File

@ -599,36 +599,35 @@ menu "Hardware Drivers Config"
bool "Enable RW007"
default n
select PKG_USING_RW007
select BSP_USING_SCI
select BSP_USING_SCI2
select BSP_USING_SCI2_SPI
select BSP_USING_SPI
select BSP_USING_SPI1
select RT_USING_MEMPOOL
select RW007_NOT_USE_EXAMPLE_DRIVERS
if BSP_USING_RW007
config RA_RW007_SPI_BUS_NAME
string "RW007 BUS NAME"
default "sci2s"
default "spi1"
config RA_RW007_CS_PIN
hex "(HEX)CS pin index"
default 0x060C
default 0x040D
config RA_RW007_BOOT0_PIN
hex "(HEX)BOOT0 pin index (same as spi clk pin)"
default 0x060B
default 0x040C
config RA_RW007_BOOT1_PIN
hex "(HEX)BOOT1 pin index (same as spi cs pin)"
default 0x060C
default 0x040D
config RA_RW007_INT_BUSY_PIN
hex "(HEX)INT/BUSY pin index"
default 0x0006
default 0x0800
config RA_RW007_RST_PIN
hex "(HEX)RESET pin index"
default 0x0A08
default 0x0504
endif
endmenu

View File

@ -0,0 +1,22 @@
from building import *
import rtconfig
cwd = GetCurrentDir()
src = []
if GetDepend(['BSP_USING_RW007']):
src += Glob('drv_rw007.c')
CPPPATH = [cwd]
LOCAL_CFLAGS = ''
if rtconfig.PLATFORM in ['gcc', 'armclang']:
LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99'
group = DefineGroup('Drivers', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
Return('group')

View File

@ -0,0 +1,65 @@
#include <rtthread.h>
#include <rtdbg.h>
#ifdef BSP_USING_RW007
#include <rtdevice.h>
#include <drv_spi.h>
#include <board.h>
#include <spi_wifi_rw007.h>
extern void spi_wifi_isr(int vector);
static void rw007_gpio_init(void)
{
/* Configure IO */
rt_pin_mode(RA_RW007_RST_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(RA_RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLDOWN);
/* Reset rw007 and config mode */
rt_pin_write(RA_RW007_RST_PIN, PIN_LOW);
rt_thread_delay(rt_tick_from_millisecond(100));
rt_pin_write(RA_RW007_RST_PIN, PIN_HIGH);
/* Wait rw007 ready(exit busy stat) */
while (!rt_pin_read(RA_RW007_INT_BUSY_PIN))
{
rt_thread_delay(5);
}
rt_thread_delay(rt_tick_from_millisecond(200));
rt_pin_mode(RA_RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLUP);
}
int wifi_spi_device_init(void)
{
char sn_version[32];
uint32_t cs_pin = RA_RW007_CS_PIN;
rw007_gpio_init();
rt_hw_spi_device_attach(RA_RW007_SPI_BUS_NAME, "wspi", cs_pin);
rt_hw_wifi_init("wspi");
rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION);
rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP);
rw007_sn_get(sn_version);
rt_kprintf("\nrw007 sn: [%s]\n", sn_version);
rw007_version_get(sn_version);
rt_kprintf("rw007 ver: [%s]\n\n", sn_version);
return 0;
}
INIT_APP_EXPORT(wifi_spi_device_init);
static void int_wifi_irq(void *p)
{
((void)p);
spi_wifi_isr(0);
}
void spi_wifi_hw_init(void)
{
rt_pin_attach_irq(RA_RW007_INT_BUSY_PIN, PIN_IRQ_MODE_FALLING, int_wifi_irq, 0);
rt_pin_irq_enable(RA_RW007_INT_BUSY_PIN, RT_TRUE);
}
#endif /* BSP_USING_RW007 */

View File

@ -30,7 +30,7 @@
#ifdef BSP_USING_SDCARD_FATFS
static int onboard_sdcard_mount(void)
{
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
{
LOG_I("SD card mount to '/sdcard'");
}

View File

@ -32,7 +32,7 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifdef RT_USING_DFS_ROMFS
#include "dfs_romfs.h"
#ifdef RT_USING_DFS_ELMFAT
@ -54,7 +54,7 @@ const struct romfs_dirent romfs_root =
{
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0])
};
#endif
#ifdef BSP_USING_SDCARD_FS
@ -65,19 +65,19 @@ static void _sdcard_mount(void)
{
rt_device_t device;
device = rt_device_find("sd0");
device = rt_device_find("sd");
if (device == NULL)
{
mmcsd_wait_cd_changed(0);
sdcard_change();
mmcsd_wait_cd_changed(RT_WAITING_FOREVER);
device = rt_device_find("sd0");
device = rt_device_find("sd");
}
if (device != RT_NULL)
{
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
{
LOG_I("sd card mount to '/sdcard'");
}

View File

@ -65,19 +65,19 @@ static void _sdcard_mount(void)
{
rt_device_t device;
device = rt_device_find("sd0");
device = rt_device_find("sd");
if (device == NULL)
{
mmcsd_wait_cd_changed(0);
sdcard_change();
mmcsd_wait_cd_changed(RT_WAITING_FOREVER);
device = rt_device_find("sd0");
device = rt_device_find("sd");
}
if (device != RT_NULL)
{
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
if (dfs_mount("sd", "/sdcard", "elm", 0, 0) == RT_EOK)
{
LOG_I("sd card mount to '/sdcard'");
}