MCUSW
EthTrcv.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2019 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 #include "ComStack_Types.h"
103 /* Requirements: MCAL-1825 */
104 #include "Eth_GeneralTypes.h"
105 #include "EthTrcv_Cfg.h"
106 
107 #ifdef __cplusplus
108 extern "C" {
109 #endif
110 
111 /* ========================================================================== */
112 /* Macros & Typedefs */
113 /* ========================================================================== */
114 
121 /*
122  * Requirements: MCAL-1752
123  */
125 #define ETHTRCV_SW_MAJOR_VERSION (1U)
126 
127 #define ETHTRCV_SW_MINOR_VERSION (2U)
128 
129 #define ETHTRCV_SW_PATCH_VERSION (1U)
130 /* @} */
131 
138 /*
139  * Requirements: MCAL-1752
140  */
142 #define ETHTRCV_AR_RELEASE_MAJOR_VERSION (4U)
143 
144 #define ETHTRCV_AR_RELEASE_MINOR_VERSION (2U)
145 
146 #define ETHTRCV_AR_RELEASE_REVISION_VERSION (1U)
147 /* @} */
148 
154 #define ETHTRCV_VENDOR_ID (44U)
155 
156 #define ETHTRCV_MODULE_ID (73U)
157 
158 #define ETHTRCV_INSTANCE_ID (0U)
159 /* @} */
160 
174 #define ETHTRCV_INIT_ID ((uint8) 0x01U)
175 
177 #define ETHTRCV_SETTRCVMODE_ID ((uint8) 0x03U)
178 
180 #define ETHTRCV_GETTRCVMODE_ID ((uint8) 0x04U)
181 
183 #define ETHTRCV_SRTAUTONEGOTIA_ID ((uint8) 0x05U)
184 
186 #define ETHTRCV_GETLNKSTATE_ID ((uint8) 0x06U)
187 
189 #define ETHTRCV_GETBAUD_ID ((uint8) 0x07U)
190 
192 #define ETHTRCV_GETDPLXMODE_ID ((uint8) 0x08U)
193 
195 #define ETHTRCV_READMIIIND_ID ((uint8) 0x09U)
196 
198 #define ETHTRCV_WRITEMIIIND_ID ((uint8) 0x0AU)
199 
201 #define ETHTRCV_VERSION_ID ((uint8) 0x0BU)
202 
204 #define ETHTRCV_MAINFCT_WRITE_ID ((uint8) 0x0CU)
205 
207 #define ETHTRCV_GETTRCVWKUPMODE_ID ((uint8) 0x0DU)
208 
210 #define ETHTRCV_SETTRCVWKUPMODE_ID ((uint8) 0x0EU)
211 
213 #define ETHTRCV_CHKWKUP_ID ((uint8) 0x0FU)
214 
216 #define ETHTRCV_SETPHYTESTMODE_ID ((uint8) 0x10U)
217 
219 #define ETHTRCV_SETPHYLOOPBACKMODE_ID ((uint8) 0x11U)
220 
222 #define ETHTRCV_GETPHYSIGNALQUALITY_ID ((uint8) 0x12U)
223 
225 #define ETHTRCV_SETPHYTXMODE_ID ((uint8) 0x13U)
226 
228 #define ETHTRCV_GETCABLEDIAGNOSTICSRESULT_ID ((uint8) 0x014U)
229 
231 #define ETHTRCV_GETPHYIDENTIFIER_ID ((uint8) 0x015U)
232 
233 /* @} */
234 /* @} */
235 
242 /*
243  * Requirements: MCAL-1763
244  */
245 
246 #ifndef ETHTRCV_E_INV_TRCV_IDX
247 
248 #define ETHTRCV_E_INV_TRCV_IDX ((uint8) 0x01U)
249 #endif
250 
251 #ifndef ETHTRCV_E_UNINIT
252 
253 #define ETHTRCV_E_UNINIT ((uint8) 0x02U)
254 #endif
255 
256 #ifndef ETHTRCV_E_PARAM_POINTER
257 
258 #define ETHTRCV_E_PARAM_POINTER ((uint8) 0x03U)
259 #endif
260 
261 #ifndef ETHTRCV_E_INIT_FAILED
262 
263 #define ETHTRCV_E_INIT_FAILED ((uint8) 0x04U)
264 #endif
265 /* @} */
266 
273 /* Requirements: MCAL-1904 */
275 #define ETHTRCV_WAKEUP_BY_INTERRUPT (0x0U)
276 
278 #define ETHTRCV_WAKEUP_BY_POLLING (0x1U)
279 
281 #define ETHTRCV_WAKEUP_NOT_SUPPORTED (0x2U)
282 
283 /* @} */
284 
285 /* ========================================================================== */
286 /* Structures and Enums */
287 /* ========================================================================== */
288 
289 /* None */
290 
291 /* ========================================================================== */
292 /* Function Declarations */
293 /* ========================================================================== */
294 
315 FUNC(void, ETHTRCV_CODE)
316 EthTrcv_Init(P2CONST(EthTrcv_ConfigType, AUTOMATIC, ETHTRCV_PBCFG) CfgPtr);
317 
318 #if (STD_ON == ETHTRCV_SETTRANSCEIVERMODE_API)
319 
344 FUNC(Std_ReturnType, ETHTRCV_CODE)
345 EthTrcv_SetTransceiverMode(uint8 TrcvIdx,
346  EthTrcv_ModeType CtrlMode);
347 #endif
348 
349 #if (STD_ON == ETHTRCV_GETTRANSCEIVERMODE_API)
350 
372 FUNC(Std_ReturnType, ETHTRCV_CODE)
373 EthTrcv_GetTransceiverMode(uint8 TrcvIdx,
374  EthTrcv_ModeType *TrcvModePtr);
375 #endif
376 
377 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
378 
408 FUNC(Std_ReturnType, ETHTRCV_CODE)
410  EthTrcv_WakeupModeType TrcvWakeupMode);
411 #endif
412 
413 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
414 
439 FUNC(Std_ReturnType, ETHTRCV_CODE)
441  EthTrcv_WakeupModeType *TrcvWakeupModePtr);
442 #endif
443 
444 #if (ETHTRCV_WAKEUPSUPPORT_API != ETHTRCV_WAKEUP_NOT_SUPPORTED)
445 
469 FUNC(Std_ReturnType, ETHTRCV_CODE)
470 EthTrcv_CheckWakeup(uint8 TrcvIdx);
471 #endif
472 
473 /* Requirements: MCAL-1820 */
474 /* The function is not required or called by an upper layer BSW software
475  * component. So making internal */
476 #if (STD_ON == ETHTRCV_STARTAUTONEGOTIATION_API)
477 
500 FUNC(Std_ReturnType, ETHTRCV_CODE)
501 EthTrcv_StartAutoNegotiation(uint8 TrcvIdx);
502 #endif
503 
504 #if (STD_ON == ETHTRCV_GETLINKSTATE_API)
505 
529 FUNC(Std_ReturnType, ETHTRCV_CODE)
530 EthTrcv_GetLinkState(uint8 TrcvIdx,
531  EthTrcv_LinkStateType *LinkStatePtr);
532 #endif
533 
534 /*
535  * Requirements: MCAL-1821
536  */
537 /* The function is not required or called by an upper layer BSW software
538  * component. So making internal */
539 #if (STD_ON == ETHTRCV_GETBAUDRATE_API)
540 
565 FUNC(Std_ReturnType, ETHTRCV_CODE)
566 EthTrcv_GetBaudRate(uint8 TrcvIdx,
567  EthTrcv_BaudRateType *BaudRatePtr);
568 #endif
569 
570 #if (STD_ON == ETHTRCV_GETDUPLEXMODE_API)
571 
595 FUNC(Std_ReturnType, ETHTRCV_CODE)
596 EthTrcv_GetDuplexMode(uint8 TrcvIdx,
597  EthTrcv_DuplexModeType *DuplexModePtr);
598 #endif
599 
600 #if (STD_ON == ETHTRCV_SETPHYTESTMODE_API)
601 
622 FUNC(Std_ReturnType, ETHTRCV_CODE)
623 EthTrcv_SetPhyTestMode(uint8 TrcvIdx,
624  EthTrcv_PhyTestModeType Mode);
625 #endif
626 
627 #if (STD_ON == ETHTRCV_SETPHYLOOPBACKMODE_API)
628 
650 FUNC(Std_ReturnType, ETHTRCV_CODE)
651 EthTrcv_SetPhyLoopbackMode(uint8 TrcvIdx,
652  EthTrcv_PhyLoopbackModeType Mode);
653 #endif
654 
655 #if (STD_ON == ETHTRCV_GETPHYSIGNALQUALITY_API)
656 
679 FUNC(Std_ReturnType, ETHTRCV_CODE)
680 EthTrcv_GetPhySignalQuality(uint8 TrcvIdx,
681  uint32* SignalQualityPtr);
682 #endif
683 
684 #if (STD_ON == ETHTRCV_SETPHYTXMODE_API)
685 
707 FUNC(Std_ReturnType, ETHTRCV_CODE)
708  EthTrcv_SetPhyTxMode(uint8 TrcvIdx,
709  EthTrcv_PhyTxModeType Mode);
710 #endif
711 
712 #if (STD_ON == ETHTRCV_GETCABLEDIAGNOSTICSRESULT_API)
713 
736 FUNC(Std_ReturnType, ETHTRCV_CODE)
737  EthTrcv_GetCableDiagnosticsResult(uint8 TrcvIdx,
738  EthTrcv_CableDiagResultType * ResultPtr);
739 #endif
740 
741 #if (STD_ON == ETHTRCV_GETPHYIDENTIFIER_API)
742 
773 FUNC(Std_ReturnType, ETHTRCV_CODE)
774 Std_ReturnType EthTrcv_GetPhyIdentifier(uint8 TrcvIdx,
775  uint32* OrgUniqueIdPtr,
776  uint8* ModelNrPtr,
777  uint8* RevisionNrPtr);
778 #endif
779 
780 #if (STD_ON == ETHTRCV_VERSION_INFO_API)
781 
801 FUNC(void, ETHTRCV_CODE)
802 EthTrcv_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, ETHTRCV_APPL_DATA) VersionInfoPtr);
803 #endif
804 
835 /* Important Note:
836  * There is discrepancy in the Eth and EthTrcv specs. Data type for RegVal in
837  * EthTrcv_ReadMiiIndication is uint8 as per Eth Trcv spec where as Eth_ReadMii
838  * takes uint16 pointer RegValPtr. To avoid data loss we change RegVal data type
839  * to uint16 */
840 FUNC(void, ETHTRCV_CODE)
841 EthTrcv_ReadMiiIndication(uint8 CtrlIdx,
842  uint8 TrcvIdx,
843  uint8 RegIdx,
844  uint16 RegVal);
845 
874 FUNC(void, ETHTRCV_CODE)
875 EthTrcv_WriteMiiIndication(uint8 CtrlIdx,
876  uint8 TrcvIdx,
877  uint8 RegId);
878 
897 FUNC(void, ETHTRCV_CODE)
899 
900 #ifdef __cplusplus
901 }
902 #endif
903 
904 #endif /* ETHTRCV_H_ */
905 
906 /* @} */
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...
void EthTrcv_GetVersionInfo(Std_VersionInfoType *VersionInfoPtr)
Function returns the version information of this module.
Std_ReturnType EthTrcv_GetTransceiverWakeupMode(uint8 TrcvIdx, EthTrcv_WakeupModeType *TrcvWakeupModePtr)
This function returns the wake up mode of the indexed transceiver.
Std_ReturnType EthTrcv_GetCableDiagnosticsResult(uint8 TrcvIdx, EthTrcv_CableDiagResultType *ResultPtr)
This function Retrieves the cable diagnostics result of a given transceiver.
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_StartAutoNegotiation(uint8 TrcvIdx)
This function restarts the negotiation of the transmission parameters used by the indexed...
Std_ReturnType EthTrcv_GetTransceiverMode(uint8 TrcvIdx, EthTrcv_ModeType *TrcvModePtr)
This function obtains the state of the indexed transceiver.
This file contains generated pre compile configuration file for Ethernet Transceiver MCAL driver...
Std_ReturnType EthTrcv_GetBaudRate(uint8 TrcvIdx, EthTrcv_BaudRateType *BaudRatePtr)
This function obtains the baud rate of the indexed transceiver.
Std_ReturnType EthTrcv_CheckWakeup(uint8 TrcvIdx)
This service is called by EthIf in case a wake-up interrupt is detected.
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...
Std_ReturnType EthTrcv_SetPhyTestMode(uint8 TrcvIdx, EthTrcv_PhyTestModeType Mode)
This function Activates a given test mode.
Std_ReturnType EthTrcv_SetTransceiverMode(uint8 TrcvIdx, EthTrcv_ModeType CtrlMode)
This function enables / disables the indexed transceiver.
void EthTrcv_Init(const EthTrcv_ConfigType *CfgPtr)
This function initializes the Ethernet Transceiver controller. All the required initialization for th...
Std_ReturnType EthTrcv_SetPhyLoopbackMode(uint8 TrcvIdx, EthTrcv_PhyLoopbackModeType Mode)
This function Activates a given loopback mode.
Std_ReturnType EthTrcv_GetLinkState(uint8 TrcvIdx, EthTrcv_LinkStateType *LinkStatePtr)
This function obtains the link state of the indexed transceiver.
Std_ReturnType EthTrcv_SetTransceiverWakeupMode(uint8 TrcvIdx, EthTrcv_WakeupModeType TrcvWakeupMode)
This function enables / disables the wake-up mode or clear the wake-up reason of the indexed transcei...
Std_ReturnType EthTrcv_GetPhySignalQuality(uint8 TrcvIdx, uint32 *SignalQualityPtr)
This function Obtains the current signal quality of the link 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.