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.

Starterware DSP Interrupt code (OMAP L138)

Hi,

I am trying to understand how to set interrupt in DSP core through starterware examples. Here are the two commands:

#ifdef _TMS320C6X
 // Initialize the DSP INTC
 IntDSPINTCInit();

 // Enable DSP interrupts globally
 IntGlobalEnable();

I trace into the function and here it is:

 void IntDSPINTCInit (void)
{
    unsigned int step = 0;

    /* Set ISRs to default "do-nothing" routine */
    while(step != C674X_INT_COUNT)
        c674xISRtbl[step++] = IntDefaultHandler;

    /* Set interrupt service table pointer to the vector table */
#ifdef __TI_EABI__
    ISTP = (unsigned int)_intcVectorTable;
#else
    ISTP = (unsigned int)intcVectorTable;
#endif

    /* Clear pending CPU maskable interrupts (if any) */
    ICR = 0xFFF0;

    /* Enable NMIE bit to allow CPU maskable interrupts */
    IER = (1 << C674X_NMI);
}

void IntGlobalEnable (void)
{
    _enable_interrupts();
}

Here it stop and I couldn't trace where is the ICR/ IER is defined and I couldn't trace _enable_interrupts() function definition. Please help on this.

Regards,

Mok

  • Hi Kim,

    _enable_interrupts() is a intrinsic function supported by the C6000 compiler for all C6000 DSP cores. Also the IER and ICR are standard registers across all DSP cores so look for these symbol definitions in the compiler rts library source files.

    Regards,

    Rahul

  • Hi Rahul,

    I am same team with Kim and face the same problem. May I know that how to check the "intcVectorTable" which is in void IntDSPINTCInit (void) function? Where is it located and what is the setting in the table?

    Thank you very much.

  • Try "C6748_StarterWare_1_20_03_03\system_config\c674x\intvecs.asm"

  • Thanks for the information.

    Is the cmd file that actually link between the source file and this .asm file? I couldn't find this file in the starterware directory.

  • The link is through .cproject file through a .lib to .project file. For example, tracing the usb_dev_bulk project, debug configuration:

    File:build\c674x\cgt_ccs\c6748\lcdkC6748\usb_dev_bulk\.cproject
    Pulls in these libraries
    - libc.a
    - binary\c674x\cgt_ccs\c6748\drivers\Debug\drivers.lib
    - binary\c674x\cgt_ccs\utils\Debug\utils.lib
    - binary\c674x\cgt_ccs\c6748\lcdkC6748\platform\Debug\platform.lib
    - binary\c674x\cgt_ccs\c6748\system_config\Debug\system_config.lib
    - binary\c674x\cgt_ccs\c6748\usblib\Debug\usblib.lib
    - binary\c674x\cgt_ccs\grlib\Debug\grlib.lib
    Outputs here:
    - binary\c674x\cgt_ccs\c6748\lcdkC6748\usb_dev_bulk\Debug\usb_dev_bulk.out

    File:build\c674x\cgt_ccs\c6748\lcdkC6748\usb_dev_bulk\.project
    Pulls in these source files
    - examples\lcdkC6748\usb_dev_bulk\usb_bulk_structs.c
    - examples\lcdkC6748\usb_dev_bulk\usb_dev_bulk.c
    - examples\lcdkC6748\usb_dev_bulk\ustdlib.c

    File:build\c674x\cgt_ccs\c6748\system_config\.cproject
    Outputs here:
    - binary\c674x\cgt_ccs\c6748\system_config\Debug\system_config.lib

    File:build\c674x\cgt_ccs\c6748\system_config\.project
    - system_config\c674x\cache.c
    - system_config\c674x\interrupt.c
    - system_config\c674x\intvecs.asm

    StarterWare has a quite few libraries that must be built separate from the application. The problem is that StarterWare libraries tend to require modification to be useful and libraries need to be rebuilt. I gave up trying to maintain the spread out organization of the code. I copied all relevent source files into one project and avoided all the precompiled libraries.

  • Hi Norman,

    Thanks for explaination for how the asm file link to the project file. But I am still not sure how the interrupt table work.

    If I am using interrupt table 4, where the table will point to? How to check the location. Thank you.

    ;**********************************************************
    ;    Interrupt Vector Table
    ;**********************************************************
     .align 1024
    _intcVectorTable:
     VEC_ENTRY _c_int00
     VEC_ENTRY _c674x_nmi_isr
     VEC_ENTRY _c674x_rsvd_int2_isr
     VEC_ENTRY _c674x_rsvd_int3_isr
     VEC_ENTRY _c674x_mask_int4_isr
     VEC_ENTRY _c674x_mask_int5_isr
     VEC_ENTRY _c674x_mask_int6_isr
     VEC_ENTRY _c674x_mask_int7_isr
     VEC_ENTRY _c674x_mask_int8_isr
     VEC_ENTRY _c674x_mask_int9_isr
     VEC_ENTRY _c674x_mask_int10_isr
     VEC_ENTRY _c674x_mask_int11_isr
     VEC_ENTRY _c674x_mask_int12_isr
     VEC_ENTRY _c674x_mask_int13_isr
     VEC_ENTRY _c674x_mask_int14_isr
     VEC_ENTRY _c674x_mask_int15_isr

  • Not sure if I understand the question. The HW register ISTP points to the base of vector table. Starterware sets ISTP to intcVectorTable which is a table of function addesses. In this case all the functions are in interrupt.c. Each of the functions in vector through a intermediate function table c674xISRtbl. The application can change the function values in c674xISRtbl via the API IntRegister(). A trace through the code for mask 4.

    File: system_config\c674x\intvecs.asm
    _intcVectorTable:
    ...
        VEC_ENTRY _c674x_mask_int4_isr
    ...


    File: system_config\c674x\interrupt.c
     void IntDSPINTCInit (void)
    {
    ...
        ISTP = (unsigned int)intcVectorTable;
    ...
    }

    void IntRegister (unsigned int cpuINT, void (*userISR)(void))
    {
    ...
        c674xISRtbl[cpuINT] = userISR;
    }

    interrupt void c674x_mask_int4_isr (void)
    {
        c674xISRtbl[4]();
    }