AM64x MCU+ SDK  10.00.00
fsi_rx.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 
49 #ifndef FSI_RX_H
50 #define FSI_RX_H
51 
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55 
56 #include <drivers/hw_include/cslr_fsi_rx.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* ========================================================================== */
63 /* Macros & Typedefs */
64 /* ========================================================================== */
65 
94 typedef uint32_t FSI_RxEnumType;
95 
96 #define FSI_RX_EVT_PING_WD_TIMEOUT ((uint16_t)0x0001U)
97 
98 #define FSI_RX_EVT_FRAME_WD_TIMEOUT ((uint16_t)0x0002U)
99 
100 #define FSI_RX_EVT_CRC_ERR ((uint16_t)0x0004U)
101 
102 #define FSI_RX_EVT_TYPE_ERR ((uint16_t)0x0008U)
103 
104 #define FSI_RX_EVT_EOF_ERR ((uint16_t)0x0010U)
105 
106 #define FSI_RX_EVT_OVERRUN ((uint16_t)0x0020U)
107 
108 #define FSI_RX_EVT_FRAME_DONE ((uint16_t)0x0040U)
109 
110 #define FSI_RX_EVT_UNDERRUN ((uint16_t)0x0080U)
111 
112 #define FSI_RX_EVT_ERR_FRAME ((uint16_t)0x0100U)
113 
114 #define FSI_RX_EVT_PING_FRAME ((uint16_t)0x0200U)
115 
116 #define FSI_RX_EVT_FRAME_OVERRUN ((uint16_t)0x0400U)
117 
119 #define FSI_RX_EVT_DATA_FRAME ((uint16_t)0x0800U)
120 
125 #define FSI_RX_EVTMASK ((uint16_t)0x0FFFU)
126 
130 #define FSI_RX_MAX_DELAY_LINE_VAL ((uint16_t)0x001FU)
131 
146 typedef uint32_t FSI_RxSubmoduleInReset;
147 
148 #define FSI_RX_MAIN_CORE_RESET ((uint32_t)0x0U)
149 
150 #define FSI_RX_FRAME_WD_CNT_RESET ((uint32_t)0x1U)
151 
152 #define FSI_RX_PING_WD_CNT_RESET ((uint32_t)0x2U)
153 
169 typedef uint32_t FSI_RxDelayTapType;
170 
171 #define FSI_RX_DELAY_CLK ((uint32_t)0x0U)
172 
173 #define FSI_RX_DELAY_D0 ((uint32_t)0x1U)
174 
175 #define FSI_RX_DELAY_D1 ((uint32_t)0x2U)
176 
191 typedef uint32_t FSI_ExtFrameTriggerSrc;
192 
193 #define FSI_EXT_TRIGSRC_EPWM1_SOCA ((uint32_t)0x08U)
194 
195 #define FSI_EXT_TRIGSRC_EPWM1_SOCB ((uint32_t)0x09U)
196 
197 #define FSI_EXT_TRIGSRC_EPWM2_SOCA ((uint32_t)0x0AU)
198 
199 #define FSI_EXT_TRIGSRC_EPWM2_SOCB ((uint32_t)0x0BU)
200 
201 #define FSI_EXT_TRIGSRC_EPWM3_SOCA ((uint32_t)0x0CU)
202 
203 #define FSI_EXT_TRIGSRC_EPWM3_SOCB ((uint32_t)0x0DU)
204 
205 #define FSI_EXT_TRIGSRC_EPWM4_SOCA ((uint32_t)0x0EU)
206 
207 #define FSI_EXT_TRIGSRC_EPWM4_SOCB ((uint32_t)0x0FU)
208 
209 #define FSI_EXT_TRIGSRC_EPWM5_SOCA ((uint32_t)0x10U)
210 
211 #define FSI_EXT_TRIGSRC_EPWM5_SOCB ((uint32_t)0x11U)
212 
213 #define FSI_EXT_TRIGSRC_EPWM6_SOCA ((uint32_t)0x12U)
214 
215 #define FSI_EXT_TRIGSRC_EPWM6_SOCB ((uint32_t)0x13U)
216 
217 #define FSI_EXT_TRIGSRC_EPWM7_SOCA ((uint32_t)0x14U)
218 
219 #define FSI_EXT_TRIGSRC_EPWM7_SOCB ((uint32_t)0x15U)
220 
221 #define FSI_EXT_TRIGSRC_EPWM8_SOCA ((uint32_t)0x16U)
222 
223 #define FSI_EXT_TRIGSRC_EPWM8_SOCB ((uint32_t)0x17U)
224 
227 /* ========================================================================== */
228 /* Function Declarations */
229 /* ========================================================================== */
230 
240 int32_t FSI_enableRxInternalLoopback(uint32_t base);
241 
251 int32_t FSI_disableRxInternalLoopback(uint32_t base);
252 
264 int32_t FSI_enableRxSPIPairing(uint32_t base);
265 
277 int32_t FSI_disableRxSPIPairing(uint32_t base);
278 
289 int32_t FSI_setRxDataWidth(uint32_t base, FSI_DataWidth dataWidth);
290 
301 int32_t FSI_enableRxSPIMode(uint32_t base);
302 
313 int32_t FSI_disableRxSPIMode(uint32_t base);
314 
325 int32_t FSI_setRxSoftwareFrameSize(uint32_t base, uint16_t nWords);
326 
336 int32_t FSI_setRxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth);
337 
347 int32_t FSI_setRxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode);
348 
358 int32_t FSI_getRxFrameType(uint32_t base, FSI_FrameType *pFrameType);
359 
369 int32_t FSI_getRxFrameTag(uint32_t base, uint16_t *pFrameTag);
370 
380 int32_t FSI_getRxUserDefinedData(uint32_t base, uint16_t *pUserData);
381 
392 int32_t FSI_getRxEventStatus(uint32_t base, uint16_t *pEvtFlags);
393 
394 
404 int32_t FSI_forceRxEvents(uint32_t base, uint16_t evtFlags);
405 
415 int32_t FSI_clearRxEvents(uint32_t base, uint16_t evtFlags);
416 
426 int32_t FSI_getRxReceivedCRC(uint32_t base, uint16_t *pCrcVal);
427 
437 int32_t FSI_getRxComputedCRC(uint32_t base, uint16_t *pCrcVal);
438 
449 int32_t FSI_setRxBufferPtr(uint32_t base, uint16_t bufPtrOff);
450 
463 int32_t FSI_getRxBufferPtr(uint32_t base, uint16_t *pBufPtrLoc);
464 
478 int32_t FSI_getRxWordCount(uint32_t base, uint16_t *pWordCnt);
479 
490 int32_t FSI_enableRxFrameWatchdog(uint32_t base,uint32_t wdRef);
491 
500 int32_t FSI_disableRxFrameWatchdog(uint32_t base);
501 
511 int32_t FSI_getRxFrameWatchdogCounter(uint32_t base, uint32_t *pWdCnt);
512 
523 int32_t FSI_enableRxPingWatchdog(uint32_t base, uint32_t wdRef);
524 
533 int32_t FSI_disableRxPingWatchdog(uint32_t base);
534 
544 int32_t FSI_getRxPingWatchdogCounter(uint32_t base, uint32_t *pWdCnt);
545 
555 int32_t FSI_getRxPingTag(uint32_t base, uint16_t *pPingTag);
556 
567 int32_t FSI_lockRxCtrl(uint32_t base);
568 
578 int32_t FSI_setRxECCData(uint32_t base, uint32_t rxECCdata);
579 
589 int32_t FSI_setRxReceivedECCValue(uint32_t base, uint16_t rxECCvalue);
590 
600 int32_t FSI_getRxECCCorrectedData(uint32_t base, uint32_t *pEccData);
601 
611 int32_t FSI_getRxECCLog(uint32_t base, uint16_t *pEccLog);
612 
627 int32_t FSI_enableRxInterrupt(uint32_t base,
628  FSI_InterruptNum intNum,
629  uint16_t intFlags);
630 
643 int32_t FSI_disableRxInterrupt(uint32_t base,
644  FSI_InterruptNum intNum,
645  uint16_t intFlags);
646 
658 int32_t FSI_getRxBufferAddress(uint32_t base, uint32_t *pAddr);
659 
669 int32_t FSI_resetRxModule(uint32_t base, FSI_RxSubmoduleInReset submodule);
670 
680 int32_t FSI_clearRxModuleReset(uint32_t base, FSI_RxSubmoduleInReset submodule);
681 
694 int32_t FSI_readRxBuffer(uint32_t base,
695  uint16_t *pArray,
696  uint16_t length,
697  uint16_t bufOffset);
698 
710 int32_t FSI_configRxDelayLine(uint32_t base,
711  FSI_RxDelayTapType delayTapType,
712  uint16_t tapValue);
713 
728 int32_t FSI_performRxInitialization(uint32_t base);
729 
730 #ifdef __cplusplus
731 }
732 #endif
733 
734 #endif
735 
FSI_setRxSoftwareFrameSize
int32_t FSI_setRxSoftwareFrameSize(uint32_t base, uint16_t nWords)
This API sets the RX frame size if frame type is user/software defined frame.
FSI_setRxECCComputeWidth
int32_t FSI_setRxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth)
This API select between 16-bit and 32-bit ECC computation for FSI RX.
FSI_setRxBufferPtr
int32_t FSI_setRxBufferPtr(uint32_t base, uint16_t bufPtrOff)
This API sets the value for receive buffer pointer at desired location.
FSI_readRxBuffer
int32_t FSI_readRxBuffer(uint32_t base, uint16_t *pArray, uint16_t length, uint16_t bufOffset)
This API reads data from FSI RX buffer.
FSI_enableRxInterrupt
int32_t FSI_enableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to generate interrupt on occurrence of RX events.
FSI_getRxComputedCRC
int32_t FSI_getRxComputedCRC(uint32_t base, uint16_t *pCrcVal)
This API gets CRC value computed for data received.
FSI_getRxPingWatchdogCounter
int32_t FSI_getRxPingWatchdogCounter(uint32_t base, uint32_t *pWdCnt)
This API gets current value of ping watchdog counter.
FSI_getRxECCLog
int32_t FSI_getRxECCLog(uint32_t base, uint16_t *pEccLog)
This API gets ECC Log details.
FSI_RxSubmoduleInReset
uint32_t FSI_RxSubmoduleInReset
List of RX modules that can be reset, can be used with reset APIs.
Definition: fsi_rx.h:146
FSI_setRxPingTimeoutMode
int32_t FSI_setRxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode)
This API sets HW/SW initiated RX ping timeout mode.
FSI_InterruptNum
uint32_t FSI_InterruptNum
Interrupt lines supported in FSI.
Definition: fsi/v0/fsi.h:136
FSI_enableRxFrameWatchdog
int32_t FSI_enableRxFrameWatchdog(uint32_t base, uint32_t wdRef)
This API enables the frame watchdog counter logic to count every time it start to receive a frame.
FSI_getRxUserDefinedData
int32_t FSI_getRxUserDefinedData(uint32_t base, uint16_t *pUserData)
This API gets User-Data (8-bit) field for received data frame.
FSI_PingTimeoutMode
uint32_t FSI_PingTimeoutMode
FSI ping timeout mode.
Definition: fsi/v0/fsi.h:190
FSI_disableRxInterrupt
int32_t FSI_disableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to disable interrupt generation on RX events.
FSI_disableRxPingWatchdog
int32_t FSI_disableRxPingWatchdog(uint32_t base)
This API disables the ping watchdog counter logic.
FSI_performRxInitialization
int32_t FSI_performRxInitialization(uint32_t base)
This API initializes FSI RX module.
FSI_clearRxEvents
int32_t FSI_clearRxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to clear RX event/error flags.
FSI_disableRxInternalLoopback
int32_t FSI_disableRxInternalLoopback(uint32_t base)
This API disables internal loopback where mux will not use internal pins coming from RX module.
FSI_getRxEventStatus
int32_t FSI_getRxEventStatus(uint32_t base, uint16_t *pEvtFlags)
This API gets current status of all the event/error flags.
FSI_getRxFrameType
int32_t FSI_getRxFrameType(uint32_t base, FSI_FrameType *pFrameType)
This API gets frame type received in the last successful frame.
FSI_enableRxSPIMode
int32_t FSI_enableRxSPIMode(uint32_t base)
This API enables SPI compatible mode in FSI RX.
FSI_getRxFrameWatchdogCounter
int32_t FSI_getRxFrameWatchdogCounter(uint32_t base, uint32_t *pWdCnt)
This API gets current value of frame watchdog counter.
FSI_disableRxSPIPairing
int32_t FSI_disableRxSPIPairing(uint32_t base)
This API disables SPI clock paring, selects regular receive clock coming from the pins.
FSI_getRxPingTag
int32_t FSI_getRxPingTag(uint32_t base, uint16_t *pPingTag)
This API gets the value of tag received for last ping frame.
FSI_enableRxSPIPairing
int32_t FSI_enableRxSPIPairing(uint32_t base)
This API enables SPI clock paring, receive clock is selected from the internal port coming from RX mo...
FSI_configRxDelayLine
int32_t FSI_configRxDelayLine(uint32_t base, FSI_RxDelayTapType delayTapType, uint16_t tapValue)
This API adds delay for selected RX tap line.
FSI_disableRxSPIMode
int32_t FSI_disableRxSPIMode(uint32_t base)
This API disables SPI compatible mode in FSI RX.
FSI_getRxBufferAddress
int32_t FSI_getRxBufferAddress(uint32_t base, uint32_t *pAddr)
This API gets address of RX data buffer.
FSI_FrameType
uint32_t FSI_FrameType
FSI frame type.
Definition: fsi/v0/fsi.h:163
FSI_setRxECCData
int32_t FSI_setRxECCData(uint32_t base, uint32_t rxECCdata)
This API sets RX ECC data on which ECC (SEC-DED) computaion logic runs.
FSI_getRxWordCount
int32_t FSI_getRxWordCount(uint32_t base, uint16_t *pWordCnt)
This API gets valid number of data words present in buffer which have not been read out yet.
FSI_getRxECCCorrectedData
int32_t FSI_getRxECCCorrectedData(uint32_t base, uint32_t *pEccData)
This API gets ECC corrected data.
FSI_ECCComputeWidth
uint32_t FSI_ECCComputeWidth
ECC Computation width - 16 bit or 32 bit.
Definition: fsi/v0/fsi.h:117
FSI_resetRxModule
int32_t FSI_resetRxModule(uint32_t base, FSI_RxSubmoduleInReset submodule)
This API resets frame watchdog, ping watchdog or entire RX module.
FSI_getRxFrameTag
int32_t FSI_getRxFrameTag(uint32_t base, uint16_t *pFrameTag)
This API gets frame tag received for the last successful frame.
FSI_enableRxInternalLoopback
int32_t FSI_enableRxInternalLoopback(uint32_t base)
This API enables internal loopback where mux will select internal pins coming from RX module instead ...
FSI_lockRxCtrl
int32_t FSI_lockRxCtrl(uint32_t base)
This API locks the control of all receive control registers, once locked further writes will not take...
FSI_clearRxModuleReset
int32_t FSI_clearRxModuleReset(uint32_t base, FSI_RxSubmoduleInReset submodule)
This API clears resets on frame watchdog, ping watchdog or entire RX module.
FSI_ExtFrameTriggerSrc
uint32_t FSI_ExtFrameTriggerSrc
Indexes of available EPWM SOC triggers.
Definition: fsi_rx.h:191
FSI_RxDelayTapType
uint32_t FSI_RxDelayTapType
Available RX lines for delay tap selection.
Definition: fsi_rx.h:169
FSI_getRxReceivedCRC
int32_t FSI_getRxReceivedCRC(uint32_t base, uint16_t *pCrcVal)
This API gets CRC value received in data frame/frame.
FSI_RxEnumType
uint32_t FSI_RxEnumType
This enumerator defines the types of possible FSI RX events.
Definition: fsi_rx.h:94
FSI_setRxReceivedECCValue
int32_t FSI_setRxReceivedECCValue(uint32_t base, uint16_t rxECCvalue)
This API sets received ECC value on which ECC (SEC-DED) computaion logic runs.
FSI_getRxBufferPtr
int32_t FSI_getRxBufferPtr(uint32_t base, uint16_t *pBufPtrLoc)
This API gets current buffer pointer location.
FSI_DataWidth
uint32_t FSI_DataWidth
Data lines used for transmit/receive operation.
Definition: fsi/v0/fsi.h:97
FSI_setRxDataWidth
int32_t FSI_setRxDataWidth(uint32_t base, FSI_DataWidth dataWidth)
This API selects number of data lines used for receiving.
FSI_enableRxPingWatchdog
int32_t FSI_enableRxPingWatchdog(uint32_t base, uint32_t wdRef)
This API enables the ping watchdog counter logic and once the set time elapses it will indicate ping ...
FSI_forceRxEvents
int32_t FSI_forceRxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to set RX event/error flags.
FSI_disableRxFrameWatchdog
int32_t FSI_disableRxFrameWatchdog(uint32_t base)
This API disables the frame watchdog counter logic.