//***************************************************************
//**** DMA transfer request source – ADC0 conversion complete
//***************************************************************
DMAMUX_CHCFG1 = DMAMUX _CHCFG_ENBL|DMAMUX_CHCFG_SOURCE(28);
//***************************************************************
//**** Source address, ADC0_RA
//***************************************************************
DMA_TCD1_SADDR = (uint32) &ADC0_RA;
//***************************************************************
//**** Source address increment; data is still read for the same address, no increment needed
//***************************************************************
DMA_TDC1_SOFF = 0x00;
//***************************************************************
//**** Source address reload after major loop finishes, no reload needed
//***************************************************************
DMA_TDC1_SLAST = 0x00;
//***************************************************************
//**** Destination address, SRAM buffer [0]
//***************************************************************
DMA_TDC1_DADDR = (uint32)&ui_adc_result[0];
//***************************************************************
//**** Destination address increment in bytes, increment for next buffer address
//**** 16 bit => 2 bytes
//***************************************************************
DMA_TDC1_DOFF = 0x02;
//***************************************************************
//**** Destination address reload after major loop finishes,
//**** must be subtracted from last pointer value, sample number is 12 each and 2 bytes long,
//**** 2 × 12 = 24 and must be subtract -24
//***************************************************************
DMA_TDC1_DLASTSGA = -24;
//***************************************************************
//**** Number of bytes for minor loop (one data transfer), ADC0 result is 16 bits long, so
//**** 2-byte transfer
//***************************************************************
DMA_TDC1_NBYTES_MLO = 0x02;
//***************************************************************
//**** Channel linking and major loop setting, linking after minor loop is enabled to
//**** channel 0 (0x0000), major loop transfers number 12 (0x0C)
//***************************************************************
DMA_TDC1_BITER_ELONKNO = (DMA_BITER_ELINKNO_ELINK_MASK|0x0000|0x0C);
//***************************************************************
//**** Channel linking and major loop setting reload value after major loop finishes,
//**** linking after minor loop is enabled, major loop transfers number 12 (0x0C).
//***************************************************************
DMA_TDC1_CITER_ELONKNO = (DMA_CITER_ELINKNO_ELINK_MASK|0x0C);
//***************************************************************
//**** Source and destination data width specification, both source and destination is 16-bit
//***************************************************************
DMA_TDC1_ATTR = DMA_ATTR_SSIZE(1)| DMA_ATTR_SDIZE(1);
//***************************************************************
//**** Common channel setting, linking after major loop enable to channel 0,
//**** IRQ request is generated after major loop complete
//***************************************************************
DMA_TDC1_CSR = (DMA_CSR_MAJORLINKCH(0)|DMA_CSR_MAJORLINCH_MASK|
DMA_CSR_INTMAJOR_MASK);
Channel 0 transfers next ADC0 input setting from constant buffer to ADC0_SC1A.
//***************************************************************
//**** DMA transfer request source – always requestor
//***************************************************************
DMAMUX_CHCFG0 = DMAMUX _CHCFG_ENBL|DMAMUX_CHCFG_SOURCE(36) ;
//***************************************************************
//**** Source address, constant buffer in SRAM
//***************************************************************
DMA_TCD1_SADDR = (uint32) &uc_adc_mux[0];
//***************************************************************
//**** Source address increment, data is 8-bit, 1 byte
//***************************************************************
DMA_TDC1_SOFF = 0x01;
//***************************************************************
//**** Source address reload after major loop finish, must be subtracted from last
//**** pointer value, sampling channel number is 3 each and 1 byte long, 1 × 3 = 3
//**** and must be subtract -3
//***************************************************************
DMA_TDC1_SLAST = -3;
//***************************************************************
//**** Destination address, ADC0 control register
//***************************************************************
DMA_TDC1_DADDR = (uint32)&ADC0_SC1A;
//***************************************************************
//**** Destination address increment in bytes, no increment needed
//***************************************************************
DMA_TDC1_DOFF = 0x00;
//***************************************************************
//**** Destination address reload after major loop finish, no address reload needed
//***************************************************************
DMA_TDC1_DLASTSGA = 0x00;
//***************************************************************
//**** Number of bytes for minor loop (one data transfer), ADC0 input setting value is
//**** 8 bits long, so 1-byte transfer
//***************************************************************
DMA_TDC1_NBYTES_MLO = 0x01;
//***************************************************************
//**** Channel linking and major loop setting, no linking after minor loop,
//**** major loop transfers number 0x03
//***************************************************************
DMA_TDC1_BITER_ELONKNO = (DMA_BITER_ELINKNO_ELINK_MASK|0x0000|0x0C);
//***************************************************************
//**** Channel linking and major loop setting reload value after major loop finish,
//**** no linking after minor loop, major loop transfers number 0x03
//***************************************************************
DMA_TDC1_CITER_ELONKNO = (DMA_CITER_ELINKNO_ELINK_MASK|0x0C);
//***************************************************************
//**** Source and destination data width specification, both source and destination are 8-bit
//***************************************************************
DMA_TDC1_ATTR = DMA_ATTR_SSIZE(1)| DMA_ATTR_SDIZE(1);
//***************************************************************
//**** Common channel setting, no linking after major loop, no IRQ request enable
//***************************************************************
DMA_TDC1_CSR = 0x00;