mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Parent:
579:53297373a894
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 /**
mbed_official 579:53297373a894 2 * \page asfdoc_sam0_dma_basic_use_case Quick Start Guide for Memory to Memory Data Transfer Using DMAC
mbed_official 579:53297373a894 3 *
mbed_official 579:53297373a894 4 * The supported board list:
mbed_official 579:53297373a894 5 * - SAMD21 Xplained Pro
mbed_official 579:53297373a894 6 * - SAMR21 Xplained Pro
mbed_official 579:53297373a894 7 * - SAMD11 Xplained Pro
mbed_official 579:53297373a894 8 * - SAML21 Xplained Pro
mbed_official 579:53297373a894 9 *
mbed_official 579:53297373a894 10 * In this use case, the DMAC is configured for:
mbed_official 579:53297373a894 11 * \li Moving data from memory to memory
mbed_official 579:53297373a894 12 * \li Using software trigger
mbed_official 579:53297373a894 13 * \li Using DMA priority level 0
mbed_official 579:53297373a894 14 * \li Transaction as DMA trigger action
mbed_official 579:53297373a894 15 * \li No action on input events
mbed_official 579:53297373a894 16 * \li Output event not enabled
mbed_official 579:53297373a894 17 *
mbed_official 579:53297373a894 18 * \section asfdoc_sam0_dma_basic_use_case_setup Setup
mbed_official 579:53297373a894 19 *
mbed_official 579:53297373a894 20 * \subsection asfdoc_sam0_dma_basic_use_casesetup_prereq Prerequisites
mbed_official 579:53297373a894 21 * There are no special setup requirements for this use-case.
mbed_official 579:53297373a894 22 *
mbed_official 579:53297373a894 23 * \subsection asfdoc_sam0_dma_basic_use_casesetup_code Code
mbed_official 579:53297373a894 24 * Copy-paste the following setup code to your user application:
mbed_official 579:53297373a894 25 * \snippet qs_dma_basic.c setup
mbed_official 579:53297373a894 26 *
mbed_official 579:53297373a894 27 * Add the below section to user application initialization (typically the
mbed_official 579:53297373a894 28 * start of \c main()):
mbed_official 579:53297373a894 29 * \snippet qs_dma_basic.c setup_init
mbed_official 579:53297373a894 30 *
mbed_official 579:53297373a894 31 * \subsection asfdoc_sam0_dma_basic_use_casesetup_flow Workflow
mbed_official 579:53297373a894 32 * -# Create a DMA resource configuration structure, which can be filled out to
mbed_official 579:53297373a894 33 * adjust the configuration of a single DMA transfer.
mbed_official 579:53297373a894 34 * \snippet qs_dma_basic.c setup_1
mbed_official 579:53297373a894 35 * \br
mbed_official 579:53297373a894 36 *
mbed_official 579:53297373a894 37 * -# Initialize the DMA resource configuration struct with the module's
mbed_official 579:53297373a894 38 * default values.
mbed_official 579:53297373a894 39 * \snippet qs_dma_basic.c setup_2
mbed_official 579:53297373a894 40 * \note This should always be performed before using the configuration
mbed_official 579:53297373a894 41 * struct to ensure that all values are initialized to known default
mbed_official 579:53297373a894 42 * settings.
mbed_official 579:53297373a894 43 *
mbed_official 579:53297373a894 44 * -# Allocate a DMA resource with the configurations.
mbed_official 579:53297373a894 45 * \snippet qs_dma_basic.c setup_3
mbed_official 579:53297373a894 46 * \br
mbed_official 579:53297373a894 47
mbed_official 579:53297373a894 48 * -# Declare a DMA transfer descriptor configuration structure, which can be
mbed_official 579:53297373a894 49 * filled out to adjust the configuration of a single DMA transfer.
mbed_official 579:53297373a894 50 * \snippet qs_dma_basic.c setup_4
mbed_official 579:53297373a894 51 * \br
mbed_official 579:53297373a894 52 *
mbed_official 579:53297373a894 53 * -# Initialize the DMA transfer descriptor configuration struct with the
mbed_official 579:53297373a894 54 * module's default values.
mbed_official 579:53297373a894 55 * \snippet qs_dma_basic.c setup_5
mbed_official 579:53297373a894 56 * \note This should always be performed before using the configuration
mbed_official 579:53297373a894 57 * struct to ensure that all values are initialized to known default
mbed_official 579:53297373a894 58 * settings.
mbed_official 579:53297373a894 59 *
mbed_official 579:53297373a894 60 * -# Set the specific parameters for a DMA transfer with transfer size, source
mbed_official 579:53297373a894 61 * address, and destination address. In this example, we have enabled the
mbed_official 579:53297373a894 62 * source and destination address increment.
mbed_official 579:53297373a894 63 * The source and destination addresses to be stored into descriptor_config
mbed_official 579:53297373a894 64 * must correspond to the end of the transfer.
mbed_official 579:53297373a894 65 *
mbed_official 579:53297373a894 66 * \snippet qs_dma_basic.c setup_6
mbed_official 579:53297373a894 67 * \br
mbed_official 579:53297373a894 68 *
mbed_official 579:53297373a894 69 * -# Create the DMA transfer descriptor.
mbed_official 579:53297373a894 70 * \snippet qs_dma_basic.c setup_7
mbed_official 579:53297373a894 71 * \br
mbed_official 579:53297373a894 72 *
mbed_official 579:53297373a894 73 * -# Add the DMA transfer descriptor to the allocated DMA resource.
mbed_official 579:53297373a894 74 * \snippet qs_dma_basic.c add_descriptor_to_dma_resource
mbed_official 579:53297373a894 75 * \br
mbed_official 579:53297373a894 76 *
mbed_official 579:53297373a894 77 * -# Register a callback to indicate transfer status.
mbed_official 579:53297373a894 78 * \snippet qs_dma_basic.c setup_callback_register
mbed_official 579:53297373a894 79 * \br
mbed_official 579:53297373a894 80 *
mbed_official 579:53297373a894 81 * -# Set the transfer done flag in the registered callback function.
mbed_official 579:53297373a894 82 * \snippet qs_dma_basic.c _transfer_done
mbed_official 579:53297373a894 83 * \br
mbed_official 579:53297373a894 84 *
mbed_official 579:53297373a894 85 * -# Enable the registered callbacks.
mbed_official 579:53297373a894 86 * \snippet qs_dma_basic.c setup_enable_callback
mbed_official 579:53297373a894 87 * \br
mbed_official 579:53297373a894 88 *
mbed_official 579:53297373a894 89 * \section asfdoc_sam0_dma_basic_use_case_main Use Case
mbed_official 579:53297373a894 90 *
mbed_official 579:53297373a894 91 * \subsection asfdoc_sam0_dma_basic_use_casecode_code Code
mbed_official 579:53297373a894 92 * Add the following code at the start of \c main():
mbed_official 579:53297373a894 93 * \snippet qs_dma_basic.c sample_resource
mbed_official 579:53297373a894 94 * Copy the following code to your user application:
mbed_official 579:53297373a894 95 * \snippet qs_dma_basic.c main
mbed_official 579:53297373a894 96 *
mbed_official 579:53297373a894 97 * \subsection dma_basic_use_case_code_flow Workflow
mbed_official 579:53297373a894 98 * -# Start the DMA transfer job with the allocated DMA resource and
mbed_official 579:53297373a894 99 * transfer descriptor.
mbed_official 579:53297373a894 100 * \snippet qs_dma_basic.c main_1
mbed_official 579:53297373a894 101 *
mbed_official 579:53297373a894 102 * -# Set the software trigger for the DMA channel. This can be done before
mbed_official 579:53297373a894 103 * or after the DMA job is started. Note that all transfers needs a trigger
mbed_official 579:53297373a894 104 * to start.
mbed_official 579:53297373a894 105 * \snippet qs_dma_basic.c main_1_1
mbed_official 579:53297373a894 106 *
mbed_official 579:53297373a894 107 * -# Waiting for the setting of the transfer done flag.
mbed_official 579:53297373a894 108 * \snippet qs_dma_basic.c main_2
mbed_official 579:53297373a894 109 */
mbed_official 579:53297373a894 110 /**
mbed_official 579:53297373a894 111 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
mbed_official 579:53297373a894 112 */