2020-07-31 17:57:08 +08:00
|
|
|
/*
|
2021-12-30 11:27:06 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2020-07-31 17:57:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
2021-12-30 11:27:06 +08:00
|
|
|
* Date Author Notes
|
2020-07-31 17:57:08 +08:00
|
|
|
* 2020-07-13 Dozingfiretruck first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "spi_flash.h"
|
|
|
|
#include "spi_flash_sfud.h"
|
|
|
|
#include "drv_spi.h"
|
|
|
|
|
|
|
|
#if defined(BSP_USING_SPI_FLASH)
|
|
|
|
static int rt_hw_spi_flash_init(void)
|
|
|
|
{
|
|
|
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
2023-01-18 13:27:08 +08:00
|
|
|
rt_hw_spi_device_attach("spi3", "spi30", GET_PIN(F, 8));
|
2020-07-31 17:57:08 +08:00
|
|
|
|
|
|
|
if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi30"))
|
|
|
|
{
|
|
|
|
return -RT_ERROR;
|
|
|
|
};
|
|
|
|
|
|
|
|
return RT_EOK;
|
|
|
|
}
|
|
|
|
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
|
|
|
|
#endif
|
|
|
|
|