Skip to content

Commit 5b6a457

Browse files
Bug Fix
1 parent 9af7b73 commit 5b6a457

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

bsp/stm32/libraries/HAL_Drivers/drivers/drv_qspi.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2023, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -146,6 +146,7 @@ static void qspi_send_cmd(struct stm32_qspi_bus *qspi_bus, struct rt_qspi_messag
146146
{
147147
Cmdhandler.InstructionMode = QSPI_INSTRUCTION_4_LINES;
148148
}
149+
149150
if (message->address.qspi_lines == 0)
150151
{
151152
Cmdhandler.AddressMode = QSPI_ADDRESS_NONE;
@@ -162,6 +163,7 @@ static void qspi_send_cmd(struct stm32_qspi_bus *qspi_bus, struct rt_qspi_messag
162163
{
163164
Cmdhandler.AddressMode = QSPI_ADDRESS_4_LINES;
164165
}
166+
165167
if (message->address.size == 24)
166168
{
167169
Cmdhandler.AddressSize = QSPI_ADDRESS_24_BITS;
@@ -170,6 +172,7 @@ static void qspi_send_cmd(struct stm32_qspi_bus *qspi_bus, struct rt_qspi_messag
170172
{
171173
Cmdhandler.AddressSize = QSPI_ADDRESS_32_BITS;
172174
}
175+
173176
if (message->qspi_data_lines == 0)
174177
{
175178
Cmdhandler.DataMode = QSPI_DATA_NONE;
@@ -323,8 +326,24 @@ rt_err_t rt_hw_qspi_device_attach(const char *bus_name, const char *device_name,
323326
goto __exit;
324327
}
325328

326-
qspi_device->enter_qspi_mode = enter_qspi_mode;
327-
qspi_device->exit_qspi_mode = exit_qspi_mode;
329+
if (enter_qspi_mode != RT_NULL)
330+
{
331+
qspi_device->enter_qspi_mode = (void (*)(struct rt_qspi_device *))enter_qspi_mode;
332+
}
333+
else
334+
{
335+
qspi_device->enter_qspi_mode = RT_NULL;
336+
}
337+
338+
if (exit_qspi_mode != RT_NULL)
339+
{
340+
qspi_device->exit_qspi_mode = (void (*)(struct rt_qspi_device *))exit_qspi_mode;
341+
}
342+
else
343+
{
344+
qspi_device->exit_qspi_mode = RT_NULL;
345+
}
346+
328347
qspi_device->config.qspi_dl_width = data_line_width;
329348

330349
#ifdef BSP_QSPI_USING_SOFTCS
@@ -377,3 +396,4 @@ INIT_BOARD_EXPORT(rt_hw_qspi_bus_init);
377396

378397
#endif /* BSP_USING_QSPI */
379398
#endif /* RT_USING_QSPI */
399+

0 commit comments

Comments
 (0)