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.




We are working with integrating HSR PRP example code in board, and got a compile error for this code:

switchEmacCfg->phyAddr[0] = Board_getPhyAddress(PRUICSS_INSTANCE, 1);
switchEmacCfg->phyAddr[1] = Board_getPhyAddress(PRUICSS_INSTANCE, 2);

switchEmacCfg->portMask = ICSS_EMAC_MODE_SWITCH;
switchEmacCfg->ethPrioQueue[ICSS_EMAC_QUEUE1] = 1 ;
switchEmacCfg->ethPrioQueue[ICSS_EMAC_QUEUE2] = 0 ;
switchEmacCfg->ethPrioQueue[ICSS_EMAC_QUEUE3] = 1 ;
switchEmacCfg->ethPrioQueue[ICSS_EMAC_QUEUE4] = 0 ;
switchEmacCfg->halfDuplexEnable = 0;

switchEmacCfg->enableIntrPacing = ICSS_EMAC_ENABLE_PACING;
switchEmacCfg->pacingThreshold = 100;

switchEmacCfg->ethPrioQueue[ICSS_EMAC_QUEUE1] = 1 is accessing a ethPrioQueue with array subscript.

The example code is located in PRU-ICSS-HSR-PRP-DAN_01.00.05.01\examples\hsr_prp\main.cpp.

In our pdk, pdk17, the struct is defined like this

*  @brief     ICSS EMAC Init Configuration Structure
typedef struct {
    /** Phy address of the ports.For mac each handle will have single port only
    *   And Two for Switch handle
    /** Flag to enable Half duplex capability. Firmware support also is required to
    *     enable the functionality
    uint8_t halfDuplexEnable;
    /** Flag to enable Interrupt pacing */
    uint8_t enableIntrPacing;
    /** Number of packets threshold for Pacing Mode1 */
    uint16_t pacingThreshold;
    /** Queue Priority separation for RT and NRT packets
    *     If packets are in Queue <=ethPrioQueue, they will be forwarded to NRT callback
    *     and others to RT callback
    uint8_t ethPrioQueue;
    /** Flag to enable learning. Not applicable for Mac mode */
    uint8_t learningEn;
    /**Port Mask. Indication to LLD which ports to be used
    uint8_t portMask;
    /* Recieve Packet, DSP: int vector number; ARM: GIC int number (peripheral event ID + 32) */
    uint32_t rxIntNum;
    /* Link Interrupt, DSP: int vector number; ARM: GIC int number (peripheral event ID + 32) */
    uint32_t linkIntNum;
    /* Transmit Completion , DSP: int vector number; ARM: GIC int number (peripheral event ID + 32) */
    uint32_t txIntNum;

    /**Macid to be used for the interface*/
    uint8_t* macId;
    /**Pacing mode to be used(MODE1/MODE2)*/
    uint8_t ICSS_EmacIntrPacingMode;
    /**Flag to enable TTS Cyclic Packet Insertion Notification Interrupt*/
    uint8_t	ICSS_EmacTTSEnableCycPktInterrupt;
    /**CorePac specific Mux configuration parameters for Rx packet interrupt*/
    ICSS_EmacIntrMuxCfg intrMuxCfgRxPkt;
    /**CorePac specific Mux configuration parameters for Tx completion  interrupt*/
    ICSS_EmacIntrMuxCfg intrMuxCfgTxComplete;
    /**CorePac specific Mux configuration parameters for Link interrupt*/
    ICSS_EmacIntrMuxCfg intrMuxCfgLink;
} ICSS_EmacInitConfig;

So the compile error is "invalid types 'uint8_t {aka unsigned char}[uint32_t {aka long unsigned int}]' for array subscript".

Is this allowed syntax?

Or do we have an outdated definition of the struct in our codebase?

Thanks for your continuous support,

Best Regards,

Anders Viken.