MCUSW
EthTrcv.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2023 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
86 /*
87  * Below are the global requirements which are met by this EthTrcv
88  * driver which can't be mapped to a particular source ID
89  */
90 /*
91  * Requirements: MCAL-1751, MCAL-1754, MCAL-1755,
92  * MCAL-1756, MCAL-1757, MCAL-1818, MCAL-981
93  */
94 
95 #ifndef ETHTRCV_H_
96 #define ETHTRCV_H_
97 
98 /* ========================================================================== */
99 /* Include Files */
100 /* ========================================================================== */
101 
102 /* Requirements: MCAL-1825 */
103 #include <EthTrcv_Types.h>
104 
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108 
109 /* ========================================================================== */
110 /* Macros & Typedefs */
111 /* ========================================================================== */
112 
119 /*
120  * Requirements: MCAL-1752
121  */
123 #define ETHTRCV_SW_MAJOR_VERSION (3U)
124 
125 #define ETHTRCV_SW_MINOR_VERSION (0U)
126 
127 #define ETHTRCV_SW_PATCH_VERSION (0U)
128 /* @} */
129 
136 /*
137  * Requirements: MCAL-1752
138  */
140 #define ETHTRCV_AR_RELEASE_MAJOR_VERSION (4U)
141 
142 #define ETHTRCV_AR_RELEASE_MINOR_VERSION (2U)
143 
144 #define ETHTRCV_AR_RELEASE_REVISION_VERSION (1U)
145 /* @} */
146 
152 #define ETHTRCV_VENDOR_ID (44U)
153 
154 #define ETHTRCV_MODULE_ID (73U)
155 
156 #define ETHTRCV_INSTANCE_ID (0U)
157 /* @} */
158 
172 #define ETHTRCV_INIT_ID ((uint8) 0x01U)
173 
175 #define ETHTRCV_CONTROLLER_INIT_ID ((uint8) 0x02U)
176 
178 #define ETHTRCV_SETTRCVMODE_ID ((uint8) 0x03U)
179 
181 #define ETHTRCV_GETTRCVMODE_ID ((uint8) 0x04U)
182 
184 #define ETHTRCV_SRTAUTONEGOTIA_ID ((uint8) 0x05U)
185 
187 #define ETHTRCV_GETLNKSTATE_ID ((uint8) 0x06U)
188 
190 #define ETHTRCV_GETBAUD_ID ((uint8) 0x07U)
191 
193 #define ETHTRCV_GETDPLXMODE_ID ((uint8) 0x08U)
194 
196 #define ETHTRCV_READMIIIND_ID ((uint8) 0x09U)
197 
199 #define ETHTRCV_WRITEMIIIND_ID ((uint8) 0x0AU)
200 
202 #define ETHTRCV_VERSION_ID ((uint8) 0x0BU)
203 
205 #define ETHTRCV_MAINFCT_WRITE_ID ((uint8) 0x0CU)
206 
208 #define ETHTRCV_GETTRCVWKUPMODE_ID ((uint8) 0x0DU)
209 
211 #define ETHTRCV_SETTRCVWKUPMODE_ID ((uint8) 0x0EU)
212 
214 #define ETHTRCV_CHKWKUP_ID ((uint8) 0x0FU)
215 
217 #define ETHTRCV_SETPHYTESTMODE_ID ((uint8) 0x10U)
218 
220 #define ETHTRCV_SETPHYLOOPBACKMODE_ID ((uint8) 0x11U)
221 
223 #define ETHTRCV_GETPHYSIGNALQUALITY_ID ((uint8) 0x12U)
224 
226 #define ETHTRCV_SETPHYTXMODE_ID ((uint8) 0x13U)
227 
229 #define ETHTRCV_GETCABLEDIAGNOSTICSRESULT_ID ((uint8) 0x014U)
230 
232 #define ETHTRCV_GETPHYIDENTIFIER_ID ((uint8) 0x015U)
233 
234 /* @} */
235 /* @} */
236 
243 /*
244  * Requirements: MCAL-1763
245  */
246 
247 #ifndef ETHTRCV_E_INV_TRCV_IDX
248 
249 #define ETHTRCV_E_INV_TRCV_IDX ((uint8) 0x01U)
250 #endif
251 
252 #ifndef ETHTRCV_E_UNINIT
253 
254 #define ETHTRCV_E_UNINIT ((uint8) 0x02U)
255 #endif
256 
257 #ifndef ETHTRCV_E_PARAM_POINTER
258 
259 #define ETHTRCV_E_PARAM_POINTER ((uint8) 0x03U)
260 #endif
261 
262 #ifndef ETHTRCV_E_INIT_FAILED
263 
264 #define ETHTRCV_E_INIT_FAILED ((uint8) 0x04U)
265 #endif
266 /* @} */
267 /* @} */
268 
269 /* ========================================================================== */
270 /* Structures and Enums */
271 /* ========================================================================== */
272 
273 /* None */
274 
275 /* ========================================================================== */
276 /* Function Declarations */
277 /* ========================================================================== */
278 
300 FUNC(void, ETHTRCV_CODE)
301 EthTrcv_Init(P2CONST(EthTrcv_ConfigType, AUTOMATIC, ETHTRCV_PBCFG) CfgPtr);
302 
326 FUNC(Std_ReturnType, ETHTRCV_CODE)
327 EthTrcv_TransceiverInit(uint8 TrcvIdx);
328 
329 
330 #if (STD_ON == ETHTRCV_SETTRANSCEIVERMODE_API)
331 
357 FUNC(Std_ReturnType, ETHTRCV_CODE)
358 EthTrcv_SetTransceiverMode(uint8 TrcvIdx,
359  EthTrcv_ModeType CtrlMode);
360 #endif
361 
362 #if (STD_ON == ETHTRCV_GETTRANSCEIVERMODE_API)
363 
386 FUNC(Std_ReturnType, ETHTRCV_CODE)
387 EthTrcv_GetTransceiverMode(uint8 TrcvIdx,
388  EthTrcv_ModeType *TrcvModePtr);
389 #endif
390 
391 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
392 
423 FUNC(Std_ReturnType, ETHTRCV_CODE)
424 EthTrcv_SetTransceiverWakeupMode(uint8 TrcvIdx,
425  EthTrcv_WakeupModeType TrcvWakeupMode);
426 #endif
427 
428 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
429 
455 FUNC(Std_ReturnType, ETHTRCV_CODE)
456 EthTrcv_GetTransceiverWakeupMode(uint8 TrcvIdx,
457  EthTrcv_WakeupModeType *TrcvWakeupModePtr);
458 #endif
459 
460 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
461 
486 FUNC(Std_ReturnType, ETHTRCV_CODE)
487 EthTrcv_CheckWakeup(uint8 TrcvIdx);
488 #endif
489 
490 /* Requirements: MCAL-1820 */
491 /* The function is not required or called by an upper layer BSW software
492  * component. So making internal */
493 #if (STD_ON == ETHTRCV_STARTAUTONEGOTIATION_API)
494 
518 FUNC(Std_ReturnType, ETHTRCV_CODE)
519 EthTrcv_StartAutoNegotiation(uint8 TrcvIdx);
520 #endif
521 
522 #if (STD_ON == ETHTRCV_GETLINKSTATE_API)
523 
548 FUNC(Std_ReturnType, ETHTRCV_CODE)
549 EthTrcv_GetLinkState(uint8 TrcvIdx,
550  EthTrcv_LinkStateType *LinkStatePtr);
551 #endif
552 
553 /*
554  * Requirements: MCAL-1821
555  */
556 /* The function is not required or called by an upper layer BSW software
557  * component. So making internal */
558 #if (STD_ON == ETHTRCV_GETBAUDRATE_API)
559 
585 FUNC(Std_ReturnType, ETHTRCV_CODE)
586 EthTrcv_GetBaudRate(uint8 TrcvIdx,
587  EthTrcv_BaudRateType *BaudRatePtr);
588 #endif
589 
590 #if (STD_ON == ETHTRCV_GETDUPLEXMODE_API)
591 
616 FUNC(Std_ReturnType, ETHTRCV_CODE)
617 EthTrcv_GetDuplexMode(uint8 TrcvIdx,
618  EthTrcv_DuplexModeType *DuplexModePtr);
619 #endif
620 
621 #if (STD_ON == ETHTRCV_SETPHYTESTMODE_API)
622 
644 FUNC(Std_ReturnType, ETHTRCV_CODE)
645 EthTrcv_SetPhyTestMode(uint8 TrcvIdx,
646  EthTrcv_PhyTestModeType Mode);
647 #endif
648 
649 #if (STD_ON == ETHTRCV_SETPHYLOOPBACKMODE_API)
650 
673 FUNC(Std_ReturnType, ETHTRCV_CODE)
674 EthTrcv_SetPhyLoopbackMode(uint8 TrcvIdx,
675  EthTrcv_PhyLoopbackModeType Mode);
676 #endif
677 
678 #if (STD_ON == ETHTRCV_GETPHYSIGNALQUALITY_API)
679 
703 FUNC(Std_ReturnType, ETHTRCV_CODE)
704 EthTrcv_GetPhySignalQuality(uint8 TrcvIdx,
705  uint32* SignalQualityPtr);
706 #endif
707 
708 #if (STD_ON == ETHTRCV_SETPHYTXMODE_API)
709 
732 FUNC(Std_ReturnType, ETHTRCV_CODE)
733  EthTrcv_SetPhyTxMode(uint8 TrcvIdx,
734  EthTrcv_PhyTxModeType Mode);
735 #endif
736 
737 #if (STD_ON == ETHTRCV_GETCABLEDIAGNOSTICSRESULT_API)
738 
762 FUNC(Std_ReturnType, ETHTRCV_CODE)
763  EthTrcv_GetCableDiagnosticsResult(uint8 TrcvIdx,
764  EthTrcv_CableDiagResultType * ResultPtr);
765 #endif
766 
767 #if (STD_ON == ETHTRCV_GETPHYIDENTIFIER_API)
768 
800 FUNC(Std_ReturnType, ETHTRCV_CODE)
801 Std_ReturnType EthTrcv_GetPhyIdentifier(uint8 TrcvIdx,
802  uint32* OrgUniqueIdPtr,
803  uint8* ModelNrPtr,
804  uint8* RevisionNrPtr);
805 #endif
806 
807 #if (STD_ON == ETHTRCV_VERSION_INFO_API)
808 
829 FUNC(void, ETHTRCV_CODE)
830 EthTrcv_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, ETHTRCV_APPL_DATA) VersionInfoPtr);
831 #endif
832 
864 /* Important Note:
865  * There is discrepancy in the Eth and EthTrcv specs. Data type for RegVal in
866  * EthTrcv_ReadMiiIndication is uint8 as per Eth Trcv spec where as Eth_ReadMii
867  * takes uint16 pointer RegValPtr. To avoid data loss we change RegVal data type
868  * to uint16 */
869 FUNC(void, ETHTRCV_CODE)
870 EthTrcv_ReadMiiIndication(uint8 CtrlIdx,
871  uint8 TrcvIdx,
872  uint8 RegIdx,
873  uint16 RegVal);
874 
904 FUNC(void, ETHTRCV_CODE)
905 EthTrcv_WriteMiiIndication(uint8 CtrlIdx,
906  uint8 TrcvIdx,
907  uint8 RegId);
908 
928 FUNC(void, ETHTRCV_CODE)
930 
931 #ifdef __cplusplus
932 }
933 #endif
934 
935 #endif /* ETHTRCV_H_ */
936 
937 /* @} */
void EthTrcv_GetVersionInfo(Std_VersionInfoType *VersionInfoPtr)
Function returns the version information of this module.
Std_ReturnType EthTrcv_GetCableDiagnosticsResult(uint8 TrcvIdx, EthTrcv_CableDiagResultType *ResultPtr)
This function Retrieves the cable diagnostics result of a given transceiver.
Std_ReturnType EthTrcv_GetLinkState(uint8 TrcvIdx, EthTrcv_LinkStateType *LinkStatePtr)
This function obtains the link state of the indexed transceiver.
Std_ReturnType EthTrcv_StartAutoNegotiation(uint8 TrcvIdx)
This function restarts the negotiation of the transmission parameters used by the indexed.
Std_ReturnType Std_ReturnType EthTrcv_GetPhyIdentifier(uint8 TrcvIdx, uint32 *OrgUniqueIdPtr, uint8 *ModelNrPtr, uint8 *RevisionNrPtr)
This function Obtains the PHY identifier of the Ethernet Transceiver according to IEEE 802....
Std_ReturnType EthTrcv_SetPhyLoopbackMode(uint8 TrcvIdx, EthTrcv_PhyLoopbackModeType Mode)
This function Activates a given loopback mode.
Std_ReturnType EthTrcv_GetPhySignalQuality(uint8 TrcvIdx, uint32 *SignalQualityPtr)
This function Obtains the current signal quality of the link of the indexed transceiver.
Std_ReturnType EthTrcv_TransceiverInit(uint8 TrcvIdx)
This function initializes the Ethernet Transceiver controller. All the required initialization for th...
Std_ReturnType EthTrcv_SetPhyTxMode(uint8 TrcvIdx, EthTrcv_PhyTxModeType Mode)
This function Activates a given transmission mode.
void EthTrcv_MainFunction(void)
This function is used for polling state changes and wakeup reasons. It calls EthIf_TrcvModeIndication...
Std_ReturnType EthTrcv_GetTransceiverMode(uint8 TrcvIdx, EthTrcv_ModeType *TrcvModePtr)
This function obtains the state of the indexed transceiver.
Std_ReturnType EthTrcv_SetTransceiverMode(uint8 TrcvIdx, EthTrcv_ModeType CtrlMode)
This function enables / disables the indexed transceiver.
Std_ReturnType EthTrcv_GetBaudRate(uint8 TrcvIdx, EthTrcv_BaudRateType *BaudRatePtr)
This function obtains the baud rate of the indexed transceiver.
void EthTrcv_WriteMiiIndication(uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegId)
This function is called when information has been written via MII interface. Triggered by previous Et...
Std_ReturnType EthTrcv_GetDuplexMode(uint8 TrcvIdx, EthTrcv_DuplexModeType *DuplexModePtr)
This function obtains the duplex mode of the indexed transceiver.
void EthTrcv_ReadMiiIndication(uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegIdx, uint16 RegVal)
This function is called when information has been read out via MII interface. Triggered by previous E...
void EthTrcv_Init(const EthTrcv_ConfigType *CfgPtr)
This function initializes the Ethernet Transceiver controller. All the required initialization for th...
Std_ReturnType EthTrcv_SetPhyTestMode(uint8 TrcvIdx, EthTrcv_PhyTestModeType Mode)
This function Activates a given test mode.