How to Use Direct Memory Access (DMA) Controller in Traveo II Family
www.cypress.com Document Number. 002-20191 Rev. *D 17
(4) P-DMA reads the data from the source address (GPIO_PRT0_IN), and writes the read data to the destination
address (RAM base address 0). After that, P-DMA increments the source address by 0x80 and the destination
address by 0x04. Then, P-DMA reads the data from the source address (GPIO_PRT1_IN) and writes it to the
destination address (RAM base address 0 +0x04) again.
(5) P-DMA notifies the CPU with an interrupt when all transfers are completed.
(6) The TCPWM outputs the trigger to P-DMA when it reaches the specified count value (overflow) again.
(7) P-DMA reads the descriptor from the pointer defined by the next descriptor pointer in its own descriptor (Descriptor
Pointer 1) when accepting the transfer.
(8) P-DMA reads the data from the source address (GPIO_PRT0_IN), and writes the read data to the destination
address (RAM base address 1). After that, P-DMA increments the source address by 0x80 and the destination
address by 0x04. Then, P-DMA reads the data from the source address (GPIO_PRT1_IN) and writes it to the
destination address (RAM base address 1 +0x04) again.
P-DMA notifies the CPU through an interrupt when all transfers are completed. Descriptor 1 chains to Descriptor 0.
Therefore, when the TCPWM outputs the trigger again, steps from (3) are repeated.
Note: The TCPWM count period must always be longer than the time required by DMA to transfer all data.
3.3.2 Initial Configuration
This section describes the initialization of the DMA channel and descriptor of this use case. Perform the initial
configuration for P-DMA according to Figure 3.
1. Disable P-DMA
DW_CTL.ENABLED = 0 /* Disable */
2. Configure Channel
DW_CH_STRUCT_CH_CURR_PTR = descriptor pointer 0 /* Channel current descriptor pointer */
DW_CH_STRUCT_CH_CTL.PREEMPTABLE = 0 /* Channel is not preemptable */
DW_CH_STRUCT_CH_CTL.PRIO = 0 /* Channel priority is 0 */
DW_CH_STRUCT_CH_IDX.X_IDX = 0 /* Initialize Channel X indices to 0 */
DW_CH_STRUCT_CH_IDX.Y_IDX = 0 /* Initialize Channel Y indices to 0 */
3. Configure Descriptor 0
DESCR_CTL.WAIT_FOR_DEACT = 0 /* Do not wait for trigger deactivation */
DESCR_CTL.INTR_TYPE = 1 /* Interrupts on the execution of 1D transfer */
DESCR_CTL.TR_OUT_TYPE = 0 /* Not use It must be disabled by the trigger
multiplexer*/
DESCR_CTL.TR_IN_TYPE = 2 /* Transfer the entire descriptor per trigger */
DESCR_CTL.CH_DISABLE = 0 /* Not disable */
DESCR_CTL.SRC_TRANSFER_SIZE = 0 /* as specified in DATA_SIZE */
DESCR_CTL.DST_TRANSFER_SIZE = 0 /* as specified in DATA_SIZE */
DESCR_CTL.DATA_SIZE = 2 /* Word (32-bit) */
DESCR_CTL.DESCR_TYPE = 1 /* 1D transfer */
DESCR_SRC = GPIO_PRT_IN /* address of the GPIO_PRT_IN */
DESCR_DST = RAM base address 0 /* address of the buffer 0 in memory */
DESCR_X_CTL.SRC_X_INCR = 32 /* address +80h */
DESCR_X_CTL.DST_X_INCR = 1 /* address +04h */
DESCR_X_CTL.X_COUNT = 22 /* 23 data elements */
DESCR_NEXT_PTR = descriptor pointer 1 /* Descriptor chain to descriptor 1 */
4. Configure Descriptor 1
Configuration of Descriptor 1 is the same as that of Descriptor 0, except for the following:
DESCR_DST = RAM base address 1 /* address of the buffer 1 in memory */
DESCR_NEXT_PTR = descriptor pointer 0 /* Descriptor chain to descriptor 0 */
5. Enable P-DMA Channel
DW_CH_STRUCT_CH_CTL.ENABLED = 1 /* Enable */
6. Enable P-DMA
DW_CTL.ENABLED = 1 /* Enable */