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 define TSCH, TSCL registers in C program



Hi:

I'm using OMAPL137 with CGT 6.1.9. I'd like to benchmark C6747 code with TSCH, TSCL counter. Search forum I found many codes similar can be used, as I list in the bottom.

When I compile below programs, it will say TSCH, TSCL identifiers are undefined. So I  add these two lines:

extern cregister volatile unsigned int TSCL;
extern cregister volatile unsigned int TSCH;

It can compiles OK now, but It seems benchmark result is different every time I run it. Tthe question is: What  .h file I should  include so that TSCH, TSCL is properly defined. Or what address for these two registers? Which document has detailed description for these two registers (sorry for the stupid question, but I did can't find these two registers in OMAPL137 data sheet, could you please show me where it is, I use SPRS563a).

Thanks.

The benchmark code I used is:  

static __inline void C6_TIMER_START(void)
{
TSCL = 0;
}

static __inline uint64_t C6_TIMER_READ(void)
{
uint32_t cntl = TSCL;
return ((uint64_t) _itoll( TSCH, cntl ));
}

static __inline uint64_t C6_TIMER_DIFF(uint64_t time1, uint64_t time2)
{
return (time2 >= time1) ? (time2 - time1) : (time2 + (UINT64_MAX-time1));
}

static __inline uint64_t C6_TIMER_READ_AND_DIFF(uint64_t time1)
{
uint64_t time2 = C6_TIMER_READ();
return C6_TIMER_DIFF(time1, time2);
}

  • The file that you are missing is c6x.h that is found in the include folder of the C6000 compiler which defines TSCL, TSCH. Those registers are described in the C674x DSP CPU guide here:

    http://www.ti.com/lit/ug/sprufe8b/sprufe8b.pdf

    Regards,

    Rahul

  • Dear sir:

    If I include <c6x.h>, some compile error shown as below:

    C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 20: error: declaration is incompatible with builtin "__int40_t _lsadd(int, __int40_t)"
    "C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 22: error: declaration is incompatible with builtin "__int40_t _lssub(int, __int40_t)"
    "C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 29: error: declaration is incompatible with builtin "__int40_t _labs(__int40_t)"
    "C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 30: error: declaration is incompatible with builtin "int _sat(__int40_t)"
    "C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 32: error: declaration is incompatible with builtin "unsigned int _lnorm(__int40_t)"
    "C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include/c6x.h", line 92: error: declaration is incompatible with builtin "__int40_t _ldotp2(int, int)"

    I use CCS5, the libraries is:

    CGT 6.1.9

    dsplink: dsplink 1.65.00.03

    Code Generation Tool: 6.1.9

    DSP/BIOS library: 5.33.03.

    PSPdrivers: 01.20.00 included inside OMAPL137 psp 1.00.00.11

    following is the compiling parameters:

    -mv6740 -g --define="MAX_DSPS=1" --define="MAX_PROCESSORS=2" --define="ID_GPP=1" --define="OMAPL1XX" --define="PROC_COMPONENT" --define="POOL_COMPONENT" --define="NOTIFY_COMPONENT" --define="MPCS_COMPONENT" --define="RINGIO_COMPONENT" --define="MPLIST_COMPONENT" --define="MSGQ_COMPONENT" --define="MSGQ_ZCPY_LINK" --define="CHNL_COMPONENT" --define="CHNL_ZCPY_LINK" --define="ZCPY_LINK" --define="PROCID=0" --define="DA8XXGEM" --define="DOS_LINUX" --define="DA8XXGEM_INTERFACE=SHMEM_INTERFACE" --define="PHYINTERFACE=SHMEM_INTERFACE" --define="_DEBUG" --include_path="C:/TI/ccsv4/tools/compiler/C6000 Code Generation Tools 6.1.9/include" --include_path="D:/work13/dsplink/readwrite/readwrite/Debug" --include_path="C:/TI/bios_5_33_05/packages/ti/bios/include" --include_path="C:/TI/bios_5_33_05/packages/ti/rtdx/include/c6000" --include_path="C:/TI/xdais_7_21_01_07/packages/ti/xdais" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/inc" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/inc/DspBios" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/inc/DspBios/5.XX" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/inc/DspBios/5.XX/OMAPL1XXGEM" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/inc/C64XX" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/export/INCLUDE/DspBios/OMAPL1XX" --include_path="C:/OMAPL137_dsp_1_00_00_11/dsplink_1_65_00_03-prebuilt/dsplink/dsp/export/INCLUDE/DspBios/OMAPL1XX/internal" --include_path="D:/work13/dsplink/readwrite/readwrite/include/ut8" --include_path="D:/work13/dsplink/readwrite/readwrite/include/ut8" --diag_warning=225 --consultant --mem_model:data=far --c_src_interlist --obj_directory="D:/work13/dsplink/readwrite/readwrite/Debug"

  • Dear Rahul:

    After change the compiler variables from CGT 7.x to CGT 6.1.9, It can compile OK now. However the benchmark result is not as I expected small. What should I notice when benchmarking, do I need to turn off interrupt, cache and/or others function blocks before call benchmark function? My program runs on SDRAM now, should I move it to chip internal location before benchmark?

    Thanks.