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.

the question is about DAT function on c6455

the question is about DAT function on c6455
We want to transfer "src" to "dst" by DAT function in CSL.
the following code is the demo of c6455,but this code didn't transfer "src" to "dst",
I find that when code run to  "DAT_wait(id)" the problem happen,and I think the problem is that“IPR”always“0”.
so I don't konw how to remedy the code?

//-------------------------------------code------------------------------------------------------
#include <stdio.h>
#include <csl_dat.h>

/*  Global Setup, Data */
#define DAT_CSL_EXA_OK    1
#define NUMBER_OF_ROW     8
#define NUM_OF_BYTES      256
#define ARRAY_INDEX       16
#define FILL_VALUE        0x55555555
#define LINE_PITCH        20

/* Function forwards */
Int dat_1dXfer(void);

/* global buffers used during transfer */
Uint8 src[NUM_OF_BYTES];
Uint8 dst[NUM_OF_BYTES];
/* Variable to verify example status */
Int pass = 1;

void main(void)
{
   if (dat_1dXfer() && pass)
      {printf("<< EXAMPLE PASSED >>: Dat 1D DAT Example Passed \n");}
    else
     {printf("<< EXAMPLE FAILED >>: Dat 1D DAT Example Failed \n");}
    
  }

Int dat_1dXfer(void)
{         
    Int         loopIdx;  
    Int         id;
    Uint32      fillVal;
    DAT_Setup   datSetup;

    /* dat setup */
    datSetup.qchNum = CSL_DAT_QCHA_0;
    datSetup.regionNum = CSL_DAT_REGION_GLOBAL ;
    datSetup.tccNum = 1;
    datSetup.paramNum = 0 ;
    datSetup.priority = CSL_DAT_PRI_1;
   
    /* Initialize the memory  */
    for (loopIdx = 0; loopIdx < NUM_OF_BYTES; loopIdx++){
        src[loopIdx] = loopIdx;
        dst[loopIdx] = 0xff;
    }
   
    /* opening the dat module */   
    DAT_open (&datSetup);
   
    /* Copies a linear block of data from Src to Dst */
    id = DAT_copy (&src, &dst, NUM_OF_BYTES);
   
    /* Waits for a previous transfer to complete */
    DAT_wait(id);                    //!!!when the code run here,the problem happen.<-------Problem!!!
   
    /* Verify received data */
    for (loopIdx = 0; loopIdx < NUM_OF_BYTES; loopIdx++) {
        if (dst[loopIdx] != loopIdx) {
            printf("Linear block of data transfer from src to dst is failed\n");
            pass = 0;}
    }
   
    fillVal = FILL_VALUE;
   
    /* Fills a linear block of memory with the specified fillVal
        using EDMA */
    DAT_fill (&dst, NUM_OF_BYTES, &fillVal);
    DAT_wait (id);
   
    /* Verify fill data */
    for (loopIdx = 0; loopIdx < NUM_OF_BYTES; loopIdx++) {
        if (dst[loopIdx] != ((Uint8)fillVal)) {
            printf("Filling linear block of memory with the specified ");
            printf("fillVal is failed\n");
            pass = 0;
        }
    }
 
    return DAT_CSL_EXA_OK;
}

  • huang huang said:
    I find that when code run to  "DAT_wait(id)" the problem happen,and I think the problem is that“IPR”always“0”.

    If IPR is always 0 for a simple DAT_copy, it must be either that something is incompletely initialized or there is an error in the setup of the DAT_copy. Is there a return code you can get from the DAT_open() call?

    Which DAT_wait(id) is where the problem happens?

    Where did the basis for your demo code come from? Can you get the original demo code to work, or is this all original code written by you?

  • thank you for your answer!

    RandyP said:
    If IPR is always 0 for a simple DAT_copy, it must be either that something is incompletely initialized or there is an error in the setup of the DAT_copy. Is there a return code you can get from the DAT_open() call?

    1、only from this code,you can find out what error from DAT_copy() ?could you write a right one for me?

    I use C6455 simulator in ccs 。

    RandyP said:
    Which DAT_wait(id) is where the problem happens?

    2、if the ccs is restart  ,the second DAT_wait(id)  have problem and  the first  DAT_wait(id)  is OK。 

     if the code have been  run  more than one time  ,the first  DAT_wait(id) have problem,I have write   “<--------Problem”  in the code to tell reader where is the problem.

    and the DAT_wait () in csl is writen like this:

    void DAT_wait (   Uint32    id  )
    {     ....

        if (_CSL_datStateStruct.regionNum != CSL_DAT_REGION_GLOBAL)

              { .........  }
        else {
            if (_CSL_datStateStruct.tccNum < 32) 
            {
                while (!(((CSL_Edma3ccRegsOvly) CSL_EDMA3CC_0_REGS)->IPR &                      //my code run  here  and  have a bad loop or Dead cycle
                        (1 << _CSL_datStateStruct.tccNum)))
                        {
                        a=((CSL_Edma3ccRegsOvly) CSL_EDMA3CC_0_REGS)->IPR ;
                        b=((CSL_Edma3ccRegsOvly) CSL_EDMA3CC_0_REGS)->IPRH ;
                        };
                ((CSL_Edma3ccRegsOvly) CSL_EDMA3CC_0_REGS)->ICR =
                    (1 << _CSL_datStateStruct.tccNum);
            }
            else {  ...........}
        }
       ......}

    3、Where did the basis for your demo code come from? Can you get the original demo code to work, or is this all original code written by you?

    I should say this is  original code ,but  didn't   write by me  ,maybe by the TI engineer,because the  begin of  the code is written  like this:

    /*  ============================================================================
     *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
     *
     *   Use of this software is controlled by the terms and conditions found in the
     *   license agreement under which this software has been supplied.
     *   ===========================================================================
     */
     
    /** ============================================================================
     *   @file  DAT_example.c
     *
     *   @path  $(CSLPATH)\example\dat\src
     *
     *   @desc  Example of DAT
     *
     *  ============================================================================
     *   @n Target Platform: EVM
     *  ============================================================================
     *   @n <b> Example Description </b>

  • Which version of CCS are you using, and which exact simulator do you select in CCSetup?

  • I have the same problems in my project discussed in this post. I have already used the DAT functions on C64x based platforms before (successfully). Now, I also tried using the DAT functions on a C64x+ CPU Cycle Accurate Simulator, C6455 DSK and C6474 EVM. My project environment is the following:

    - Code Composer 3.3

    - CSL_C6455_03.00.10.02

    - CSL_C6474_03.00.04.00.

    - C64x+ CPU Cycle Accurate Simulator

     

    >> Where did the basis for your demo code come from? Can you get the original demo code to work, or is this all original code written by you?

    The example code that I'm using was already posted by huang and is included in the CSL examples. Both the C6455 CSL and the C6474 CSL have the same sources regarding the DAT module. However, the example projects are not working!

     

    My questions are the following:

    *) On the C64x I always used DAT_CHAANY for opening the DAT module. Is this parameter obsolete on the C64x+ and do I have to rebuild the DAT_CHAANY in my own functions?

    *) DAT_copy returns 1 and no data is copied from src to dst! Why?

    *) DAT_wait does not return and has a bad loop, shown by huang. Why?

    *) DAT_copy returns a transfer identifier and DAT_wait should wait for this identifier. The implementation of DAT_wait has an id parameter, that is never used in this function. How can I wait for a specific transfer identifier using DAT_wait?

    *) Can I use another DAT implementation that is working on C64x+ platforms?