ChibiOS/RT Architecture - Reference Manual - Guides |
00001 /* 00002 ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. 00003 00004 This file is part of ChibiOS/RT. 00005 00006 ChibiOS/RT is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 ChibiOS/RT is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 --- 00020 00021 A special exception to the GPL can be applied should you wish to distribute 00022 a combined work that includes ChibiOS/RT, without being obliged to provide 00023 the source code for any proprietary components. See the file exception.txt 00024 for full details of how and when the exception can be applied. 00025 */ 00026 00027 /** 00028 * @file AT91SAM7/at91sam7_mii.h 00029 * @brief AT91SAM7 low level MII driver header. 00030 * @addtogroup AT91SAM7_MII 00031 * @{ 00032 */ 00033 00034 #ifndef _AT91SAM7_MII_H_ 00035 #define _AT91SAM7_MII_H_ 00036 00037 #if CH_HAL_USE_MAC || defined(__DOXYGEN__) 00038 00039 /*===========================================================================*/ 00040 /* Driver constants. */ 00041 /*===========================================================================*/ 00042 00043 #define PHY_MICREL_KS8721 0 00044 #define PHY_DAVICOM_9161 1 00045 00046 /*===========================================================================*/ 00047 /* Driver pre-compile time settings. */ 00048 /*===========================================================================*/ 00049 00050 /** 00051 * @brief PHY manufacturer and model. 00052 */ 00053 #if !defined(PHY_HARDWARE) || defined(__DOXYGEN__) 00054 #define PHY_HARDWARE PHY_MICREL_KS8721 00055 #endif 00056 00057 /*===========================================================================*/ 00058 /* Derived constants and error checks. */ 00059 /*===========================================================================*/ 00060 00061 /** 00062 * @brief Pins latched by the PHY at reset. 00063 */ 00064 #if PHY_HARDWARE == PHY_MICREL_KS8721 00065 #define PHY_ADDRESS 1 00066 #define PHY_ID MII_KS8721_ID 00067 #define PHY_LATCHED_PINS (AT91C_PB4_ECRS | AT91C_PB5_ERX0 | \ 00068 AT91C_PB6_ERX1 | AT91C_PB7_ERXER | \ 00069 AT91C_PB13_ERX2 | AT91C_PB14_ERX3 | \ 00070 AT91C_PB15_ERXDV_ECRSDV | AT91C_PB16_ECOL | \ 00071 AT91C_PIO_PB26) 00072 00073 #elif PHY_HARDWARE == PHY_DAVICOM_9161 00074 #define PHY_ADDRESS 0 00075 #define PHY_ID MII_DM9161_ID 00076 #define PHY_LATCHED_PINS (AT91C_PB0_ETXCK_EREFCK | AT91C_PB4_ECRS | \ 00077 AT91C_PB5_ERX0 | AT91C_PB6_ERX1 | \ 00078 AT91C_PB7_ERXER | AT91C_PB13_ERX2 | \ 00079 AT91C_PB14_ERX3 | AT91C_PB15_ERXDV_ECRSDV | \ 00080 AT91C_PB16_ECOL | AT91C_PB17_ERXCK) 00081 #endif /* PHY_HARDWARE */ 00082 00083 /*===========================================================================*/ 00084 /* Driver data structures and types. */ 00085 /*===========================================================================*/ 00086 00087 /** 00088 * @brief Type of a PHY register value. 00089 */ 00090 typedef uint16_t phyreg_t; 00091 00092 /** 00093 * @brief Type of a PHY register address. 00094 */ 00095 typedef uint8_t phyaddr_t; 00096 00097 /*===========================================================================*/ 00098 /* Driver macros. */ 00099 /*===========================================================================*/ 00100 00101 /*===========================================================================*/ 00102 /* External declarations. */ 00103 /*===========================================================================*/ 00104 00105 #ifdef __cplusplus 00106 extern "C" { 00107 #endif 00108 void miiInit(void); 00109 void miiReset(MACDriver *macp); 00110 phyreg_t miiGet(MACDriver *macp, phyaddr_t addr); 00111 void miiPut(MACDriver *macp, phyaddr_t addr, phyreg_t value); 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif /* CH_HAL_USE_MAC */ 00117 00118 #endif /* _AT91SAM7_MII_H_ */ 00119 00120 /** @} */