AM64x MCU+ SDK  08.02.00
iRtcDrv.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 IRTCDRV_H_
34 #define IRTCDRV_H_
35 
36 /* ========================================================================== */
37 /* Include Files */
38 /* ========================================================================== */
39 
40 #include "iRtcDrv2.h"
41 
42 /* ========================================================================== */
43 /* Macros & Typedefs */
44 /* ========================================================================== */
45 
46 #ifdef RTC_DEBUG
47 void newLogPkt(uint32_t msg);
48 
49 typedef enum
50 {
51  INSPPM,
52  INSCPM,
53  DELPM
54 } eDebugAPI;
55 #endif
56 
62 #define DESC_WORD_LENGTH 4
63 
64 /* ========================================================================== */
65 /* Structure Declarations */
66 /* ========================================================================== */
67 
77 typedef struct
78 #ifndef DOXYGEN
79 __attribute__((packed))
80 #endif
81 cpmDesc /* CPM*/
82 {
83  uint16_t
84  FrameReference;
85  uint16_t
86  FrameLength;
87  uint16_t
88  FrameDataPointer;
89  uint8_t FrameIndex;
93  uint8_t FrameFlags2;
97  uint16_t
98  FrameId;
99  uint8_t FrameFlags1;
100  uint8_t Reserved;
101  uint16_t
102  RR;
104  uint16_t
105  Phase;
107 
114 typedef struct ppmDesc /* PPM*/
115 {
116  uint16_t
118  uint16_t
120  uint32_t
122  uint16_t
124  uint8_t FrameFlags1;
125  uint8_t FrameIndex;
126  uint16_t
127  RR;
129  uint16_t
132 } t_ppmDesc;
133 
137 /* ========================================================================== */
138 /* Function Declarations */
139 /* ========================================================================== */
140 #ifdef MRP_SUPPORT
141 
143 /* @pre MRP_SUPPORT defined*/
154 uint32_t PN_allCpmKnown(PN_Handle pnHandle);
163 
174 void PN_setCpmPort(PN_Handle pnHandle, t_rtcPacket *pID);
178 #endif /*MRP_SUPPORT*/
179 
193 int32_t PN_togglePpmList(PN_Handle pnHandle, t_rtcPacket *pktID,
194  uint8_t ppmMrpPortShift);
195 
196 
209 int32_t PN_writePpmDesc(PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos);
210 
221 int32_t PN_writeCpmDesc(PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos);
222 
234 int32_t PN_readPpmDesc(PN_Handle pnHandle, t_ppmDesc *pDesc, uint8_t pos,
235  uint8_t act);
236 
245 int32_t PN_readCpmDesc(PN_Handle pnHandle, t_cpmDesc *pDesc, uint8_t pos);
246 
256 
266 int8_t PN_getLastCpmBuffIndex(PN_Handle pnHandle, uint8_t pos);
267 
277 
286 int32_t PN_emptyList(t_descList *pList);
287 
288 
302 int32_t PN_writeSortedList(PN_Handle pnHandle, t_rtcPacket *pPkts);
303 
318 int8_t PN_getDhtStatusEvent(PN_Handle pnHandle, t_rtcPacket **pktID);
319 
320 
335 
336 
347 int8_t PN_getShadowIndex(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t lType);
348 
365 int32_t PN_getPmStatus(PRUICSS_HwAttrs const *pruicssHwAttrs,
366  uint8_t dir, uint8_t numPm);
367 
368 
382 int32_t PN_setPPMARlink(PRUICSS_HwAttrs const *pruicssHwAttrs,
383  uint8_t ARgroup, uint8_t PpmNum);
384 
398 int32_t PN_setCPMARlink(PRUICSS_HwAttrs const *pruicssHwAttrs,
399  uint8_t ARgroup, uint8_t CpmNum);
400 
413 int32_t PN_setCpmDHT(PRUICSS_HwAttrs const *pruicssHwAttrs,
414  uint16_t dht, uint8_t pos);
415 
425 void PN_clearMrpFlag(PN_Handle pnHandle);
433 void PN_setListToggleReq(PN_Handle pnHandle, uint8_t enable);
434 
435 
436 #endif /* IRTCDRV_H_ */
PN_setCpmDHT
int32_t PN_setCpmDHT(PRUICSS_HwAttrs const *pruicssHwAttrs, uint16_t dht, uint8_t pos)
Sets the Data hold timer timeout value for a given descriptor.
PN_getListToggleStatusEvent
int8_t PN_getListToggleStatusEvent(PN_Handle pnHandle, t_rtcPacket **pktID)
__attribute__
struct __attribute__((packed)) cpmDesc
Definition: iRtcDrv.h:79
PN_Handle
struct PN_Config_s * PN_Handle
Alias for Profinet Handle containing base addresses and modules.
Definition: PN_Handle.h:96
index
uint16_t index
Definition: tisci_rm_proxy.h:3
t_ppmDesc::FrameFlags1
uint8_t FrameFlags1
Definition: iRtcDrv.h:124
PN_togglePpmList
int32_t PN_togglePpmList(PN_Handle pnHandle, t_rtcPacket *pktID, uint8_t ppmMrpPortShift)
iRtcDrv2.h
t_listIndex
Definition: iRtcDrv2.h:126
t_ppmDesc::FrameLength
uint16_t FrameLength
Definition: iRtcDrv.h:119
PN_readCpmDesc
int32_t PN_readCpmDesc(PN_Handle pnHandle, t_cpmDesc *pDesc, uint8_t pos)
t_descList
Definition: iRtcDrv2.h:207
PN_getIndexInt
int32_t PN_getIndexInt(t_listIndex *index)
PN_setIndexInt
int32_t PN_setIndexInt(PN_Handle pnHandle, t_listIndex *index)
PN_getLastCpmBuffIndex
int8_t PN_getLastCpmBuffIndex(PN_Handle pnHandle, uint8_t pos)
t_ppmDesc
Definition: iRtcDrv.h:115
t_ppmDesc::FrameIndex
uint8_t FrameIndex
Definition: iRtcDrv.h:125
PN_readPpmDesc
int32_t PN_readPpmDesc(PN_Handle pnHandle, t_ppmDesc *pDesc, uint8_t pos, uint8_t act)
PN_getShadowIndex
int8_t PN_getShadowIndex(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t lType)
PN_allCpmKnown
uint32_t PN_allCpmKnown(PN_Handle pnHandle)
PN_setPPMARlink
int32_t PN_setPPMARlink(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t ARgroup, uint8_t PpmNum)
PN_writePpmDesc
int32_t PN_writePpmDesc(PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos)
PN_getPmStatus
int32_t PN_getPmStatus(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t dir, uint8_t numPm)
PRUICSS_HwAttrs
PRUICSS Hardware Attributes.
Definition: pruicss/g_v0/pruicss.h:334
PN_writeSortedList
int32_t PN_writeSortedList(PN_Handle pnHandle, t_rtcPacket *pPkts)
t_ppmDesc::RR
uint16_t RR
Definition: iRtcDrv.h:127
PN_getDhtStatusEvent
int8_t PN_getDhtStatusEvent(PN_Handle pnHandle, t_rtcPacket **pktID)
PN_emptyList
int32_t PN_emptyList(t_descList *pList)
PN_resetCpmPorts
void PN_resetCpmPorts(PN_Handle pnHandle)
t_ppmDesc::FrameReference
uint16_t FrameReference
Definition: iRtcDrv.h:117
PN_setCPMARlink
int32_t PN_setCPMARlink(PRUICSS_HwAttrs const *pruicssHwAttrs, uint8_t ARgroup, uint8_t CpmNum)
t_ppmDesc::Phase
uint16_t Phase
Definition: iRtcDrv.h:130
PN_setListToggleReq
void PN_setListToggleReq(PN_Handle pnHandle, uint8_t enable)
Sets or clears the listToggleReq flag in ppmList data structure.
PN_clearMrpFlag
void PN_clearMrpFlag(PN_Handle pnHandle)
Clears the mrpFlag in ppmList data structure.
t_rtcPacket
real-time packet structure
Definition: iRtcDrv2.h:178
t_ppmDesc::FrameSendOffset
uint32_t FrameSendOffset
Definition: iRtcDrv.h:121
t_ppmDesc::FrameId
uint16_t FrameId
Definition: iRtcDrv.h:123
PN_writeCpmDesc
int32_t PN_writeCpmDesc(PN_Handle pnHandle, t_rtcPacket *pPkt, uint8_t pos)
PN_setCpmPort
void PN_setCpmPort(PN_Handle pnHandle, t_rtcPacket *pID)
t_cpmDesc
t_cpmDesc
Definition: iRtcDrv.h:106
enable
@ enable
Definition: iPtcpDrv.h:63