You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.9 KiB
78 lines
1.9 KiB
#include "edma_ss.h"
|
|
|
|
void test( void ){
|
|
hostBuffer hostData;
|
|
uint32_t channelMask;
|
|
uint16_t paramOffset;
|
|
edmaParam params;
|
|
volatile uint32_t *ptr;
|
|
volatile uint32_t *ptr_cm;
|
|
volatile edmaParam *pParams;
|
|
|
|
ptr = EDMA0_CC_BASE;
|
|
ptr_cm = CM_PER_BASE;
|
|
|
|
/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
|
|
//CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
|
|
|
|
ptr_cm[TPTC0_CLKCTRL] = ON;
|
|
ptr_cm[TPCC_CLKCTRL] = ON;
|
|
|
|
/* Load channel parameters from DRAM - loaded by host */
|
|
hostData.src = /*buf.src*/ 0x4A310000; //PRU Shared memory
|
|
hostData.dst = /*buf.dst*/ 0x4A310100; //PRU Shared memory
|
|
hostData.chan = /*buf.chan*/ 10;
|
|
|
|
channelMask = (1 << hostData.chan);
|
|
|
|
/* Map Channel 10 to PaRAM 10 */
|
|
ptr[DCHMAP_10] = (hostData.chan << 5);
|
|
|
|
/* Setup EDMA region access for Shadow Region 1 */
|
|
ptr[DRAE1] |= channelMask;
|
|
|
|
/* Clear channel event from EDMA event registers */
|
|
ptr[SECR] |= channelMask;
|
|
ptr[ICR] |= channelMask;
|
|
|
|
/* Enable channel interrupt */
|
|
ptr[IESR] |= channelMask;
|
|
|
|
/* Enable channel */
|
|
ptr[EESR] |= channelMask;
|
|
|
|
/* Clear event missed register */
|
|
ptr[EMCR] |= channelMask;
|
|
|
|
/* Setup channel to submit to EDMA TC0 */
|
|
ptr[DMAQNUM1] &= 0xFFFFF0FF;
|
|
|
|
/* Setup and store PaRAM set for transfer */
|
|
paramOffset = PARAM_OFFSET;
|
|
/* channel * 0x20, word address */
|
|
paramOffset += ((hostData.chan << 5) / 4);
|
|
|
|
params.lnkrld.link = 0xFFFF;
|
|
params.lnkrld.bcntrld = 0x0000;
|
|
params.opt.tcc = hostData.chan;
|
|
params.opt.tcinten = 1;
|
|
params.opt.itcchen = 1;
|
|
|
|
params.ccnt.ccnt = CCNT;
|
|
params.abcnt.acnt = ACNT;
|
|
params.abcnt.bcnt = BCNT;
|
|
params.bidx.srcbidx = 0x1;
|
|
params.bidx.dstbidx = 0x1;
|
|
params.src = hostData.src;
|
|
params.dst = hostData.dst;
|
|
|
|
pParams = (volatile edmaParam *)(ptr + paramOffset);
|
|
*pParams = params;
|
|
|
|
/* Trigger transfer */
|
|
ptr[ESR] = (channelMask);
|
|
|
|
/* Wait for transfer completion */
|
|
while (!(ptr[IPR] & channelMask)){
|
|
};
|
|
};
|