Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SimpleDMA by
Revision 6:e9ab0bb912c8, committed 2014-03-18
- Comitter:
- BaderP
- Date:
- Tue Mar 18 12:44:46 2014 +0000
- Parent:
- 5:d9f46ef80e20
- Commit message:
- patched SimpleDMA to include additional 32 kb ram
Changed in this revision
SimpleDMA_LPC1768.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d9f46ef80e20 -r e9ab0bb912c8 SimpleDMA_LPC1768.cpp --- a/SimpleDMA_LPC1768.cpp Sat Jan 04 14:42:33 2014 +0000 +++ b/SimpleDMA_LPC1768.cpp Tue Mar 18 12:44:46 2014 +0000 @@ -84,18 +84,23 @@ _callback.call(); } +static inline bool isMemory(uint32_t addr) +{ + return (addr >> 28) == 0 || (addr >> 28) == 1 || ((addr >= 0x2007C000) && (addr < (0x2007C000 + 0x8000))); +} + uint32_t getTransferType(SimpleDMA_Trigger trig, uint32_t source, uint32_t destination) { //If it is always, simply put it on memory-to-memory if (trig == Trigger_ALWAYS) return 0; - else if ((source >> 28) == 0 || (source >> 28) == 1) { //if source is RAM/Flash - if ((destination >> 28) == 0 || (destination >> 28) == 1) //if destination is RAM/flash + else if (isMemory(source)) { //if source is RAM/Flash + if (isMemory(destination)) //if destination is RAM/flash return 3; //Return p2p for m2m with a trigger (since I have no idea wtf you are trying to do) else return 1; //Source is memory, destination is peripheral, so m2p } else { - if ((destination >> 28) == 0 || (destination >> 28)) + if (isMemory(destination)) return 2; //Source is peripheral, destination is memory else return 3; //Both source and destination are peripherals