AM243x INDUSTRIAL COMMUNICATIONS SDK  09.02.00
iPnOs.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 IPNOS_H_
34 #define IPNOS_H_
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 
42 /* ========================================================================== */
43 /* Doxygen */
44 /* ========================================================================== */
45 
61 /* ========================================================================== */
62 /* Include Files */
63 /* ========================================================================== */
64 
65 #include "PN_Handle.h"
66 #include "iRtcDrv2.h"
67 
68 
69 /* ========================================================================== */
70 /* Macros */
71 /* ========================================================================== */
72 
73 #define PTCP_TASK_PRIORITY 26
74 #define SYNC_MONITOR_TASK_PRIORITY 23
75 #define LEGACY_MODE_TASK_PRIOROTY 3
76 #define MRP_TASK_PRIORITY 23
77 #define WATCHDOG_TASK_PRIORITY 11
78 
79 /* ========================================================================== */
80 /* Function Declarations */
81 /* ========================================================================== */
94 uint8_t *PN_getPpmBuff(t_rtcPacket *pkt);
95 
106 uint8_t *PN_relPpmBuff(PN_Handle pnHandle, t_rtcPacket *pkt);
107 
122 int32_t PN_checkLastPPM(PN_Handle pnHandle, t_rtcPacket *pkt);
123 
139 int32_t PN_nextCpmRdy(PN_Handle pnHandle,
140  t_rtcPacket *pkt);
141 
142 
155 uint8_t *PN_getLastCpm(PN_Handle pnHandle, t_rtcPacket *pkt);
156 
171 uint32_t PN_enterFlushMode(PN_Handle pnHandle);
176 typedef enum
177 {
182  MRPEXIT
198 
206 void PN_setLegState(void *arg, void *arg2);
207 
215 void PN_setLegPkt(void *arg, void *arg2);
226 int32_t PN_initOs(PN_Handle pnHandle);
227 
234 int32_t PN_RTC_setupIsr(PN_Handle pnHandle);
235 
242 int32_t PN_RTC_enableISR(PN_Handle pnHandle);
243 
250 int32_t PN_RTC_disableISR(PN_Handle pnHandle);
251 
266 int32_t PN_OS_txPacket(PN_Handle pnHandle,
267  const uint8_t *srcAddress, int32_t portNumber, int32_t queuePriority,
268  int32_t lengthOfPacket);
269 
270 
271 #ifdef __cplusplus
272 }
273 #endif
274 
275 #endif /* IPNOS_H_ */
PN_nextCpmRdy
int32_t PN_nextCpmRdy(PN_Handle pnHandle, t_rtcPacket *pkt)
Swap CPM NEXT with LAST and set validLast flag.
MRPEXIT
@ MRPEXIT
Definition: iPnOs.h:182
PN_Handle
struct PN_Config_s * PN_Handle
Alias for Profinet Handle containing base addresses and modules.
Definition: PN_Handle.h:102
PN_RTC_setupIsr
int32_t PN_RTC_setupIsr(PN_Handle pnHandle)
Interrupt management function Initializes PPM/CPM/DHT interrupts. (OS dependent!)
MRPCHECK
@ MRPCHECK
Definition: iPnOs.h:181
iRtcDrv2.h
PN_getPpmBuff
uint8_t * PN_getPpmBuff(t_rtcPacket *pkt)
Return a pointer to buffer indicated by NEXT This will be the next available free buffer(in the trip...
MRPREADY
@ MRPREADY
Definition: iPnOs.h:178
PN_setLegState
void PN_setLegState(void *arg, void *arg2)
Sets the state of legacy state machine This API is registered as a callback in PN_registerSetState.
tLegStates
tLegStates
possible states for legacy suppport state machine
Definition: iRtcDrv2.h:541
PN_RTC_disableISR
int32_t PN_RTC_disableISR(PN_Handle pnHandle)
Disables the PN interrupts.
PN_checkLastPPM
int32_t PN_checkLastPPM(PN_Handle pnHandle, t_rtcPacket *pkt)
Update proc pointer in paket object and udpate descriptor if there is a new last buffer.
tMrpStates
tMrpStates
Definition: iPnOs.h:177
PN_getLastCpm
uint8_t * PN_getLastCpm(PN_Handle pnHandle, t_rtcPacket *pkt)
Swap CPM LAST with PROC if validLast is true, clear validLast flag.
PN_Handle.h
PN_RTC_enableISR
int32_t PN_RTC_enableISR(PN_Handle pnHandle)
Enables the PN interrupts.
MRPENTER
@ MRPENTER
Definition: iPnOs.h:179
PN_setLegPkt
void PN_setLegPkt(void *arg, void *arg2)
Sets the Ethernet packet to output during legacy startup Usually a copy of RTC3 PPM....
t_rtcPacket
real-time packet structure
Definition: iRtcDrv2.h:184
PN_initOs
int32_t PN_initOs(PN_Handle pnHandle)
Initialization function for all PN driver tasks, mutexes.
PN_getLegState
tLegStates PN_getLegState(void)
Returns the IRT Legacy mode state.
PN_OS_txPacket
int32_t PN_OS_txPacket(PN_Handle pnHandle, const uint8_t *srcAddress, int32_t portNumber, int32_t queuePriority, int32_t lengthOfPacket)
Switch driver extension of TxPacket.
MRPWAIT
@ MRPWAIT
Definition: iPnOs.h:180
PN_relPpmBuff
uint8_t * PN_relPpmBuff(PN_Handle pnHandle, t_rtcPacket *pkt)
Swap NEXT with LAST and return new NEXT address .
PN_enterFlushMode
uint32_t PN_enterFlushMode(PN_Handle pnHandle)
Used to signal topology change to MRP state machine.