Functions
INTC Functions
INTC

Functions

int IRQ_plug (Uint16 EventId, IRQ_IsrPtr funcAddr)
int _IRQ_plug (Uint16 EventId, IRQ_IsrPtr funcAddr)
CSL_Status IRQ_init (CSL_IRQ_Dispatch *dispatchTable, Uint16 biosPresent)
CSL_Status IRQ_clear (Uint16 EventId)
void IRQ_clearAll (void)
CSL_Status IRQ_config (Uint16 EventId, CSL_IRQ_Config *config)
CSL_Status IRQ_getConfig (Uint16 EventId, CSL_IRQ_Config *config)
int IRQ_disable (Uint16 EventId)
void IRQ_disableAll (void)
int IRQ_enable (Uint16 EventId)
CSL_Status IRQ_restore (Uint16 EventId, int value)
CSL_Status IRQ_getArg (Uint16 EventId, Uint32 *arg)
CSL_Status IRQ_map (Uint16 EventId)
CSL_Status IRQ_setArg (Uint16 EventId, Uint32 val)
CSL_Status IRQ_setVecs (Uint32 Ivpd)
CSL_Status IRQ_test (Uint16 EventId, Bool *IntStatus)
Bool IRQ_globalDisable ()
Bool IRQ_globalEnable ()
void IRQ_globalRestore (Bool val)

Function Documentation

int _IRQ_plug ( Uint16  EventId,
IRQ_IsrPtr  funcAddr 
)

============================================================================
IRQ_plug

Description
This function is used to register the ISR routine for the corresponding interrupt event.This is defined in assembly file - csl_irqplug.asm

Arguments

       EventId      Interrupt Event Number
       funcAddr     ISR function Address
 *   

Pre Condition
IRQ_setVecs API should be called before calling this API

Post Condition
Register ISR with Interrupt event number

Modifies
1. update vector table

Example

            interrupt void ISR_routine(void);
            CSL_Status            status;
            Uint32                vectorAddress;
            // Adress for interrupt vector table
             extern void VECSTART(void); // defined in vector table
            ...

            // to set the interrupt vector table address
            status = IRQ_setVecs((Uint32)&VECSTART);
            IRQ_plug(SAR_EVENT,&ISR_routine);


            ...

    

============================================================================

CSL_Status IRQ_clear ( Uint16  EventId)

============================================================================
IRQ_clear

Description
This function acknowledge the interrupt by clearing the corresponding Interrupt flag .

Arguments

            eventId          Event Id for the peripheral in IFR Register
     

Return Value CSL_Status

  • CSL_SOK - INTC_close is successful
  • CSL_ESYS_INVPARAMS - Invalid handle

Pre Condition
IRQ_setVecs and IRQ_plug API should be called before calling this API

Post Condition
IFR Register bit will be cleared

Modifies
1. The status variable
2. IFR Register Example

            Uint16           EventId;
            CSL_status       status;

            ...

            status = IRQ_clear(EventId);
     

============================================================================

References CSL_INTC_BIT_SET, IRQ_globalDisable(), IRQ_globalRestore(), RCV2_EVENT, SINT31_EVENT, and XMT3_EVENT.

void IRQ_clearAll ( void  )

============================================================================
IRQ_clearAll

Description
This function clears all the interrupts. Both IFR0 and IFR1 are cleared by this function.

Arguments

            None
     

Return Value None

Pre Condition
None

Post Condition
Clears All the interrupt

Modifies
Interrupt Flag Registers

Example

            IRQ_clearAll();
     

============================================================================

References CSL_INTC_IFR_RESET.

CSL_Status IRQ_config ( Uint16  EventId,
CSL_IRQ_Config config 
)

============================================================================
IRQ_config

Description
This API function is used to update ISR function and its arguments passed in config structure for the corresponding event in dispatch table Arguments

            EventId         Id for peripheral in IFR and IER Registers .

            config          Config structure

 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_config call is successful
  • CSL_ESYS_BADHANDLE - Invalid handle
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init API should be called before this API call

Post Condition
It updates CSL_IrqDataObj structure Modifies
1. The status variable
2. Hardware Registers

Example

         interrupt void ISR_routine(void);
         CSL_Status     status;
         // Adress for interrupt vector table
         extern void VECSTART(void);
         IRQ_Config     config;
         Uint16         EventId;
         status = IRQ_init();
         ...
         // to set the interrupt vector table address
         IRQ_setVecs((Uint32)&VECSTART);
         ...
         config.funcAddr = &ISR_routine;
         status = IRQ_config(EventId,&config);
         ...
    

============================================================================

References CSL_IRQ_Config::cacheCtrl, CSL_IRQ_Dispatch::cacheCtrl, CSL_IRQ_DATA, CSL_IRQ_Config::funcAddr, CSL_IRQ_Dispatch::funcAddr, CSL_IRQ_Config::funcArg, CSL_IRQ_Dispatch::funcArg, CSL_IRQ_Config::ierMask, CSL_IRQ_Dispatch::ierMask, CSL_IrqDataObj::IrqDispatchTable, and SINT31_EVENT.

int IRQ_disable ( Uint16  EventId)

============================================================================
IRQ_disable

Description
It disables the corresponding interrupt in IER Register and also return the previous bit mask value

Arguments

            EventId         Id for peripheral in IFR and IER Registers

 *   

Return Value IER Register value before enabling

Pre Condition
IRQ_setVecs andIRQ_plug API should be called before calling this API

Post Condition
It disabled the corresponding interrupt bit in IER Register

Modifies
IER h/w Registers

Example

            Uint16         EventId;
            int            old_IER;

            old_IER = IRQ_disable(EventId);
     

============================================================================

References CSL_INTC_BIT_RESET, IRQ_globalDisable(), IRQ_globalRestore(), RCV2_EVENT, SINT31_EVENT, and XMT3_EVENT.

void IRQ_disableAll ( void  )

============================================================================
IRQ_disableAll

Description
This function disables all the interrupts avaible on C5505 DSP. Both IER0 and IER1 are cleared by this function

Arguments

            None

 *   

Return Value None

Pre Condition
None

Post Condition
Disables all the interrupts

Modifies
Interrupt Enable Registers

Example


            IRQ_disableAll();
     

============================================================================

int IRQ_enable ( Uint16  EventId)

============================================================================
IRQ_enable

Description
It enables the corresponding interrupt bit in IER Register and also return the previous bit mask value

Arguments

             EventId         Id for peripheral in IFR and IER Registers
 *   

Return Value IER Register value before enabling

Pre Condition
IRQ_setVecs and IRQ_plug API should be called before calling this API

Post Condition
It set the corresponding interrupt bit to 1 in IER Register

Modifies
IER CPU Registers

Example

            Uint16         EventId;
            int            old_IER;

            old_IER = IRQ_enable(EventId);
     

============================================================================

============================================================================
IRQ_enable

Description
It enables the corresponding interrupt bit in IER Register and also return the previous bit mask value

Arguments

             EventId         Id for peripheral in IFR and IER Registers
 *   

Return Value IER Register value before enabling

Pre Condition
IRQ_setVecs andIRQ_plug API should be called before calling this API

Post Condition
It set the corresponding interrupt bit to 1 in IER Register

Modifies
IER CPU Registers

Example

            Uint16         EventId;
            int            old_IER;

            old_IER = IRQ_enable(EventId);
     

============================================================================

References CSL_INTC_BIT_SET, IRQ_globalDisable(), IRQ_globalRestore(), RCV2_EVENT, SINT31_EVENT, and XMT3_EVENT.

CSL_Status IRQ_getArg ( Uint16  EventId,
Uint32 *  arg 
)

============================================================================
IRQ_getArg

Description
It gets the ISR function arguments correspond to eventId

Arguments

             EventId         Id for peripheral in IFR and IER Registers
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init,IRQ_config should be called before calling this API

Post Condition

Modifies
arg variable

Example

            Uint16         EventId;
            Uint32         arg;
            CSL_Status     status;

            status = IRQ_getArg(EventId,&arg);
     

============================================================================

References CSL_IRQ_DATA, CSL_IRQ_Dispatch::funcArg, CSL_IrqDataObj::IrqDispatchTable, and SINT31_EVENT.

CSL_Status IRQ_getConfig ( Uint16  EventId,
CSL_IRQ_Config config 
)

============================================================================
IRQ_getConfig

Description
It reads the configuration values (function address,arguments etc) from global IRQ data object structure

Arguments

          EventId         Id for peripheral in IFR and IER Registers

          config          Config structure
     

Return Value CSL_Status

  • CSL_SOK - IRQ_getConfig is successfull
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_config should be called before calling this API

Post Condition
The configuration structure will be populated

Modifies
1.status 2.config structure Example

        // Global IRQ object structure
         CSL_IrqDataObj  CSL_IrqData;
         CSL_Status     status;
         IRQ_Config     config;
         Uint16         EventId;
            ...
             status = IRQ_config(EventId,&config);
             ...
            status = IRQ_getConfig(EventId,&config);
     

============================================================================

References CSL_IRQ_Dispatch::cacheCtrl, CSL_IRQ_Config::cacheCtrl, CSL_IRQ_DATA, CSL_IRQ_Dispatch::funcAddr, CSL_IRQ_Config::funcAddr, CSL_IRQ_Dispatch::funcArg, CSL_IRQ_Config::funcArg, CSL_IRQ_Dispatch::ierMask, CSL_IRQ_Config::ierMask, CSL_IrqDataObj::IrqDispatchTable, and SINT31_EVENT.

Bool IRQ_globalDisable ( )

============================================================================
IRQ_globalDisable

Description
It disables the interrupt globally by disabling INTM bit and also return the previous mask value for INTM bit

Arguments


 *   

Return Value Bool

  • Old INTM bit value

Pre Condition
None

Post Condition
set INTM bit to 1 in ST1 CPU Register

Modifies 1. ST1 CPU Register Example

            Bool oldMask;
            ....
            oldMask = IRQ_globalDisable();
     

============================================================================

Referenced by IRQ_clear(), IRQ_disable(), IRQ_enable(), IRQ_restore(), IRQ_setVecs(), IRQ_test(), MMC_read(), MMC_write(), USB_confDmaRx(), USB_confDmaTx(), USB_initDma(), and USB_initQueueManager().

Bool IRQ_globalEnable ( )

============================================================================
IRQ_globalEnable

Description
It enables the interrupt globally by enabling INTM bit and also return the previous mask value for INTM bit

Arguments


 *   

Return Value Bool

  • Old INTM bit value

Pre Condition
None

Post Condition
set INTM bit to 0 in ST1 CPU Register

Modifies 1.ST1 CPU Register Example

            Bool oldMask;
            ....
            oldMask = IRQ_globalEnable();
     

============================================================================

void IRQ_globalRestore ( Bool  value)

============================================================================
IRQ_globalRestore

Description
It sets INTM bit to the value passed in the API

Arguments

            val -  INTM bit value
 *   

Return Value void

Pre Condition
IRQ_globalDisable or IRQ_globalEnable should be called

Post Condition
set or clear INTM bit in ST1 CPU Register

Modifies 1. ST1 CPU Register Example

            Bool val;
            ....
            IRQ_globalRestore(val);
     

============================================================================

Referenced by IRQ_clear(), IRQ_disable(), IRQ_enable(), IRQ_restore(), IRQ_setVecs(), IRQ_test(), MMC_read(), MMC_write(), USB_confDmaRx(), USB_confDmaTx(), USB_initDma(), and USB_initQueueManager().

CSL_Status IRQ_init ( CSL_IRQ_Dispatch dispatchTable,
Uint16  biosPresent 
)

============================================================================
IRQ_init

Description
This is the initialization function for INTC module. This function initializes the CSL INTC data structures

Arguments

       dispatchTable - Dispatch table
       biosPresent   - DspBios is present or not
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_init is successful
  • CSL_ESYS_INVPARAMS - Invalid parameter Pre Condition
    None

Post Condition
Initializes CSL data structures

Modifies
1. The status variable
2. Update CSL_IrqDataObj structure

Example

            CSL_Status            status;
            CSL_IRQ_Dispatch     dispatchTable
            ...

            status = IRQ_init(&dispatchTable,0);
            ...

    

============================================================================

References CSL_IrqDataObj::biosPresent, CSL_IRQ_DATA, INV, IRQ_EVENT_CNT, IRQ_MASK32, CSL_IrqDataObj::IrqDispatchTable, CSL_IrqDataObj::IrqEventTable, and CSL_IrqDataObj::IrqIntTable.

CSL_Status IRQ_map ( Uint16  EventId)

============================================================================
IRQ_map

Description
It initialize the interrupt table with the event mask value for the corresponding event id

Arguments

             EventId         Id for peripheral in IFR and IER Registers
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init should be called before calling this API

Post Condition

Modifies
CSL_IrqData structure

Example

            Uint16         EventId;
            CSL_Status     status;

            status = IRQ_map(EventId);
     

============================================================================

References CSL_IRQ_DATA, IRQ_MASK32, CSL_IrqDataObj::IrqIntTable, and SINT31_EVENT.

int IRQ_plug ( Uint16  EventId,
IRQ_IsrPtr  funcAddr 
)

============================================================================
IRQ_plug

Description
This function is used to register the ISR routine for the corresponding interrupt event.This is defined in assembly file - csl_irqplug.asm

Arguments

       EventId      Interrupt Event Number
       funcAddr     ISR function Address
 *   

Pre Condition
IRQ_setVecs API should be called before calling this API

Post Condition
Register ISR with Interrupt event number

Modifies
1. update vector table

Example

            interrupt void ISR_routine(void);
            CSL_Status            status;
            Uint32                vectorAddress;
            // Adress for interrupt vector table
             extern void VECSTART(void); // defined in vector table
            ...

            // to set the interrupt vector table address
            status = IRQ_setVecs((Uint32)&VECSTART);
            IRQ_plug(SAR_EVENT,&ISR_routine);


            ...

    

============================================================================

CSL_Status IRQ_restore ( Uint16  EventId,
int  value 
)

============================================================================
IRQ_restore

Description
It restores the given value in IER Register passed in API

Arguments

             EventId         Id for peripheral in IFR and IER Registers
             value           bit value - 1 or 0
 *   

Return Value CSL_Status

  • CSL_SOK always returns

Pre Condition
IRQ_enable or IRQ_disable should be called before calling this API

Post Condition
It configures the given bit value in IER Register

Modifies
IER CPU Registers

Example

            Uint16         EventId;
            int             value;
            CSL_Status     status;
            value = IRQ_enable(EventId);
            ..
            status = IRQ_restore(EventId,value);
     

============================================================================

References IRQ_globalDisable(), IRQ_globalRestore(), RCV2_EVENT, SINT31_EVENT, and XMT3_EVENT.

CSL_Status IRQ_setArg ( Uint16  EventId,
Uint32  val 
)

============================================================================
IRQ_setArg

Description
It sets the ISR function arguments correspond to the eventId

Arguments

             EventId         Id for peripheral in IFR and IER Registers
             val             value for ISR arguments
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init should be called before calling this API

Post Condition

Modifies
CSL_IrqData structure

Example

            Uint16         EventId;
            Uint32         val;
            CSL_Status     status;

            status = IRQ_setArg(EventId,val);
     

============================================================================

============================================================================
IRQ_setArg

Description
It sets the ISR function arguments correspond to the eventId

Arguments

             EventId         Id for peripheral in IFR and IMR Registers
             val             value for ISR arguments
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init should be called before calling this API

Post Condition

Modifies
status

Example

            // Global IRQ object structure
            CSL_IrqDataObj  CSL_IrqData;
            Uint16         EventId;
            Uint32         val;
            CSL_Status     status;

            status = IRQ_setArg(EventId,val);
     

============================================================================

References CSL_IRQ_DATA, CSL_IRQ_Dispatch::funcArg, CSL_IrqDataObj::IrqDispatchTable, and SINT31_EVENT.

CSL_Status IRQ_setVecs ( Uint32  Ivpd)

============================================================================
IRQ_setVecs

Description
It stores the Interrupt vector table address in Interrupt vector pointer DSP and Interrupt vector pointer host Registers

Arguments

             Ivpd           Interrupt Vector Pointer Address
 *   

Return Value CSL_Status

  • Always returns CSL_SOK

Pre Condition
None

Post Condition
It sets IVPD and IVPH CPU Registers

Modifies
IVPD and IVPH CPU Registers

Example

           // Interrupt Vector Table Address
            Uint32         Ivpd;
            CSL_Status     status;

            status = IRQ_setVecs(Ivpd);
     

============================================================================

============================================================================
IRQ_setVecs

Description
It stores the Interrupt vector table address in Interrupt vector pointer DSP and Interrupt vector pointer host Registers

Arguments

             Ivpd           Interrupt Vector Pointer Address
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
None

Post Condition
It sets IVPD and IVPH CPU Registers

Modifies
IVPD and IVPH CPU Registers

Example

           // Interrupt Vector Table Address
            Uint32         Ivpd;
            CSL_Status     status;

            status = IRQ_setVecs(Ivpd);
     

============================================================================

References CSL_CPU_IVPD_MASK, CSL_CPU_IVPD_SHIFT, IRQ_globalDisable(), and IRQ_globalRestore().

CSL_Status IRQ_test ( Uint16  EventId,
Bool *  IntStatus 
)

============================================================================
IRQ_test

Description
It reads the status bit for the particular event from IFR Registers

Arguments

             EventId           Interrupt Vector Pointer Address
 *           IntStatus         to store Interrupt Status bit in IFR Register
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init should be called before calling this API

Post Condition
It stores the IFR bit value in IntStatus variable

Modifies
1. IntStatus - to store Interrupt flag bit

Example

            Uint16         EventId;
            CSL_Status     status;
            bool           IntStatus;

            status = IRQ_test(EventId,&IntStatus);
     

============================================================================

============================================================================
IRQ_test

Description
It gets the status bit for the particular Interupt from IFR Registers

Arguments

             EventId           Interrupt Vector Pointer Address
 *           IntStatus         to store Interrupt Status bit in IFR Register
 *   

Return Value CSL_Status

  • CSL_SOK - IRQ_enable is successful
  • CSL_ESYS_BADHANDLE - The handle is passed is invalid
  • CSL_ESYS_INVPARAMS - Invalid parameter

Pre Condition
IRQ_init should be called before calling this API

Post Condition
It stores the IFR bit value in IntStatus variable

Modifies
1. IntStatus - to store Interrupt flag bit

Example

            Uint16         EventId;
            CSL_Status     status;
            bool           IntStatus;

            status = IRQ_test(EventId,&IntStatus);
     

============================================================================

References IRQ_globalDisable(), IRQ_globalRestore(), RCV2_EVENT, SINT31_EVENT, and XMT3_EVENT.