RTOS 设计说明
源码说明
相关模块 | 源码路径 |
---|---|
mtd | kernel/rt-thread/components/drivers/mtd/mtd_nor.c |
spinand | bsp/peripheral/spinor_sfudbsp/artinchip/drv/spinor/spinor_sfud.c |
qspi | bsp/artinchip/drv/qspi/drv_qspi.c |
RTOS 层次关系

mtd 设备用来挂载 Littlefs 文件系统,blk 设备用来挂载 FatFS 文件系统。
RTOS 关键流程
SPI NOR
初始化流程
rt_hw_spi_flash_with_sfud_init //bsp/artinchip/drv/spinor/spinor_sfud.c |-> aic_qspi_bus_attach_device("qspi0", SPI_FLASH_DEVICE_NAME, 0, 4, RT_NULL, RT_NULL);//创建 qspi 总线 |-> rt_sfud_flash_probe(USING_NOR_FLASH_DEV_NAME,SPI_FLASH_DEVICE_NAME) //kernel/rt-thread/components/drivers/spi/spi_flash_sfud.c |-> rt_sfud_flash_probe_ex(spi_flash_dev_name, spi_dev_name, &cfg, RT_NULL); |-> rt_qspi_configure(qspi_dev, qspi_cfg); |-> sfud_device_init(sfud_dev) |-> hardware_init(flash); |-> sfud_spi_port_init(flash); ////kernel/rt-thread/components/drivers/spi/spi_flash_sfud.c |-> flash->spi.wr = spi_write_read; //提供读写接口 |-> flash->spi.qspi_read = (void *)qspi_read; //提供快速读取接口 |-> read_jedec_id(flash); //读取设备 id |-> sfud_read_sfdp(flash); //自动识别 SPI NOR |-> sfud_qspi_fast_read_enable(sfud_dev, qspi_dev->config.qspi_dl_width); |-> rt_device_register(&(rtt_dev->flash_device), spi_flash_dev_name, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);