git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1361 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-11-29 17:35:32 +00:00
parent 2302385ec3
commit 3f8c09fde1
6 changed files with 19 additions and 85 deletions

View File

@ -32,9 +32,6 @@
#ifndef _MII_H_ #ifndef _MII_H_
#define _MII_H_ #define _MII_H_
#include "mac_lld.h"
#include "mii_lld.h"
/* /*
* Generic MII registers. Note, not all registers are present on all PHY * Generic MII registers. Note, not all registers are present on all PHY
* devices and some extra registers may be present. * devices and some extra registers may be present.
@ -185,36 +182,7 @@
#define MII_AM79C875_ID 0x00225540 #define MII_AM79C875_ID 0x00225540
#define MII_KS8721_ID 0x00221610 #define MII_KS8721_ID 0x00221610
/**
* @brief MII Driver initialization.
*/
#define miiInit() mii_lld_init()
/** #endif /* _MII_H_ */
* Resets a MII device.
*
* @param[in] macp pointer to the @p MACDriver object
*/
#define miiReset(macp) mii_lld_reset(macp)
/**
* @brief Reads a MII register.
*
* @param[in] macp pointer to the @p MACDriver object
* @param addr the register address
* @return The register value.
*/
#define miiGet(macp, addr) mii_lld_get(macp, addr)
/**
* @brief Writes a MII register.
*
* @param[in] macp pointer to the @p MACDriver object
* @param addr the register address
* @param value the new register value
*/
#define miiPut(macp, addr, value) mii_lld_put(macp, addr, value)
#endif /**< _MII_H_ */
/** @} */ /** @} */

View File

@ -18,7 +18,7 @@
*/ */
/** /**
* @file AT91SAM7/mii_lld.c * @file AT91SAM7/at91sam7_mii.c
* @brief AT91SAM7 low level MII driver code * @brief AT91SAM7 low level MII driver code
* @addtogroup AT91SAM7_MII * @addtogroup AT91SAM7_MII
* @{ * @{
@ -26,12 +26,13 @@
#include "ch.h" #include "ch.h"
#include "hal.h" #include "hal.h"
#include "mii.h"
#include "at91sam7_mii.h"
/** /**
* @brief Low level MII driver initialization. * @brief Low level MII driver initialization.
*/ */
void mii_lld_init(void) { void miiInit(void) {
} }
@ -40,7 +41,7 @@ void mii_lld_init(void) {
* *
* @param[in] macp pointer to the @p MACDriver object * @param[in] macp pointer to the @p MACDriver object
*/ */
void mii_lld_reset(MACDriver *macp) { void miiReset(MACDriver *macp) {
(void)macp; (void)macp;
@ -78,7 +79,7 @@ void mii_lld_reset(MACDriver *macp) {
* @param addr the register address * @param addr the register address
* @return The register value. * @return The register value.
*/ */
phyreg_t mii_lld_get(MACDriver *macp, phyaddr_t addr) { phyreg_t miiGet(MACDriver *macp, phyaddr_t addr) {
(void)macp; (void)macp;
AT91C_BASE_EMAC->EMAC_MAN = (0b01 << 30) | /* SOF */ AT91C_BASE_EMAC->EMAC_MAN = (0b01 << 30) | /* SOF */
@ -98,7 +99,7 @@ phyreg_t mii_lld_get(MACDriver *macp, phyaddr_t addr) {
* @param addr the register address * @param addr the register address
* @param value the new register value * @param value the new register value
*/ */
void mii_lld_put(MACDriver *macp, phyaddr_t addr, phyreg_t value) { void miiPut(MACDriver *macp, phyaddr_t addr, phyreg_t value) {
(void)macp; (void)macp;
AT91C_BASE_EMAC->EMAC_MAN = (0b01 << 30) | /* SOF */ AT91C_BASE_EMAC->EMAC_MAN = (0b01 << 30) | /* SOF */

View File

@ -18,14 +18,14 @@
*/ */
/** /**
* @file AT91SAM7/mii_lld.h * @file AT91SAM7/at91sam7_mii.h
* @brief AT91SAM7 low level MII driver header * @brief AT91SAM7 low level MII driver header
* @addtogroup AT91SAM7_MII * @addtogroup AT91SAM7_MII
* @{ * @{
*/ */
#ifndef _MII_LLD_H_ #ifndef _AT91SAM7_MII_H_
#define _MII_LLD_H_ #define _AT91SAM7_MII_H_
/*===========================================================================*/ /*===========================================================================*/
/* Driver pre-compile time settings. */ /* Driver pre-compile time settings. */
@ -88,14 +88,14 @@ typedef uint8_t phyaddr_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void mii_lld_init(void); void miiInit(void);
void mii_lld_reset(MACDriver *macp); void miiReset(MACDriver *macp);
phyreg_t mii_lld_get(MACDriver *macp, phyaddr_t addr); phyreg_t miiGet(MACDriver *macp, phyaddr_t addr);
void mii_lld_put(MACDriver *macp, phyaddr_t addr, phyreg_t value); void miiPut(MACDriver *macp, phyaddr_t addr, phyreg_t value);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _MII_LLD_H_ */ #endif /* _AT91SAM7_MII_H_ */
/** @} */ /** @} */

View File

@ -30,6 +30,8 @@
#include "hal.h" #include "hal.h"
#include "mii.h" #include "mii.h"
#include "at91sam7_mii.h"
#if CH_HAL_USE_MAC || defined(__DOXYGEN__) #if CH_HAL_USE_MAC || defined(__DOXYGEN__)
/** /**

View File

@ -3,7 +3,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/AT91SAM7/hal_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/AT91SAM7/pal_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/AT91SAM7/serial_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/mac_lld.c \ ${CHIBIOS}/os/hal/platforms/AT91SAM7/mac_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/mii_lld.c \ ${CHIBIOS}/os/hal/platforms/AT91SAM7/at91sam7_mii.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/at91lib/aic.c ${CHIBIOS}/os/hal/platforms/AT91SAM7/at91lib/aic.c
# Required include directories # Required include directories

View File

@ -1,37 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
ChibiOS/RT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ChibiOS/RT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file mii.c
* @brief mii Driver code.
* @addtogroup MII
* @{
*/
#include "ch.h"
#include "mac.h"
#include "mii.h"
/*
* Currently there is no code, everything is done in the header, you may
* omit this file from the project but this may change in future releases.
* The file is here because the driver's naming pattern.
*/
/** @} */