From 090de1adf5c64d4c59d86fa3d5c3f1dd2bae1f80 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 11 Apr 2001 14:07:22 +0000 Subject: 2001-04-11 Eric Valette * Makefile.am, configure.in, console/console.c, include/Makefile.am, include/bsp.h, network/network.c, startup/Makefile.am, startup/bspstart.c, startup/linkcmds, wrapup/Makefile.am: Switch the eth_comm BSP to use the "new exception processing model." --- .../lib/libbsp/powerpc/eth_comm/network/network.c | 81 +++++++++++++--------- 1 file changed, 49 insertions(+), 32 deletions(-) (limited to 'c/src/lib/libbsp/powerpc/eth_comm/network/network.c') diff --git a/c/src/lib/libbsp/powerpc/eth_comm/network/network.c b/c/src/lib/libbsp/powerpc/eth_comm/network/network.c index 2fa25f664c..0def297e0c 100644 --- a/c/src/lib/libbsp/powerpc/eth_comm/network/network.c +++ b/c/src/lib/libbsp/powerpc/eth_comm/network/network.c @@ -30,6 +30,7 @@ #include #include +#include /* * Number of interfaces supported by this driver @@ -45,6 +46,8 @@ #define TX_BUF_COUNT 8 #define TX_BD_PER_BUF 4 +#define INET_ADDR_MAX_BUF_SIZE (sizeof "255.255.255.255") + /* * RTEMS event used by interrupt handler to signal daemons. * This must *not* be the same event used by the TCP/IP task synchronization. @@ -108,11 +111,29 @@ struct m860_enet_struct { }; static struct m860_enet_struct enet_driver[NIFACES]; +static void m8xx_scc1_ethernet_on(const rtems_irq_connect_data* ptr) +{ + /* + * Please put relevant code there + */ +} + +static void m8xx_scc1_ethernet_off(const rtems_irq_connect_data* ptr) +{ + /* + * Please put relevant code there + */ +} + +static void m8xx_scc1_ethernet_isOn(const rtems_irq_connect_data* ptr) +{ + return BSP_irq_enabled_at_cpm (ptr->name); +} + /* * SCC1 interrupt handler */ -static rtems_isr -m860_scc1_interrupt_handler (rtems_vector_number v) +static void m860_scc1_interrupt_handler () { /* * Frame received? @@ -139,14 +160,12 @@ m860_scc1_interrupt_handler (rtems_vector_number v) enet_driver[0].txInterrupts++; rtems_event_send (enet_driver[0].txDaemonTid, INTERRUPT_EVENT); } - m8xx.cisr = 1UL << 30; /* Clear SCC1 interrupt-in-service bit */ } /* * FEC interrupt handler */ -static rtems_isr -m860_fec_interrupt_handler (rtems_vector_number v) +static void m860_fec_interrupt_handler () { /* * Frame received? @@ -166,6 +185,13 @@ m860_fec_interrupt_handler (rtems_vector_number v) rtems_event_send (enet_driver[0].txDaemonTid, INTERRUPT_EVENT); } } +static rtems_irq_connect_data ethernetSCC1IrqData = { + BSP_CPM_IRQ_SCC1, + (rtems_irq_hdl) m860_scc1_interrupt_handler, + (rtems_irq_enable) m8xx_scc1_ethernet_on, + (rtems_irq_disable) m8xx_scc1_ethernet_off, + (rtems_irq_is_enabled)m8xx_scc1_ethernet_isOn +}; /* * Initialize the ethernet hardware @@ -334,15 +360,12 @@ m860_scc_initialize_hardware (struct m860_enet_struct *sc) /* * Set up interrupts */ - status = rtems_interrupt_catch (m860_scc1_interrupt_handler, - PPC_IRQ_CPM_SCC1, - &old_handler); + status = BSP_install_rtems_irq_handler (ðernetSCC1IrqData); if (status != RTEMS_SUCCESSFUL) { - rtems_panic ("Can't attach M860 SCC1 interrupt handler: %s\n", + rtems_panic ("Can't attach M8xx SCC1 interrupt handler: %s\n", rtems_status_text (status)); } m8xx.scc1.sccm = 0; /* No interrupts unmasked till necessary */ - m8xx.cimr |= (1UL << 30); /* Enable SCC1 interrupt */ /* * Set up General SCC Mode Register @@ -381,27 +404,25 @@ m860_scc_initialize_hardware (struct m860_enet_struct *sc) m8xx.pcpar |= 0x1; m8xx.pcdir &= ~0x1; - - /* - * Set up interrupts - * FIXME: DANGER: WARNING: - * CICR and SIMASK must be set in any module that uses - * the CPM. Currently those are console-generic.c and - * network.c. If the registers are not set the same - * in both places, strange things may happen. - * If they are only set in one place, then an application - * that used the other module won't work correctly. - * Put this comment in each module that sets these 2 registers - */ - m8xx.cicr = 0x00e43e80; /* SCaP=SCC1, SCbP=SCC2, SCcP=SCC3, - SCdP=SCC4, IRL=1, HP=SCC1, IEN=1 */ - m8xx.simask |= M8xx_SIMASK_LVM1; - /* * Enable receiver and transmitter */ m8xx.scc1.gsmr_l = 0x1088003c; } +static void m8xx_fec_ethernet_on(){}; +static void m8xx_fec_ethernet_off(){}; +static int m8xx_fec_ethernet_isOn (const rtems_irq_connect_data* ptr) +{ + return BSP_irq_enabled_at_siu (ptr->name); +} + +static rtems_irq_connect_data ethernetFECIrqData = { + BSP_FAST_ETHERNET_CTRL, + (rtems_irq_hdl) m860_fec_interrupt_handler, + (rtems_irq_enable) m8xx_fec_ethernet_on, + (rtems_irq_disable) m8xx_fec_ethernet_off, + (rtems_irq_is_enabled)m8xx_fec_ethernet_isOn +}; static void m860_fec_initialize_hardware (struct m860_enet_struct *sc) @@ -437,7 +458,7 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc) * Set SIU interrupt level to LVL2 * */ - m8xx.fec.ivec = 0x02 << 29; + m8xx.fec.ivec = ((((unsigned) BSP_FAST_ETHERNET_CTRL)/2) << 29); /* * Set the TX and RX fifo sizes. For now, we'll split it evenly @@ -551,15 +572,11 @@ m860_fec_initialize_hardware (struct m860_enet_struct *sc) /* * Set up interrupts */ - status = rtems_interrupt_catch (m860_fec_interrupt_handler, - PPC_IRQ_LVL2, - &old_handler); + status = BSP_install_rtems_irq_handler (ðernetFECIrqData); if (status != RTEMS_SUCCESSFUL) rtems_panic ("Can't attach M860 FEC interrupt handler: %s\n", rtems_status_text (status)); - m8xx.simask |= M8xx_SIMASK_LVM2; - } -- cgit v1.2.3