mbed library sources
Fork of mbed-src by
targets/hal/TARGET_Atmel/TARGET_SAM21/drivers/sercom/i2c/quick_start_slave_dma/qs_i2c_slave_dma.h@592:a274ee790e56, 2015-07-17 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 579:53297373a894 | 1 | /** |
mbed_official | 579:53297373a894 | 2 | * \page asfdoc_sam0_sercom_i2c_slave_dma_use_case Quick Start Guide for Using DMA with SERCOM I2C Slave |
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 | * - SAML21 Xplained Pro |
mbed_official | 579:53297373a894 | 8 | * |
mbed_official | 579:53297373a894 | 9 | * In this use case, the I<SUP>2</SUP>C will used and set up as follows: |
mbed_official | 579:53297373a894 | 10 | * - Slave mode |
mbed_official | 579:53297373a894 | 11 | * - 100KHz operation speed |
mbed_official | 579:53297373a894 | 12 | * - Not operational in standby |
mbed_official | 579:53297373a894 | 13 | * - 65535 unknown bus state timeout value |
mbed_official | 579:53297373a894 | 14 | * |
mbed_official | 579:53297373a894 | 15 | * |
mbed_official | 579:53297373a894 | 16 | * \section asfdoc_sam0_sercom_i2c_slave_dma_use_case_prereq Prerequisites |
mbed_official | 579:53297373a894 | 17 | * The device must be connected to an I<SUP>2</SUP>C slave. |
mbed_official | 579:53297373a894 | 18 | * |
mbed_official | 579:53297373a894 | 19 | * \section asfdoc_sam0_sercom_i2c_slave_dma_use_setup Setup |
mbed_official | 579:53297373a894 | 20 | * |
mbed_official | 579:53297373a894 | 21 | * \subsection asfdoc_sam0_sercom_i2c_slave_dma_use_setup_code Code |
mbed_official | 579:53297373a894 | 22 | * The following must be added to the user application: |
mbed_official | 579:53297373a894 | 23 | * |
mbed_official | 579:53297373a894 | 24 | * - Address to respond to: |
mbed_official | 579:53297373a894 | 25 | * \snippet qs_i2c_slave_dma.c address |
mbed_official | 579:53297373a894 | 26 | * |
mbed_official | 579:53297373a894 | 27 | * - A sample buffer to send, number of entries to send and address of slave: |
mbed_official | 579:53297373a894 | 28 | * \snippet qs_i2c_slave_dma.c packet_data |
mbed_official | 579:53297373a894 | 29 | * |
mbed_official | 579:53297373a894 | 30 | * - Globally accessible module structure: |
mbed_official | 579:53297373a894 | 31 | * \snippet qs_i2c_slave_dma.c module |
mbed_official | 579:53297373a894 | 32 | * |
mbed_official | 579:53297373a894 | 33 | * - Function for setting up the module: |
mbed_official | 579:53297373a894 | 34 | * \snippet qs_i2c_slave_dma.c initialize_i2c |
mbed_official | 579:53297373a894 | 35 | * |
mbed_official | 579:53297373a894 | 36 | * - Globally accessible DMA module structure: |
mbed_official | 579:53297373a894 | 37 | * \snippet qs_i2c_slave_dma.c dma_resource |
mbed_official | 579:53297373a894 | 38 | * |
mbed_official | 579:53297373a894 | 39 | * - Globally accessible DMA transfer descriptor: |
mbed_official | 579:53297373a894 | 40 | * \snippet qs_i2c_slave_dma.c transfer_descriptor |
mbed_official | 579:53297373a894 | 41 | * |
mbed_official | 579:53297373a894 | 42 | * - Function for setting up the DMA resource: |
mbed_official | 579:53297373a894 | 43 | * \snippet qs_i2c_slave_dma.c config_dma_resource |
mbed_official | 579:53297373a894 | 44 | * |
mbed_official | 579:53297373a894 | 45 | * - Function for setting up the DMA transfer descriptor: |
mbed_official | 579:53297373a894 | 46 | * \snippet qs_i2c_slave_dma.c setup_dma_transfer_descriptor |
mbed_official | 579:53297373a894 | 47 | * |
mbed_official | 579:53297373a894 | 48 | * - Add to user application \c main(): |
mbed_official | 579:53297373a894 | 49 | * \snippet qs_i2c_slave_dma.c init |
mbed_official | 579:53297373a894 | 50 | * |
mbed_official | 579:53297373a894 | 51 | * \subsection asfdoc_sam0_sercom_i2c_slave_dma_use_setup_workflow Workflow |
mbed_official | 579:53297373a894 | 52 | * \subsubsection asfdoc_sam0_sercom_i2c_slave_dma_use_setup_workflow_i2c Configure and enable SERCOM: |
mbed_official | 579:53297373a894 | 53 | * \snippet qs_i2c_slave_dma.c initialize_i2c |
mbed_official | 579:53297373a894 | 54 | * -# Create and initialize configuration structure. |
mbed_official | 579:53297373a894 | 55 | * \snippet qs_i2c_slave_dma.c init_conf |
mbed_official | 579:53297373a894 | 56 | * -# Change settings in the configuration. |
mbed_official | 579:53297373a894 | 57 | * \snippet qs_i2c_slave_dma.c conf_changes |
mbed_official | 579:53297373a894 | 58 | * -# Initialize the module with the set configurations. |
mbed_official | 579:53297373a894 | 59 | * \snippet qs_i2c_slave_dma.c init_module |
mbed_official | 579:53297373a894 | 60 | * -# Enable the module. |
mbed_official | 579:53297373a894 | 61 | * \snippet qs_i2c_slave_dma.c enable_module |
mbed_official | 579:53297373a894 | 62 | * |
mbed_official | 579:53297373a894 | 63 | * \subsubsection asfdoc_sam0_sercom_i2c_slave_dma_use_setup_workflow_dma Configure DMA |
mbed_official | 579:53297373a894 | 64 | * -# Create a DMA resource configuration structure, which can be filled out to |
mbed_official | 579:53297373a894 | 65 | * adjust the configuration of a single DMA transfer. |
mbed_official | 579:53297373a894 | 66 | * \snippet qs_i2c_slave_dma.c dma_setup_1 |
mbed_official | 579:53297373a894 | 67 | * |
mbed_official | 579:53297373a894 | 68 | * -# Initialize the DMA resource configuration struct with the module's |
mbed_official | 579:53297373a894 | 69 | * default values. |
mbed_official | 579:53297373a894 | 70 | * \snippet qs_i2c_slave_dma.c dma_setup_2 |
mbed_official | 579:53297373a894 | 71 | * \note This should always be performed before using the configuration |
mbed_official | 579:53297373a894 | 72 | * struct to ensure that all values are initialized to known default |
mbed_official | 579:53297373a894 | 73 | * settings. |
mbed_official | 579:53297373a894 | 74 | * |
mbed_official | 579:53297373a894 | 75 | * -# Set extra configurations for the DMA resource. It is using peripheral |
mbed_official | 579:53297373a894 | 76 | * trigger. SERCOM RX trigger causes a beat transfer in this |
mbed_official | 579:53297373a894 | 77 | * example. |
mbed_official | 579:53297373a894 | 78 | * \snippet qs_i2c_slave_dma.c dma_setup_3 |
mbed_official | 579:53297373a894 | 79 | * |
mbed_official | 579:53297373a894 | 80 | * -# Allocate a DMA resource with the configurations. |
mbed_official | 579:53297373a894 | 81 | * \snippet qs_i2c_slave_dma.c dma_setup_4 |
mbed_official | 579:53297373a894 | 82 | * |
mbed_official | 579:53297373a894 | 83 | * -# Create a DMA transfer descriptor configuration structure, which can be |
mbed_official | 579:53297373a894 | 84 | * filled out to adjust the configuration of a single DMA transfer. |
mbed_official | 579:53297373a894 | 85 | * \snippet qs_i2c_slave_dma.c dma_setup_5 |
mbed_official | 579:53297373a894 | 86 | * |
mbed_official | 579:53297373a894 | 87 | * -# Initialize the DMA transfer descriptor configuration struct with the module's |
mbed_official | 579:53297373a894 | 88 | * default values. |
mbed_official | 579:53297373a894 | 89 | * \snippet qs_i2c_slave_dma.c dma_setup_6 |
mbed_official | 579:53297373a894 | 90 | * \note This should always be performed before using the configuration |
mbed_official | 579:53297373a894 | 91 | * struct to ensure that all values are initialized to known default |
mbed_official | 579:53297373a894 | 92 | * settings. |
mbed_official | 579:53297373a894 | 93 | * |
mbed_official | 579:53297373a894 | 94 | * -# Set the specific parameters for a DMA transfer with transfer size, source |
mbed_official | 579:53297373a894 | 95 | * address, and destination address. |
mbed_official | 579:53297373a894 | 96 | * \snippet qs_i2c_slave_dma.c dma_setup_7 |
mbed_official | 579:53297373a894 | 97 | * |
mbed_official | 579:53297373a894 | 98 | * -# Create the DMA transfer descriptor. |
mbed_official | 579:53297373a894 | 99 | * \snippet qs_i2c_slave_dma.c dma_setup_8 |
mbed_official | 579:53297373a894 | 100 | * |
mbed_official | 579:53297373a894 | 101 | * \section asfdoc_sam0_sercom_i2c_slave_dma_use_implemenation Implementation |
mbed_official | 579:53297373a894 | 102 | * \subsection asfdoc_sam0_sercom_i2c_slave_dma_use_implemenation_code Code |
mbed_official | 579:53297373a894 | 103 | * Add to user application \c main(): |
mbed_official | 579:53297373a894 | 104 | * \snippet qs_i2c_slave_dma.c main |
mbed_official | 579:53297373a894 | 105 | * |
mbed_official | 579:53297373a894 | 106 | * \subsection asfdoc_sam0_sercom_i2c_slave_dma_use_implemenation_workflow Workflow |
mbed_official | 579:53297373a894 | 107 | * -# Start to wait a packet from master. |
mbed_official | 579:53297373a894 | 108 | * \snippet qs_i2c_slave_dma.c wait_packet |
mbed_official | 579:53297373a894 | 109 | * |
mbed_official | 579:53297373a894 | 110 | * -# Once data ready, clear the address match status. |
mbed_official | 579:53297373a894 | 111 | * \snippet qs_i2c_slave_dma.c clear_status |
mbed_official | 579:53297373a894 | 112 | * |
mbed_official | 579:53297373a894 | 113 | */ |
mbed_official | 579:53297373a894 | 114 | /** |
mbed_official | 579:53297373a894 | 115 | * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> |
mbed_official | 579:53297373a894 | 116 | */ |