Skip to content

Commit 59be34a

Browse files
committed
changed sourceinc/destinationinc settings for MDMA
wait on a sempahore for QSPI DMA operations changed FATFileSystem to use 32byte-aligned allocation enhanced D-Cache consistency for STM32F7/H7 families
1 parent 8fad66e commit 59be34a

File tree

13 files changed

+362
-68
lines changed

13 files changed

+362
-68
lines changed

storage/filesystem/fat/source/FATFileSystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ extern "C" DWORD get_fattime(void)
155155

156156
extern "C" void *ff_memalloc(UINT size)
157157
{
158+
#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
159+
return aligned_alloc(32U, size);
160+
#else
158161
return malloc(size);
162+
#endif
159163
}
160164

161165
extern "C" void ff_memfree(void *p)

targets/TARGET_STM/TARGET_STM32F4/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "stm32f4xx_ll_rcc.h"
3030

3131
#include "stm_dma_info.h"
32+
#include "cmsis_os.h"
33+
#include "cmsis_os2.h"
3234

3335
#ifdef __cplusplus
3436
extern "C" {
@@ -153,6 +155,8 @@ struct qspi_s {
153155
PinName sclk;
154156
PinName ssel;
155157
bool dmaInitialized;
158+
osSemaphoreId_t semaphoreId;
159+
osRtxSemaphore_t semaphoreMem;
156160
};
157161
#endif
158162

targets/TARGET_STM/TARGET_STM32F7/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "stm32f7xx_ll_rcc.h"
4444

4545
#include "stm_dma_info.h"
46+
#include "cmsis_os.h"
47+
#include "cmsis_os2.h"
4648

4749
#ifdef __cplusplus
4850
extern "C" {
@@ -127,6 +129,8 @@ struct qspi_s {
127129
PinName sclk;
128130
PinName ssel;
129131
bool dmaInitialized;
132+
osSemaphoreId_t semaphoreId;
133+
osRtxSemaphore_t semaphoreMem;
130134
};
131135
#endif
132136

targets/TARGET_STM/TARGET_STM32G4/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "stm32g4xx_ll_rcc.h"
2828

2929
#include "stm_dma_info.h"
30+
#include "cmsis_os.h"
31+
#include "cmsis_os2.h"
3032

3133
#ifdef __cplusplus
3234
extern "C" {
@@ -109,6 +111,8 @@ struct qspi_s {
109111
PinName sclk;
110112
PinName ssel;
111113
bool dmaInitialized;
114+
osSemaphoreId_t semaphoreId;
115+
osRtxSemaphore_t semaphoreMem;
112116
};
113117
#endif
114118

targets/TARGET_STM/TARGET_STM32H7/objects.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "stm32h7xx_ll_system.h"
3333

3434
#include "stm_dma_info.h"
35+
#include "cmsis_os.h"
36+
#include "cmsis_os2.h"
3537

3638
#ifdef __cplusplus
3739
extern "C" {
@@ -86,6 +88,7 @@ struct analogin_s {
8688
struct qspi_s {
8789
#if defined(OCTOSPI1)
8890
OSPI_HandleTypeDef handle;
91+
IRQn_Type qspiIRQ;
8992
#else
9093
QSPI_HandleTypeDef handle;
9194
#endif
@@ -96,14 +99,16 @@ struct qspi_s {
9699
PinName io3;
97100
PinName sclk;
98101
PinName ssel;
99-
IRQn_Type qspiIRQ;
100102
bool dmaInitialized;
103+
osSemaphoreId_t semaphoreId;
104+
osRtxSemaphore_t semaphoreMem;
101105
};
102106
#endif
103107

104108
#if DEVICE_OSPI
105109
struct ospi_s {
106110
OSPI_HandleTypeDef handle;
111+
IRQn_Type ospiIRQ;
107112
OSPIName ospi;
108113
PinName io0;
109114
PinName io1;
@@ -116,8 +121,9 @@ struct ospi_s {
116121
PinName sclk;
117122
PinName ssel;
118123
PinName dqs;
119-
IRQn_Type ospiIRQ;
120124
bool dmaInitialized;
125+
osSemaphoreId_t semaphoreId;
126+
osRtxSemaphore_t semaphoreMem;
121127
};
122128
#endif
123129

targets/TARGET_STM/TARGET_STM32H7/stm_dma_info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ static const DMALinkInfo SPIRxDMALinks[] = {
4545
/// Mapping from QSPI/OSPI index to DMA link info
4646
#if defined(OCTOSPI1)
4747
static const DMALinkInfo OSPIDMALinks[] = {
48-
{4, 0, MDMA_REQUEST_OCTOSPI1_FIFO_TH},
49-
{4, 1, MDMA_REQUEST_OCTOSPI2_FIFO_TH}
48+
{MDMA_IDX, 0, MDMA_REQUEST_OCTOSPI1_FIFO_TH},
49+
{MDMA_IDX, 1, MDMA_REQUEST_OCTOSPI2_FIFO_TH}
5050
};
5151
#else
5252
static const DMALinkInfo QSPIDMALinks[] = {
53-
{4, 0, MDMA_REQUEST_QUADSPI_FIFO_TH},
53+
{MDMA_IDX, 0, MDMA_REQUEST_QUADSPI_FIFO_TH},
5454
};
5555
#endif
5656

targets/TARGET_STM/TARGET_STM32L4/objects.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "stm32l4xx_ll_rcc.h"
3333

3434
#include "stm_dma_utils.h"
35+
#include "cmsis_os.h"
36+
#include "cmsis_os2.h"
3537

3638
#ifdef __cplusplus
3739
extern "C" {
@@ -120,12 +122,15 @@ struct qspi_s {
120122
PinName sclk;
121123
PinName ssel;
122124
bool dmaInitialized;
125+
osSemaphoreId_t semaphoreId;
126+
osRtxSemaphore_t semaphoreMem;
123127
};
124128
#endif
125129

126130
#if DEVICE_OSPI
127131
struct ospi_s {
128132
OSPI_HandleTypeDef handle;
133+
IRQn_Type ospiIRQ;
129134
OSPIName ospi;
130135
PinName io0;
131136
PinName io1;
@@ -138,8 +143,9 @@ struct ospi_s {
138143
PinName sclk;
139144
PinName ssel;
140145
PinName dqs;
141-
IRQn_Type ospiIRQ;
142-
bool dmaInitialized;
146+
bool dmaInitialized;
147+
osSemaphoreId_t semaphoreId;
148+
osRtxSemaphore_t semaphoreMem;
143149
};
144150
#endif
145151

targets/TARGET_STM/TARGET_STM32L5/objects.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "stm32l5xx_ll_rcc.h"
2929

3030
#include "stm_dma_info.h"
31+
#include "cmsis_os.h"
32+
#include "cmsis_os2.h"
3133

3234
#ifdef __cplusplus
3335
extern "C" {
@@ -107,19 +109,22 @@ struct can_s {
107109

108110
struct qspi_s {
109111
OSPI_HandleTypeDef handle;
112+
IRQn_Type qspiIRQ;
110113
QSPIName qspi;
111114
PinName io0;
112115
PinName io1;
113116
PinName io2;
114117
PinName io3;
115118
PinName sclk;
116119
PinName ssel;
117-
IRQn_Type qspiIRQ;
118120
bool dmaInitialized;
121+
osSemaphoreId_t semaphoreId;
122+
osRtxSemaphore_t semaphoreMem;
119123
};
120124

121125
struct ospi_s {
122126
OSPI_HandleTypeDef handle;
127+
IRQn_Type ospiIRQ;
123128
OSPIName ospi;
124129
PinName io0;
125130
PinName io1;
@@ -132,8 +137,9 @@ struct ospi_s {
132137
PinName sclk;
133138
PinName ssel;
134139
PinName dqs;
135-
IRQn_Type ospiIRQ;
136140
bool dmaInitialized;
141+
osSemaphoreId_t semaphoreId;
142+
osRtxSemaphore_t semaphoreMem;
137143
};
138144

139145
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32U5/objects.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "stm32u5xx_ll_rcc.h"
2929

3030
#include "stm_dma_info.h"
31+
#include "cmsis_os.h"
32+
#include "cmsis_os2.h"
3133

3234
#ifdef __cplusplus
3335
extern "C" {
@@ -107,19 +109,22 @@ struct can_s {
107109

108110
struct qspi_s {
109111
OSPI_HandleTypeDef handle;
112+
IRQn_Type qspiIRQ;
110113
QSPIName qspi;
111114
PinName io0;
112115
PinName io1;
113116
PinName io2;
114117
PinName io3;
115118
PinName sclk;
116119
PinName ssel;
117-
IRQn_Type qspiIRQ;
118120
bool dmaInitialized;
121+
osSemaphoreId_t semaphoreId;
122+
osRtxSemaphore_t semaphoreMem;
119123
};
120124

121125
struct ospi_s {
122126
OSPI_HandleTypeDef handle;
127+
IRQn_Type ospiIRQ;
123128
OSPIName ospi;
124129
PinName io0;
125130
PinName io1;
@@ -132,8 +137,9 @@ struct ospi_s {
132137
PinName sclk;
133138
PinName ssel;
134139
PinName dqs;
135-
IRQn_Type ospiIRQ;
136140
bool dmaInitialized;
141+
osSemaphoreId_t semaphoreId;
142+
osRtxSemaphore_t semaphoreMem;
137143
};
138144

139145
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32WB/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#endif
3535

3636
#include "stm_dma_info.h"
37+
#include "cmsis_os.h"
38+
#include "cmsis_os2.h"
3739

3840
#ifdef __cplusplus
3941
extern "C" {
@@ -101,6 +103,8 @@ struct qspi_s {
101103
PinName sclk;
102104
PinName ssel;
103105
bool dmaInitialized;
106+
osSemaphoreId_t semaphoreId;
107+
osRtxSemaphore_t semaphoreMem;
104108
};
105109
#endif
106110

0 commit comments

Comments
 (0)