DMA library for the KL25Z

Dependents:   SimpleDMA_HelloWorld RTOS_SPI spiDMAtest Pinscape_Controller_v1 ... more

Introduction

SimpleDMA is a standard library for different DMA peripherals. Currently the LPC1768, KL46Z and KL25Z are supported. It provided one set of functions for different peripherals. It does not allow for usage of all the advanced functions, partially because the goal was to provide a simple interface, and partially because they are different for different microcontrollers.

Examples

Helloworld: http://mbed.org/users/Sissors/code/SimpleDMA_HelloWorld/

Example in a library (SPI): http://mbed.org/users/Sissors/code/RTOS_SPI/

Committer:
wkleunen
Date:
Fri May 12 10:26:15 2017 +0000
Revision:
9:f7345d41b076
Parent:
5:d9f46ef80e20
Use callback template class to integrate library with mbed os 5.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 5:d9f46ef80e20 1 #include "SimpleDMA.h"
Sissors 5:d9f46ef80e20 2
Sissors 5:d9f46ef80e20 3 void SimpleDMA::channel(int chan) {
Sissors 5:d9f46ef80e20 4 if (chan == -1) {
Sissors 5:d9f46ef80e20 5 auto_channel = true;
Sissors 5:d9f46ef80e20 6 _channel = 0;
Sissors 5:d9f46ef80e20 7 } else {
Sissors 5:d9f46ef80e20 8 auto_channel = false;
Sissors 5:d9f46ef80e20 9 if (chan >= 0 && chan < DMA_CHANNELS)
Sissors 5:d9f46ef80e20 10 _channel = chan;
Sissors 5:d9f46ef80e20 11 else
Sissors 5:d9f46ef80e20 12 _channel = DMA_CHANNELS-1;
Sissors 5:d9f46ef80e20 13 }
Sissors 5:d9f46ef80e20 14 }
Sissors 5:d9f46ef80e20 15
Sissors 5:d9f46ef80e20 16 int SimpleDMA::getFreeChannel(void) {
Sissors 5:d9f46ef80e20 17 int retval = 0;
Sissors 5:d9f46ef80e20 18 while(1) {
Sissors 5:d9f46ef80e20 19 if (!isBusy(retval))
Sissors 5:d9f46ef80e20 20 return retval;
Sissors 5:d9f46ef80e20 21 retval++;
Sissors 5:d9f46ef80e20 22 if (retval >= DMA_CHANNELS)
Sissors 5:d9f46ef80e20 23 retval = 0;
Sissors 5:d9f46ef80e20 24 }
Sissors 5:d9f46ef80e20 25 }