mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-25 21:48:54 +00:00
40 lines
939 B
C
40 lines
939 B
C
/*
|
|
* Copyright (c) 2023, Artinchip Technology Co., Ltd
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Authors: xuan.wen <xuan.wen@artinchip.com>
|
|
*/
|
|
|
|
#include <rtdevice.h>
|
|
#include <drv_qspi.h>
|
|
#include <aic_log.h>
|
|
|
|
#if defined(RT_USING_SFUD)
|
|
|
|
#define SPI_FLASH_DEVICE_NAME "qspi01"
|
|
|
|
#define USING_NOR_FLASH_DEV_NAME "norflash0"
|
|
|
|
#include "spi_flash_sfud.h"
|
|
int rt_hw_spi_flash_with_sfud_init(void)
|
|
{
|
|
rt_err_t ret;
|
|
|
|
ret = aic_qspi_bus_attach_device("qspi0", SPI_FLASH_DEVICE_NAME, 0, 4,
|
|
RT_NULL, RT_NULL);
|
|
if (ret < 0) {
|
|
pr_err("attach qspi device failed.\n");
|
|
return RT_ERROR;
|
|
}
|
|
if (RT_NULL == rt_sfud_flash_probe(USING_NOR_FLASH_DEV_NAME,
|
|
SPI_FLASH_DEVICE_NAME)) {
|
|
pr_err("sfud flash probe failed.\n");
|
|
return RT_ERROR;
|
|
};
|
|
|
|
return RT_EOK;
|
|
}
|
|
INIT_PREV_EXPORT(rt_hw_spi_flash_with_sfud_init);
|
|
#endif
|