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_ICSS1
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 are some important points related to INTC configuration:
For industrial communication protocol examples running on R5F, Host Interrupts 2 through 9 exported from PRU-ICSS are used for signalling an interrupt to R5F. As this mapping is programmable and varies from example to example, we have a *_pruss_intc_mapping.h
file for different protocol examples which is used for passing PRUICSS_IntcInitData structure while calling PRUICSS_intcInit API.
You may use the sysconfig interface for PRU_ICSSG Local INTC mapping.
Sysconfig will create (see on right side generated code)
icss0_intc_initdata
, icss1_intc_initdata
for ICSS0, ICSS1 instances respectively in ti_drivers_config.c
. This is for use in main app to initialize interrupt settings by passing these to PRUICSS_intcInit. The previous interrupt settings are overwritten by this so please use it only once to initialize the interrupts.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).
Include the below file to access the APIs
Instance Open Example
Sequence for loading a firmware on PRU and running the PRU core
The ICSSG can be used as a generic Layer 2 Ethernet Switch or Dual Mac. The Ethernet Low Level Driver (Enet-LLD) APIs can be used to realize this networking capability using the ICSSG sub-system.
Enet Layer 2 ICSSG Example
Enet ICSSG Loopback Example
Enet Lwip ICSSG Example | Enet Lwip TCP Server Example on ICSSG
Enet VLAN ICSSG Example
Enet ICSSG Time Aware Shaper (EST) Example
Ethernet TSN ICSSG gPTP TimeReceiver (gPTP Slave) Example | Ethernet TSN ICSSG gPTP TimeTransmitter (gPTP Master) Example | Ethernet TSN ICSSG gPTP Bridge Example | Ethernet TSN gPTP on ICSSG along with LwIP stack
The ICSSG Queues used for packet content buffering are elaborated here:
File : {Any of above ENET ICSSG examples} CCS Project > Generated Source > SysConfig > ti_enet_soc.c
ICSSG_SWITCH_PORT_POOL_SIZE :
ICSSG_SWITCH_HOST_POOL_SIZE:
ICSSG_SWITCH_HOST_QUEUE_SIZE:
ICSSG_SWITCH_PORT_BUFFER_POOL_NUM: The number of ICSSG Port buffer pools is by default defined as 8 (max) to provide a unique Pool for upto 8 QoS levels.
This number can be reduced as per the requirement of the user application, for example 'n' (n = 1 to 8). However, care must be taken to ensure all priorities (PCPs), in case of VLAN-tagging, are mapped to only those 0 to n-1 Queues.
This can be done by using the IOCTL: ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP
For Example if setting ICSSG_SWITCH_PORT_BUFFER_POOL_NUM = 3, Then the available pools will only be 0 ,1, 2. Hence, all the traffic must be directed to only these queues 0 to 2 by using the above IOCTL. Type of mapping is left to the user.
This PCP to Queue mapping can be done via the input argument of the IOCTL ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP.
uint32_t EnetPort_PriorityMap::priorityMap[ENET_PRI_NUM]
, where the array index corresponds to the PCP and the value holds the mapped Queue value
PCP(Index) | Queue Number = priorityMap[pcp] |
---|---|
0 | 0 |
1 | 0 |
2 | 0 |
3 | 1 |
4 | 1 |
5 | 2 |
6 | 2 |
7 | 2 |
Sample IOCTL usage: ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP