AM263x MCU+ SDK  08.02.01
fsi_tx.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_TX_H
50 #define FSI_TX_H
51 
52 
53 #if defined (SOC_AM64X) || defined (SOC_AM243X)
54 #define FSI_TX_BUFFER_ACCESS_64BIT
55 #endif
56 
57 /* ========================================================================== */
58 /* Include Files */
59 /* ========================================================================== */
60 
61 #include <drivers/hw_include/cslr_fsi_tx.h>
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /* ========================================================================== */
68 /* Macros & Typedefs */
69 /* ========================================================================== */
70 
94 typedef uint32_t FSI_TxEnumType;
95 
96 #define FSI_TX_EVT_FRAME_DONE ((uint16_t)0x1U)
97 
98 #define FSI_TX_EVT_BUF_UNDERRUN ((uint16_t)0x2U)
99 
100 #define FSI_TX_EVT_BUF_OVERRUN ((uint16_t)0x4U)
101 
102 #define FSI_TX_EVT_PING_TIMEOUT ((uint16_t)0x8U)
103 
104 #define FSI_TX_EVT_PING_HW_TRIG ((uint16_t)0x8U)
105 
110 #define FSI_TX_EVTMASK ((uint16_t)0xFU)
111 
115 #define FSI_TX_MAX_NUM_EXT_TRIGGERS ((uint16_t)0x20U)
116 
120 #define FSI_TX_INT2_CTRL_S ((uint16_t)0x8U)
121 
131 typedef uint32_t FSI_TxSubmoduleInReset;
132 
133 #define FSI_TX_MASTER_CORE_RESET ((uint32_t)0x0U)
134 
135 #define FSI_TX_CLOCK_RESET ((uint32_t)0x1U)
136 
137 #define FSI_TX_PING_TIMEOUT_CNT_RESET ((uint32_t)0x2U)
138 
149 typedef uint32_t FSI_TxStartMode;
150 
151 #define FSI_TX_START_FRAME_CTRL ((uint32_t)0x0U)
152 
153 #define FSI_TX_START_EXT_TRIG ((uint32_t)0x1U)
154 
155 #define FSI_TX_START_FRAME_CTRL_OR_UDATA_TAG ((uint32_t)0x2U)
156 
167 typedef uint32_t FSI_TxClkSel;
168 
169 #define FSI_TX_CLK_SEL0 ((uint32_t)0x0U)
170 
171 #define FSI_TX_CLK_SEL1 ((uint32_t)0x1U)
172 
186 typedef uint32_t FSI_FrameTag;
187 
188 #define FSI_FRAME_TAG0 ((uint32_t)0x0U)
189 
190 #define FSI_FRAME_TAG1 ((uint32_t)0x1U)
191 
192 #define FSI_FRAME_TAG2 ((uint32_t)0x2U)
193 
194 #define FSI_FRAME_TAG3 ((uint32_t)0x3U)
195 
196 #define FSI_FRAME_TAG4 ((uint32_t)0x4U)
197 
198 #define FSI_FRAME_TAG5 ((uint32_t)0x5U)
199 
200 #define FSI_FRAME_TAG6 ((uint32_t)0x6U)
201 
202 #define FSI_FRAME_TAG7 ((uint32_t)0x7U)
203 
204 #define FSI_FRAME_TAG8 ((uint32_t)0x8U)
205 
206 #define FSI_FRAME_TAG9 ((uint32_t)0x9U)
207 
208 #define FSI_FRAME_TAG10 ((uint32_t)0xAU)
209 
210 #define FSI_FRAME_TAG11 ((uint32_t)0xBU)
211 
212 #define FSI_FRAME_TAG12 ((uint32_t)0xCU)
213 
214 #define FSI_FRAME_TAG13 ((uint32_t)0xDU)
215 
216 #define FSI_FRAME_TAG14 ((uint32_t)0xEU)
217 
218 #define FSI_FRAME_TAG15 ((uint32_t)0xFU)
219 
222 /* ========================================================================== */
223 /* Function Declarations */
224 /* ========================================================================== */
225 
238 int32_t FSI_sendTxFlush(uint32_t base);
239 
252 int32_t FSI_stopTxFlush(uint32_t base);
253 
264 int32_t FSI_selectTxPLLClock(uint32_t base, FSI_TxClkSel clkSel);
265 
276 int32_t FSI_enableTxClock(uint32_t base, uint16_t preScaleValue);
277 
286 int32_t FSI_disableTxClock(uint32_t base);
287 
298 int32_t FSI_setTxDataWidth(uint32_t base, FSI_DataWidth dataWidth);
299 
315 int32_t FSI_enableTxSPIMode(uint32_t base);
316 
327 int32_t FSI_disableTxSPIMode(uint32_t base);
328 
338 int32_t FSI_setTxStartMode(uint32_t base, FSI_TxStartMode txStartMode);
339 
349 int32_t FSI_setTxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode);
350 
360 int32_t FSI_setTxExtFrameTrigger(uint32_t base, uint16_t extInputNum);
361 
375 int32_t FSI_enableTxCRCForceError(uint32_t base);
376 
385 int32_t FSI_disableTxCRCForceError(uint32_t base);
386 
396 int32_t FSI_setTxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth);
397 
407 int32_t FSI_setTxFrameType(uint32_t base, FSI_FrameType frameType);
408 
418 int32_t FSI_setTxSoftwareFrameSize(uint32_t base, uint16_t nWords);
419 
428 int32_t FSI_startTxTransmit(uint32_t base);
429 
439 int32_t FSI_setTxFrameTag(uint32_t base, FSI_FrameTag frameTag);
440 
451 int32_t FSI_setTxUserDefinedData(uint32_t base, uint16_t userDefData);
452 
463 int32_t FSI_setTxBufferPtr(uint32_t base, uint16_t bufPtrOff);
464 
474 int32_t FSI_getTxBufferPtr(uint32_t base, uint16_t *pBufPtrLoc);
475 
489 int32_t FSI_getTxWordCount(uint32_t base, uint16_t *pWordCnt);
490 
506 int32_t FSI_enableTxPingTimer(uint32_t base,
507  uint32_t refValue,
508  FSI_FrameTag pingFrameTag);
509 
521 int32_t FSI_setTxPingTag(uint32_t base, FSI_FrameTag frameTag);
522 
531 int32_t FSI_disableTxPingTimer(uint32_t base);
532 
542 int32_t FSI_enableTxExtPingTrigger(uint32_t base, uint16_t extTrigSel);
543 
552 int32_t FSI_disableTxExtPingTrigger(uint32_t base);
553 
564  uint32_t *pPingToCnt);
565 
575 int32_t FSI_lockTxCtrl(uint32_t base);
576 
587 int32_t FSI_getTxEventStatus(uint32_t base, uint16_t *pEvtFlags);
588 
603 int32_t FSI_forceTxEvents(uint32_t base, uint16_t evtFlags);
604 
617 int32_t FSI_clearTxEvents(uint32_t base, uint16_t evtFlags);
618 
629 int32_t FSI_enableTxUserCRC(uint32_t base, uint16_t userCRCValue);
630 
640 int32_t FSI_disableTxUserCRC(uint32_t base);
641 
651 int32_t FSI_setTxECCdata(uint32_t base, uint32_t data);
652 
662 int32_t FSI_getTxECCValue(uint32_t base, uint16_t *pEccVal);
663 
675 int32_t FSI_enableTxInterrupt(uint32_t base,
676  FSI_InterruptNum intNum,
677  uint16_t intFlags);
678 
691 int32_t FSI_disableTxInterrupt(uint32_t base,
692  FSI_InterruptNum intNum,
693  uint16_t intFlags);
694 
706 int32_t FSI_getTxBufferAddress(uint32_t base, uint32_t *pBufAddr);
707 
717 int32_t FSI_resetTxModule(uint32_t base, FSI_TxSubmoduleInReset submodule);
718 
728 int32_t FSI_clearTxModuleReset(uint32_t base, FSI_TxSubmoduleInReset submodule);
729 
748 int32_t FSI_writeTxBuffer(uint32_t base,
749  const uint16_t *pArray,
750  uint16_t length,
751  uint16_t bufOffset);
752 
766 int32_t FSI_performTxInitialization(uint32_t base, uint16_t prescalar);
767 
781 int32_t FSI_executeTxFlushSequence(uint32_t base, uint16_t prescalar);
782 
783 #ifdef __cplusplus
784 }
785 #endif
786 
787 #endif
788 
FSI_setTxBufferPtr
int32_t FSI_setTxBufferPtr(uint32_t base, uint16_t bufPtrOff)
This API sets the value for transmit buffer pointer at desired location.
FSI_sendTxFlush
int32_t FSI_sendTxFlush(uint32_t base)
This API sends FLUSH pattern.
FSI_InterruptNum
uint32_t FSI_InterruptNum
Interrupt lines supported in FSI.
Definition: fsi/v0/fsi.h:136
FSI_startTxTransmit
int32_t FSI_startTxTransmit(uint32_t base)
This API starts transmitting frames.
FSI_enableTxExtPingTrigger
int32_t FSI_enableTxExtPingTrigger(uint32_t base, uint16_t extTrigSel)
This API enables external trigger to transmit a ping frame.
FSI_getTxEventStatus
int32_t FSI_getTxEventStatus(uint32_t base, uint16_t *pEvtFlags)
This API gets current status of all the error flags.
FSI_setTxPingTimeoutMode
int32_t FSI_setTxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode)
This API sets HW/SW initiated TX ping timeout mode.
FSI_setTxPingTag
int32_t FSI_setTxPingTag(uint32_t base, FSI_FrameTag frameTag)
This API sets the ping tag value, used by either timeout counter initiated PING frame transfer or by ...
FSI_stopTxFlush
int32_t FSI_stopTxFlush(uint32_t base)
This API stops FLUSH pattern transmission.
FSI_enableTxCRCForceError
int32_t FSI_enableTxCRCForceError(uint32_t base)
This API enables CRC value of a data frame to be forced to zero.
FSI_PingTimeoutMode
uint32_t FSI_PingTimeoutMode
FSI ping timeout mode.
Definition: fsi/v0/fsi.h:190
FSI_enableTxSPIMode
int32_t FSI_enableTxSPIMode(uint32_t base)
This API enables SPI compatible mode.
FSI_disableTxPingTimer
int32_t FSI_disableTxPingTimer(uint32_t base)
This API disables ping timer logic.
FSI_TxStartMode
uint32_t FSI_TxStartMode
Start Mode for TX frame transmission (i.e. how transmission will start)
Definition: fsi_tx.h:149
FSI_clearTxEvents
int32_t FSI_clearTxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to clear TX error flags.
FSI_setTxSoftwareFrameSize
int32_t FSI_setTxSoftwareFrameSize(uint32_t base, uint16_t nWords)
This API sets the frame size if frame type is user/software defined frame.
FSI_setTxFrameType
int32_t FSI_setTxFrameType(uint32_t base, FSI_FrameType frameType)
This API sets frame type for transmission.
FSI_disableTxExtPingTrigger
int32_t FSI_disableTxExtPingTrigger(uint32_t base)
This API disables external trigger logic.
FSI_enableTxUserCRC
int32_t FSI_enableTxUserCRC(uint32_t base, uint16_t userCRCValue)
This API sets the CRC value to be picked transmission if transmission is configured to use user defin...
FSI_setTxExtFrameTrigger
int32_t FSI_setTxExtFrameTrigger(uint32_t base, uint16_t extInputNum)
This API sets a particular external input to trigger transmission.
FSI_executeTxFlushSequence
int32_t FSI_executeTxFlushSequence(uint32_t base, uint16_t prescalar)
This API sends Flush pattern sequence.
FSI_getTxECCValue
int32_t FSI_getTxECCValue(uint32_t base, uint16_t *pEccVal)
This API gets ECC value evaluated for 16/32 bit data.
FSI_disableTxCRCForceError
int32_t FSI_disableTxCRCForceError(uint32_t base)
This API disables forcing of CRC value of a data frame to zero.
FSI_resetTxModule
int32_t FSI_resetTxModule(uint32_t base, FSI_TxSubmoduleInReset submodule)
This API resets clock or ping timeout counter or entire TX module.
FSI_enableTxClock
int32_t FSI_enableTxClock(uint32_t base, uint16_t preScaleValue)
This API sets clock division prescalar and enables the transmit clock.
FSI_performTxInitialization
int32_t FSI_performTxInitialization(uint32_t base, uint16_t prescalar)
This API initializes FSI TX module.
FSI_disableTxInterrupt
int32_t FSI_disableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to disable generation interrupt on occurrence of FSI TX events.
FSI_TxClkSel
uint32_t FSI_TxClkSel
FSI TX input clock select.
Definition: fsi_tx.h:167
FSI_TxEnumType
uint32_t FSI_TxEnumType
This enumerator defines the types of possible FSI TX events.
Definition: fsi_tx.h:94
FSI_FrameType
uint32_t FSI_FrameType
FSI frame type.
Definition: fsi/v0/fsi.h:163
FSI_writeTxBuffer
int32_t FSI_writeTxBuffer(uint32_t base, const uint16_t *pArray, uint16_t length, uint16_t bufOffset)
This API writes data in FSI TX buffer.
FSI_getTxCurrentPingTimeoutCounter
int32_t FSI_getTxCurrentPingTimeoutCounter(uint32_t base, uint32_t *pPingToCnt)
This API gets current value of ping timeout logic counter.
FSI_FrameTag
uint32_t FSI_FrameTag
FSI frame tag values.
Definition: fsi_tx.h:186
FSI_disableTxClock
int32_t FSI_disableTxClock(uint32_t base)
This API disables transmit clock.
FSI_setTxECCComputeWidth
int32_t FSI_setTxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth)
This API select between 16-bit and 32-bit ECC computation for FSI TX.
FSI_ECCComputeWidth
uint32_t FSI_ECCComputeWidth
ECC Computation width - 16 bit or 32 bit.
Definition: fsi/v0/fsi.h:117
FSI_setTxFrameTag
int32_t FSI_setTxFrameTag(uint32_t base, FSI_FrameTag frameTag)
This API sets frame tag for transmission.
FSI_setTxUserDefinedData
int32_t FSI_setTxUserDefinedData(uint32_t base, uint16_t userDefData)
This API sets user defined data for transmission It is an extra data field (8 bit) apart from regular...
FSI_disableTxUserCRC
int32_t FSI_disableTxUserCRC(uint32_t base)
This API disables user defined CRC value, the transmitted CRC value is computed by hardware.
FSI_enableTxInterrupt
int32_t FSI_enableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags)
This API enables user to generate interrupt on occurrence of FSI_TxEventList events.
FSI_TxSubmoduleInReset
uint32_t FSI_TxSubmoduleInReset
TX submodules that can be reset with reset APIs.
Definition: fsi_tx.h:131
FSI_forceTxEvents
int32_t FSI_forceTxEvents(uint32_t base, uint16_t evtFlags)
This API enables user to set TX error flags.
FSI_disableTxSPIMode
int32_t FSI_disableTxSPIMode(uint32_t base)
This API disables SPI compatible mode.
FSI_setTxDataWidth
int32_t FSI_setTxDataWidth(uint32_t base, FSI_DataWidth dataWidth)
This API sets Data width for transmission.
FSI_enableTxPingTimer
int32_t FSI_enableTxPingTimer(uint32_t base, uint32_t refValue, FSI_FrameTag pingFrameTag)
This API enables ping timer logic and once set time elapses it sends signal to transmitter to send pi...
FSI_setTxECCdata
int32_t FSI_setTxECCdata(uint32_t base, uint32_t data)
This API sets data for ECC logic computaion.
FSI_getTxBufferAddress
int32_t FSI_getTxBufferAddress(uint32_t base, uint32_t *pBufAddr)
This API gets address of TX data buffer.
FSI_DataWidth
uint32_t FSI_DataWidth
Data lines used for transmit/receive operation.
Definition: fsi/v0/fsi.h:97
FSI_clearTxModuleReset
int32_t FSI_clearTxModuleReset(uint32_t base, FSI_TxSubmoduleInReset submodule)
This API clears reset on clock or ping timeout counter or entire TX module.
FSI_getTxWordCount
int32_t FSI_getTxWordCount(uint32_t base, uint16_t *pWordCnt)
This API gets valid number of data words present in buffer which have not been transmitted yet.
FSI_selectTxPLLClock
int32_t FSI_selectTxPLLClock(uint32_t base, FSI_TxClkSel clkSel)
This API selects PLL clock as source for clock dividers.
FSI_getTxBufferPtr
int32_t FSI_getTxBufferPtr(uint32_t base, uint16_t *pBufPtrLoc)
This API gets current buffer pointer locationn.
FSI_lockTxCtrl
int32_t FSI_lockTxCtrl(uint32_t base)
This API locks the control of all transmit control registers, once locked further writes will not tak...
FSI_setTxStartMode
int32_t FSI_setTxStartMode(uint32_t base, FSI_TxStartMode txStartMode)
This API sets start mode for any frame transmission.