AM64x MCU+ SDK  08.02.00
iPNDrv.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef IPNDRV_H_
34 #define IPNDRV_H_
35 
36 /* ========================================================================== */
37 /* Include Files */
38 /* ========================================================================== */
39 
40 #include <stdint.h>
41 #include "PN_Handle.h"
42 
43 /* ========================================================================== */
44 /* Doxygen */
45 /* ========================================================================== */
66 /* ========================================================================== */
67 /* Macros & Typedefs */
68 /* ========================================================================== */
69 
74 #define ERR_STATION_NAME_LENGTH -1
75 
80 #define ERR_FIRMWARE_VERSION_BAD -2
81 
86 #define ERR_FIRMWARE_LOAD_FAIL -3
87 
92 #define ERR_DRIVER_INIT_FAIL -4
93 
94 #define PRU_IEP_CMP_CFG_EN_SOG_EVENTS 0x000001cf /*sets cmp0, cmp2/5/6/7*/
95 
100 #define NO_RCV_NO_FWD 0
101 
106 #define RCV_NO_FWD 1
107 
112 #define NO_RCV_FWD 2
113 
118 #define RCV_FWD 3
119 
124 #define OFF 0
125 
130 #define UP 2
131 
136 #define RUN 4
137 
145 #define DISABLED 0
146 
151 #define BLOCKING 1
152 
156 #define FORWARDING 2
157 
158 #ifdef WATCHDOG_SUPPORT
159 
163 #define watchDogExpireDuration 100
164 #endif
165 
166 
170 /* ========================================================================== */
171 /* Function Declarations */
172 /* ========================================================================== */
190 int32_t PN_initDrv(PN_Handle pnHandle);
191 
201  void PN_getFirmwareVersion(uint32_t *version_major, uint32_t *version_minor,
202  uint32_t *version_build, uint32_t *version_release_type);
203 
212  void PN_getFirmwareReleaseInfoAndFeatures(uint32_t *firmware_release_1,
213  uint32_t *firmware_release_2,
214  uint32_t *firmware_feature_mask);
215 
230 int32_t PN_setDcpFilterStationName(PRUICSS_HwAttrs const *pruicssHwAttrs,
231  const uint8_t *dcpNameOfStation,
232  uint8_t lengthOfStationName);
233 
251 int32_t PN_MRP_setPortState(PRUICSS_HwAttrs const *pruicssHwAttrs,
252  uint8_t portNumber,
253  uint8_t pState);
254 
265 int32_t PN_MRP_getPortState(PRUICSS_HwAttrs const *pruicssHwAttrs,
266  uint8_t portNumber,
267  uint8_t *pState);
268 
290 int32_t PN_mapPhaseToProfile(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t portNumber, int32_t phaseNumber,
291  int32_t profileNumberRx, int32_t profileNumberTx);
292 
293 
294 
309 int32_t PN_setMaxLineRxDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, int32_t maxLineRxDelayValue);
310 
320 int32_t PN_setMaxBridgeDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t maxBridgeDelayValue);
321 
322 
331 int32_t PN_setYellowPeriod(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t yellowPeriodTime);
332 
333 
351 int32_t PN_setProfile(PRUICSS_HwAttrs const *pruicssHwAttrs,
352  int32_t portNumber, int32_t profileNumber, int32_t rxSoGValue,
353  int32_t txSoGValue);
354 
361 void PN_setCompensationValue(PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t compensationValue);
362 
363 
376 int32_t PN_setRedGuard(PRUICSS_HwAttrs const *pruicssHwAttrs,
377  uint16_t validLowerFrameId, uint16_t validUpperFrameId);
378 
395 int32_t PN_setRtc3PortStatus(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, uint8_t status);
424 int32_t PN_setStaticFilterTable(PRUICSS_HwAttrs const *pruicssHwAttrs, const uint8_t *macAddr, uint8_t ctrl,
425  uint8_t portNumber, uint8_t table);
429 #ifdef WATCHDOG_SUPPORT
430 
441 int32_t PN_setWatchDogTimer(PN_Handle pnHandle, int32_t timerPeriod);
442 
446 #endif
447 
462 int32_t PN_loadStaticTable(PRUICSS_HwAttrs const *pruicssHwAttrs,
463  const uint32_t *staticTable,
464  uint8_t staticTableLength,
465  uint8_t staticTableType,
466  uint8_t portNumber);
467 
475 void PN_cpmIsrHandler(void* arg);
483 void PN_ppmIsrHandler(void* arg);
491 void PN_dhtIsrHandler(void* arg);
499 void PN_PTCP_isrHandler(void* arg);
500 #endif /* IPNDRV_H_ */
PN_mapPhaseToProfile
int32_t PN_mapPhaseToProfile(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t portNumber, int32_t phaseNumber, int32_t profileNumberRx, int32_t profileNumberTx)
API to map a Phase to start of green Profile.
PN_cpmIsrHandler
void PN_cpmIsrHandler(void *arg)
Profinet CPM ISR handler.
PN_Handle
struct PN_Config_s * PN_Handle
Alias for Profinet Handle containing base addresses and modules.
Definition: PN_Handle.h:96
PN_setDcpFilterStationName
int32_t PN_setDcpFilterStationName(PRUICSS_HwAttrs const *pruicssHwAttrs, const uint8_t *dcpNameOfStation, uint8_t lengthOfStationName)
API to configure the station name and length of station name of device for filtering DCP Identify req...
PN_setWatchDogTimer
int32_t PN_setWatchDogTimer(PN_Handle pnHandle, int32_t timerPeriod)
API to configure the ICSS watchdog expiry duration.
PN_setStaticFilterTable
int32_t PN_setStaticFilterTable(PRUICSS_HwAttrs const *pruicssHwAttrs, const uint8_t *macAddr, uint8_t ctrl, uint8_t portNumber, uint8_t table)
API to enable/disable the reception & forward for a Multicast address in port multicast filter tables...
PN_ppmIsrHandler
void PN_ppmIsrHandler(void *arg)
Profinet PPM ISR handler.
PN_PTCP_isrHandler
void PN_PTCP_isrHandler(void *arg)
Profinet PTCP ISR handler.
PRUICSS_HwAttrs
PRUICSS Hardware Attributes.
Definition: pruicss/g_v0/pruicss.h:334
PN_getFirmwareVersion
void PN_getFirmwareVersion(uint32_t *version_major, uint32_t *version_minor, uint32_t *version_build, uint32_t *version_release_type)
Get the details on version of firmware.
PN_setCompensationValue
void PN_setCompensationValue(PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t compensationValue)
API to configure the compensation value which is used while computing the forward FSO for a RTC3 fram...
PN_setYellowPeriod
int32_t PN_setYellowPeriod(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t yellowPeriodTime)
API to configure the yellow period.
PN_Handle.h
PN_initDrv
int32_t PN_initDrv(PN_Handle pnHandle)
Initializes the Profinet Driver.
PN_loadStaticTable
int32_t PN_loadStaticTable(PRUICSS_HwAttrs const *pruicssHwAttrs, const uint32_t *staticTable, uint8_t staticTableLength, uint8_t staticTableType, uint8_t portNumber)
PN_loadStaticTable API to load multicast static table to ICSS memory.
PN_getFirmwareReleaseInfoAndFeatures
void PN_getFirmwareReleaseInfoAndFeatures(uint32_t *firmware_release_1, uint32_t *firmware_release_2, uint32_t *firmware_feature_mask)
Get the details on release information and features of firmware.
PN_setMaxLineRxDelay
int32_t PN_setMaxLineRxDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, int32_t maxLineRxDelayValue)
API to configure the maximum line receive delay.
PN_setRedGuard
int32_t PN_setRedGuard(PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t validLowerFrameId, uint16_t validUpperFrameId)
API to set the Red Guard for the device.
PN_MRP_setPortState
int32_t PN_MRP_setPortState(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, uint8_t pState)
API to set the MRP state for a port.
PN_setMaxBridgeDelay
int32_t PN_setMaxBridgeDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t maxBridgeDelayValue)
API to configure the maximum bridge delay. This value comes from the GSD file.
PN_MRP_getPortState
int32_t PN_MRP_getPortState(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, uint8_t *pState)
Returns the MRP state of a port.
PN_setProfile
int32_t PN_setProfile(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t portNumber, int32_t profileNumber, int32_t rxSoGValue, int32_t txSoGValue)
API to configure a Profile. In a profile the start of green time in a cycle for Receive (Rx) and Tran...
PN_setRtc3PortStatus
int32_t PN_setRtc3PortStatus(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, uint8_t status)
API to set the RTClass3 port status of a port.
PN_dhtIsrHandler
void PN_dhtIsrHandler(void *arg)
Profinet DHT ISR handler.