![]() |
|
|||
File indexing completed on 2025-05-11 08:22:44
0001 /* ---------------------------------------------------------------------------- */ 0002 /* Atmel Microcontroller Software Support */ 0003 /* SAM Software Package License */ 0004 /* ---------------------------------------------------------------------------- */ 0005 /* Copyright (c) 2015, Atmel Corporation */ 0006 /* */ 0007 /* All rights reserved. */ 0008 /* */ 0009 /* Redistribution and use in source and binary forms, with or without */ 0010 /* modification, are permitted provided that the following condition is met: */ 0011 /* */ 0012 /* - Redistributions of source code must retain the above copyright notice, */ 0013 /* this list of conditions and the disclaimer below. */ 0014 /* */ 0015 /* Atmel's name may not be used to endorse or promote products derived from */ 0016 /* this software without specific prior written permission. */ 0017 /* */ 0018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 0019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 0020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 0021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 0022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 0023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 0024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 0025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 0026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 0027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 0028 /* ---------------------------------------------------------------------------- */ 0029 0030 /** \file */ 0031 0032 /** \addtogroup gmacb_module Ethernet GMACB Driver 0033 *@{ 0034 * Implement GEMAC PHY driver, that initialize the PHY to prepare for 0035 * Ethernet transfer. 0036 * 0037 * \section Usage 0038 * -# EMAC related pins and Driver should be initialized at first. 0039 * -# Initialize GMACB Driver instance by invoking GMACB_Init(). 0040 * -# Initialize PHY connected via GMACB_InitPhy(), PHY address is 0041 * automatically adjusted by attempt to read. 0042 * -# Perform PHY auto negotiate through GMACB_AutoNegotiate(), so 0043 * connection established. 0044 * 0045 * 0046 * Related files:\n 0047 * \ref gmacb.h\n 0048 * \ref gmacb.c\n 0049 * \ref gmii.h.\n 0050 * 0051 */ 0052 /**@}*/ 0053 0054 #ifndef _GMACB_PHY_H 0055 #define _GMACB_PHY_H 0056 0057 0058 /*--------------------------------------------------------------------------- 0059 * Headers 0060 *---------------------------------------------------------------------------*/ 0061 0062 #include "board.h" 0063 0064 /*--------------------------------------------------------------------------- 0065 * Definitions 0066 *---------------------------------------------------------------------------*/ 0067 0068 /** The reset length setting for external reset configuration */ 0069 #define GMACB_RESET_LENGTH 0xD 0070 0071 /*--------------------------------------------------------------------------- 0072 * Types 0073 *---------------------------------------------------------------------------*/ 0074 0075 0076 /** The DM9161 instance */ 0077 typedef struct _GMacb { 0078 /**< Driver */ 0079 sGmacd *pGmacd; 0080 /** The retry & timeout settings */ 0081 uint32_t retryMax; 0082 /** PHY address (pre-defined by pins on reset) */ 0083 uint8_t phyAddress; 0084 } GMacb; 0085 0086 /*--------------------------------------------------------------------------- 0087 * Exported functions 0088 *---------------------------------------------------------------------------*/ 0089 extern void GMACB_SetupTimeout(GMacb *pMacb, uint32_t toMax); 0090 0091 extern void GMACB_Init(GMacb *pMacb, sGmacd *pGmacd, uint8_t phyAddress); 0092 0093 extern uint8_t GMACB_InitPhy( 0094 GMacb *pMacb, 0095 uint32_t mck, 0096 const Pin *pResetPins, 0097 uint32_t nbResetPins, 0098 const Pin *pEmacPins, 0099 uint32_t nbEmacPins); 0100 0101 extern uint8_t GMACB_AutoNegotiate(GMacb *pMacb); 0102 0103 extern uint8_t GMACB_GetLinkSpeed(GMacb *pMacb, uint8_t applySettings); 0104 0105 extern uint8_t GMACB_Send(GMacb *pMacb, void *pBuffer, uint32_t size); 0106 0107 extern uint32_t GMACB_Poll(GMacb *pMacb, uint8_t *pBuffer, uint32_t size); 0108 0109 extern void GMACB_DumpRegisters(GMacb *pMacb); 0110 0111 extern uint8_t GMACB_ResetPhy(GMacb *pMacb); 0112 0113 #endif // #ifndef _GMACB_H 0114
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |