summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2004-04-21 10:43:04 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2004-04-21 10:43:04 +0000
commit6128a4aa5e791ed4e0a655bfd346a52d92da7883 (patch)
treeaf53ca3f67ce405b6fbc6c98399c8e0c87e01a9e /c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
parent2004-04-20 Ralf Corsepius <ralf_corsepius@rtems.org> (diff)
downloadrtems-6128a4aa5e791ed4e0a655bfd346a52d92da7883.tar.bz2
Remove stray white spaces.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/network/network.c282
1 files changed, 141 insertions, 141 deletions
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c b/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
index 1c2d20ec70..32c08798f5 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
@@ -7,7 +7,7 @@
* Right now, we only do 10 Mbps, even with the FEC. The function
* rtems_enet_driver_attach determines which one to use. Currently,
* only one may be used at a time.
- *
+ *
* Based on the MC68360 network driver by
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
@@ -180,7 +180,7 @@ static void m860_fec_interrupt_handler ()
enet_driver[0].rxInterrupts++;
rtems_event_send (enet_driver[0].rxDaemonTid, INTERRUPT_EVENT);
}
-
+
/*
* Buffer transmitted or transmitter error?
*/
@@ -208,7 +208,7 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
{
int i;
unsigned char *hwaddr;
-
+
/*
* Configure port A
* PA15 is enet RxD. Set PAPAR(15) to 1, PADIR(15) to 0.
@@ -219,7 +219,7 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
m8xx.papar |= 0x303;
m8xx.padir &= ~0x303;
m8xx.paodr &= ~0x2;
-
+
/*
* Configure port C
* PC11 is CTS1*. Set PCPAR(11) to 0, PCDIR(11) to 0, and PCSO(11) to 1.
@@ -228,7 +228,7 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
m8xx.pcpar &= ~0x30;
m8xx.pcdir &= ~0x30;
m8xx.pcso |= 0x30;
-
+
/*
* Connect CLK1 and CLK2 to SCC1 in the SICR.
* CLK1 is TxClk, CLK2 is RxClk. No grant mechanism, SCC1 is directly
@@ -237,22 +237,22 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
* T1CS = 0b100 (CLK1)
*/
m8xx.sicr |= 0x2C;
-
+
/*
* Initialize SDMA configuration register
*/
m8xx.sdcr = 1;
-
+
/*
* Allocate mbuf pointers
*/
- sc->rxMbuf = malloc (sc->rxBdCount * sizeof *sc->rxMbuf,
+ sc->rxMbuf = malloc (sc->rxBdCount * sizeof *sc->rxMbuf,
M_MBUF, M_NOWAIT);
- sc->txMbuf = malloc (sc->txBdCount * sizeof *sc->txMbuf,
+ sc->txMbuf = malloc (sc->txBdCount * sizeof *sc->txMbuf,
M_MBUF, M_NOWAIT);
if (!sc->rxMbuf || !sc->txMbuf)
rtems_panic ("No memory for mbuf pointers");
-
+
/*
* Set receiver and transmitter buffer descriptor bases
*/
@@ -260,46 +260,46 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
sc->txBdBase = m8xx_bd_allocate(sc->txBdCount);
m8xx.scc1p.rbase = (char *)sc->rxBdBase - (char *)&m8xx;
m8xx.scc1p.tbase = (char *)sc->txBdBase - (char *)&m8xx;
-
+
/*
* Send "Init parameters" command
*/
m8xx_cp_execute_cmd (M8xx_CR_OP_INIT_RX_TX | M8xx_CR_CHAN_SCC1);
-
+
/*
* Set receive and transmit function codes
*/
m8xx.scc1p.rfcr = M8xx_RFCR_MOT | M8xx_RFCR_DMA_SPACE(0);
m8xx.scc1p.tfcr = M8xx_TFCR_MOT | M8xx_TFCR_DMA_SPACE(0);
-
+
/*
* Set maximum receive buffer length
*/
m8xx.scc1p.mrblr = RBUF_SIZE;
-
+
/*
* Set CRC parameters
*/
m8xx.scc1p.un.ethernet.c_pres = 0xFFFFFFFF;
m8xx.scc1p.un.ethernet.c_mask = 0xDEBB20E3;
-
+
/*
* Clear diagnostic counters
*/
m8xx.scc1p.un.ethernet.crcec = 0;
m8xx.scc1p.un.ethernet.alec = 0;
m8xx.scc1p.un.ethernet.disfc = 0;
-
+
/*
* Set pad value
*/
m8xx.scc1p.un.ethernet.pads = 0x8888;
-
+
/*
* Set retry limit
*/
m8xx.scc1p.un.ethernet.ret_lim = 15;
-
+
/*
* Set maximum and minimum frame length
*/
@@ -307,7 +307,7 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
m8xx.scc1p.un.ethernet.minflr = 64;
m8xx.scc1p.un.ethernet.maxd1 = MAX_MTU_SIZE;
m8xx.scc1p.un.ethernet.maxd2 = MAX_MTU_SIZE;
-
+
/*
* Clear group address hash table
*/
@@ -315,21 +315,21 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
m8xx.scc1p.un.ethernet.gaddr2 = 0;
m8xx.scc1p.un.ethernet.gaddr3 = 0;
m8xx.scc1p.un.ethernet.gaddr4 = 0;
-
+
/*
* Set our physical address
*/
hwaddr = sc->arpcom.ac_enaddr;
-
+
m8xx.scc1p.un.ethernet.paddr_h = (hwaddr[5] << 8) | hwaddr[4];
m8xx.scc1p.un.ethernet.paddr_m = (hwaddr[3] << 8) | hwaddr[2];
m8xx.scc1p.un.ethernet.paddr_l = (hwaddr[1] << 8) | hwaddr[0];
-
+
/*
* Aggressive retry
*/
m8xx.scc1p.un.ethernet.p_per = 0;
-
+
/*
* Clear individual address hash table
*/
@@ -337,14 +337,14 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
m8xx.scc1p.un.ethernet.iaddr2 = 0;
m8xx.scc1p.un.ethernet.iaddr3 = 0;
m8xx.scc1p.un.ethernet.iaddr4 = 0;
-
+
/*
* Clear temp address
*/
m8xx.scc1p.un.ethernet.taddr_l = 0;
m8xx.scc1p.un.ethernet.taddr_m = 0;
m8xx.scc1p.un.ethernet.taddr_h = 0;
-
+
/*
* Set up receive buffer descriptors
*/
@@ -361,12 +361,12 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
}
sc->txBdHead = sc->txBdTail = 0;
sc->txBdActiveCount = 0;
-
+
/*
* Clear any outstanding events
*/
m8xx.scc1.scce = 0xFFFF;
-
+
/*
* Set up interrupts
*/
@@ -374,20 +374,20 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
rtems_panic ("Can't attach M8xx SCC1 interrupt handler\n");
}
m8xx.scc1.sccm = 0; /* No interrupts unmasked till necessary */
-
+
/*
* Set up General SCC Mode Register
* Ethernet configuration
*/
m8xx.scc1.gsmr_h = 0x0;
m8xx.scc1.gsmr_l = 0x1088000c;
-
+
/*
* Set up data synchronization register
* Ethernet synchronization pattern
*/
m8xx.scc1.dsr = 0xd555;
-
+
/*
* Set up protocol-specific mode register
* No Heartbeat check
@@ -405,13 +405,13 @@ m8xx_enet_initialize (struct m8xx_enet_struct *sc)
* Disable full-duplex operation
*/
m8xx.scc1.psmr = 0x080A | (sc->acceptBroadcast ? 0 : 0x100);
-
+
/*
* Enable the TENA (RTS1*) pin
*/
m8xx.pcpar |= 0x1;
m8xx.pcdir &= ~0x1;
-
+
/*
* Enable receiver and transmitter
*/
@@ -452,7 +452,7 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
*/
m8xx.fec.ecntrl=0x1;
- /*
+ /*
* Put ethernet transciever in reset
*/
m8xx.pgcra |= 0x80;
@@ -471,10 +471,10 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
/*
* Set SIU interrupt level to LVL2
- *
+ *
*/
m8xx.fec.ivec = ((((unsigned) BSP_FAST_ETHERNET_CTRL)/2) << 29);
-
+
/*
* Set the TX and RX fifo sizes. For now, we'll split it evenly
*/
@@ -487,7 +487,7 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
* Set our physical address
*/
hwaddr = sc->arpcom.ac_enaddr;
-
+
m8xx.fec.addr_low = (hwaddr[0] << 24) | (hwaddr[1] << 16) |
(hwaddr[2] << 8) | (hwaddr[3] << 0);
m8xx.fec.addr_high = (hwaddr[4] << 24) | (hwaddr[5] << 16);
@@ -506,13 +506,13 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
/*
* Allocate mbuf pointers
*/
- sc->rxMbuf = malloc (sc->rxBdCount * sizeof *sc->rxMbuf,
+ sc->rxMbuf = malloc (sc->rxBdCount * sizeof *sc->rxMbuf,
M_MBUF, M_NOWAIT);
- sc->txMbuf = malloc (sc->txBdCount * sizeof *sc->txMbuf,
+ sc->txMbuf = malloc (sc->txBdCount * sizeof *sc->txMbuf,
M_MBUF, M_NOWAIT);
if (!sc->rxMbuf || !sc->txMbuf)
rtems_panic ("No memory for mbuf pointers");
-
+
/*
* Set receiver and transmitter buffer descriptor bases
*/
@@ -520,7 +520,7 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
sc->txBdBase = m8xx_bd_allocate(sc->txBdCount);
m8xx.fec.r_des_start = (int)sc->rxBdBase;
m8xx.fec.x_des_start = (int)sc->txBdBase;
-
+
/*
* Set up Receive Control Register:
* Not promiscuous mode
@@ -554,17 +554,17 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
m8xx.sdcr = 1;
/*
- * Set MII speed to 2.5 MHz for 25 Mhz system clock
+ * Set MII speed to 2.5 MHz for 25 Mhz system clock
*/
m8xx.fec.mii_speed = 0x0a;
m8xx.fec.mii_data = 0x58021000;
-
+
/*
* Set up receive buffer descriptors
*/
for (i = 0 ; i < sc->rxBdCount ; i++)
(sc->rxBdBase + i)->status = 0;
-
+
/*
* Set up transmit buffer descriptors
*/
@@ -574,13 +574,13 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc)
}
sc->txBdHead = sc->txBdTail = 0;
sc->txBdActiveCount = 0;
-
-
+
+
/*
* Mask all FEC interrupts and clear events
*/
- m8xx.fec.imask = M8xx_FEC_IEVENT_TFINT |
+ m8xx.fec.imask = M8xx_FEC_IEVENT_TFINT |
M8xx_FEC_IEVENT_RFINT;
m8xx.fec.ievent = ~0;
@@ -610,7 +610,7 @@ m8xx_Enet_retire_tx_bd (struct m8xx_enet_struct *sc)
int i;
int nRetired;
struct mbuf *m, *n;
-
+
i = sc->txBdTail;
nRetired = 0;
while ((sc->txBdActiveCount != 0)
@@ -636,7 +636,7 @@ m8xx_Enet_retire_tx_bd (struct m8xx_enet_struct *sc)
enet_driver[0].txRetryLimit++;
if (status & M8xx_BD_UNDERRUN)
enet_driver[0].txUnderrun++;
-
+
/*
* Restart the transmitter
*/
@@ -682,7 +682,7 @@ scc_rxDaemon (void *arg)
uint16_t status;
m8xxBufferDescriptor_t *rxBd;
int rxBdIndex;
-
+
/*
* Allocate space for incoming packets and start reception
*/
@@ -699,14 +699,14 @@ scc_rxDaemon (void *arg)
break;
}
}
-
+
/*
* Input packet handling loop
*/
rxBdIndex = 0;
for (;;) {
rxBd = sc->rxBdBase + rxBdIndex;
-
+
/*
* Wait for packet if there's not one ready
*/
@@ -715,7 +715,7 @@ scc_rxDaemon (void *arg)
* Clear old events
*/
m8xx.scc1.scce = 0x8;
-
+
/*
* Wait for packet
* Note that the buffer descriptor is checked
@@ -725,19 +725,19 @@ scc_rxDaemon (void *arg)
*/
while ((status = rxBd->status) & M8xx_BD_EMPTY) {
rtems_event_set events;
-
+
/*
* Unmask RXF (Full frame received) event
*/
m8xx.scc1.sccm |= 0x8;
-
+
rtems_bsdnet_event_receive (INTERRUPT_EVENT,
RTEMS_WAIT|RTEMS_EVENT_ANY,
RTEMS_NO_TIMEOUT,
&events);
}
}
-
+
/*
* Check that packet is valid
*/
@@ -756,12 +756,12 @@ scc_rxDaemon (void *arg)
* FIXME: Packet filtering hook could be done here.
*/
struct ether_header *eh;
-
+
/*
* Invalidate the buffer for this descriptor
*/
rtems_cache_invalidate_multiple_data_lines((const void *)rxBd->buffer, rxBd->length);
-
+
m = sc->rxMbuf[rxBdIndex];
m->m_len = m->m_pkthdr.len = rxBd->length -
sizeof(uint32_t) -
@@ -769,7 +769,7 @@ scc_rxDaemon (void *arg)
eh = mtod (m, struct ether_header *);
m->m_data += sizeof(struct ether_header);
ether_input (ifp, eh, m);
-
+
/*
* Allocate a new mbuf
*/
@@ -800,13 +800,13 @@ scc_rxDaemon (void *arg)
if (status & M8xx_BD_COLLISION)
sc->rxCollision++;
}
-
+
/*
* Reenable the buffer descriptor
*/
rxBd->status = (status & (M8xx_BD_WRAP | M8xx_BD_INTERRUPT)) |
M8xx_BD_EMPTY;
-
+
/*
* Move to next buffer descriptor
*/
@@ -826,7 +826,7 @@ fec_rxDaemon (void *arg)
uint16_t status;
m8xxBufferDescriptor_t *rxBd;
int rxBdIndex;
-
+
/*
* Allocate space for incoming packets and start reception
*/
@@ -844,14 +844,14 @@ fec_rxDaemon (void *arg)
break;
}
}
-
+
/*
* Input packet handling loop
*/
rxBdIndex = 0;
for (;;) {
rxBd = sc->rxBdBase + rxBdIndex;
-
+
/*
* Wait for packet if there's not one ready
*/
@@ -860,7 +860,7 @@ fec_rxDaemon (void *arg)
* Clear old events
*/
m8xx.fec.ievent = M8xx_FEC_IEVENT_RFINT;
-
+
/*
* Wait for packet
* Note that the buffer descriptor is checked
@@ -870,19 +870,19 @@ fec_rxDaemon (void *arg)
*/
while ((status = rxBd->status) & M8xx_BD_EMPTY) {
rtems_event_set events;
-
+
/*
* Unmask RXF (Full frame received) event
*/
m8xx.fec.ievent |= M8xx_FEC_IEVENT_RFINT;
-
+
rtems_bsdnet_event_receive (INTERRUPT_EVENT,
RTEMS_WAIT|RTEMS_EVENT_ANY,
RTEMS_NO_TIMEOUT,
&events);
}
}
-
+
/*
* Check that packet is valid
*/
@@ -892,12 +892,12 @@ fec_rxDaemon (void *arg)
* FIXME: Packet filtering hook could be done here.
*/
struct ether_header *eh;
-
+
/*
* Invalidate the buffer for this descriptor
*/
rtems_cache_invalidate_multiple_data_lines((const void *)rxBd->buffer, rxBd->length);
-
+
m = sc->rxMbuf[rxBdIndex];
m->m_len = m->m_pkthdr.len = rxBd->length -
sizeof(uint32_t) -
@@ -905,7 +905,7 @@ fec_rxDaemon (void *arg)
eh = mtod (m, struct ether_header *);
m->m_data += sizeof(struct ether_header);
ether_input (ifp, eh, m);
-
+
/*
* Allocate a new mbuf
*/
@@ -958,12 +958,12 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
struct mbuf *l = NULL;
uint16_t status;
int nAdded;
-
+
/*
* Free up buffer descriptors
*/
m8xx_Enet_retire_tx_bd (sc);
-
+
/*
* Set up the transmit buffer descriptors.
* No need to pad out short packets since the
@@ -982,7 +982,7 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
* Clear old events
*/
m8xx.scc1.scce = 0x12;
-
+
/*
* Wait for buffer descriptor to become available.
* Note that the buffer descriptors are checked
@@ -998,7 +998,7 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
m8xx_Enet_retire_tx_bd (sc);
while ((sc->txBdActiveCount + nAdded) == sc->txBdCount) {
rtems_event_set events;
-
+
/*
* Unmask TXB (buffer transmitted) and
* TXE (transmitter error) events.
@@ -1011,13 +1011,13 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
m8xx_Enet_retire_tx_bd (sc);
}
}
-
+
/*
* Don't set the READY flag till the
* whole packet has been readied.
*/
status = nAdded ? M8xx_BD_READY : 0;
-
+
/*
* FIXME: Why not deal with empty mbufs at at higher level?
* The IP fragmentation routine in ip_output
@@ -1037,7 +1037,7 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
* Flush the buffer for this descriptor
*/
rtems_cache_flush_multiple_data_lines((const void *)txBd->buffer, txBd->length);
-
+
sc->txMbuf[sc->txBdHead] = m;
nAdded++;
if (++sc->txBdHead == sc->txBdCount) {
@@ -1057,7 +1057,7 @@ scc_sendpacket (struct ifnet *ifp, struct mbuf *m)
if (l != NULL)
l->m_next = m;
}
-
+
/*
* Set the transmit buffer status.
* Break out of the loop if this mbuf is the last in the frame.
@@ -1086,12 +1086,12 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
/* struct mbuf *l = NULL; */
uint16_t status;
int nAdded;
-
+
/*
* Free up buffer descriptors
*/
m8xx_Enet_retire_tx_bd (sc);
-
+
/*
* Set up the transmit buffer descriptors.
* No need to pad out short packets since the
@@ -1110,7 +1110,7 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
* Clear old events
*/
m8xx.fec.ievent = M8xx_FEC_IEVENT_TFINT;
-
+
/*
* Wait for buffer descriptor to become available.
* Note that the buffer descriptors are checked
@@ -1126,7 +1126,7 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
m8xx_Enet_retire_tx_bd (sc);
while ((sc->txBdActiveCount + nAdded) == sc->txBdCount) {
rtems_event_set events;
-
+
/*
* Unmask TXB (buffer transmitted) and
* TXE (transmitter error) events.
@@ -1139,13 +1139,13 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
m8xx_Enet_retire_tx_bd (sc);
}
}
-
+
/*
* Don't set the READY flag till the
* whole packet has been readied.
*/
status = nAdded ? M8xx_BD_READY : 0;
-
+
/*
* FIXME: Why not deal with empty mbufs at at higher level?
* The IP fragmentation routine in ip_output
@@ -1160,12 +1160,12 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
*/
txBd->buffer = mtod (m, void *);
txBd->length = m->m_len;
-
+
/*
* Flush the buffer for this descriptor
*/
rtems_cache_flush_multiple_data_lines(txBd->buffer, txBd->length);
-
+
sc->txMbuf[sc->txBdHead] = m;
nAdded++;
if (++sc->txBdHead == sc->txBdCount) {
@@ -1187,7 +1187,7 @@ fec_sendpacket (struct ifnet *ifp, struct mbuf *m)
l->m_next = m;
*/
}
-
+
/*
* Set the transmit buffer status.
* Break out of the loop if this mbuf is the last in the frame.
@@ -1219,13 +1219,13 @@ scc_txDaemon (void *arg)
struct ifnet *ifp = &sc->arpcom.ac_if;
struct mbuf *m;
rtems_event_set events;
-
+
for (;;) {
/*
* Wait for packet
*/
rtems_bsdnet_event_receive (START_TRANSMIT_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
-
+
/*
* Send packets till queue is empty
*/
@@ -1251,16 +1251,16 @@ fec_txDaemon (void *arg)
struct ifnet *ifp = &sc->arpcom.ac_if;
struct mbuf *m;
rtems_event_set events;
-
+
for (;;) {
/*
* Wait for packet
*/
- rtems_bsdnet_event_receive (START_TRANSMIT_EVENT,
- RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
+ rtems_bsdnet_event_receive (START_TRANSMIT_EVENT,
+ RTEMS_EVENT_ANY | RTEMS_WAIT,
+ RTEMS_NO_TIMEOUT,
&events);
-
+
/*
* Send packets till queue is empty
*/
@@ -1286,7 +1286,7 @@ static void
m8xx_enet_start (struct ifnet *ifp)
{
struct m8xx_enet_struct *sc = ifp->if_softc;
-
+
rtems_event_send (sc->txDaemonTid, START_TRANSMIT_EVENT);
ifp->if_flags |= IFF_OACTIVE;
}
@@ -1300,22 +1300,22 @@ scc_init (void *arg)
{
struct m8xx_enet_struct *sc = arg;
struct ifnet *ifp = &sc->arpcom.ac_if;
-
+
if (sc->txDaemonTid == 0) {
-
+
/*
* Set up SCC hardware
*/
m8xx_enet_initialize (sc);
-
+
/*
* Start driver tasks
*/
sc->txDaemonTid = rtems_bsdnet_newproc ("SCtx", 4096, scc_txDaemon, sc);
sc->rxDaemonTid = rtems_bsdnet_newproc ("SCrx", 4096, scc_rxDaemon, sc);
-
+
}
-
+
/*
* Set flags appropriately
*/
@@ -1323,12 +1323,12 @@ scc_init (void *arg)
m8xx.scc1.psmr |= 0x200;
else
m8xx.scc1.psmr &= ~0x200;
-
+
/*
* Tell the world that we're running.
*/
ifp->if_flags |= IFF_RUNNING;
-
+
/*
* Enable receiver and transmitter
*/
@@ -1342,22 +1342,22 @@ fec_init (void *arg)
{
struct m8xx_enet_struct *sc = arg;
struct ifnet *ifp = &sc->arpcom.ac_if;
-
+
if (sc->txDaemonTid == 0) {
-
+
/*
* Set up SCC hardware
*/
m8xx_fec_initialize_hardware (sc);
-
+
/*
* Start driver tasks
*/
sc->txDaemonTid = rtems_bsdnet_newproc ("SCtx", 4096, fec_txDaemon, sc);
sc->rxDaemonTid = rtems_bsdnet_newproc ("SCrx", 4096, fec_rxDaemon, sc);
-
+
}
-
+
/*
* Set flags appropriately
*/
@@ -1366,12 +1366,12 @@ fec_init (void *arg)
else
m8xx.fec.r_cntrl &= ~0x8;
-
+
/*
* Tell the world that we're running.
*/
ifp->if_flags |= IFF_RUNNING;
-
+
/*
* Enable receiver and transmitter
*/
@@ -1387,9 +1387,9 @@ static void
scc_stop (struct m8xx_enet_struct *sc)
{
struct ifnet *ifp = &sc->arpcom.ac_if;
-
+
ifp->if_flags &= ~IFF_RUNNING;
-
+
/*
* Shut down receiver and transmitter
*/
@@ -1402,9 +1402,9 @@ static void
fec_stop (struct m8xx_enet_struct *sc)
{
struct ifnet *ifp = &sc->arpcom.ac_if;
-
+
ifp->if_flags &= ~IFF_RUNNING;
-
+
/*
* Shut down receiver and transmitter
*/
@@ -1429,7 +1429,7 @@ enet_stats (struct m8xx_enet_struct *sc)
printf (" Overrun:%-8lu", sc->rxOverrun);
printf (" Collision:%-8lu\n", sc->rxCollision);
printf (" Discarded:%-8lu\n", (unsigned long)m8xx.scc1p.un.ethernet.disfc);
-
+
printf (" Tx Interrupts:%-8lu", sc->txInterrupts);
printf (" Deferred:%-8lu", sc->txDeferred);
printf (" Missed Hearbeat:%-8lu\n", sc->txHeartbeat);
@@ -1449,37 +1449,37 @@ scc_ioctl (struct ifnet *ifp, int command, caddr_t data)
{
struct m8xx_enet_struct *sc = ifp->if_softc;
int error = 0;
-
+
switch (command) {
case SIOCGIFADDR:
case SIOCSIFADDR:
ether_ioctl (ifp, command, data);
break;
-
+
case SIOCSIFFLAGS:
switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
case IFF_RUNNING:
scc_stop (sc);
break;
-
+
case IFF_UP:
scc_init (sc);
break;
-
+
case IFF_UP | IFF_RUNNING:
scc_stop (sc);
scc_init (sc);
break;
-
+
default:
break;
}
break;
-
+
case SIO_RTEMS_SHOW_STATS:
enet_stats (sc);
break;
-
+
/*
* FIXME: All sorts of multicast commands need to be added here!
*/
@@ -1497,37 +1497,37 @@ fec_ioctl (struct ifnet *ifp, int command, caddr_t data)
{
struct m8xx_enet_struct *sc = ifp->if_softc;
int error = 0;
-
+
switch (command) {
case SIOCGIFADDR:
case SIOCSIFADDR:
ether_ioctl (ifp, command, data);
break;
-
+
case SIOCSIFFLAGS:
switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
case IFF_RUNNING:
fec_stop (sc);
break;
-
+
case IFF_UP:
fec_init (sc);
break;
-
+
case IFF_UP | IFF_RUNNING:
fec_stop (sc);
fec_init (sc);
break;
-
+
default:
break;
}
break;
-
+
case SIO_RTEMS_SHOW_STATS:
enet_stats (sc);
break;
-
+
/*
* FIXME: All sorts of multicast commands need to be added here!
*/
@@ -1575,12 +1575,12 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
printf ("Driver already in use.\n");
return 0;
}
-
+
/*
* Process options
*/
#if NVRAM_CONFIGURE == 1
-
+
/* Configure from NVRAM */
if ( (addr = nvram->ipaddr) ) {
/* We have a non-zero entry, copy the value */
@@ -1589,7 +1589,7 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
else
rtems_panic("Can't allocate ip_address buffer!\n");
}
-
+
if ( (addr = nvram->netmask) ) {
/* We have a non-zero entry, copy the value */
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
@@ -1601,7 +1601,7 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
/* Ethernet address requires special handling -- it must be copied into
* the arpcom struct. The following if construct serves only to give the
* User Area NVRAM parameter the highest priority.
- *
+ *
* If the ethernet address is specified in NVRAM, go ahead and copy it.
* (ETHER_ADDR_LEN = 6 bytes).
*/
@@ -1619,9 +1619,9 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
*/
rtems_panic("No Ethernet address specified!\n");
}
-
+
#else /* NVRAM_CONFIGURE != 1 */
-
+
if (config->hardware_address) {
memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
}
@@ -1631,7 +1631,7 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
*/
rtems_panic("No Ethernet address specified!\n");
}
-
+
#endif /* NVRAM_CONFIGURE != 1 */
if (config->mtu)
@@ -1647,7 +1647,7 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
else
sc->txBdCount = TX_BUF_COUNT * TX_BD_PER_BUF;
sc->acceptBroadcast = !config->ignore_broadcast;
-
+
/*
* Set up network interface values
*/
@@ -1662,7 +1662,7 @@ rtems_scc1_driver_attach (struct rtems_bsdnet_ifconfig *config)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
if (ifp->if_snd.ifq_maxlen == 0)
ifp->if_snd.ifq_maxlen = ifqmaxlen;
-
+
/*
* Attach the interface
*/
@@ -1701,7 +1701,7 @@ rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config)
printf ("Driver already in use.\n");
return 0;
}
-
+
/*
* Process options
*/
@@ -1724,7 +1724,7 @@ rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config)
else
sc->txBdCount = TX_BUF_COUNT * TX_BD_PER_BUF;
sc->acceptBroadcast = !config->ignore_broadcast;
-
+
/*
* Set up network interface values
*/
@@ -1739,7 +1739,7 @@ rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
if (ifp->if_snd.ifq_maxlen == 0)
ifp->if_snd.ifq_maxlen = ifqmaxlen;
-
+
/*
* Attach the interface
*/
@@ -1753,7 +1753,7 @@ rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config)
int
rtems_enet_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
-
+
#ifdef MPC860T
if ((m8xx.fec.mii_data & 0xffff) == 0x2000) {
/* rtems_scc1_driver_attach(config);*/