Skip to content

Commit 77d24d2

Browse files
Update file
1 parent 17f963c commit 77d24d2

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

bsp/stm32/stm32l475-atk-pandora/board/ports/drv_qspi_flash.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*
66
* Change Logs:
7-
* Date Author Notes
8-
* 2018-11-27 zylx first version
7+
* Date Author Notes
8+
* 2018-11-27 zylx first version
9+
* 2025-12-14 LinuxMint-User resolve QSPI compilation error
910
*/
1011

1112
#include <board.h>
@@ -19,6 +20,9 @@
1920
#include "dev_spi_flash.h"
2021
#include "dev_spi_flash_sfud.h"
2122

23+
#define QSPI_BUS_NAME "qspi1"
24+
#define QSPI_DEVICE_NAME "qspi10"
25+
2226
char w25qxx_read_status_register2(struct rt_qspi_device *device)
2327
{
2428
/* 0x35 read status register2 */
@@ -60,26 +64,14 @@ void w25qxx_enter_qspi_mode(struct rt_qspi_device *device)
6064
}
6165
}
6266

63-
/* Adapter function to bridge the signature mismatch between driver layer
64-
* expectation (void (*)()) and framework requirement (void (*)(struct rt_qspi_device *)).
65-
*/
66-
void w25qxx_enter_qspi_mode_adapter(void)
67-
{
68-
struct rt_qspi_device *device = (struct rt_qspi_device *)rt_device_find("qspi10");
69-
if (device == RT_NULL)
70-
{
71-
rt_kprintf("QSPI device not found!\n");
72-
return;
73-
}
74-
w25qxx_enter_qspi_mode(device);
75-
}
76-
7767
static int rt_hw_qspi_flash_with_sfud_init(void)
7868
{
79-
rt_hw_qspi_device_attach("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode_adapter, RT_NULL);
69+
/* 直接使用类型转换,避免单独的适配器函数 */
70+
rt_hw_qspi_device_attach(QSPI_BUS_NAME, QSPI_DEVICE_NAME, RT_NULL, 4,
71+
(void (*)(void))w25qxx_enter_qspi_mode, RT_NULL);
8072

8173
/* init w25q128 */
82-
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10"))
74+
if (RT_NULL == rt_sfud_flash_probe("W25Q128", QSPI_DEVICE_NAME))
8375
{
8476
return -RT_ERROR;
8577
}

0 commit comments

Comments
 (0)