From 8287eb7e0024033d8b96a04ee0913d238b35bbc2 Mon Sep 17 00:00:00 2001 From: Till Straumann Date: Tue, 20 Oct 2009 23:39:38 +0000 Subject: 2009-10-20 Till Straumann * if_pcn/if_pcn.c: fixed 'type-punned pointer' warning. Use 'memcpy' to copy 2 bytes to a short. This requires another #ifdef __rtems__, however. --- bsd_eth_drivers/if_pcn/if_pcn.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bsd_eth_drivers/if_pcn') diff --git a/bsd_eth_drivers/if_pcn/if_pcn.c b/bsd_eth_drivers/if_pcn/if_pcn.c index 7dde188..b116265 100644 --- a/bsd_eth_drivers/if_pcn/if_pcn.c +++ b/bsd_eth_drivers/if_pcn/if_pcn.c @@ -1509,7 +1509,6 @@ pcn_init_locked(sc) #ifndef __rtems__ mii = device_get_softc(sc->pcn_miibus); ife = mii->mii_media.ifm_cur; -#endif /* Set MAC address */ { unsigned tmp; @@ -1521,6 +1520,22 @@ pcn_init_locked(sc) tmp = htole16(((u_int16_t *)IF_LLADDR(sc->pcn_ifp))[2]); pcn_csr_write(sc, PCN_CSR_PAR2, tmp); } +#else + /* Set MAC address */ + { unsigned tmp; + u_int16_t s; + /* fix endinanness; LLADDR gets swapped on a BE machine */ + memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 0, sizeof(s)); + tmp = htole16(s); + pcn_csr_write(sc, PCN_CSR_PAR0, tmp); + memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 2, sizeof(s)); + tmp = htole16(s); + pcn_csr_write(sc, PCN_CSR_PAR1, tmp); + memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 4, sizeof(s)); + tmp = htole16(s); + pcn_csr_write(sc, PCN_CSR_PAR2, tmp); + } +#endif /* Init circular RX list. */ if (pcn_list_rx_init(sc) == ENOBUFS) { -- cgit v1.2.3