This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to assign DMA channel to a specific TCn?

Other Parts Discussed in Thread: TMS320C6678

Hello everyone

I have some confusions about how to assign DMA channel to a specific TCn. I found an EDMA initialization code for C6678, but I do not know fully understand what is the reason of doing it. I try to find answer from EDMA Controller User Guide, but I still confused. In E2E Comunity, I found a similar question in this thread, but I still cannot fully understand. 

To initiate the DMA channel, at first, the code program DCHMAP with parameter set number to which the channel maps. To Assign PaRAM for different channels:

for(i=0; i<CSL_EDMA3_TPCC0_NUM_DMACH; i++) 	
	gpEDMA_CC0_regs->TPCC_DCHMAP[i] = i<< CSL_TPCC_TPCC_DCHMAP0_PAENTRY_SHIFT;

for(i=0; i<CSL_EDMA3_TPCC1_NUM_DMACH; i++) 	
	gpEDMA_CC1_regs->TPCC_DCHMAP[i] = i<< CSL_TPCC_TPCC_DCHMAP0_PAENTRY_SHIFT;

for(i=0; i<CSL_EDMA3_TPCC2_NUM_DMACH; i++) 	
	gpEDMA_CC2_regs->TPCC_DCHMAP[i] = i<< CSL_TPCC_TPCC_DCHMAP0_PAENTRY_SHIFT;

Then set up the DMAQNUM to map the event to the respective event queue.

gpEDMA_CC0_regs->TPCC_DMAQNUM[0]= 0x10101010;
gpEDMA_CC0_regs->TPCC_DMAQNUM[1]= 0x10101010;

gpEDMA_CC1_regs->TPCC_DMAQNUM[0]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[1]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[2]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[3]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[4]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[5]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[6]= 0x32103210;
gpEDMA_CC1_regs->TPCC_DMAQNUM[7]= 0x32103210;

gpEDMA_CC2_regs->TPCC_DMAQNUM[0]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[1]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[2]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[3]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[4]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[5]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[6]= 0x32103210;
gpEDMA_CC2_regs->TPCC_DMAQNUM[7]= 0x32103210;

In the above code, it program the DMAQNUM n with 0x10101010 or 0x32103210. I have three questions about the above codes.

1. It turns out EDMA0 only have 2 DMAQNUM registers, EDMA1 and EDMA2 has 8 DMQNUM registers. What does the number of DMAQNUM registers of EDMAn represent for?

2. For the EDMA0, it programs the DMAQNUMn register as 0x10101010. Suppose, I manually trigger the transfer by setting up ESR register. From the below Table 4-7, E9,E11,E13,and E15 are sending/receiving throughTC1, and E0, E2, E4, E6 are sending/receiving from TC0. My question is what about other those unset Events? For example, what happens if I trigger E1 in ESR, which TCn it would use?

3. For DMA channels in each EDMA, do those channels assign to its according number of event by default? For example, Channel 1 is Event 1, Channel 2 is Event 2, and so on.

Thanks!

Xining


  • Xining,

    A1. From TMS320C6678 data manual, 7.9.2 EDMA3 Channel Controller Configuration, Table 7-33 EDMA3 Channel Controller Configuration:

    There are 3 EDMA Channel Controllers on the C6678 DSP, EDMA3CC0, EDMA3CC1, and EDMA3CC2.
    • EDMA3CC0 has two transfer controllers: EDMA3TC0 and EDMA3TC1.
    • EDMA3CC1 has four transfer controllers: EDMA3TC0, EDMA3TC1, EDMA3TC2, and EDMA3TC3.
    • EDMA3CC2 has four transfer controllers: EDMA3TC0, EDMA3TC1, EDMA3TC2, and EDMA3TC3.

    Number of DMA channels in Channel Controller: 16 for CC0/ 64 for CC1/ 64 for CC2. As each DMAQNUM configures 8 DMA channels to queue mapping, that is why you need 2 (=16/8) DMAQNUM for CC0, but 8 for CC1 or CC2.

    A2. For EDMA CC0, you only have 16 DMA channels, you can only refer to the columns 0, 1 (that is  E0 to E15), the rest E16 to E63 is invalid for CC0.  Also, you have only two TC, that is TC0 and TC1 to choose from.

    If you program DMAQNUM0 = 0X10101010, that means E0, E2, E4, E6 are submitted to TC0; E1, E3, E5, E7 are submitted to TC1.

    If you program DMAQNUM1= 0X10101010, that means E8, E10, E12, E14 are submitted to TC0; E9, E11, E13, E15 are submitted to TC1.

    Another example, if you program DMAQNUM0 = 0x11110000, it means E0,E1,E2,E3 are submitted to TC0; E4,E5,E6,E7 are submitted to TC1.

    A3. Yes, The association of an event to a channel is fixed.

    Regards, Eric

  • Hi Eric

    Your reply clarify my confusions. I have an misunderstanding of Table 4-7. Previously, I thought the number (0~7) below the table Heading <DMAQNUM n> represents the value that configured in each En bits.

    Regards
    Xining