Other Parts Discussed in Thread: AM3358
I have a TI-RTOS application that loads a PRU application using the PRUSS driver. The APIs are not well documented and I'm unclear how to configure it.
Here's the PRU code running on PRU 1
#define PRU1_ARM_INTERRUPT 19
#define HOST_NUM 2
#define CHAN_NUM 2
/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
// Globally enable host interrupts
CT_INTC.GER = 0x1;
/* Clear any pending PRU-generated events */
__R31 = 0x00000000;
/* Enable Host interrupt 2 */
CT_INTC.HIEISR |= HOST_NUM;
/* Map channel 2 to host 2 */
CT_INTC.HMR0_bit.HINT_MAP_2 = HOST_NUM;
/* Map PRU1_ARM_INTERRUPT (event 19) to channel 2 */
CT_INTC.CMR4_bit.CH_MAP_19 = CHAN_NUM;
/* Ensure PRU1_ARM_INTERRUPT is cleared */
CT_INTC.SICR = PRU1_ARM_INTERRUPT;
The ARM code
PRUICSS_socGetInitCfg(&pruss_config);
/* Creates handle for PRUICSS instance */
handle = PRUICSS_create(pruss_config, PRUICCSS_PRU1);
/* Disable PRUICSS instance */
PRUICSS_pruDisable(handle,PRUICCSS_PRU1);
/* Register an Interrupt Handler for an event */
//PRUICSS_registerIrqHandler(handle,pruEvtoutNum,intrNum,eventNum,waitEnable,irqHandler); <-- What should these parameter be?
/* Sets the buffer pointer for PRU */
PRUICSS_setPRUBuffer(handle, PRUICCSS_PRU1, pru_code, sizeof(pru_code));
/* API to do Interrupt-Channel-host mapping */
//PRUICSS_pruIntcInit(handle, &pruss_intc_initdata);
PRUICSS_enableOCPMasterAccess(handle);
/* Execute program on PRU */
PRUICSS_pruExecProgram(handle,PRUICCSS_PRU1);
/* Enable PRU */
PRUICSS_pruEnable(handle,PRUICCSS_PRU1);