2018-11-29 17:00:22 +08:00
|
|
|
/*
|
2021-03-14 15:33:55 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2018-11-29 17:00:22 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2018-11-27 SummerGift add spi flash port file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
2024-09-14 05:40:40 +08:00
|
|
|
#include "dev_spi_flash.h"
|
|
|
|
#include "dev_spi_flash_sfud.h"
|
2018-11-29 17:00:22 +08:00
|
|
|
#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("spi5", "spi50", GET_PIN(F, 6));
|
2018-11-29 17:00:22 +08:00
|
|
|
|
|
|
|
if (RT_NULL == rt_sfud_flash_probe("W25Q256", "spi50"))
|
|
|
|
{
|
|
|
|
return -RT_ERROR;
|
|
|
|
};
|
|
|
|
|
|
|
|
return RT_EOK;
|
|
|
|
}
|
|
|
|
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
|
|
|
|
#endif
|
|
|
|
|