Fix: ChibiOS V2 doesn't support dma cache handling at all

This commit is contained in:
inmarket 2017-10-02 13:33:38 +10:00
parent 7ef1fa156c
commit fdaf636b5f
2 changed files with 16 additions and 6 deletions

View File

@ -40,9 +40,14 @@
// specified data structure is aligned on a cache line boundary - not a good assumption. // specified data structure is aligned on a cache line boundary - not a good assumption.
// Solution: We increase the size provided to ChibiOS so that it does it properly. // Solution: We increase the size provided to ChibiOS so that it does it properly.
// This assumes of course that we know the size of the cpu cache line. // This assumes of course that we know the size of the cpu cache line.
#define CPU_CACHE_LINE_SIZE 32 #if CH_KERNEL_MAJOR > 2
#define CACHE_FLUSH(buf, sz) dmaBufferFlush((buf), (sz)+(CPU_CACHE_LINE_SIZE-1)) #define CPU_CACHE_LINE_SIZE 32
#define CACHE_INVALIDATE(buf, sz) dmaBufferInvalidate((buf), (sz)+(CPU_CACHE_LINE_SIZE-1)) #define CACHE_FLUSH(buf, sz) dmaBufferFlush((buf), (sz)+(CPU_CACHE_LINE_SIZE-1))
#define CACHE_INVALIDATE(buf, sz) dmaBufferInvalidate((buf), (sz)+(CPU_CACHE_LINE_SIZE-1))
#else
#define CACHE_FLUSH(buf, sz)
#define CACHE_INVALIDATE(buf, sz)
#endif
/* Initialize a Drive */ /* Initialize a Drive */
DSTATUS disk_initialize ( DSTATUS disk_initialize (

View File

@ -35,9 +35,14 @@
// specified data structure is aligned on a cache line boundary - not a good assumption. // specified data structure is aligned on a cache line boundary - not a good assumption.
// Solution: We increase the size provided to ChibiOS so that it does it properly. // Solution: We increase the size provided to ChibiOS so that it does it properly.
// This assumes of course that we know the size of the cpu cache line. // This assumes of course that we know the size of the cpu cache line.
#define CPU_CACHE_LINE_SIZE 32 #if CH_KERNEL_MAJOR > 2
#define CACHE_FLUSH(buf, sz) dmaBufferFlush((buf), (sz)+(CPU_CACHE_LINE_SIZE-1)) #define CPU_CACHE_LINE_SIZE 32
#define CACHE_INVALIDATE(buf, sz) dmaBufferInvalidate((buf), (sz)+(CPU_CACHE_LINE_SIZE-1)) #define CACHE_FLUSH(buf, sz) dmaBufferFlush((buf), (sz)+(CPU_CACHE_LINE_SIZE-1))
#define CACHE_INVALIDATE(buf, sz) dmaBufferInvalidate((buf), (sz)+(CPU_CACHE_LINE_SIZE-1))
#else
#define CACHE_FLUSH(buf, sz)
#define CACHE_INVALIDATE(buf, sz)
#endif
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Initialize a Drive */ /* Initialize a Drive */