avnish aggarwal
/
IO-dma-memmem
http://mbed.org/cookbook/MODDMA
Revision 0:ad229870f727, committed 2013-09-04
- Comitter:
- avnisha
- Date:
- Wed Sep 04 19:44:37 2013 +0000
- Commit message:
- ok
Changed in this revision
diff -r 000000000000 -r ad229870f727 MODDMA.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODDMA.lib Wed Sep 04 19:44:37 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/AjK/code/MODDMA/#97a16bf2ff43
diff -r 000000000000 -r ad229870f727 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 04 19:44:37 2013 +0000 @@ -0,0 +1,62 @@ +#ifdef OLD +#include "mbed.h" + +DigitalOut myled(LED1); + +int main() { + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +} +#endif + +#include "mbed.h" +#include "MODDMA.h" + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); +MODDMA dma; + +int main() { + pc.baud(115200); + pc.printf("Hello World\r\n"); + + // Create a source buffer we are going to move. + char src[] = "TEST TEST TEST"; + + // Create a buffer for the destination to copy to. + char dst[sizeof(src)]; + + // Create a MODDMA configuration object. + MODDMA_Config *config = new MODDMA_Config; + + // Setup that configuration + config + ->channelNum ( MODDMA::Channel_0 ) + ->srcMemAddr ( (uint32_t) &src ) + ->dstMemAddr ( (uint32_t) &dst ) + ->transferSize ( sizeof(src) ) + ->transferType ( MODDMA::m2m ) + ; // config end + + // Pass the configuration to the controller + dma.Setup( config ); + + // Tell the controller to perform the DMA operation + // defined by that configuration. + dma.Enable ( config ); + + wait(1); + + pc.printf("%s\r\n", dst); + + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +} \ No newline at end of file
diff -r 000000000000 -r ad229870f727 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 04 19:44:37 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file