AM243x MCU+ SDK  08.04.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 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 
42 /* ========================================================================== */
43 /* Include Files */
44 /* ========================================================================== */
45 
46 #include <stdint.h>
47 #include "PN_Handle.h"
48 
49 /* ========================================================================== */
50 /* Doxygen */
51 /* ========================================================================== */
72 /* ========================================================================== */
73 /* Macros & Typedefs */
74 /* ========================================================================== */
75 
80 #define ERR_STATION_NAME_LENGTH -1
81 
86 #define ERR_FIRMWARE_VERSION_BAD -2
87 
92 #define ERR_FIRMWARE_LOAD_FAIL -3
93 
98 #define ERR_DRIVER_INIT_FAIL -4
99 
100 #define PRU_IEP_CMP_CFG_EN_SOG_EVENTS 0x000001cf /*sets cmp0, cmp2/5/6/7*/
101 
106 #define NO_RCV_NO_FWD 0
107 
112 #define RCV_NO_FWD 1
113 
118 #define NO_RCV_FWD 2
119 
124 #define RCV_FWD 3
125 
130 #define OFF 0
131 
136 #define UP 2
137 
142 #define RUN 4
143 
151 #define DISABLED 0
152 
157 #define BLOCKING 1
158 
162 #define FORWARDING 2
163 
164 #ifdef WATCHDOG_SUPPORT
165 
169 #define watchDogExpireDuration 100
170 #endif
171 
172 
176 /* ========================================================================== */
177 /* Function Declarations */
178 /* ========================================================================== */
196 int32_t PN_initDrv(PN_Handle pnHandle);
197 
207  void PN_getFirmwareVersion(uint32_t *version_major, uint32_t *version_minor,
208  uint32_t *version_build, uint32_t *version_release_type);
209 
218  void PN_getFirmwareReleaseInfoAndFeatures(uint32_t *firmware_release_1,
219  uint32_t *firmware_release_2,
220  uint32_t *firmware_feature_mask);
221 
236 int32_t PN_setDcpFilterStationName(PRUICSS_HwAttrs const *pruicssHwAttrs,
237  const uint8_t *dcpNameOfStation,
238  uint8_t lengthOfStationName);
239 
257 int32_t PN_MRP_setPortState(PRUICSS_HwAttrs const *pruicssHwAttrs,
258  uint8_t portNumber,
259  uint8_t pState);
260 
271 int32_t PN_MRP_getPortState(PRUICSS_HwAttrs const *pruicssHwAttrs,
272  uint8_t portNumber,
273  uint8_t *pState);
274 
296 int32_t PN_mapPhaseToProfile(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t portNumber, int32_t phaseNumber,
297  int32_t profileNumberRx, int32_t profileNumberTx);
298 
299 
300 
315 int32_t PN_setMaxLineRxDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, int32_t maxLineRxDelayValue);
316 
326 int32_t PN_setMaxBridgeDelay(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t maxBridgeDelayValue);
327 
328 
337 int32_t PN_setYellowPeriod(PRUICSS_HwAttrs const *pruicssHwAttrs, int32_t yellowPeriodTime);
338 
339 
357 int32_t PN_setProfile(PRUICSS_HwAttrs const *pruicssHwAttrs,
358  int32_t portNumber, int32_t profileNumber, int32_t rxSoGValue,
359  int32_t txSoGValue);
360 
367 void PN_setCompensationValue(PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t compensationValue);
368 
369 
382 int32_t PN_setRedGuard(PRUICSS_HwAttrs const *pruicssHwAttrs,
383  uint16_t validLowerFrameId, uint16_t validUpperFrameId);
384 
401 int32_t PN_setRtc3PortStatus(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t portNumber, uint8_t status);
430 int32_t PN_setStaticFilterTable(PRUICSS_HwAttrs const *pruicssHwAttrs, const uint8_t *macAddr, uint8_t ctrl,
431  uint8_t portNumber, uint8_t table);
435 #ifdef WATCHDOG_SUPPORT
436 
447 int32_t PN_setWatchDogTimer(PN_Handle pnHandle, int32_t timerPeriod);
448 
452 #endif
453 
468 int32_t PN_loadStaticTable(PRUICSS_HwAttrs const *pruicssHwAttrs,
469  const uint32_t *staticTable,
470  uint8_t staticTableLength,
471  uint8_t staticTableType,
472  uint8_t portNumber);
473 
481 void PN_cpmIsrHandler(void* arg);
489 void PN_ppmIsrHandler(void* arg);
497 void PN_dhtIsrHandler(void* arg);
505 void PN_PTCP_isrHandler(void* arg);
506 
507 #ifdef __cplusplus
508 }
509 #endif
510 
511 #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:102
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:335
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.