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.

RTOS/PROCESSOR-SDK-AM437X: How to use the function PRUICSS_registerIrqHandler()in am437x?

Part Number: PROCESSOR-SDK-AM437X

Tool/software: TI-RTOS

I am researching the example C:\ti\pdk_am437x_1_0_10\packages\ti\drv\pruss\test\src\main_test_pruss2_pru0.c, I want to know how to use the function PRUICSS_registerIrqHandler(),and find its define in the pruicss_int.c:
/**
* @brief This function Registers an Interrupt Handler for an event.\n
*
* @param pruEvtoutNum The ARM side event number.\n
*
* @param handle Pruss's driver handle
*
* @param intrNum Interrupt number of MPU/C66x
*
* @param eventNum Event number of PRUICSS
*
* @param waitEnable Flag specifying whether application can wait on this interrupt
* using PRUICSSPruWaitEvent function
*
* @param irqHandler Pointer to a function which will be called on interrupt.\n
*
* \return 0 in case of successful registration, -1 otherwise. \n
*/
int32_t PRUICSS_registerIrqHandler(PRUICSS_Handle handle,
uint32_t pruEvtoutNum,
int32_t intrNum,
int32_t eventNum,
uint8_t waitEnable,
PRUICSSDRV_IRQ_HANDLER irqHandler
)

if I want register the interrupt server function to int number(PRU_ICSS1_EVTOUT0) which corresponds to Host-2 of the PRU-ICSS interrupt controller.
So, the parameter intrNum will be 52, eventNum will be a PRU interrupt event number, such as 16(pr0_pru_mst_intr0_intr_req).
but I do not know what the parameter pruEvtoutNum is?I track the code: PRUICSS_registerIrqHandler()->PRUICSS_osalRegisterInterrupt()->HwiP_create()->Hwi_construct(), but I can not find where define the function Hwi_construct()? 

and how to use the waitEnable?


CPU : AM437x, CCS7.4, pdk_am437x_1_0_10

  • zhuangbin,

    The pruEvtoutNum is as shown in the Test_pruss_intc_mapping.h, which is 2 (channel 2 mapping to PRU_EVTOUT0) in your case. PRUICSS_IntcInitData structure and some explanation in the section - may help though it's for AM335x.

    #define CHANNEL0                0

    #define CHANNEL1                1

    #define CHANNEL2                2

    #define CHANNEL3                3

    #define CHANNEL4                4

    #define CHANNEL5                5

    #define CHANNEL6                6

    #define CHANNEL7                7

    #define CHANNEL8                8

    #define CHANNEL9                9

    #define PRU0                    0

    #define PRU1                    1

    #define PRU_EVTOUT0             2

    #define PRU_EVTOUT1             3

    #define PRU_EVTOUT2             4

    #define PRU_EVTOUT3             5

    #define PRU_EVTOUT4             6

    #define PRU_EVTOUT5             7

    #define PRU_EVTOUT6             8

    #define PRU_EVTOUT7             9

    Hwi_construct() is from SYS/BIOS.

    waitEnable is as commented - Flag specifying whether application can wait on this interrupt using PRUICSSPruWaitEvent function. waitEnable is enabled in most of applications.

    Regards,

    Garrett

  • as follow, Whether the function can be written like this:PRUICSS_registerIrqHandler(handle,PRU_EVTOUT0,52,16, 1, pruss_isr )?
    in this example, waitEnable=1, but I cannot find where the function PRUICSSPruWaitEvent() is called, why? how to use this function, when the waitEnble=1?
  • zhuangbin,

    yes, you can call PRUICSS_registerIrqHandler() like you described.

    The PRUICSS_PruWaitEvent() (PRUICSSPruWaitEvent is a typo) is called by eventwait() task which is created in .cfg file or not be used.

    Regards,
    Garrett
  • Yes,
    I see.
    I hope that we have the example for am437x.