Merge remote-tracking branch 'upstream/prepare_for_master' into prepare_for_master

This commit is contained in:
TXuian
2022-11-22 08:03:14 -08:00
588 changed files with 231095 additions and 12153 deletions
@@ -34,6 +34,11 @@ Modification:
*************************************************/
#include "board.h"
#include <clint.h>
#include <sysctl.h>
#include <xizi.h>
#include "connect_gpio.h"
#include "connect_spi.h"
#include "connect_uart.h"
@@ -42,9 +47,6 @@ Modification:
#include "encoding.h"
#include "fpioa.h"
#include "tick.h"
#include <clint.h>
#include <sysctl.h>
#include <xizi.h>
#if defined(FS_VFS)
#include <iot-vfs.h>
@@ -61,33 +63,51 @@ extern int HwTouchInit(void);
extern int HwSpiInit(void);
extern int HwWiznetInit(void);
extern int HwCh438Init(void);
extern int HwCh376Init(void);
extern int HwTimerInit(void);
extern int HwRtcInit(void);
extern int HwWdtInit(void);
#if defined(FS_VFS) && defined(MOUNT_SDCARD)
#ifdef FS_CH376
#include <iot-vfs.h>
#include <sd_spi.h>
extern SpiSdDeviceType SpiSdInit(struct Bus *bus, const char *dev_name,
const char *drv_name, const char *sd_name);
#ifdef MOUNT_USB
/**
* @description: Mount USB
* @return 0
*/
int MountUsb(void) {
if (MountFilesystem(USB_BUS_NAME, USB_DEVICE_NAME, USB_DRIVER_NAME,
FSTYPE_CH376, "/") == 0)
KPrintf("usb mount to '/'\n");
else
KPrintf("usb mount to '/' failed!\n");
return 0;
}
#endif
#ifdef MOUNT_SDCARD
/**
* @description: Mount SD card
* @return 0
*/
int MountSDCard(void) {
struct Bus *spi_bus;
spi_bus = BusFind(SPI_BUS_NAME_1);
if (NONE ==
SpiSdInit(spi_bus, SPI_1_DEVICE_NAME_0, SPI_1_DRV_NAME, SPI_SD_NAME)) {
KPrintf("MountSDCard SpiSdInit error!\n");
return 0;
}
if (EOK == MountFilesystem(SPI_BUS_NAME_1, SPI_SD_NAME, SPI_1_DRV_NAME,
FSTYPE_FATFS, "/"))
KPrintf("SPI SD card fatfs mounted\n");
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME,
FSTYPE_CH376, "/") == 0)
KPrintf("sd card mount to '/'\n");
else
KPrintf("sd card mount to '/' failed!\n");
return 0;
}
if (EOK == MountFilesystem(SPI_BUS_NAME_1, SPI_SD_NAME, SPI_1_DRV_NAME,
FSTYPE_FATFS, "/"))
KPrintf("SPI SD card fatfs mounted\n");
return 0;
}
#endif
#endif
void InitBss(void) {
@@ -101,26 +121,26 @@ void InitBss(void) {
void Kd233Start(uint32_t mhartid) {
switch (mhartid) {
case CPU0:
InitBss();
case CPU0:
InitBss();
/*kernel start entry*/
entry();
break;
case CPU1:
while (0x2018050420191010 !=
cpu2_boot_flag) { ///< waiting for boot flag ,then start cpu1 core
/*kernel start entry*/
entry();
break;
case CPU1:
while (0x2018050420191010 !=
cpu2_boot_flag) { ///< waiting for boot flag ,then start cpu1 core
#ifndef ARCH_SMP
asm volatile("wfi");
asm volatile("wfi");
#endif
}
}
#ifdef ARCH_SMP
SecondaryCpuCStart();
SecondaryCpuCStart();
#endif
break;
break;
default:
break;
default:
break;
}
}
@@ -168,6 +188,21 @@ struct InitSequenceDesc _board_init[] = {
#ifdef BSP_USING_I2C
{"hw_i2c", HwI2cInit},
#endif
#ifdef BSP_USING_RTC
{"hw_rtc", HwRtcInit},
#endif
#ifdef BSP_USING_HWTIMER
{"hw_timer", HwTimerInit},
#endif
#ifdef BSP_USING_WDT
{"hw_wdt", HwWdtInit},
#endif
#ifdef BSP_USING_SDIO
{"hw_sdio", HwCh376Init},
#endif
#ifdef BSP_USING_USB
{"hw_usb", HwCh376Init},
#endif
#ifdef BSP_USING_TOUCH
{"touch", HwTouchInit},
#endif