This code is the statemachine for incoming data #ifndef DISABLE_DMA_NET1 //if the DMA is active //COMM_PORT->FCR |= RXCLR; //if we previously received an entire message, do nothing until the message has been processed. if (recvData.status == NET1_RECV_MESSAGE) { } // Otherwise if we are receiving characters, check for any new ones else if (recvData.status == NET1_RECV_ACTIVE) { // If there is a flag clear it if (((0x01 << DMA_INPUT_CHANNEL) & (edma_getIntrStatus(DMA_CONTROLLER_ADDRESS))) != 0) { // TCODE // if (++kme & 1) // DOUT_SET_LED_BLU // TCODE GOES HI // else // DOUT_CLR_LED_BLU // TCODE GOES LO edma_clrIntr (DMA_CONTROLLER_ADDRESS, DMA_INPUT_CHANNEL); //TCODE sjsvect[sjsi]=edma_getAccntLength (DMA_INPUT_CHANNEL, DMA_CONTROLLER_ADDRESS); sjsi++; } // Else transfer complete, calc Length, update global flag, update state machine, renew params else { //tcode sjsi=0; DOUT_SET_LED_BLU // TCODE GOES HI recvData.status = NET1_RECV_MESSAGE; recvData.messageLength = edma_getAccntLength (DMA_INPUT_CHANNEL, DMA_CONTROLLER_ADDRESS); edma_channelToParamMap (DMA_CONTROLLER_ADDRESS, DMA_INPUT_CHANNEL, DMA_INPUT_RELOAD_CHANNEL); //should probably be done when the signal is being figured out } } // Otherwise if we received any characters, then a new message has started else if (((0x01 << DMA_INPUT_CHANNEL) & (edma_getIntrStatus(DMA_CONTROLLER_ADDRESS))) != 0) { DOUT_CLR_LED_BLU // TCODE GOES LO recvData.status = NET1_RECV_ACTIVE; // Update state machine, clear flag edma_clrIntr (DMA_CONTROLLER_ADDRESS, DMA_INPUT_CHANNEL); //COMM_PORT->FCR |= RXCLR; } ///////////////////////////////////////////////////////////////// This code is how we initialize the DMA ///////////////////////////////////////////////////////////////// void net1_edmaInitialize (void) { int i; // DATA PARAMETERS PROVIDED BY APPLICATION // Configure EDMA for UART Inputs unsigned int chType = EDMA3_CHANNEL_TYPE_DMA; unsigned int chNum = DMA_INPUT_CHANNEL; unsigned int reloadParamChNum = DMA_INPUT_RELOAD_CHANNEL; // Set this up now, it is to be used by the Reading Function unsigned int tccNum = DMA_TRANSFER_CONTROLLER; unsigned int evtQ = EVENTQ; // Event Queue used EDMA3Init(DMA_CONTROLLER_ADDRESS, evtQ); volatile char *srcBuff; volatile char *dstBuff; volatile unsigned int count = 0; unsigned int retVal = 0u; // retVal is only needed to allow IT code to remain unchanged unsigned int acnt = MAX_ACOUNT; unsigned int bcnt = MAX_BCOUNT; unsigned int ccnt = MAX_CCOUNT; srcBuff = (char *) COMM_BASE; dstBuff = (char *) recvData.buffer; for (i = 0; i < 127; i++) recvData.buffer[i] = 0XFF; retVal = edma_requestChannel(DMA_CONTROLLER_ADDRESS, chType, chNum, tccNum, evtQ); retVal = edma_requestChannel(DMA_CONTROLLER_ADDRESS, chType, reloadParamChNum, tccNum, evtQ); // Fill the PaRAM Set with transfer specific information paramSet.srcAddr = (unsigned int) (srcBuff); paramSet.destAddr = (unsigned int) (dstBuff); paramSet.aCnt = (unsigned short) acnt; paramSet.bCnt = (unsigned short) bcnt; paramSet.cCnt = (unsigned short) ccnt; paramSet.linkAddr = 0xFFFF; // Setting up the SRC/DES Index paramSet.srcBIdx = 0; //Static Uart Source paramSet.destBIdx = (short) acnt; // A Sync Transfer Mode paramSet.srcCIdx = (short) acnt; paramSet.destCIdx = (short) acnt; // Enable Final transfer completion interrupt flag, and dynamic destination addressing paramSet.opt = 0; paramSet.opt |= (chNum << EDMA3CC_OPT_TCC_SHIFT); paramSet.opt |= (1 << EDMA3CC_OPT_TCINTEN_SHIFT); paramSet.opt |= (1 << EDMA3CC_OPT_ITCINTEN_SHIFT); paramSet.opt &= 0xFFFFFFFB; // Now, write the PaRAM Sets. edma_clrIntr (DMA_CONTROLLER_ADDRESS, chNum); edma_setParam (DMA_CONTROLLER_ADDRESS, chNum, ¶mSet); edma_setParam (DMA_CONTROLLER_ADDRESS, reloadParamChNum, ¶mSet); edma_enableDmaEvt (DMA_CONTROLLER_ADDRESS, chNum); chNum = DMA_OUTPUT_CHANNEL; //initialize the output channel as well. retVal = edma_requestChannel(DMA_CONTROLLER_ADDRESS, chType, chNum, tccNum, evtQ); //assemble PaRAM information srcBuff = (char *) xmitData.buffer; dstBuff = (char *) COMM_BASE; // Fill the Param Set with transfer specific information except Bcnt paramSet.aCnt = (unsigned short) acnt; paramSet.cCnt = (unsigned short) ccnt; paramSet.linkAddr = 0xFFFF; //Turn off after message is complete // Setting up the SRC/DES Index paramSet.srcBIdx = (short) acnt; //Static Uart Source paramSet.destBIdx = 0; paramSet.srcAddr = (unsigned int) (srcBuff); paramSet.destAddr = (unsigned int) (dstBuff); // A Sync Transfer Mode paramSet.srcCIdx = (short) acnt; paramSet.destCIdx = (short) acnt; // Enable Final transfer completion interrupt flag, and dynamic destination addressing paramSet.opt = 0; paramSet.opt |= (1 << EDMA3CC_OPT_TCINTEN_SHIFT); paramSet.opt |= (EDMA3CC_OPT_DAM); paramSet.opt &= 0xFFFFFFFBu; //A type transfer