Programmable Real-Time Unit and Industrial Communication Subsystem(PRU-ICSS) driver provides a well-defined API layer which allows applications to use the PRU-ICSS. PRU-ICSS is firmware programmable and can take on various personalities like Industrial Communication Protocol Switch (for protocols like EtherCAT, Profinet, EtherNet/IP), Ethernet Switch, Ethernet MAC, Industrial Drives, etc.
CONFIG_PRU_ICSS0
using the name passed in SysConfig. This is used as an input to PRUICSS_open API.The interrupt controller (INTC) module maps interrupts coming from different parts of the device (mapped to PRU-ICSS instance) to a reduced set of interrupt channels.
The interrupt controller has the following features:
Following is an example of one mapping from ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/icss_fwhal/tiesc_pruss_intc_mapping.h
used for EtherCAT SubDevice.
The following line maps PRU_ARM_EVENT2
to CHANNEL6
.
CHANNEL6
is mapped to the fourth host interrupt mapped to device level interrupt controller(Host Interrupt 6 out of 20) through this line.
In AM64x, PRU_ICSSG0_PR1_HOST_INTR_PEND_0
-PRU_ICSSG0_PR1_HOST_INTR_PEND_7
(8 host interrupts) are mapped to R5FSS0_CORE0_INTR_IN_120
-R5FSS0_CORE0_INTR_IN_127
. This values are for ICSSG0 events mapped to R5FSS0 CORE0. For details regarding interrupt numbers on other cores, please refer to "9.4 Interrupt Sources" section in Technical Reference Manual(TRM) of AM64x, or corresponding section in TRM of other SoCs. These interrupt numbers can change from SoC to SoC, so please consult TRM before making any modifications to the interrupt map.
For the example mentioned above, interrupt number 124 (R5FSS0_CORE0_INTR_IN_124
) should be used for intrNum
parameter for PRUICSS_registerIrqHandler. PRUICSS_registerIrqHandler creates Hwi instance using HwiP_construct API with the intrNum
passed,
This mapping alone determines which interrupt number on R5F will be associated with a particular interrupt from PRUICSS. For example, in the code shown above, where `PRU_ARM_EVENT2
maps to CHANNEL6
, and CHANNEL6
maps to PRU_EVTOUT4
can be modified to following, and the interrupt number on R5F would still remain the same.
But the usefulness of channels is that channels allow us to map multiple PRU events to a single channel and in turn to a single host interrupt. For example, take a look at the following mapping used for link interrupt.
This configuration maps both Port 0 and Port 1 link interrupts to a single channel and in turn to a single host interrupt for PRU1 (Host Interrupt 1 out of 20).
PRUICSS_intcInit API should be used to configure the INTC module.
Include the below file to access the APIs
Instance Open Example
Sequence for loading a firmware on PRU and running the PRU core