Fixed bug #539.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7359 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
d05fb1e4ff
commit
c74da79d45
|
@ -202,7 +202,7 @@ extern "C" {
|
||||||
MACReceiveDescriptor *rdp,
|
MACReceiveDescriptor *rdp,
|
||||||
systime_t time);
|
systime_t time);
|
||||||
void macReleaseReceiveDescriptor(MACReceiveDescriptor *rdp);
|
void macReleaseReceiveDescriptor(MACReceiveDescriptor *rdp);
|
||||||
bool_t macPollLinkStatus(MACDriver *macp);
|
bool macPollLinkStatus(MACDriver *macp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -216,7 +216,7 @@ void mac_lld_init(void) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
macObjectInit(ÐD1);
|
macObjectInit(ÐD1);
|
||||||
ETHD1.link_up = FALSE;
|
ETHD1.link_up = false;
|
||||||
|
|
||||||
/* Descriptor tables are initialized in chained mode, note that the first
|
/* Descriptor tables are initialized in chained mode, note that the first
|
||||||
word is not initialized here but in mac_lld_start().*/
|
word is not initialized here but in mac_lld_start().*/
|
||||||
|
@ -252,7 +252,7 @@ void mac_lld_init(void) {
|
||||||
rccResetETH();
|
rccResetETH();
|
||||||
|
|
||||||
/* MAC clocks temporary activation.*/
|
/* MAC clocks temporary activation.*/
|
||||||
rccEnableETH(FALSE);
|
rccEnableETH(false);
|
||||||
|
|
||||||
/* PHY address setup.*/
|
/* PHY address setup.*/
|
||||||
#if defined(BOARD_PHY_ADDRESS)
|
#if defined(BOARD_PHY_ADDRESS)
|
||||||
|
@ -280,7 +280,7 @@ void mac_lld_init(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MAC clocks stopped again.*/
|
/* MAC clocks stopped again.*/
|
||||||
rccDisableETH(FALSE);
|
rccDisableETH(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -302,7 +302,7 @@ void mac_lld_start(MACDriver *macp) {
|
||||||
macp->txptr = (stm32_eth_tx_descriptor_t *)td;
|
macp->txptr = (stm32_eth_tx_descriptor_t *)td;
|
||||||
|
|
||||||
/* MAC clocks activation and commanded reset procedure.*/
|
/* MAC clocks activation and commanded reset procedure.*/
|
||||||
rccEnableETH(FALSE);
|
rccEnableETH(false);
|
||||||
#if defined(STM32_MAC_DMABMR_SR)
|
#if defined(STM32_MAC_DMABMR_SR)
|
||||||
ETH->DMABMR |= ETH_DMABMR_SR;
|
ETH->DMABMR |= ETH_DMABMR_SR;
|
||||||
while(ETH->DMABMR & ETH_DMABMR_SR)
|
while(ETH->DMABMR & ETH_DMABMR_SR)
|
||||||
|
@ -381,7 +381,7 @@ void mac_lld_stop(MACDriver *macp) {
|
||||||
ETH->DMASR = ETH->DMASR;
|
ETH->DMASR = ETH->DMASR;
|
||||||
|
|
||||||
/* MAC clocks stopped.*/
|
/* MAC clocks stopped.*/
|
||||||
rccDisableETH(FALSE);
|
rccDisableETH(false);
|
||||||
|
|
||||||
/* ISR vector disabled.*/
|
/* ISR vector disabled.*/
|
||||||
nvicDisableVector(ETH_IRQn);
|
nvicDisableVector(ETH_IRQn);
|
||||||
|
@ -549,12 +549,12 @@ void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp) {
|
||||||
*
|
*
|
||||||
* @param[in] macp pointer to the @p MACDriver object
|
* @param[in] macp pointer to the @p MACDriver object
|
||||||
* @return The link status.
|
* @return The link status.
|
||||||
* @retval TRUE if the link is active.
|
* @retval true if the link is active.
|
||||||
* @retval FALSE if the link is down.
|
* @retval false if the link is down.
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
bool_t mac_lld_poll_link_status(MACDriver *macp) {
|
bool mac_lld_poll_link_status(MACDriver *macp) {
|
||||||
uint32_t maccr, bmsr, bmcr;
|
uint32_t maccr, bmsr, bmcr;
|
||||||
|
|
||||||
maccr = ETH->MACCR;
|
maccr = ETH->MACCR;
|
||||||
|
@ -571,7 +571,7 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) {
|
||||||
/* Auto-negotiation must be finished without faults and link established.*/
|
/* Auto-negotiation must be finished without faults and link established.*/
|
||||||
if ((bmsr & (BMSR_LSTATUS | BMSR_RFAULT | BMSR_ANEGCOMPLETE)) !=
|
if ((bmsr & (BMSR_LSTATUS | BMSR_RFAULT | BMSR_ANEGCOMPLETE)) !=
|
||||||
(BMSR_LSTATUS | BMSR_ANEGCOMPLETE))
|
(BMSR_LSTATUS | BMSR_ANEGCOMPLETE))
|
||||||
return macp->link_up = FALSE;
|
return macp->link_up = false;
|
||||||
|
|
||||||
/* Auto-negotiation enabled, checks the LPA register.*/
|
/* Auto-negotiation enabled, checks the LPA register.*/
|
||||||
lpa = mii_read(macp, MII_LPA);
|
lpa = mii_read(macp, MII_LPA);
|
||||||
|
@ -591,7 +591,7 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) {
|
||||||
else {
|
else {
|
||||||
/* Link must be established.*/
|
/* Link must be established.*/
|
||||||
if (!(bmsr & BMSR_LSTATUS))
|
if (!(bmsr & BMSR_LSTATUS))
|
||||||
return macp->link_up = FALSE;
|
return macp->link_up = false;
|
||||||
|
|
||||||
/* Check on link speed.*/
|
/* Check on link speed.*/
|
||||||
if (bmcr & BMCR_SPEED100)
|
if (bmcr & BMCR_SPEED100)
|
||||||
|
@ -610,7 +610,7 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) {
|
||||||
ETH->MACCR = maccr;
|
ETH->MACCR = maccr;
|
||||||
|
|
||||||
/* Returns the link status.*/
|
/* Returns the link status.*/
|
||||||
return macp->link_up = TRUE;
|
return macp->link_up = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -260,7 +260,7 @@ struct MACDriver {
|
||||||
/**
|
/**
|
||||||
* @brief Link status flag.
|
* @brief Link status flag.
|
||||||
*/
|
*/
|
||||||
bool_t link_up;
|
bool link_up;
|
||||||
/**
|
/**
|
||||||
* @brief PHY address (pre shifted).
|
* @brief PHY address (pre shifted).
|
||||||
*/
|
*/
|
||||||
|
@ -339,7 +339,7 @@ extern "C" {
|
||||||
msg_t mac_lld_get_receive_descriptor(MACDriver *macp,
|
msg_t mac_lld_get_receive_descriptor(MACDriver *macp,
|
||||||
MACReceiveDescriptor *rdp);
|
MACReceiveDescriptor *rdp);
|
||||||
void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp);
|
void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp);
|
||||||
bool_t mac_lld_poll_link_status(MACDriver *macp);
|
bool mac_lld_poll_link_status(MACDriver *macp);
|
||||||
size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp,
|
size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp,
|
||||||
uint8_t *buf,
|
uint8_t *buf,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
|
|
@ -250,12 +250,12 @@ void macReleaseReceiveDescriptor(MACReceiveDescriptor *rdp) {
|
||||||
*
|
*
|
||||||
* @param[in] macp pointer to the @p MACDriver object
|
* @param[in] macp pointer to the @p MACDriver object
|
||||||
* @return The link status.
|
* @return The link status.
|
||||||
* @retval TRUE if the link is active.
|
* @retval true if the link is active.
|
||||||
* @retval FALSE if the link is down.
|
* @retval false if the link is down.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
bool_t macPollLinkStatus(MACDriver *macp) {
|
bool macPollLinkStatus(MACDriver *macp) {
|
||||||
|
|
||||||
osalDbgCheck(macp != NULL);
|
osalDbgCheck(macp != NULL);
|
||||||
osalDbgAssert(macp->state == MAC_ACTIVE, "not active");
|
osalDbgAssert(macp->state == MAC_ACTIVE, "not active");
|
||||||
|
|
Loading…
Reference in New Issue