1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2012, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
32 /** \addtogroup gmacb_module Ethernet GMACB Driver
\r
34 * Implement GEMAC PHY driver, that initialize the PHY to prepare for
\r
35 * ethernet transfer.
\r
38 * -# EMAC related pins and Driver should be initialized at first.
\r
39 * -# Initialize GMACB Driver instance by invoking GMACB_Init().
\r
40 * -# Initialize PHY connected via GMACB_InitPhy(), PHY address is
\r
41 * automatically adjusted by attempt to read.
\r
42 * -# Perform PHY auto negotiate through GMACB_AutoNegotiate(), so
\r
43 * connection established.
\r
54 #ifndef _GMACB_PHY_H
\r
55 #define _GMACB_PHY_H
\r
58 /*---------------------------------------------------------------------------
\r
60 *---------------------------------------------------------------------------*/
\r
64 /*---------------------------------------------------------------------------
\r
66 *---------------------------------------------------------------------------*/
\r
68 /** The reset length setting for external reset configuration */
\r
69 #define GMACB_RESET_LENGTH 0xD
\r
71 /*---------------------------------------------------------------------------
\r
73 *---------------------------------------------------------------------------*/
\r
76 /** The DM9161 instance */
\r
77 typedef struct _GMacb {
\r
78 sGmacd *pGmacd; /**< Driver */
\r
79 /** The retry & timeout settings */
\r
81 /** PHY address ( pre-defined by pins on reset ) */
\r
85 /*---------------------------------------------------------------------------
\r
86 * Exported functions
\r
87 *---------------------------------------------------------------------------*/
\r
88 extern void GMACB_SetupTimeout(GMacb *pMacb, uint32_t toMax);
\r
90 extern void GMACB_Init(GMacb *pMacb, sGmacd *pGmacd, uint8_t phyAddress);
\r
92 extern uint8_t GMACB_InitPhy(GMacb *pMacb,
\r
94 const Pin *pResetPins,
\r
95 uint32_t nbResetPins,
\r
96 const Pin *pEmacPins,
\r
97 uint32_t nbEmacPins);
\r
99 extern uint8_t GMACB_AutoNegotiate(GMacb *pMacb);
\r
101 extern uint8_t GMACB_GetLinkSpeed(GMacb *pMacb, uint8_t applySettings);
\r
103 extern uint8_t GMACB_Send(GMacb *pMacb, void *pBuffer, uint32_t size);
\r
105 extern uint32_t GMACB_Poll(GMacb *pMacb, uint8_t *pBuffer, uint32_t size);
\r
107 extern void GMACB_DumpRegisters(GMacb *pMacb);
\r
109 extern uint8_t GMACB_ResetPhy(GMacb *pMacb);
\r
111 #endif // #ifndef _GMACB_H
\r