Skip to content

Commit

Permalink
Merge pull request #13383 from JannesVolkens/stm32_eth_mac_filter_fix
Browse files Browse the repository at this point in the history
cpu/stm32_common/periph: Fix addr filtering
  • Loading branch information
PeterKietzmann authored Feb 25, 2020
2 parents 8e32161 + 4bb0d8b commit 00d4d36
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cpu/stm32_common/periph/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,23 @@ void stm32_eth_get_mac(char *out)
unsigned t;

t = ETH->MACA0HR;
out[0] = (t >> 8);
out[1] = (t & 0xff);
out[5] = (t >> 8);
out[4] = (t & 0xff);

t = ETH->MACA0LR;
out[2] = (t >> 24);
out[3] = (t >> 16);
out[4] = (t >> 8);
out[5] = (t & 0xff);
out[3] = (t >> 24);
out[2] = (t >> 16);
out[1] = (t >> 8);
out[0] = (t & 0xff);
}

/** Set the mac address. The peripheral supports up to 4 MACs but only one is
* implemented */
void stm32_eth_set_mac(const char *mac)
{
ETH->MACA0HR &= 0xffff0000;
ETH->MACA0HR |= ((mac[0] << 8) | mac[1]);
ETH->MACA0LR = ((mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | mac[5]);
ETH->MACA0HR |= ((mac[5] << 8) | mac[4]);
ETH->MACA0LR = ((mac[3] << 24) | (mac[2] << 16) | (mac[1] << 8) | mac[0]);
}

/** Initialization of the DMA descriptors to be used */
Expand Down Expand Up @@ -211,8 +211,6 @@ int stm32_eth_init(void)

/* pass all */
//ETH->MACFFR |= ETH_MACFFR_RA;
/* perfect filter on address */
ETH->MACFFR |= (ETH_MACFFR_PAM | ETH_MACFFR_DAIF);

/* store forward */
ETH->DMAOMR |= (ETH_DMAOMR_RSF | ETH_DMAOMR_TSF | ETH_DMAOMR_OSF);
Expand Down

0 comments on commit 00d4d36

Please sign in to comment.