Post Go back to editing

TS201 Chaining TCB register setting questions

hello, aces:

i am using two TS201 EZ-KIT LITE BOARD to realize the DSP chaining practice, and i am learning one example including in the Visual DSP++ 5.0, it is here: " D:\visual_dsp++\TS\Examples\ADSP-TS201 EZ-KIT Lite\AudioPassThrough C ", some porblems confused me, the most difficult one is how to set the TCB registers, in the example, it has the codes like this:

i can't understand (1). what do these variables represent? --------RcveDMALSourceTCB, RcveDMALDestinTCB, XmitDMALSourceTCB,  XmitDMALDestinTCB, RcveDMARSourceTCB, RcveDMARDestinTCB, XmitDMARSourceTCB, XmitDMARDestinTCB----------------it seems that in this program, it is not necessary to set so many registers.

                           (2). i can't understanding this operation--------------- (long)(&XmitDMALSourceTCB) >> 2) & 0x7FFFF),  according to the TS201 manual, the CHPT saves the next TCB register's content, but what is "the next TCB register"?  and you know the next TCB is a 32-bits register, but here we only have 19bits, it seems not right???

                           (3)   i think you have known that i don't understand this example, can you give me some help to understand, if you can give me a diagram, it is best.

best regards,

sheng ming

  • Hi Sheng Ming,

    The EZ-KIT communicates with the audio codecs via the CPLD. The CPLD is required to be accessed over the external bus interface unit. Therefore we need to use the the externa port DMA channels for the communication.

    The external port DMA channels require both a source and destination transfer control block to describe the DMA operation.

    For a receive operation the source points to the externel memory address required to read the CODEC data (address 0x38000000) and the destination channel points to where we wish to store the data.

    For a transmit operation the source points to data we wish to transmit and the destination points to the external memory address in the CPLD that we need to write to to access the CODEC (address 0x38000000).

    The audio interface on the EZ-KIT works as follows:

    The first read from the CODEC is the Received Left Channel Audio

    The second read is the Received Right Channel Audio

    The first write writes the Left Channel Audio

    The second write writes the Right Channel Audio.

    So we have 4 audio channel we need process. As we have both Source and Destination TCBs required this accounts for the 8 TCB configurations you refer to in the example. It is required to set all these TCB registers for this example. As it's a passthrough example we need to take the received left and right audio data then transmit it out again. The data provided below is not actually registers that are set but in fact DMA descriptors that are loaded to the DCS0 (Source) and DCD0 (Destination) DMA channel TCB registers in a chained manner. The eight descriptors below are used to define the 4 DMA transfers that are required for the passthough example.

    RcveDMALSourceTCB // Receive Left Channel Source TCB that gets loaded to DCS0
    RcveDMALDestinTCB // Receive Left Channel Destination TCB that gets loaded to DCD0
    XmitDMALSourceTCB // Transmit Left Channel Source TCB that gets loaded to DCS0
    XmitDMALDestinTCB // Transmit Left Channel Destination TCB that gets loaded to DCD0
    RcveDMARSourceTCB // Receive Right Channel Source TCB that gets loaded to DCS0
    RcveDMARDestinTCB // Receive Right Channel Destination TCB that gets loaded to DCD0
    XmitDMARSourceTCB // Transmit Right Channel Source TCB that gets loaded to DCS0
    XmitDMARDestinTCB // Transmit Right Channel Destination TCB that gets loaded to DCD0

    In regards to the CHPT field. This field is used to store the address (or actually only part of the address) of the next TCB that is to be loaded to the DMA channel TCB, it does not contain the data.  The field must be loaded with the first 19bits of the QUAD WORD ALIGNED  address of the next TCB to be loaded as a TCB is a 128-bits in length.

    Therefore looking at the first TCB operation, &XmitDMALSourceTCB resolves to the address where the XmitDMALSourceTCB TCB is located in memory. We then right shift it by 2 to get the quad word aligned address, then use the 19-bit mask to get the correct 19-bits of the address. This value is stored to the CHPT field of the RcveDMALSourceTCB creating a chain from the RxLeft Channel Source DMA to the TxLeft Channel Source DMA.

    So if we look at the full example:

    RcveDMALSourceTCB.DP = (((long)(&XmitDMALSourceTCB) >> 2) & 0x7FFFF) | TCB_EXTMEM | TCB_NORMAL | TCB_DMAR | TCB_CHAIN;
    RcveDMALDestinTCB.DP = (((long)(&XmitDMALDestinTCB) >> 2) & 0x7FFFF) | TCB_INTMEM | TCB_NORMAL | TCB_DMAR | TCB_CHAIN;
    XmitDMALSourceTCB.DP = (((long)(&RcveDMARSourceTCB) >> 2) & 0x7FFFF) | TCB_INTMEM | TCB_NORMAL | TCB_INT | TCB_CHAIN;
    XmitDMALDestinTCB.DP = (((long)(&RcveDMARDestinTCB) >> 2) & 0x7FFFF) | TCB_EXTMEM | TCB_NORMAL | TCB_INT | TCB_CHAIN;
    RcveDMARSourceTCB.DP = (((long)(&XmitDMARSourceTCB) >> 2) & 0x7FFFF) | TCB_EXTMEM | TCB_NORMAL | TCB_CHAIN;
    RcveDMARDestinTCB.DP = (((long)(&XmitDMARDestinTCB) >> 2) & 0x7FFFF) | TCB_INTMEM | TCB_NORMAL | TCB_CHAIN;
    XmitDMARSourceTCB.DP = (((long)(&RcveDMALSourceTCB) >> 2) & 0x7FFFF) | TCB_INTMEM | TCB_NORMAL | TCB_CHAIN;
    XmitDMARDestinTCB.DP = (((long)(&RcveDMALDestinTCB) >> 2) & 0x7FFFF) | TCB_EXTMEM | TCB_NORMAL | TCB_CHAIN;
    1. The CHPT field of the Rx Left Source DMA chains to the Tx Left Source DMA
    2. Tx Left Source DMA chains to Rx Right Source DMA
    3. Rx Right Source DMA  chains to Tx Right Source DMA
    4. Tx Right Source DMA chains back to Rx Left Channel Audio Source DMA

    This creates our RxLeft->TxLeft->RxRight->TxRight flow. However the above 4 points only deal with the chaining of the source DMA channel (Quad register group for DCS0). We also need to do the same for the destination DMA channel (quad register group for DCD0).

    Hopefully this clarifies why we have the 8 DMA channel descriptors and how they are split up in order to deal with the 4 audio transfers required for the stereo passthough example.

    Regards

    Andy

  • Andy, thank you very much, you have given me great help,  it makes me understand the example.