diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 14:53:02 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 14:53:02 +0000 |
commit | 32b8506b2409a01d434dd0ab5024c7718852ebcb (patch) | |
tree | 24b3215851217bf05c40cc8a62af4d021019b5d1 /c/src/lib/libbsp/arm/csb336 | |
parent | Whitespace removal. (diff) | |
download | rtems-32b8506b2409a01d434dd0ab5024c7718852ebcb.tar.bz2 |
Whitespace removal.
Diffstat (limited to 'c/src/lib/libbsp/arm/csb336')
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/console/uart.c | 62 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/include/bsp.h | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/network/lan91c11x.c | 70 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/network/lan91c11x.h | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/network/network.c | 168 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb336/start/start.S | 38 |
6 files changed, 171 insertions, 171 deletions
diff --git a/c/src/lib/libbsp/arm/csb336/console/uart.c b/c/src/lib/libbsp/arm/csb336/console/uart.c index 7e5fc96b0d..3db7888435 100644 --- a/c/src/lib/libbsp/arm/csb336/console/uart.c +++ b/c/src/lib/libbsp/arm/csb336/console/uart.c @@ -37,7 +37,7 @@ static void imx_uart_init(int minor); static void imx_uart_set_baud(int, int); static int imx_uart_poll_write(int, const char *, int); -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) static void imx_uart_tx_isr(rtems_irq_hdl_param); static void imx_uart_rx_isr(rtems_irq_hdl_param); static void imx_uart_isr_on(const rtems_irq_connect_data *irq); @@ -49,7 +49,7 @@ static int imx_uart_intr_write(int, const char *, int); /* TERMIOS callbacks */ -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) rtems_termios_callbacks imx_uart_cbacks = { .firstOpen = imx_uart_first_open, .lastClose = imx_uart_last_close, @@ -60,7 +60,7 @@ rtems_termios_callbacks imx_uart_cbacks = { .startRemoteTx = NULL, .outputUsesInterrupts = 1, }; -#else +#else rtems_termios_callbacks imx_uart_cbacks = { .firstOpen = imx_uart_first_open, .lastClose = imx_uart_last_close, @@ -73,7 +73,7 @@ rtems_termios_callbacks imx_uart_cbacks = { }; #endif -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) static rtems_irq_connect_data imx_uart_tx_isr_data[NUM_DEVS]; static rtems_irq_connect_data imx_uart_rx_isr_data[NUM_DEVS]; #endif @@ -141,7 +141,7 @@ rtems_device_driver console_open( return rc; } - + rtems_device_driver console_close( rtems_device_major_number major, rtems_device_minor_number minor, @@ -150,7 +150,7 @@ rtems_device_driver console_close( { return rtems_termios_close(arg); } - + rtems_device_driver console_read( rtems_device_major_number major, rtems_device_minor_number minor, @@ -159,7 +159,7 @@ rtems_device_driver console_read( { return rtems_termios_read(arg); } - + rtems_device_driver console_write( rtems_device_major_number major, rtems_device_minor_number minor, @@ -168,7 +168,7 @@ rtems_device_driver console_write( { return rtems_termios_write(arg); } - + rtems_device_driver console_control( rtems_device_major_number major, rtems_device_minor_number minor, @@ -186,25 +186,25 @@ static void imx_uart_init(int minor) imx_uart_data[minor].idx = 0; if (minor == 0) { -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) imx_uart_tx_isr_data[minor].name = BSP_INT_UART1_TX; imx_uart_rx_isr_data[minor].name = BSP_INT_UART1_RX; #endif - imx_uart_data[minor].regs = + imx_uart_data[minor].regs = (mc9328mxl_uart_regs_t *) MC9328MXL_UART1_BASE; } else if (minor == 1) { -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) imx_uart_tx_isr_data[minor].name = BSP_INT_UART2_TX; imx_uart_rx_isr_data[minor].name = BSP_INT_UART2_RX; #endif - imx_uart_data[minor].regs = + imx_uart_data[minor].regs = (mc9328mxl_uart_regs_t *) MC9328MXL_UART2_BASE; } else { - rtems_panic("%s:%d Unknown UART minor number %d\n", - __FUNCTION__, __LINE__, minor); + rtems_panic("%s:%d Unknown UART minor number %d\n", + __FUNCTION__, __LINE__, minor); } -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) imx_uart_tx_isr_data[minor].hdl = imx_uart_tx_isr; imx_uart_tx_isr_data[minor].handle = &imx_uart_data[minor]; imx_uart_tx_isr_data[minor].on = imx_uart_isr_on; @@ -234,8 +234,8 @@ static void imx_uart_init(int minor) imx_uart_data[minor].regs->cr4 = 0; imx_uart_data[minor].regs->fcr = ( - MC9328MXL_UART_FCR_TXTL(32) | - MC9328MXL_UART_FCR_RFDIV_1 | + MC9328MXL_UART_FCR_TXTL(32) | + MC9328MXL_UART_FCR_RFDIV_1 | MC9328MXL_UART_FCR_RXTL(1)); imx_uart_set_baud(minor, 38400); @@ -247,8 +247,8 @@ static int imx_uart_first_open(int major, int minor, void *arg) rtems_libio_open_close_args_t *args = arg; imx_uart_data[minor].tty = args->iop->data1; - -#if defined(USE_INTERRUPTS) + +#if defined(USE_INTERRUPTS) BSP_install_rtems_irq_handler(&imx_uart_tx_isr_data[minor]); BSP_install_rtems_irq_handler(&imx_uart_rx_isr_data[minor]); @@ -260,7 +260,7 @@ static int imx_uart_first_open(int major, int minor, void *arg) static int imx_uart_last_close(int major, int minor, void *arg) { -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) BSP_remove_rtems_irq_handler(&imx_uart_tx_isr_data[minor]); BSP_remove_rtems_irq_handler(&imx_uart_rx_isr_data[minor]); #endif @@ -268,7 +268,7 @@ static int imx_uart_last_close(int major, int minor, void *arg) return 0; } -static int imx_uart_poll_read(int minor) +static int imx_uart_poll_read(int minor) { if (imx_uart_data[minor].regs->sr2 & MC9328MXL_UART_SR2_RDR) { return imx_uart_data[minor].regs->rxd & 0xff; @@ -278,7 +278,7 @@ static int imx_uart_poll_read(int minor) } -static int imx_uart_poll_write(int minor, const char *buf, int len) +static int imx_uart_poll_write(int minor, const char *buf, int len) { int i; for (i = 0; i < len; i++) { @@ -293,22 +293,22 @@ static int imx_uart_poll_write(int minor, const char *buf, int len) } -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) static int imx_uart_intr_write(int minor, const char *buf, int len) { imx_uart_data[minor].buf = buf; imx_uart_data[minor].len = len; imx_uart_data[minor].idx = 0; - + imx_uart_data[minor].regs->cr1 |= MC9328MXL_UART_CR1_TXMPTYEN; return 1; } #endif - + /* This is for setting baud rate, bits, etc. */ -static int imx_uart_set_attrs(int minor, const struct termios *t) +static int imx_uart_set_attrs(int minor, const struct termios *t) { int baud; @@ -318,7 +318,7 @@ static int imx_uart_set_attrs(int minor, const struct termios *t) return 0; } -#if defined(USE_INTERRUPTS) +#if defined(USE_INTERRUPTS) static void imx_uart_isr_on(const rtems_irq_connect_data *irq) { MC9328MXL_AITC_INTENNUM = irq->name; @@ -403,12 +403,12 @@ static void imx_uart_set_baud(int minor, int baud) case MC9328MXL_UART_FCR_RFDIV_6: ref_freq = perclk1/6; break; case MC9328MXL_UART_FCR_RFDIV_7: ref_freq = perclk1/7; break; default: - rtems_panic("%s:%d Unknown RFDIV: 0x%x", + rtems_panic("%s:%d Unknown RFDIV: 0x%x", __FUNCTION__, __LINE__, fcr & MC9328MXL_UART_FCR_RFDIV_MASK); break; } - + denom = ref_freq / baud; imx_uart_data[minor].regs->bir = 0xf; @@ -416,7 +416,7 @@ static void imx_uart_set_baud(int minor, int baud) } -/* +/* * Polled, non-blocking read from UART */ int imx_uart_poll_read_char(int minor) @@ -424,7 +424,7 @@ int imx_uart_poll_read_char(int minor) return imx_uart_poll_read(minor); } -/* +/* * Polled, blocking write from UART */ void imx_uart_poll_write_char(int minor, char c) diff --git a/c/src/lib/libbsp/arm/csb336/include/bsp.h b/c/src/lib/libbsp/arm/csb336/include/bsp.h index b9770e0ecf..c90879a9cd 100644 --- a/c/src/lib/libbsp/arm/csb336/include/bsp.h +++ b/c/src/lib/libbsp/arm/csb336/include/bsp.h @@ -39,7 +39,7 @@ int get_perclk1_freq(void); extern struct rtems_bsdnet_ifconfig *config; /* Change these to match your board */ -int rtems_mc9328mxl_enet_attach(struct rtems_bsdnet_ifconfig *config, +int rtems_mc9328mxl_enet_attach(struct rtems_bsdnet_ifconfig *config, void *chip); #define RTEMS_BSP_NETWORK_DRIVER_NAME "eth0" #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_mc9328mxl_enet_attach diff --git a/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c b/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c index 3377c601ac..3c54a3c39d 100644 --- a/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c +++ b/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c @@ -82,29 +82,29 @@ uint16_t lan91c11x_read_phy_reg(int reg) { int i; uint16_t mask; - uint16_t bits[64]; + uint16_t bits[64]; int clk_idx = 0; int input_idx = 0; uint16_t phydata; - + /* 32 consecutive ones on MDO to establish sync */ for (i = 0; i < 32; ++i) { bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; } - + /* Start code <01> */ bits[clk_idx++] = LAN91C11X_MGMT_MDOE; bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; - + /* Read command <10> */ bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; bits[clk_idx++] = LAN91C11X_MGMT_MDOE; - + /* Output the PHY address, msb first - Internal PHY is address 0 */ for (i = 0; i < 5; ++i) { bits[clk_idx++] = LAN91C11X_MGMT_MDOE; } - + /* Output the phy register number, msb first */ mask = 0x10; for (i = 0; i < 5; ++i) { @@ -113,57 +113,57 @@ uint16_t lan91c11x_read_phy_reg(int reg) } else { bits[clk_idx++] = LAN91C11X_MGMT_MDOE; } - - + + /* Shift to next lowest bit */ mask >>= 1; } - + /* 1 bit time for turnaround */ bits[clk_idx++] = 0; - + /* Input starts at this bit time */ input_idx = clk_idx; - + /* Will input 16 bits */ for (i = 0; i < 16; ++i) { bits[clk_idx++] = 0; } - + /* Final clock bit */ bits[clk_idx++] = 0; - + /* Turn off all MII Interface bits */ - lan91c11x_write_reg(LAN91C11X_MGMT, + lan91c11x_write_reg(LAN91C11X_MGMT, lan91c11x_read_reg(LAN91C11X_MGMT) & 0xfff0); - + /* Clock all 64 cycles */ for (i = 0; i < sizeof bits; ++i) { /* Clock Low - output data */ lan91c11x_write_reg(LAN91C11X_MGMT, bits[i]); rtems_task_wake_after(1); - + /* Clock Hi - input data */ lan91c11x_write_reg(LAN91C11X_MGMT, bits[i] | LAN91C11X_MGMT_MCLK); rtems_task_wake_after(1); bits[i] |= lan91c11x_read_reg(LAN91C11X_MGMT) & LAN91C11X_MGMT_MDI; } - + /* Return to idle state */ /* Set clock to low, data to low, and output tristated */ lan91c11x_write_reg(LAN91C11X_MGMT, lan91c11x_read_reg(LAN91C11X_MGMT) & 0xfff0); rtems_task_wake_after(1); - + /* Recover input data */ phydata = 0; for (i = 0; i < 16; ++i) { phydata <<= 1; - + if (bits[input_idx++] & LAN91C11X_MGMT_MDI) { phydata |= 0x0001; } } - + return phydata; } @@ -173,27 +173,27 @@ void lan91c11x_write_phy_reg(int reg, uint16_t phydata) { int i; ushort mask; - ushort bits[64]; + ushort bits[64]; int clk_idx = 0; - + /* 32 consecutive ones on MDO to establish sync */ for (i = 0; i < 32; ++i) { bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; } - + /* Start code <01> */ bits[clk_idx++] = LAN91C11X_MGMT_MDOE; bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; - + /* Write command <01> */ bits[clk_idx++] = LAN91C11X_MGMT_MDOE; bits[clk_idx++] = LAN91C11X_MGMT_MDOE | LAN91C11X_MGMT_MDO; - + /* Output the PHY address, msb first - Internal PHY is address 0 */ for (i = 0; i < 5; ++i) { bits[clk_idx++] = LAN91C11X_MGMT_MDOE; } - + /* Output the phy register number, msb first */ mask = 0x10; for (i = 0; i < 5; ++i) { @@ -202,15 +202,15 @@ void lan91c11x_write_phy_reg(int reg, uint16_t phydata) } else { bits[clk_idx++] = LAN91C11X_MGMT_MDOE; } - + /* Shift to next lowest bit */ mask >>= 1; } - + /* 2 extra bit times for turnaround */ bits[clk_idx++] = 0; bits[clk_idx++] = 0; - + /* Write out 16 bits of data, msb first */ mask = 0x8000; for (i = 0; i < 16; ++i) { @@ -225,27 +225,27 @@ void lan91c11x_write_phy_reg(int reg, uint16_t phydata) } /* Turn off all MII Interface bits */ - lan91c11x_write_reg(LAN91C11X_MGMT, + lan91c11x_write_reg(LAN91C11X_MGMT, lan91c11x_read_reg(LAN91C11X_MGMT) & 0xfff0); - + /* Clock all 64 cycles */ for (i = 0; i < sizeof bits; ++i) { /* Clock Low - output data */ lan91c11x_write_reg(LAN91C11X_MGMT, bits[i]); rtems_task_wake_after(1); - + /* Clock Hi - input data */ lan91c11x_write_reg(LAN91C11X_MGMT, bits[i] | LAN91C11X_MGMT_MCLK); rtems_task_wake_after(1); bits[i] |= lan91c11x_read_reg(LAN91C11X_MGMT) & LAN91C11X_MGMT_MDI; } - + /* Return to idle state */ /* Set clock to low, data to low, and output tristated */ - lan91c11x_write_reg(LAN91C11X_MGMT, + lan91c11x_write_reg(LAN91C11X_MGMT, lan91c11x_read_reg(LAN91C11X_MGMT) & 0xfff0); rtems_task_wake_after(1); - + } diff --git a/c/src/lib/libbsp/arm/csb336/network/lan91c11x.h b/c/src/lib/libbsp/arm/csb336/network/lan91c11x.h index 85c7e3262c..f379b25df7 100644 --- a/c/src/lib/libbsp/arm/csb336/network/lan91c11x.h +++ b/c/src/lib/libbsp/arm/csb336/network/lan91c11x.h @@ -29,7 +29,7 @@ void lan91c11x_lock(void); #define LAN91C11X_BASE_ADDR 0x12000000 #define LAN91C11X_REG(_b_, _r_) ((((_b_) & 0xf) << 4) | ((_r_) & 0xf)) - + #define LAN91C11X_TCR (LAN91C11X_REG(0, 0x0)) #define LAN91C11X_EPHSTAT (LAN91C11X_REG(0, 0x2)) diff --git a/c/src/lib/libbsp/arm/csb336/network/network.c b/c/src/lib/libbsp/arm/csb336/network/network.c index ea5adbb406..fa6f903a4d 100644 --- a/c/src/lib/libbsp/arm/csb336/network/network.c +++ b/c/src/lib/libbsp/arm/csb336/network/network.c @@ -77,13 +77,13 @@ typedef struct * This entry *must* be the first in the sonic_softc structure. */ struct arpcom arpcom; - + int accept_bcast; - + /* Tasks waiting for interrupts */ rtems_id rx_task; rtems_id tx_task; - + eth_stats_t stats; } mc9328mxl_enet_softc_t; @@ -92,7 +92,7 @@ static mc9328mxl_enet_softc_t softc; /* function prototypes */ -int rtems_mc9328mxl_enet_attach(struct rtems_bsdnet_ifconfig *config, +int rtems_mc9328mxl_enet_attach(struct rtems_bsdnet_ifconfig *config, void *chip); void mc9328mxl_enet_init(void *arg); void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc); @@ -102,7 +102,7 @@ void mc9328mxl_enet_tx_task (void *arg); void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m); void mc9328mxl_enet_rx_task(void *arg); void mc9328mxl_enet_stats(mc9328mxl_enet_softc_t *sc); -static int mc9328mxl_enet_ioctl(struct ifnet *ifp, +static int mc9328mxl_enet_ioctl(struct ifnet *ifp, ioctl_command_t command, caddr_t data); @@ -116,7 +116,7 @@ int rtems_mc9328mxl_enet_attach ( int unitnumber; char *unitname; int tmp; - + /* * Parse driver name */ @@ -124,7 +124,7 @@ int rtems_mc9328mxl_enet_attach ( if (unitnumber < 0) { return 0; } - + /* * Is driver free? */ @@ -138,11 +138,11 @@ int rtems_mc9328mxl_enet_attach ( printf ("Driver already in use.\n"); return 0; } - + /* zero out the control structure */ memset( &softc, 0, sizeof(softc) ); - - + + /* set the MAC address */ tmp = lan91c11x_read_reg(LAN91C11X_IA0); softc.arpcom.ac_enaddr[0] = tmp & 0xff; @@ -163,7 +163,7 @@ int rtems_mc9328mxl_enet_attach ( } softc.accept_bcast = !config->ignore_broadcast; - + /* * Set up network interface values */ @@ -179,7 +179,7 @@ int rtems_mc9328mxl_enet_attach ( if (ifp->if_snd.ifq_maxlen == 0) { ifp->if_snd.ifq_maxlen = ifqmaxlen; } - + /* Attach the interface */ if_attach (ifp); ether_ifattach (ifp); @@ -188,52 +188,52 @@ int rtems_mc9328mxl_enet_attach ( void mc9328mxl_enet_init(void *arg) { - mc9328mxl_enet_softc_t *sc = arg; + mc9328mxl_enet_softc_t *sc = arg; struct ifnet *ifp = &sc->arpcom.ac_if; - - /* - *This is for stuff that only gets done once (mc9328mxl_enet_init() - * gets called multiple times + + /* + *This is for stuff that only gets done once (mc9328mxl_enet_init() + * gets called multiple times */ if (sc->tx_task == 0) { /* Set up ENET hardware */ mc9328mxl_enet_init_hw(sc); - + /* Start driver tasks */ - sc->rx_task = rtems_bsdnet_newproc("ENrx", - 4096, - mc9328mxl_enet_rx_task, + sc->rx_task = rtems_bsdnet_newproc("ENrx", + 4096, + mc9328mxl_enet_rx_task, sc); - sc->tx_task = rtems_bsdnet_newproc("ENtx", - 4096, - mc9328mxl_enet_tx_task, + sc->tx_task = rtems_bsdnet_newproc("ENtx", + 4096, + mc9328mxl_enet_tx_task, sc); } /* if tx_task */ - + /* Configure for promiscuous if needed */ if (ifp->if_flags & IFF_PROMISC) { - lan91c11x_write_reg(LAN91C11X_RCR, + lan91c11x_write_reg(LAN91C11X_RCR, (lan91c11x_read_reg(LAN91C11X_RCR) | LAN91C11X_RCR_PRMS)); } - - + + /* * Tell the world that we're running. */ ifp->if_flags |= IFF_RUNNING; - + /* Enable TX/RX */ - lan91c11x_write_reg(LAN91C11X_TCR, + lan91c11x_write_reg(LAN91C11X_TCR, (lan91c11x_read_reg(LAN91C11X_TCR) | LAN91C11X_TCR_TXENA)); - lan91c11x_write_reg(LAN91C11X_RCR, + lan91c11x_write_reg(LAN91C11X_RCR, (lan91c11x_read_reg(LAN91C11X_RCR) | LAN91C11X_RCR_RXEN)); - + } /* mc9328mxl_enet_init() */ @@ -254,7 +254,7 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) stat = lan91c11x_read_phy_reg(PHY_STAT); - + if(stat & PHY_STAT_CAPT4) { my |= PHY_ADV_T4; } @@ -274,22 +274,22 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) if(stat & PHY_STAT_CAPTH) { my |= PHY_ADV_10HDX; } - + my |= PHY_ADV_CSMA; - + lan91c11x_write_phy_reg(PHY_AD, my); /* Enable Autonegotiation */ #if 0 - lan91c11x_write_phy_reg(PHY_CTRL, + lan91c11x_write_phy_reg(PHY_CTRL, (PHY_CTRL_ANEGEN | PHY_CTRL_ANEGRST)); #endif /* Enable full duplex, let MAC take care * of padding and CRC. */ - lan91c11x_write_reg(LAN91C11X_TCR, + lan91c11x_write_reg(LAN91C11X_TCR, (LAN91C11X_TCR_PADEN | LAN91C11X_TCR_SWFDUP)); @@ -297,7 +297,7 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) lan91c11x_write_reg(LAN91C11X_RCR, 0); /* Enable auto-negotiation, LEDA is link, LEDB is traffic */ - lan91c11x_write_reg(LAN91C11X_RPCR, + lan91c11x_write_reg(LAN91C11X_RPCR, (LAN91C11X_RPCR_ANEG | LAN91C11X_RPCR_LS2B)); @@ -308,9 +308,9 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) /* Disable error interrupts, enable auto release */ lan91c11x_write_reg(LAN91C11X_CTRL, LAN91C11X_CTRL_AUTO); - + /* Reset MMU */ - lan91c11x_write_reg(LAN91C11X_MMUCMD, + lan91c11x_write_reg(LAN91C11X_MMUCMD, LAN91C11X_MMUCMD_RESETMMU ); @@ -324,7 +324,7 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) /* Enable interrupts on GPIO Port A3 */ /* Make pin 3 an input */ - MC9328MXL_GPIOA_DDIR &= ~bit(3); + MC9328MXL_GPIOA_DDIR &= ~bit(3); /* Use GPIO function for pin 3 */ MC9328MXL_GPIOA_GIUS |= bit(3); @@ -338,13 +338,13 @@ void mc9328mxl_enet_init_hw(mc9328mxl_enet_softc_t *sc) /* Install the interrupt handler */ BSP_install_rtems_irq_handler(&mc9328mxl_enet_isr_data); - + } /* mc9328mxl_enet_init_hw() */ void mc9328mxl_enet_start(struct ifnet *ifp) { mc9328mxl_enet_softc_t *sc = ifp->if_softc; - + rtems_event_send(sc->tx_task, START_TRANSMIT_EVENT); ifp->if_flags |= IFF_OACTIVE; } @@ -352,19 +352,19 @@ void mc9328mxl_enet_start(struct ifnet *ifp) void mc9328mxl_enet_stop (mc9328mxl_enet_softc_t *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; - + ifp->if_flags &= ~IFF_RUNNING; - + /* Stop the transmitter and receiver. */ - lan91c11x_write_reg(LAN91C11X_TCR, - (lan91c11x_read_reg(LAN91C11X_TCR) & + lan91c11x_write_reg(LAN91C11X_TCR, + (lan91c11x_read_reg(LAN91C11X_TCR) & ~LAN91C11X_TCR_TXENA)); - lan91c11x_write_reg(LAN91C11X_RCR, - (lan91c11x_read_reg(LAN91C11X_RCR) & + lan91c11x_write_reg(LAN91C11X_RCR, + (lan91c11x_read_reg(LAN91C11X_RCR) & ~LAN91C11X_RCR_RXEN)); - + } /* @@ -376,7 +376,7 @@ void mc9328mxl_enet_tx_task(void *arg) struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; rtems_event_set events; - + for (;;) { rtems_bsdnet_event_receive( @@ -384,7 +384,7 @@ void mc9328mxl_enet_tx_task(void *arg) RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); - + /* Send packets till queue is empty */ for (;;) { @@ -395,7 +395,7 @@ void mc9328mxl_enet_tx_task(void *arg) } mc9328mxl_enet_sendpacket (ifp, m); softc.stats.tx_packets++; - + } ifp->if_flags &= ~IFF_OACTIVE; } @@ -419,7 +419,7 @@ void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m) } while (l != NULL); /* Allocate a TX buffer */ - lan91c11x_write_reg(LAN91C11X_MMUCMD, + lan91c11x_write_reg(LAN91C11X_MMUCMD, (LAN91C11X_MMUCMD_ALLOCTX | (size >> 8))); @@ -446,18 +446,18 @@ void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m) if (size & 1) { size++; } - lan91c11x_write_reg(LAN91C11X_DATA, size + 6); + lan91c11x_write_reg(LAN91C11X_DATA, size + 6); lan91c11x_lock(); /* Copy the mbuf */ - l = m; + l = m; start = 0; d = 0; while (l != NULL) { uint8_t *data; - + data = mtod(l, uint8_t *); for (i = start; i < l->m_len; i++) { @@ -474,10 +474,10 @@ void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m) l = l->m_next; } - + /* write control byte */ if (i & 1) { - lan91c11x_write_reg_fast(LAN91C11X_DATA, + lan91c11x_write_reg_fast(LAN91C11X_DATA, htons(LAN91C11X_PKT_CTRL_ODD | d)); } else { lan91c11x_write_reg_fast(LAN91C11X_DATA, 0); @@ -486,18 +486,18 @@ void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m) lan91c11x_unlock(); /* Enable TX interrupts */ - lan91c11x_write_reg(LAN91C11X_INT, + lan91c11x_write_reg(LAN91C11X_INT, (lan91c11x_read_reg(LAN91C11X_INT) | LAN91C11X_INT_TXMASK | LAN91C11X_INT_TXEMASK)); /* Enqueue it */ - lan91c11x_write_reg(LAN91C11X_MMUCMD, + lan91c11x_write_reg(LAN91C11X_MMUCMD, LAN91C11X_MMUCMD_ENQUEUE); - + /* free the mbuf chain we just copied */ m_freem(m); - + } /* mc9328mxl_enet_sendpacket () */ @@ -525,7 +525,7 @@ void mc9328mxl_enet_rx_task(void *arg) &events); /* Configure for reads from RX data area */ - lan91c11x_write_reg(LAN91C11X_PTR, + lan91c11x_write_reg(LAN91C11X_PTR, (LAN91C11X_PTR_AUTOINC | LAN91C11X_PTR_RCV | LAN91C11X_PTR_READ)); @@ -540,16 +540,16 @@ void mc9328mxl_enet_rx_task(void *arg) /* get an mbuf for this packet */ MGETHDR(m, M_WAIT, MT_DATA); - + /* now get a cluster pointed to by the mbuf */ /* since an mbuf by itself is too small */ MCLGET(m, M_WAIT); lan91c11x_lock(); - + /* Copy the received packet into an mbuf */ for (i = 0; i < (pktlen / 2); i++) { - ((uint16_t*)m->m_ext.ext_buf)[i] = + ((uint16_t*)m->m_ext.ext_buf)[i] = lan91c11x_read_reg_fast(LAN91C11X_DATA); } @@ -561,23 +561,23 @@ void mc9328mxl_enet_rx_task(void *arg) lan91c11x_unlock(); /* Release the packets memory */ - lan91c11x_write_reg(LAN91C11X_MMUCMD, + lan91c11x_write_reg(LAN91C11X_MMUCMD, LAN91C11X_MMUCMD_REMTOP); /* set the receiving interface */ m->m_pkthdr.rcvif = ifp; m->m_nextpkt = 0; - + /* set the length of the mbuf */ m->m_len = pktlen - (sizeof(struct ether_header)); m->m_pkthdr.len = m->m_len; - + /* strip off the ethernet header from the mbuf */ /* but save the pointer to it */ eh = mtod (m, struct ether_header *); m->m_data += sizeof(struct ether_header); - - + + softc.stats.rx_packets++; /* give all this stuff to the stack */ @@ -589,7 +589,7 @@ void mc9328mxl_enet_rx_task(void *arg) lan91c11x_write_reg(LAN91C11X_INT, int_reg); } -} /* mc9328mxl_enet_rx_task */ +} /* mc9328mxl_enet_rx_task */ /* Show interface statistics */ @@ -609,7 +609,7 @@ static void enet_isr_on(const rtems_irq_connect_data *unused) { /* Enable interrupts */ MC9328MXL_AITC_INTENNUM = MC9328MXL_INT_GPIO_PORTA; - + return; } @@ -636,38 +636,38 @@ mc9328mxl_enet_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data) { mc9328mxl_enet_softc_t *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: mc9328mxl_enet_stop (sc); break; - + case IFF_UP: mc9328mxl_enet_init (sc); break; - + case IFF_UP | IFF_RUNNING: mc9328mxl_enet_stop (sc); mc9328mxl_enet_init (sc); break; - + default: break; } /* switch (if_flags) */ break; - + case SIO_RTEMS_SHOW_STATS: mc9328mxl_enet_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -686,14 +686,14 @@ static void enet_isr(rtems_irq_hdl_param unused) softc.stats.interrupts++; /* get the ISR status and determine RX or TX */ int_reg = lan91c11x_read_reg(LAN91C11X_INT); - + /* Handle RX interrupts */ if ((int_reg & LAN91C11X_INT_RX) && (int_reg & LAN91C11X_INT_RXMASK)) { softc.stats.rx_interrupts++; /* Disable the interrupt */ int_reg &= ~LAN91C11X_INT_RXMASK; - + rtems_event_send (softc.rx_task, START_RECEIVE_EVENT); } @@ -716,7 +716,7 @@ static void enet_isr(rtems_irq_hdl_param unused) softc.stats.txerr_interrupts++; printk("Caught TX interrupt - error on transmission\n"); } - + /* Update the interrupt register on the 91c11x */ lan91c11x_write_reg(LAN91C11X_INT, int_reg); diff --git a/c/src/lib/libbsp/arm/csb336/start/start.S b/c/src/lib/libbsp/arm/csb336/start/start.S index 80bd30f80d..67c74b114a 100644 --- a/c/src/lib/libbsp/arm/csb336/start/start.S +++ b/c/src/lib/libbsp/arm/csb336/start/start.S @@ -2,7 +2,7 @@ * Cogent CSB336 startup code * * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com> - * + * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * @@ -16,7 +16,7 @@ #warning The call is "void boot_card(const char* cmdline);" #warning You need to pass a NULL. #warning Please check and remove these warnings. - + /* Some standard definitions...*/ .equ PSR_MODE_USR, 0x10 .equ PSR_MODE_FIQ, 0x11 @@ -33,25 +33,25 @@ .text .globl _start _start: - /* + /* * Since I don't plan to return to the bootloader, * I don't have to save the registers. * - * I'll just set the CPSR for SVC mode, interrupts + * I'll just set the CPSR for SVC mode, interrupts * off, and ARM instructions. */ mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) msr cpsr, r0 - + /* zero the bss */ ldr r1, =_bss_end_ ldr r0, =_bss_start_ -_bss_init: +_bss_init: mov r2, #0 cmp r0, r1 strlot r2, [r0], #4 - blo _bss_init /* loop while r0 < r1 */ + blo _bss_init /* loop while r0 < r1 */ /* --- Initialize stack pointer registers */ @@ -75,33 +75,33 @@ _bss_init: ldr r1, =_abt_stack_size ldr sp, =_abt_stack add sp, sp, r1 - + /* Enter UNDEF mode and set up the UNDEF stack pointer */ mov r0, #(PSR_MODE_UNDEF | PSR_I | PSR_F) /* No interrupts */ msr cpsr, r0 ldr r1, =_undef_stack_size ldr sp, =_undef_stack add sp, sp, r1 - + /* Set up the SVC stack pointer last and stay in SVC mode */ mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) /* No interrupts */ msr cpsr, r0 ldr r1, =_svc_stack_size ldr sp, =_svc_stack add sp, sp, r1 - sub sp, sp, #0x64 + sub sp, sp, #0x64 - /* + /* * Initialize the MMU. After we return, the MMU is enabled, * and memory may be remapped. I hope we don't remap this * memory away. */ ldr r0, =mem_map - bl mmu_init + bl mmu_init - /* + /* * Initialize the exception vectors. This includes the - * exceptions vectors (0x00000000-0x0000001c), and the + * exceptions vectors (0x00000000-0x0000001c), and the * pointers to the exception handlers (0x00000020-0x0000003c). */ mov r0, #0 @@ -114,7 +114,7 @@ _bss_init: /* Now we are prepared to start the BSP's C code */ bl boot_card - /* + /* * Theoretically, we could return to what started us up, * but we'd have to have saved the registers and stacks. * Instead, we'll just reset. @@ -124,13 +124,13 @@ _bss_init: /* We shouldn't get here. If we do, hang */ _hang: b _hang - -/* + +/* * This is the exception vector table and the pointers to * the functions that handle the exceptions. It's a total * of 16 words (64 bytes) */ -vector_block: +vector_block: ldr pc, Reset_Handler ldr pc, Undefined_Handler ldr pc, SWI_Handler @@ -142,7 +142,7 @@ vector_block: Reset_Handler: b bsp_reset Undefined_Handler: b Undefined_Handler -SWI_Handler: b SWI_Handler +SWI_Handler: b SWI_Handler Prefetch_Handler: b Prefetch_Handler Abort_Handler: b Abort_Handler nop |