File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -332,21 +332,25 @@ void SPIClass::dmaAllocate(void) {
332
332
totalDescriptors * sizeof (DmacDescriptor)))) {
333
333
use_dma = true ; // Everything allocated successfully
334
334
extraWriteDescriptors = &extraReadDescriptors[numReadDescriptors];
335
+
336
+ // dmac.h didn't include extern "C" which cause
337
+ // DmacDescriptor and its members are defined as C++ struct therefore
338
+ // memcpy will throw warning on copying where simple assignment won't work
339
+ #pragma GCC diagnostic push
340
+ #pragma GCC diagnostic ignored "-Wclass-memaccess"
341
+
335
342
// Initialize descriptors (copy from first ones)
336
343
for (int i=0 ; i<numReadDescriptors; i++) {
337
- #pragma GCC diagnostic push
338
- #pragma GCC diagnostic ignored "-Wclass-memaccess"
339
344
memcpy (&extraReadDescriptors[i], firstReadDescriptor,
340
345
sizeof (DmacDescriptor));
341
- #pragma GCC diagnostic pop
342
346
}
343
347
for (int i=0 ; i<numWriteDescriptors; i++) {
344
- #pragma GCC diagnostic push
345
- #pragma GCC diagnostic ignored "-Wclass-memaccess"
346
348
memcpy (&extraWriteDescriptors[i], firstWriteDescriptor,
347
349
sizeof (DmacDescriptor));
348
- #pragma GCC diagnostic pop
349
350
}
351
+
352
+ #pragma GCC diagnostic pop
353
+
350
354
} // end malloc
351
355
} // end extra descriptor check
352
356
You can’t perform that action at this time.
0 commit comments