diff options
Diffstat (limited to '')
36 files changed, 595 insertions, 505 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c index 07feea0255..cf06a85916 100644 --- a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c +++ b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c @@ -6,7 +6,7 @@ * e-mail: rdasilva@connecttel.com * * MODULE DESCRIPTION: - * RTEMS driver for 3COM 3C509 Ethernet Card. + * RTEMS driver for 3COM 3C509 Ethernet Card. * The driver has been tested on PC with a single network card. * * @@ -54,10 +54,13 @@ * Saskatoon, Saskatchewan, CANADA * eric@skatter.usask.ca ******************************************************************************* - * + * * * MODIFICATION/HISTORY: * $Log$ + * Revision 1.2 1999/12/13 21:21:31 joel + * Warning removal patch from Philip A. Prindeville <philipp@zembu.com>. + * * Revision 1.1 1999/05/14 16:23:42 joel * Added 3COM 3C509 driver from Rosimildo DaSilva <rdasilva@connecttel.com>. * @@ -140,7 +143,7 @@ * more powerful mechanism for detecting and dealing with multiple types * of non-fatal conflict. -jkh XXX */ -struct isa_device +struct isa_device { int id_id; /* device id */ int id_unit; /* unit number */ @@ -149,7 +152,7 @@ struct isa_device }; -struct ep_board +struct ep_board { int epb_addr; /* address of this board */ char epb_used; /* was this entry already used for configuring ? */ @@ -163,7 +166,7 @@ struct ep_board /* * Ethernet software status per interface. */ -struct ep_softc +struct ep_softc { struct arpcom arpcom; /* Ethernet common part */ int ep_io_addr; /* i/o bus address */ @@ -194,7 +197,7 @@ struct ep_softc static volatile unsigned long overrun; static volatile unsigned long resend; static struct ep_softc ep_softc[ NWDDRIVER ]; -static struct isa_device isa_dev[ NWDDRIVER ] = +static struct isa_device isa_dev[ NWDDRIVER ] = { { 0, /* device id */ 0, /* unit number */ @@ -230,7 +233,7 @@ extern void Wait_X_ms( unsigned int timeToWait ); /* timer.c ??? */ /********************************************************************************** - * + * * DESCRIPTION: Writes a buffer of data to the I/O port. The data is sent to the * port as 32 bits units( 4 bytes ). * @@ -239,7 +242,7 @@ extern void Wait_X_ms( unsigned int timeToWait ); /* timer.c ??? */ **********************************************************************************/ static __inline void outsl( unsigned short io_addr, unsigned char *out_data, int len ) { - u_long *pl = ( u_long *)out_data; + u_long *pl = ( u_long *)out_data; while( len-- ) { outport_long( io_addr, *pl ); @@ -248,7 +251,7 @@ static __inline void outsl( unsigned short io_addr, unsigned char *out_data, int } /********************************************************************************** - * + * * DESCRIPTION: Writes a buffer of data to the I/O port. The data is sent to the * port as 16 bits units( 2 bytes ). * @@ -257,7 +260,7 @@ static __inline void outsl( unsigned short io_addr, unsigned char *out_data, int **********************************************************************************/ static __inline void outsw( unsigned short io_addr, unsigned char *out_data, int len ) { - u_short *ps = ( u_short *)out_data; + u_short *ps = ( u_short *)out_data; while( len-- ) { outport_word( io_addr, *ps ); @@ -266,7 +269,7 @@ static __inline void outsw( unsigned short io_addr, unsigned char *out_data, int } /********************************************************************************** - * + * * DESCRIPTION: Writes a buffer of data to the I/O port. The data is sent to the * port as 8 bits units( 1 byte ). * @@ -284,7 +287,7 @@ static __inline void outsb( unsigned short io_addr, unsigned char *out_data, int /********************************************************************************** - * + * * DESCRIPTION: Read a buffer of data from an I/O port. The data is read as 16 bits * units or 2 bytes. * @@ -293,7 +296,7 @@ static __inline void outsb( unsigned short io_addr, unsigned char *out_data, int **********************************************************************************/ static __inline void insw( unsigned short io_addr, unsigned char *in_data, int len ) { - u_short *ps = ( u_short *)in_data; + u_short *ps = ( u_short *)in_data; while( len-- ) { inport_word( io_addr, *ps ); @@ -302,7 +305,7 @@ static __inline void insw( unsigned short io_addr, unsigned char *in_data, int l } /********************************************************************************** - * + * * DESCRIPTION: Read a buffer of data from an I/O port. The data is read as 32 bits * units or 4 bytes. * @@ -311,7 +314,7 @@ static __inline void insw( unsigned short io_addr, unsigned char *in_data, int l **********************************************************************************/ static __inline void insl( unsigned short io_addr, unsigned char *in_data, int len ) { - u_long *pl = ( u_long *)in_data; + u_long *pl = ( u_long *)in_data; while( len-- ) { inport_long( io_addr, *pl ); @@ -320,7 +323,7 @@ static __inline void insl( unsigned short io_addr, unsigned char *in_data, int l } /********************************************************************************** - * + * * DESCRIPTION: Read a buffer of data from an I/O port. The data is read as 8 bits * units or 1 bytes. * @@ -337,7 +340,7 @@ static __inline void insb( unsigned short io_addr, unsigned char *in_data, int l /********************************************************************************** - * + * * DESCRIPTION: Writes a word to the I/O port. * * RETURNS: nothing. @@ -353,7 +356,7 @@ static __inline void outw( unsigned short io_addr, unsigned short out_data ) /********************************************************************************** - * + * * DESCRIPTION: Routine to read a word as defined in FreeBSD. * * RETURNS: nothing @@ -367,7 +370,7 @@ static __inline unsigned short inw( unsigned short io_addr ) } /********************************************************************************** - * + * * DESCRIPTION: Routine to output a word as defined in FreeBSD. * * RETURNS: nothing. @@ -379,7 +382,7 @@ void __inline outb( unsigned short io_addr, unsigned char out_data ) } /********************************************************************************** - * + * * DESCRIPTION: Routine to read a word as defined in FreeBSD. * * RETURNS: byte read. @@ -394,7 +397,7 @@ static __inline unsigned char inb( unsigned short io_addr ) /********************************************************************************** - * + * * DESCRIPTION: * We get eeprom data from the id_port given an offset into the eeprom. * Basically; after the ID_sequence is sent to all of the cards; they enter @@ -422,7 +425,7 @@ static int get_eeprom_data( int id_port, int offset ) /********************************************************************************** - * + * * DESCRIPTION: Waits until the EEPROM of the card is ready to be accessed. * * RETURNS: 0 - not ready; 1 - ok @@ -434,7 +437,7 @@ static int eeprom_rdy( struct ep_softc *sc ) for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) continue; - if (i >= MAX_EEPROMBUSY) + if (i >= MAX_EEPROMBUSY) { printf("ep%d: eeprom failed to come ready.\n", sc->unit); return (0); @@ -443,9 +446,9 @@ static int eeprom_rdy( struct ep_softc *sc ) } /********************************************************************************** - * + * * DESCRIPTION: - * get_e: gets a 16 bits word from the EEPROM. + * get_e: gets a 16 bits word from the EEPROM. * We must have set the window before call this routine. * * RETURNS: data from EEPROM @@ -463,7 +466,7 @@ u_short get_e( struct ep_softc *sc, int offset ) /********************************************************************************** - * + * * DESCRIPTION: * Driver interrupt handler. This routine is called by the RTEMS kernel when this * interrupt is raised. @@ -477,14 +480,14 @@ static rtems_isr ap_interrupt_handler( rtems_vector_number v ) /* de-activate any pending interrrupt, and sent and event to interrupt task * to process all events required by this interrupt. - */ + */ outw( BASE + EP_COMMAND, SET_INTR_MASK ); /* disable all Ints */ - rtems_event_send( sc->rxDaemonTid, INTERRUPT_EVENT ); + rtems_event_send( sc->rxDaemonTid, INTERRUPT_EVENT ); } /********************************************************************************** - * + * * DESCRIPTION: * * RETURNS: @@ -496,7 +499,7 @@ static void nopOn(const rtems_irq_connect_data* notUsed) } /********************************************************************************** - * + * * DESCRIPTION: * * RETURNS: @@ -509,7 +512,7 @@ static int _3c509_IsOn(const rtems_irq_connect_data* irq) /********************************************************************************** - * + * * DESCRIPTION: * Initializes the ethernet hardware. * @@ -521,15 +524,15 @@ static void _3c509_initialize_hardware (struct ep_softc *sc) rtems_status_code st; epinit( sc ); - + /* - * Set up interrupts + * Set up interrupts */ sc->irqInfo.hdl = ( rtems_irq_hdl )ap_interrupt_handler; sc->irqInfo.on = nopOn; sc->irqInfo.off = nopOn; sc->irqInfo.isOn = _3c509_IsOn; - + printf ("3c509: IRQ with Kernel: %d\n", sc->irqInfo.name ); st = BSP_install_rtems_irq_handler( &sc->irqInfo ); if( !st ) @@ -539,7 +542,7 @@ static void _3c509_initialize_hardware (struct ep_softc *sc) } /********************************************************************************** - * + * * DESCRIPTION: Driver interrupt daemon. * * RETURNS: nothing. @@ -561,13 +564,13 @@ static void _3c509_rxDaemon (void *arg) /* printk( "R+" ); */ ep_intr( dp ); epstart( &dp->arpcom.ac_if ); - } + } printf ("3C509: RX Daemon is finishing.\n"); } /********************************************************************************** - * + * * DESCRIPTION: Driver transmit daemon * * RETURNS: @@ -578,7 +581,7 @@ static void _3c509_txDaemon (void *arg) struct ep_softc *sc = (struct ep_softc *)&ep_softc[0]; struct ifnet *ifp = &sc->arpcom.ac_if; rtems_event_set events; - + printf ("3C509: TX Daemon is starting.\n"); for( ;; ) { @@ -586,9 +589,9 @@ static void _3c509_txDaemon (void *arg) * Wait for packet */ /* printk( "T-\n" ); */ - 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 ); /* printk( "T+\n" ); */ epstart( ifp ); @@ -600,7 +603,7 @@ static void _3c509_txDaemon (void *arg) /********************************************************************************** - * + * * DESCRIPTION: Activates the trabsmitter task... * * RETURNS: nothing. @@ -615,7 +618,7 @@ static void _3c509_start (struct ifnet *ifp) } /********************************************************************************** - * + * * DESCRIPTION: Initialize and start the device * * RETURNS: @@ -628,11 +631,11 @@ static void _3c509_init (void *arg) printf ("3C509: Initialization called.\n"); if (sc->txDaemonTid == 0) { - + /* * Set up WD hardware */ - _3c509_initialize_hardware (sc); + _3c509_initialize_hardware (sc); printf ("3C509: starting network driver tasks..\n"); /* * Start driver tasks @@ -648,7 +651,7 @@ static void _3c509_init (void *arg) } /********************************************************************************** - * + * * DESCRIPTION: Stop the device * * RETURNS: @@ -679,7 +682,7 @@ static void _3c509_stop (struct ep_softc *sc) /********************************************************************************** - * + * * DESCRIPTION: Show interface statistics * * RETURNS: nothing. @@ -697,10 +700,10 @@ static void _3c509_stats (struct ep_softc *sc) } /********************************************************************************** - * + * * DESCRIPTION: Driver ioctl handler * - * RETURNS: + * RETURNS: * **********************************************************************************/ static int _3c509_ioctl (struct ifnet *ifp, int command, caddr_t data) @@ -738,7 +741,7 @@ static int _3c509_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: _3c509_stats( sc ); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -750,7 +753,7 @@ static int _3c509_ioctl (struct ifnet *ifp, int command, caddr_t data) } /********************************************************************************** - * + * * DESCRIPTION: * Attaches this network driver to the system. This function is called by the network * interface during the initialization of the system. @@ -784,7 +787,7 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config ) if (ifp->if_softc == NULL) break; } - if (i >= NWDDRIVER) + if (i >= NWDDRIVER) { printf ("Too many 3C509 drivers.\n"); return 0; @@ -793,11 +796,11 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config ) /* * Process options */ - if( config->hardware_address ) + if( config->hardware_address ) { memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); } - else + else { /* set it to something ... */ memset (sc->arpcom.ac_enaddr, 0x08,ETHER_ADDR_LEN); @@ -856,11 +859,11 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config ) /********************************************************************************** - * + * * DESCRIPTION: * This function looks for a 3COM card 3c5x9 in an isa bus. If a board is found, it * returns a structure describing the caracteristics of the card. It returns zero when - * card can not be found. + * card can not be found. * * RETURNS: 0 - fail - could not find a card... * <> description of the card. @@ -871,7 +874,7 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) int data, i, j, id_port = ELINK_ID_PORT; int count = 0; - if(ep_current_tag == (EP_LAST_TAG + 1) ) + if(ep_current_tag == (EP_LAST_TAG + 1) ) { /* Come here just one time */ ep_current_tag--; @@ -883,7 +886,7 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) elink_idseq(0xCF); elink_reset(); Wait_X_ms( 10 ); /* RPS: assuming delay in miliseconds */ - for (i = 0; i < EP_MAX_BOARDS; i++) + for (i = 0; i < EP_MAX_BOARDS; i++) { outb(id_port, 0); outb(id_port, 0); @@ -923,7 +926,7 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) ep_current_tag--; } ep_board[ep_boards].epb_addr = 0; - if( count ) + if( count ) { printf("%d 3C5x9 board(s) on ISA found at", count); for (j = 0; ep_board[j].epb_addr; j++) @@ -943,7 +946,7 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) * */ - if (IS_BASE == -1) + if (IS_BASE == -1) { /* port? */ for (i = 0; ep_board[i].epb_addr && ep_board[i].epb_used; i++) ; if (ep_board[i].epb_addr == 0) @@ -952,15 +955,15 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) IS_BASE = ep_board[i].epb_addr; ep_board[i].epb_used = 1; return &ep_board[ i ]; - } - else + } + else { for (i = 0; ep_board[i].epb_addr && ep_board[i].epb_addr != IS_BASE; i++ ) ; if (ep_board[i].epb_used || ep_board[i].epb_addr != IS_BASE) return 0; - if (inw(IS_BASE + EP_W0_EEPROM_COMMAND) & EEPROM_TST_MODE) + if (inw(IS_BASE + EP_W0_EEPROM_COMMAND) & EEPROM_TST_MODE) { - printf("ep%d: 3c5x9 at 0x%x in PnP mode. Disable PnP mode!\n", + printf("ep%d: 3c5x9 at 0x%x in PnP mode. Disable PnP mode!\n", is->id_unit, IS_BASE ); } ep_board[i].epb_used = 1; @@ -971,7 +974,7 @@ static struct ep_board *ep_look_for_board_at( struct isa_device *is ) /********************************************************************************** - * + * * DESCRIPTION: * This routine checks if there card installed on the machine. * @@ -989,7 +992,7 @@ static int ep_isa_probe( struct isa_device *is ) if( (epb = ep_look_for_board_at(is)) == 0 ) return (0); - sc = &ep_softc[ 0 ]; + sc = &ep_softc[ 0 ]; sc->ep_io_addr = epb->epb_addr; sc->epb = epb; @@ -1001,10 +1004,10 @@ static int ep_isa_probe( struct isa_device *is ) GO_WINDOW(0); k = sc->epb->prod_id; #ifdef PC98 - if ((k & 0xf0f0) != (PROD_ID & 0xf0f0)) + if ((k & 0xf0f0) != (PROD_ID & 0xf0f0)) { #else - if ((k & 0xf0ff) != (PROD_ID & 0xf0ff)) + if ((k & 0xf0ff) != (PROD_ID & 0xf0ff)) { #endif printf("ep_isa_probe: ignoring model %04x\n", k ); @@ -1024,7 +1027,7 @@ static int ep_isa_probe( struct isa_device *is ) * */ - if (is->id_irq == 0) + if (is->id_irq == 0) { /* irq? */ is->id_irq = ( k == 2 ) ? 9 : k; } @@ -1039,9 +1042,9 @@ static int ep_isa_probe( struct isa_device *is ) /********************************************************************************** - * + * * DESCRIPTION: - * This routine attaches this network driver and the network interface routines. + * This routine attaches this network driver and the network interface routines. * * RETURNS: 0 - failed to attach * 1 - success @@ -1055,15 +1058,15 @@ static int ep_isa_attach( struct isa_device *is ) sc->ep_connectors = 0; config = inw( IS_BASE + EP_W0_CONFIG_CTRL ); - if (config & IS_AUI) + if (config & IS_AUI) { sc->ep_connectors |= AUI; } - if (config & IS_BNC) + if (config & IS_BNC) { sc->ep_connectors |= BNC; } - if (config & IS_UTP) + if (config & IS_UTP) { sc->ep_connectors |= UTP; } @@ -1082,7 +1085,7 @@ static int ep_isa_attach( struct isa_device *is ) GO_WINDOW( 0 ); SET_IRQ( BASE, irq ); - printf( "3C509: I/O=0x%x, IRQ=%d, CONNECTOR=%s, ", + printf( "3C509: I/O=0x%x, IRQ=%d, CONNECTOR=%s, ", sc->ep_io_addr, sc->irqInfo.name,ep_conn_type[ sc->ep_connector ] ); ep_attach( sc ); @@ -1090,7 +1093,7 @@ static int ep_isa_attach( struct isa_device *is ) } /********************************************************************************** - * + * * DESCRIPTION: Completes the initialization/attachement of the driver. * * RETURNS: 0 - ok. @@ -1100,21 +1103,21 @@ static int ep_attach( struct ep_softc *sc ) { u_short *p; int i; - + /* * Setup the station address */ p = (u_short *) &sc->arpcom.ac_enaddr; GO_WINDOW(2); printf("ADDRESS=" ); - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { p[i] = htons( sc->epb->eth_addr[i] ); outw( BASE + EP_W2_ADDR_0 + (i * 2), ntohs( p[i] ) ); printf("%04x ", (u_short)ntohs( p[i] ) ); } printf("\n" ); - + sc->rx_no_first = sc->rx_no_mbuf = sc->rx_bpf_disc = sc->rx_overrunf = sc->rx_overrunl = sc->tx_underrun = 0; @@ -1126,7 +1129,7 @@ static int ep_attach( struct ep_softc *sc ) /********************************************************************************** - * + * * DESCRIPTION: * Initializes the card. * The order in here seems important. Otherwise we may not receive interrupts. ?! @@ -1199,19 +1202,19 @@ static void epinit( struct ep_softc *sc ) */ /* Set the xcvr. */ - if (ifp->if_flags & IFF_LINK0 && sc->ep_connectors & AUI) + if (ifp->if_flags & IFF_LINK0 && sc->ep_connectors & AUI) { i = ACF_CONNECTOR_AUI; - } - else if (ifp->if_flags & IFF_LINK1 && sc->ep_connectors & BNC) + } + else if (ifp->if_flags & IFF_LINK1 && sc->ep_connectors & BNC) { i = ACF_CONNECTOR_BNC; - } - else if (ifp->if_flags & IFF_LINK2 && sc->ep_connectors & UTP) + } + else if (ifp->if_flags & IFF_LINK2 && sc->ep_connectors & UTP) { i = ACF_CONNECTOR_UTP; - } - else + } + else { i = sc->ep_connector; } @@ -1219,10 +1222,10 @@ static void epinit( struct ep_softc *sc ) j = inw(BASE + EP_W0_ADDRESS_CFG) & 0x3fff; outw(BASE + EP_W0_ADDRESS_CFG, j | (i << ACF_CONNECTOR_BITS)); - switch(i) + switch(i) { case ACF_CONNECTOR_UTP: - if (sc->ep_connectors & UTP) + if (sc->ep_connectors & UTP) { GO_WINDOW(4); outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP); @@ -1230,7 +1233,7 @@ static void epinit( struct ep_softc *sc ) break; case ACF_CONNECTOR_BNC: - if (sc->ep_connectors & BNC) + if (sc->ep_connectors & BNC) { outw(BASE + EP_COMMAND, START_TRANSCEIVER); Wait_X_ms( 1 ); @@ -1258,7 +1261,7 @@ static void epinit( struct ep_softc *sc ) sc->tx_underrun = 0; ep_fset(F_RX_FIRST); - if( sc->top ) + if( sc->top ) { m_freem( sc->top ); sc->top = sc->mcur = 0; @@ -1279,7 +1282,7 @@ static void epinit( struct ep_softc *sc ) static const char padmap[] = {0, 3, 2, 1}; /********************************************************************************** - * + * * DESCRIPTION: Routine to transmit frames to the card. * * RETURNS: nothing. @@ -1293,14 +1296,14 @@ static void epstart( struct ifnet *ifp ) struct mbuf *top; int pad; - while( inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS ) + while( inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS ) ; startagain: /* printk( "S-" ); */ /* Sneak a peek at the next packet */ m = ifp->if_snd.ifq_head; - if (m == 0) + if (m == 0) { ifp->if_flags &= ~IFF_OACTIVE; return; @@ -1316,7 +1319,7 @@ startagain: * but we drop packets that are too large. Perhaps we should truncate * them instead? */ - if( len + pad > ETHER_MAX_LEN ) + if( len + pad > ETHER_MAX_LEN ) { /* packet is obviously too large: toss it */ ++ifp->if_oerrors; @@ -1324,30 +1327,30 @@ startagain: m_freem( m ); goto readcheck; } - if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) + if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { /* no room in FIFO */ outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4)); /* make sure */ - if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) + if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { ifp->if_flags |= IFF_OACTIVE; return; } } IF_DEQUEUE( &ifp->if_snd, m ); - outw(BASE + EP_W1_TX_PIO_WR_1, len); + outw(BASE + EP_W1_TX_PIO_WR_1, len); outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */ for (top = m; m != 0; m = m->m_next) { - if( ep_ftst(F_ACCESS_32_BITS ) ) + if( ep_ftst(F_ACCESS_32_BITS ) ) { outsl( BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t), m->m_len / 4 ); if( m->m_len & 3 ) outsb(BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t) + (m->m_len & (~3)), m->m_len & 3 ); - } - else + } + else { outsw( BASE + EP_W1_TX_PIO_WR_1, mtod(m, caddr_t), m->m_len / 2 ); if( m->m_len & 1 ) @@ -1368,13 +1371,13 @@ startagain: * fifo. */ readcheck: - if( inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK ) + if( inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK ) { /* * we check if we have packets left, in that case we prepare to come * back later */ - if( ifp->if_snd.ifq_head ) + if( ifp->if_snd.ifq_head ) { outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8); } @@ -1386,7 +1389,7 @@ readcheck: /********************************************************************************** - * + * * DESCRIPTION: Routine to read frames from the card. * * RETURNS: nothing. @@ -1407,10 +1410,10 @@ static void epread( register struct ep_softc *sc ) read_again: - if (status & ERR_RX) + if (status & ERR_RX) { ++ifp->if_ierrors; - if( status & ERR_RX_OVERRUN ) + if( status & ERR_RX_OVERRUN ) { /* * we can think the rx latency is actually greather than we @@ -1426,7 +1429,7 @@ read_again: } rx_fifo = rx_fifo2 = status & RX_BYTES_MASK; - if( ep_ftst( F_RX_FIRST ) ) + if( ep_ftst( F_RX_FIRST ) ) { MGETHDR( m, M_DONTWAIT, MT_DATA ); if( !m ) @@ -1443,8 +1446,8 @@ read_again: top->m_len = sizeof(struct ether_header); rx_fifo -= sizeof(struct ether_header); sc->cur_len = rx_fifo2; - } - else + } + else { /* come here if we didn't have a complete packet last time */ top = sc->top; @@ -1453,10 +1456,10 @@ read_again: } /* Reads what is left in the RX FIFO */ - while (rx_fifo > 0) + while (rx_fifo > 0) { lenthisone = min( rx_fifo, M_TRAILINGSPACE(m) ); - if( lenthisone == 0 ) + if( lenthisone == 0 ) { /* no room in this one */ mcur = m; MGET(m, M_WAIT, MT_DATA); @@ -1468,15 +1471,15 @@ read_again: mcur->m_next = m; lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); } - if( ep_ftst( F_ACCESS_32_BITS ) ) + if( ep_ftst( F_ACCESS_32_BITS ) ) { /* default for EISA configured cards*/ insl( BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len, lenthisone / 4); m->m_len += (lenthisone & ~3); if (lenthisone & 3) insb(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len, lenthisone & 3); m->m_len += (lenthisone & 3); - } - else + } + else { insw(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t) + m->m_len, lenthisone / 2); m->m_len += lenthisone; @@ -1486,12 +1489,12 @@ read_again: rx_fifo -= lenthisone; } - if( status & ERR_RX_INCOMPLETE) + if( status & ERR_RX_INCOMPLETE) { /* we haven't received the complete packet */ sc->mcur = m; sc->rx_no_first++; /* to know how often we come here */ ep_frst( F_RX_FIRST ); - if( !((status = inw(BASE + EP_W1_RX_STATUS)) & ERR_RX_INCOMPLETE) ) + if( !((status = inw(BASE + EP_W1_RX_STATUS)) & ERR_RX_INCOMPLETE) ) { /* we see if by now, the packet has completly arrived */ goto read_again; @@ -1516,7 +1519,7 @@ read_again: out: outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - if (sc->top) + if (sc->top) { m_freem(sc->top); sc->top = 0; @@ -1530,10 +1533,10 @@ out: /********************************************************************************** - * - * DESCRIPTION: - * This routine handles interrupts. It is called from the "RX" task whenever - * the ISR post an event to the task. + * + * DESCRIPTION: + * This routine handles interrupts. It is called from the "RX" task whenever + * the ISR post an event to the task. * This is basically the "isr" from the FreeBSD driver. * * RETURNS: nothing. @@ -1548,17 +1551,17 @@ static void ep_intr( struct ep_softc *sc ) rescan: /* printk( "I-" ); */ - while( ( status = inw(BASE + EP_STATUS)) & S_5_INTS ) + while( ( status = inw(BASE + EP_STATUS)) & S_5_INTS ) { /* first acknowledge all interrupt sources */ outw( BASE + EP_COMMAND, ACK_INTR | ( status & S_MASK ) ); - if( status & ( S_RX_COMPLETE | S_RX_EARLY ) ) + if( status & ( S_RX_COMPLETE | S_RX_EARLY ) ) { epread( sc ); continue; } - if (status & S_TX_AVAIL) + if (status & S_TX_AVAIL) { /* we need ACK */ ifp->if_timer = 0; @@ -1567,7 +1570,7 @@ rescan: inw(BASE + EP_W1_FREE_TX); epstart(ifp); } - if (status & S_CARD_FAILURE) + if (status & S_CARD_FAILURE) { ifp->if_timer = 0; printf("\nep%d:\n\tStatus: %x\n", sc->unit, status); @@ -1584,7 +1587,7 @@ rescan: epinit(sc); return; } - if (status & S_TX_COMPLETE) + if (status & S_TX_COMPLETE) { ifp->if_timer = 0; /* we need ACK. we do it at the end */ @@ -1592,18 +1595,18 @@ rescan: * We need to read TX_STATUS until we get a 0 status in order to * turn off the interrupt flag. */ - while ((status = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) + while ((status = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) { if (status & TXS_SUCCES_INTR_REQ) ; - else if( status & (TXS_UNDERRUN | TXS_JABBER | TXS_MAX_COLLISION ) ) + else if( status & (TXS_UNDERRUN | TXS_JABBER | TXS_MAX_COLLISION ) ) { outw(BASE + EP_COMMAND, TX_RESET); - if (status & TXS_UNDERRUN) + if (status & TXS_UNDERRUN) { sc->tx_underrun++; - } - else + } + else { if( status & TXS_JABBER ) ; @@ -1616,7 +1619,7 @@ rescan: * To have a tx_avail_int but giving the chance to the * Reception */ - if( ifp->if_snd.ifq_head ) + if( ifp->if_snd.ifq_head ) { outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8); } @@ -1632,7 +1635,7 @@ rescan: outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */ if( (status = inw(BASE + EP_STATUS) ) & S_5_INTS ) goto rescan; - + /* re-enable Ints */ outw( BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS ); /* printk( "I+" ); */ diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c index 9fa7acbd33..a1b1899dc9 100644 --- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c @@ -64,7 +64,7 @@ rtems_device_minor_number rtems_clock_minor; | Description: Interrupt Service Routine for clock (0h) interruption. | Global Variables: Clock_driver_ticks, Clock_isrs. | Arguments: vector - standard RTEMS argument - see documentation. -| Returns: standard return value - see documentation. +| Returns: standard return value - see documentation. +--------------------------------------------------------------------------*/ static void clockIsr() { @@ -99,7 +99,7 @@ static void clockIsr() | not really necessary, since there will be a reset at exit. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void clockOff(const rtems_irq_connect_data* unused) { @@ -115,7 +115,7 @@ void clockOff(const rtems_irq_connect_data* unused) | Description: Initialize and install clock interrupt handler. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ static void clockOn(const rtems_irq_connect_data* unused) { @@ -162,9 +162,9 @@ static void clockOn(const rtems_irq_connect_data* unused) outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); outport_byte(TIMER_CNTR0, count >> 0 & 0xff); outport_byte(TIMER_CNTR0, count >> 8 & 0xff); - } + } -} +} int clockIsOn(const rtems_irq_connect_data* unused) { @@ -176,8 +176,8 @@ static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER, clockOn, clockOff, clockIsOn}; - - + + /*-------------------------------------------------------------------------+ | Clock device driver INITIALIZE entry point. @@ -195,14 +195,14 @@ Clock_initialize(rtems_device_major_number major, rtems_fatal_error_occurred(1); } /* make major/minor avail to others such as shared memory driver */ - + rtems_clock_major = major; rtems_clock_minor = minor; - + return RTEMS_SUCCESSFUL; } /* Clock_initialize */ - + /*-------------------------------------------------------------------------+ | Console device driver CONTROL entry point +--------------------------------------------------------------------------*/ @@ -214,12 +214,12 @@ Clock_control(rtems_device_major_number major, if (pargp != NULL) { rtems_libio_ioctl_args_t *args = pargp; - + /*-------------------------------------------------------------------------+ | This is hokey, but until we get a defined interface to do this, it will | just be this simple... +-------------------------------------------------------------------------*/ - + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) clockIsr(); else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) diff --git a/c/src/lib/libbsp/i386/pc386/clock/rtc.c b/c/src/lib/libbsp/i386/pc386/clock/rtc.c index 401220bf6d..26c4c2056d 100644 --- a/c/src/lib/libbsp/i386/pc386/clock/rtc.c +++ b/c/src/lib/libbsp/i386/pc386/clock/rtc.c @@ -79,9 +79,9 @@ | Description: Convert 2 digit number to its BCD representation. | Global Variables: None. | Arguments: i - Number to convert. -| Returns: BCD representation of number. +| Returns: BCD representation of number. +--------------------------------------------------------------------------*/ -static inline uint8_t +static inline uint8_t bcd(uint8_t i) { return ((i / 16) * 10 + (i % 16)); @@ -99,9 +99,9 @@ bcd(uint8_t i) | Description: Convert years to seconds (since 1970). | Global Variables: None. | Arguments: y - year to convert (1970 <= y <= 2100). -| Returns: number of seconds since 1970. +| Returns: number of seconds since 1970. +--------------------------------------------------------------------------*/ -static inline uint32_t +static inline uint32_t ytos(uint16_t y) { /* v NUM LEAP YEARS v */ return ((y - 1970) * SECS_PER_REG_YEAR + (y - 1970 + 1) / 4 * SECS_PER_DAY); @@ -113,9 +113,9 @@ ytos(uint16_t y) | Description: Convert months to seconds since January. | Global Variables: None. | Arguments: m - month to convert, leap - is this a month of a leap year. -| Returns: number of seconds since January. +| Returns: number of seconds since January. +--------------------------------------------------------------------------*/ -static inline uint32_t +static inline uint32_t mtos(uint8_t m, rtems_boolean leap) { static uint16_t daysMonth[] = { 0, 0, 31, 59, 90, 120, 151, 181, @@ -132,9 +132,9 @@ mtos(uint8_t m, rtems_boolean leap) | Description: Perform action on RTC and return its result. | Global Variables: None. | Arguments: what - what to write to RTC port (what to do). -| Returns: result received from RTC port after action performed. +| Returns: result received from RTC port after action performed. +--------------------------------------------------------------------------*/ -static inline uint8_t +static inline uint8_t rtcin(uint8_t what) { uint8_t r; @@ -153,7 +153,7 @@ rtcin(uint8_t what) | Description: Initialize real-time clock (RTC). | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void init_rtc(void) @@ -181,7 +181,7 @@ init_rtc(void) | Description: Read present time from RTC and return it. | Global Variables: None. | Arguments: tod - to return present time in 'rtems_time_of_day' format. -| Returns: number of seconds from 1970/01/01 corresponding to 'tod'. +| Returns: number of seconds from 1970/01/01 corresponding to 'tod'. +--------------------------------------------------------------------------*/ long int rtc_read(rtems_time_of_day *tod) @@ -201,7 +201,7 @@ rtc_read(rtems_time_of_day *tod) sa = rtcin(RTC_STATUSA); tod->year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */ - if (tod->year < 1970) tod->year += 100; + if (tod->year < 1970) tod->year += 100; tod->month = bcd(rtcin(RTC_MONTH)); /* month */ tod->day = bcd(rtcin(RTC_DAY)); /* day */ (void) bcd(rtcin(RTC_WDAY)); /* weekday */ diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c index 7a1ad2dbd6..a0b468e52b 100644 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ b/c/src/lib/libbsp/i386/pc386/console/console.c @@ -96,7 +96,7 @@ isr_on(const rtems_irq_connect_data *unused) { return; } - + static void isr_off(const rtems_irq_connect_data *unused) { @@ -151,9 +151,9 @@ void __assert (const char *file, int line, const char *msg) { static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot..."; unsigned char ch; - + /* - * Note we cannot call exit or printf from here, + * Note we cannot call exit or printf from here, * assert can fail inside ISR too */ @@ -218,13 +218,13 @@ console_initialize(rtems_device_major_number major, { /* Install keyboard interrupt handler */ status = BSP_install_rtems_irq_handler(&console_isr_data); - + if (!status) { printk("Error installing keyboard interrupt handler!\n"); rtems_fatal_error_occurred(status); } - + status = rtems_io_register_name("/dev/console", major, 0); if (status != RTEMS_SUCCESSFUL) { @@ -240,14 +240,14 @@ console_initialize(rtems_device_major_number major, */ /* 9600-8-N-1 */ BSP_uart_init(BSPConsolePort, 9600, CHR_8_BITS, 0, 0, 0); - - + + /* Set interrupt handler */ if(BSPConsolePort == BSP_UART_COM1) { console_isr_data.name = BSP_UART_COM1_IRQ; console_isr_data.hdl = BSP_uart_termios_isr_com1; - + } else { @@ -322,7 +322,7 @@ console_open(rtems_device_major_number major, void *arg) { rtems_status_code status; - static rtems_termios_callbacks cb = + static rtems_termios_callbacks cb = { NULL, /* firstOpen */ console_last_close, /* lastClose */ @@ -338,7 +338,7 @@ console_open(rtems_device_major_number major, { /* Let's set the routines for termios to poll the - * Kbd queue for data + * Kbd queue for data */ cb.pollRead = kbd_poll_read; cb.outputUsesInterrupts = 0; @@ -371,9 +371,9 @@ console_open(rtems_device_major_number major, /* * Pass data area info down to driver */ - BSP_uart_termios_set(BSPConsolePort, + BSP_uart_termios_set(BSPConsolePort, ((rtems_libio_open_close_args_t *)arg)->iop->data1); - + /* Enable interrupts on channel */ BSP_uart_intr_ctrl(BSPConsolePort, BSP_UART_INTR_CTRL_TERMIOS); @@ -391,7 +391,7 @@ console_close(rtems_device_major_number major, return rtems_termios_close (arg); } /* console_close */ - + /*-------------------------------------------------------------------------+ | Console device driver READ entry point. +--------------------------------------------------------------------------+ @@ -404,7 +404,7 @@ console_read(rtems_device_major_number major, { return rtems_termios_read( arg ); } /* console_read */ - + /*-------------------------------------------------------------------------+ | Console device driver WRITE entry point. @@ -424,7 +424,7 @@ console_write(rtems_device_major_number major, { return rtems_termios_write (arg); } - + /* write data to VGA */ ibmpc_console_write( minor, buffer, maximum ); rw_args->bytes_moved = maximum; @@ -433,18 +433,18 @@ console_write(rtems_device_major_number major, extern int vt_ioctl( unsigned int cmd, unsigned long arg); - + /* * Handle ioctl request. */ -rtems_device_driver +rtems_device_driver console_control(rtems_device_major_number major, rtems_device_minor_number minor, void * arg ) -{ +{ rtems_libio_ioctl_args_t *args = arg; - switch (args->command) + switch (args->command) { default: if( vt_ioctl( args->command, (unsigned long)args->buffer ) != 0 ) @@ -469,45 +469,45 @@ conSetAttr(int minor, const struct termios *t) { unsigned long baud, databits, parity, stopbits; - switch (t->c_cflag & CBAUD) + switch (t->c_cflag & CBAUD) { - case B50: + case B50: baud = 50; break; - case B75: - baud = 75; + case B75: + baud = 75; break; - case B110: - baud = 110; + case B110: + baud = 110; break; - case B134: - baud = 134; + case B134: + baud = 134; break; - case B150: - baud = 150; + case B150: + baud = 150; break; case B200: - baud = 200; + baud = 200; break; - case B300: + case B300: baud = 300; break; - case B600: - baud = 600; + case B600: + baud = 600; break; - case B1200: + case B1200: baud = 1200; break; - case B1800: - baud = 1800; + case B1800: + baud = 1800; break; - case B2400: + case B2400: baud = 2400; break; - case B4800: + case B4800: baud = 4800; break; - case B9600: + case B9600: baud = 9600; break; case B19200: @@ -516,7 +516,7 @@ conSetAttr(int minor, const struct termios *t) case B38400: baud = 38400; break; - case B57600: + case B57600: baud = 57600; break; case B115200: @@ -542,7 +542,7 @@ conSetAttr(int minor, const struct termios *t) /* No parity */ parity = 0; } - + switch (t->c_cflag & CSIZE) { case CS5: databits = CHR_5_BITS; break; case CS6: databits = CHR_6_BITS; break; @@ -569,7 +569,7 @@ conSetAttr(int minor, const struct termios *t) * BSP initialization */ -BSP_output_char_function_type BSP_output_char = +BSP_output_char_function_type BSP_output_char = (BSP_output_char_function_type) _IBMPC_outch; BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input; diff --git a/c/src/lib/libbsp/i386/pc386/console/defkeymap.c b/c/src/lib/libbsp/i386/pc386/console/defkeymap.c index ce5e918fb5..a6bf5103a1 100644 --- a/c/src/lib/libbsp/i386/pc386/console/defkeymap.c +++ b/c/src/lib/libbsp/i386/pc386/console/defkeymap.c @@ -154,34 +154,34 @@ unsigned int keymap_count = 7; */ char func_buf[] = { - '\033', '[', '[', 'A', 0, - '\033', '[', '[', 'B', 0, - '\033', '[', '[', 'C', 0, - '\033', '[', '[', 'D', 0, - '\033', '[', '[', 'E', 0, - '\033', '[', '1', '7', '~', 0, - '\033', '[', '1', '8', '~', 0, - '\033', '[', '1', '9', '~', 0, - '\033', '[', '2', '0', '~', 0, - '\033', '[', '2', '1', '~', 0, - '\033', '[', '2', '3', '~', 0, - '\033', '[', '2', '4', '~', 0, - '\033', '[', '2', '5', '~', 0, - '\033', '[', '2', '6', '~', 0, - '\033', '[', '2', '8', '~', 0, - '\033', '[', '2', '9', '~', 0, - '\033', '[', '3', '1', '~', 0, - '\033', '[', '3', '2', '~', 0, - '\033', '[', '3', '3', '~', 0, - '\033', '[', '3', '4', '~', 0, - '\033', '[', '1', '~', 0, - '\033', '[', '2', '~', 0, - '\033', '[', '3', '~', 0, - '\033', '[', '4', '~', 0, - '\033', '[', '5', '~', 0, - '\033', '[', '6', '~', 0, - '\033', '[', 'M', 0, - '\033', '[', 'P', 0, + '\033', '[', '[', 'A', 0, + '\033', '[', '[', 'B', 0, + '\033', '[', '[', 'C', 0, + '\033', '[', '[', 'D', 0, + '\033', '[', '[', 'E', 0, + '\033', '[', '1', '7', '~', 0, + '\033', '[', '1', '8', '~', 0, + '\033', '[', '1', '9', '~', 0, + '\033', '[', '2', '0', '~', 0, + '\033', '[', '2', '1', '~', 0, + '\033', '[', '2', '3', '~', 0, + '\033', '[', '2', '4', '~', 0, + '\033', '[', '2', '5', '~', 0, + '\033', '[', '2', '6', '~', 0, + '\033', '[', '2', '8', '~', 0, + '\033', '[', '2', '9', '~', 0, + '\033', '[', '3', '1', '~', 0, + '\033', '[', '3', '2', '~', 0, + '\033', '[', '3', '3', '~', 0, + '\033', '[', '3', '4', '~', 0, + '\033', '[', '1', '~', 0, + '\033', '[', '2', '~', 0, + '\033', '[', '3', '~', 0, + '\033', '[', '4', '~', 0, + '\033', '[', '5', '~', 0, + '\033', '[', '6', '~', 0, + '\033', '[', 'M', 0, + '\033', '[', 'P', 0, }; char *funcbufptr = func_buf; diff --git a/c/src/lib/libbsp/i386/pc386/console/fb_vga.c b/c/src/lib/libbsp/i386/pc386/console/fb_vga.c index 29b840f728..8c678b8081 100644 --- a/c/src/lib/libbsp/i386/pc386/console/fb_vga.c +++ b/c/src/lib/libbsp/i386/pc386/console/fb_vga.c @@ -3,14 +3,47 @@ // $Header$ // // Copyright (c) 2000 - Rosimildo da Silva ( rdasilva@connecttel.com ) -// +// // MODULE DESCRIPTION: -// This module implements the micro FB driver for "Bare VGA". It uses the +// This module implements the micro FB driver for "Bare VGA". It uses the // routines for "bare hardware" that comes with MicroWindows. // // MODIFICATION/HISTORY: // // $Log$ +// Revision 1.1 2000/08/30 08:15:30 joel +// 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> +// +// * Major rework of the "/dev/console" driver. +// * Added termios support for stdin ( keyboard ). +// * Added ioctls() to support modes similar to Linux( XLATE, +// RAW, MEDIUMRAW ). +// * Added Keyboard mapping and handling of the keyboard's leds. +// * Added Micro FrameBuffer driver ( "/dev/fb0" ) for bare VGA +// controller ( 16 colors ). +// * Added PS/2 and Serial mouse support for PC386 BSP. +// * console/defkeymap.c: New file. +// * console/fb_vga.c: New file. +// * console/fb_vga.h: New file. +// * console/i386kbd.h: New file. +// * console/kd.h: New file. +// * console/keyboard.c: New file. +// * console/keyboard.h: New file. +// * console/mouse_parser.c: New file. +// * console/mouse_parser.h: New file. +// * console/pc_keyb.c: New file. +// * console/ps2_drv.h: New file. +// * console/ps2_mouse.c: New file. +// * console/ps2_mouse.h: New file. +// * console/serial_mouse.c: New file. +// * console/serial_mouse.h: New file. +// * console/vgainit.c: New file. +// * console/vt.c: New file. +// * console/Makefile.am: Reflect new files. +// * console/console.c, console/inch.c, console/outch.c: Console +// functionality modifications. +// * startup/Makefile.am: Pick up tty_drv.c and gdb_glue.c +// // ///////////////////////////////////////////////////////////////////////////// */ @@ -28,14 +61,14 @@ /* these routines are defined in the microwindows code. This driver is here more as an example of how to implement and - use the micro FB interface + use the micro FB interface */ extern void ega_hwinit( void ); extern void ega_hwterm( void ); /* screen information for the VGA driver */ -static struct fb_screeninfo fb_info = +static struct fb_screeninfo fb_info = { 640, 480, /* screen size x, y */ 4, /* bits per pixel */ @@ -109,7 +142,7 @@ fbvga_close(rtems_device_major_number major, return RTEMS_SUCCESSFUL; } - + /* * fbvga device driver READ entry point. * Read characters from the PS/2 mouse. @@ -124,7 +157,7 @@ fbvga_read( rtems_device_major_number major, rw_args->bytes_moved = 0; return RTEMS_SUCCESSFUL; } - + /* * fbvga device driver WRITE entry point. @@ -187,15 +220,15 @@ static int set_palette( struct fb_cmap *cmap ) * IOCTL entry point -- This method is called to carry * all services of this interface. */ -rtems_device_driver +rtems_device_driver fbvga_control( rtems_device_major_number major, rtems_device_minor_number minor, void * arg ) -{ +{ rtems_libio_ioctl_args_t *args = arg; printk( "FBVGA ioctl called, cmd=%x\n", args->command ); - switch( args->command ) + switch( args->command ) { case FB_SCREENINFO: args->ioctl_return = get_screen_info( args->buffer ); @@ -208,7 +241,7 @@ fbvga_control( rtems_device_major_number major, break; /* this function would execute one of the routines of the - * interface based on the operation requested + * interface based on the operation requested */ case FB_EXEC_FUNCTION: { diff --git a/c/src/lib/libbsp/i386/pc386/console/fb_vga.h b/c/src/lib/libbsp/i386/pc386/console/fb_vga.h index 6587e7474d..643c892949 100644 --- a/c/src/lib/libbsp/i386/pc386/console/fb_vga.h +++ b/c/src/lib/libbsp/i386/pc386/console/fb_vga.h @@ -5,8 +5,8 @@ * $Header$ * * Copyright (c) 2000 -- Rosimildo da Silva. - * - * MODULE DESCRIPTION: + * + * MODULE DESCRIPTION: * Prototype routines for the fbvga driver. * * by: Rosimildo da Silva: @@ -16,6 +16,9 @@ * MODIFICATION/HISTORY: * * $Log$ + * Revision 1.2 2004/04/15 13:26:12 ralf + * Remove stray white spaces. + * * Revision 1.1 2000/08/30 08:15:30 joel * 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> * diff --git a/c/src/lib/libbsp/i386/pc386/console/i386kbd.h b/c/src/lib/libbsp/i386/pc386/console/i386kbd.h index 5bd0365ae4..c3fe9463a6 100644 --- a/c/src/lib/libbsp/i386/pc386/console/i386kbd.h +++ b/c/src/lib/libbsp/i386/pc386/console/i386kbd.h @@ -183,6 +183,6 @@ extern unsigned char aux_device_present; but then the read function would need a lock etc - ick */ -#define mark_bh(x) +#define mark_bh(x) #endif /* _I386_KEYBOARD_H */ diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c index 7997a6b246..264b0ae0a4 100644 --- a/c/src/lib/libbsp/i386/pc386/console/inch.c +++ b/c/src/lib/libbsp/i386/pc386/console/inch.c @@ -64,7 +64,7 @@ static char shift_map[] = '*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,'7','8','9',0x80,'4','5','6',0x80, '1','2','3','0',177 -}; /* Keyboard scancode -> character map with SHIFT key modifier. */ +}; /* Keyboard scancode -> character map with SHIFT key modifier. */ static unsigned short kbd_buffer[KBD_BUF_SIZE]; @@ -175,7 +175,7 @@ _IBMPC_scankey(char *outChar) break; case 0x53: - if (ctrl_pressed && alt_pressed) + if (ctrl_pressed && alt_pressed) rtemsReboot(); /* ctrl+alt+del -> reboot */ break; @@ -256,11 +256,11 @@ _IBMPC_inch(void) return c; } /* _IBMPC_inch */ - + /* * Routine that can be used before interrupt management is initialized. */ - + char BSP_wait_polled_input(void) { diff --git a/c/src/lib/libbsp/i386/pc386/console/kd.h b/c/src/lib/libbsp/i386/pc386/console/kd.h index 7833abfa9d..963c8cc935 100644 --- a/c/src/lib/libbsp/i386/pc386/console/kd.h +++ b/c/src/lib/libbsp/i386/pc386/console/kd.h @@ -5,11 +5,44 @@ // MODULE DESCRIPTION: // // This module was based on the Linux version kd.h -// +// // by: Rosimildo da Silva: rdasilva@connecttel.com // // MODIFICATION/HISTORY: // $Log$ +// Revision 1.1 2000/08/30 08:15:30 joel +// 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> +// +// * Major rework of the "/dev/console" driver. +// * Added termios support for stdin ( keyboard ). +// * Added ioctls() to support modes similar to Linux( XLATE, +// RAW, MEDIUMRAW ). +// * Added Keyboard mapping and handling of the keyboard's leds. +// * Added Micro FrameBuffer driver ( "/dev/fb0" ) for bare VGA +// controller ( 16 colors ). +// * Added PS/2 and Serial mouse support for PC386 BSP. +// * console/defkeymap.c: New file. +// * console/fb_vga.c: New file. +// * console/fb_vga.h: New file. +// * console/i386kbd.h: New file. +// * console/kd.h: New file. +// * console/keyboard.c: New file. +// * console/keyboard.h: New file. +// * console/mouse_parser.c: New file. +// * console/mouse_parser.h: New file. +// * console/pc_keyb.c: New file. +// * console/ps2_drv.h: New file. +// * console/ps2_mouse.c: New file. +// * console/ps2_mouse.h: New file. +// * console/serial_mouse.c: New file. +// * console/serial_mouse.h: New file. +// * console/vgainit.c: New file. +// * console/vt.c: New file. +// * console/Makefile.am: Reflect new files. +// * console/console.c, console/inch.c, console/outch.c: Console +// functionality modifications. +// * startup/Makefile.am: Pick up tty_drv.c and gdb_glue.c +// // ///////////////////////////////////////////////////////////////////////////// */ diff --git a/c/src/lib/libbsp/i386/pc386/console/keyboard.c b/c/src/lib/libbsp/i386/pc386/console/keyboard.c index bcae056b97..0be2ef4e15 100644 --- a/c/src/lib/libbsp/i386/pc386/console/keyboard.c +++ b/c/src/lib/libbsp/i386/pc386/console/keyboard.c @@ -14,7 +14,7 @@ * `Sticky' modifier keys, 951006. * * 11-11-96: SAK should now work in the raw mode (Martin Mares) - * + * * Modified to provide 'generic' keyboard support by Hamish Macdonald * Merge with the m68k keyboard driver and split-off of the PC low-level * parts by Geert Uytterhoeven, May 1997 @@ -24,7 +24,7 @@ * ------------------------------------------------------------------- * End of Linux - Copyright notes... * - * Ported to RTEMS to provide the basic fuctionality to the console driver. + * Ported to RTEMS to provide the basic fuctionality to the console driver. * by: Rosimildo da Silva: rdasilva@connecttel.com * */ @@ -110,9 +110,9 @@ static unsigned char k_down[NR_SHIFT] = {0, }; static unsigned long key_down[256/BITS_PER_LONG] = { 0, }; static int dead_key_next = 0; -/* +/* * In order to retrieve the shift_state (for the mouse server), either - * the variable must be global, or a new procedure must be created to + * the variable must be global, or a new procedure must be created to * return the value. I chose the former way. */ int shift_state = 0; diff --git a/c/src/lib/libbsp/i386/pc386/console/keyboard.h b/c/src/lib/libbsp/i386/pc386/console/keyboard.h index ab4c669b15..2946235039 100644 --- a/c/src/lib/libbsp/i386/pc386/console/keyboard.h +++ b/c/src/lib/libbsp/i386/pc386/console/keyboard.h @@ -5,11 +5,17 @@ // MODULE DESCRIPTION: // // This module was based on the Linux version keyboard.h + kbd_kern.h -// +// // by: Rosimildo da Silva: rdasilva@connecttel.com // // MODIFICATION/HISTORY: // $Log$ +// Revision 1.2 2000/08/30 17:06:23 joel +// 2000-08-30 Joel Sherrill <joel@OARcorp.com> +// +// * console/keyboard.h: Changed numerous routines from extern inline +// to static inline. +// // Revision 1.1 2000/08/30 08:15:30 joel // 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> // diff --git a/c/src/lib/libbsp/i386/pc386/console/mouse_parser.c b/c/src/lib/libbsp/i386/pc386/console/mouse_parser.c index bb49a3906a..308ace335f 100644 --- a/c/src/lib/libbsp/i386/pc386/console/mouse_parser.c +++ b/c/src/lib/libbsp/i386/pc386/console/mouse_parser.c @@ -5,7 +5,7 @@ * provided that this copyright notice remains intact. * * UNIX Serial Port Mouse Driver - * + * * This driver opens a serial port directly, and interprets serial data. * Microsoft, PC, Logitech and PS/2 mice are supported. * The PS/2 mouse is only supported if the OS runs the mouse @@ -148,7 +148,7 @@ int MOU_Data( int ch, COORD *dx, COORD *dy, COORD *dz, BUTTON *bptr) * When a complete state has been read, return the results, * leaving further bytes in the buffer for later calls. */ - if( (*parse)( ch ) ) + if( (*parse)( ch ) ) { *dx = xd; *dy = yd; @@ -268,7 +268,7 @@ static int ParsePS2(int byte) switch (state) { case IDLE: if (byte & PS2_CTRL_BYTE) { - buttons = byte & + buttons = byte & (PS2_LEFT_BUTTON|PS2_RIGHT_BUTTON); state = XSET; } @@ -372,7 +372,7 @@ static void kbd_parser( void *ptr, unsigned short keycode, unsigned long mods ) m.m.kbd.modifiers = kbd->ledflagstate; m.m.kbd.mode = kbd->kbdmode; /* printk( "kbd: msg: keycode=%X, mod=%X\n", keycode, mods ); */ - rtems_message_queue_send( queue_id, ( void * )&m, + rtems_message_queue_send( queue_id, ( void * )&m, sizeof( struct MW_UID_MESSAGE ) ); } diff --git a/c/src/lib/libbsp/i386/pc386/console/mouse_parser.h b/c/src/lib/libbsp/i386/pc386/console/mouse_parser.h index 0adc9be55a..40d491f2c4 100644 --- a/c/src/lib/libbsp/i386/pc386/console/mouse_parser.h +++ b/c/src/lib/libbsp/i386/pc386/console/mouse_parser.h @@ -8,9 +8,9 @@ extern "C" { #endif /* Use the same definitions as the user interface */ -#define RBUTTON MV_BUTTON_RIGHT -#define MBUTTON MV_BUTTON_CENTER -#define LBUTTON MV_BUTTON_LEFT +#define RBUTTON MV_BUTTON_RIGHT +#define MBUTTON MV_BUTTON_CENTER +#define LBUTTON MV_BUTTON_LEFT typedef int COORD; /* device coordinates*/ typedef unsigned int BUTTON; /* mouse button mask*/ diff --git a/c/src/lib/libbsp/i386/pc386/console/outch.c b/c/src/lib/libbsp/i386/pc386/console/outch.c index e32f361476..ae6cb6d288 100644 --- a/c/src/lib/libbsp/i386/pc386/console/outch.c +++ b/c/src/lib/libbsp/i386/pc386/console/outch.c @@ -37,12 +37,12 @@ static unsigned char column; static unsigned short attribute; static unsigned int nLines; -static void +static void scroll(void) { int i, j; /* Counters */ unsigned short *pt_scroll, *pt_bitmap; /* Pointers on the bit-map */ - + pt_bitmap = bitMapBaseAddr; j = 0; pt_bitmap = pt_bitmap + j; @@ -50,11 +50,11 @@ scroll(void) for (i = j; i < (maxRow - 1) * maxCol; i++) { *pt_bitmap++ = *pt_scroll++; } - + /* * Blank characters are displayed on the last line. - */ - for (i = 0; i < maxCol; i++) { + */ + for (i = 0; i < maxCol; i++) { *pt_bitmap++ = (short) (' ' | attribute); } } @@ -63,9 +63,9 @@ static void doCRNL(int cr, int nl) { if (nl) { - if (++row == maxRow) { + if (++row == maxRow) { scroll(); /* Scroll the screen now */ - row = maxRow - 1; + row = maxRow - 1; } nLines++; } @@ -102,7 +102,7 @@ gotorc(int r, int c) #define BLANK ((char)0x7f) -static void +static void videoPutChar(char car) { unsigned short *pt_bitmap = bitMapBaseAddr + row * maxCol + column; @@ -123,7 +123,7 @@ videoPutChar(char car) doCRNL(1,1); return; } - while (i--) *pt_bitmap++ = ' ' | attribute; + while (i--) *pt_bitmap++ = ' ' | attribute; wr_cursor(row * maxCol + column, ioCrtBaseAddr); return; } @@ -134,7 +134,7 @@ videoPutChar(char car) case 7: { /* Bell code must be inserted here */ return; } - case '\r' : { + case '\r' : { doCRNL(1,0); return; } @@ -149,7 +149,7 @@ videoPutChar(char car) return; } } -} +} /* trivial state machine to handle escape sequences: * @@ -161,9 +161,9 @@ videoPutChar(char car) * ^\ \ \ \ * KEY: | \other \ other \ other \ other * <------------------------------------- - * + * * in state '-1', the DCABHKJ cases are handled - * + * * (cursor motion and screen clearing) */ @@ -262,7 +262,7 @@ clear_screen(void) | Description: Higher level (console) interface to consPutc. | Global Variables: None. | Arguments: c - character to write to console. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void _IBMPC_outch(char c) @@ -280,7 +280,7 @@ static int escaped = 0; | Global Variables: bitMapBaseAddr, ioCrtBaseAddr, maxCol, maxRow, row | column, attribute, nLines; | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void _IBMPC_initVideo(void) @@ -301,7 +301,7 @@ _IBMPC_initVideo(void) attribute = ((BLACK << 4) | WHITE)<<8; nLines = 0; clear_screen(); -#ifdef DEBUG_EARLY_STAGE +#ifdef DEBUG_EARLY_STAGE printk("bitMapBaseAddr = %X, display controller base IO = %X\n", (unsigned) bitMapBaseAddr, (unsigned) ioCrtBaseAddr); diff --git a/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c b/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c index d9feaca1b4..074d84e38a 100644 --- a/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c +++ b/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c @@ -369,7 +369,7 @@ static unsigned char handle_kbd_event(void) } status = kbd_read_status(); - + if(!work--) { printk( "pc_keyb: controller jammed (0x%02X).\n", status); @@ -378,10 +378,10 @@ static unsigned char handle_kbd_event(void) return status; } - /* - * the commands to set the leds for some reason, returns 0x14, 0x16 + /* + * the commands to set the leds for some reason, returns 0x14, 0x16 * and I am intepreting as an ACK, because the original code from - * Linux was timeing out here... + * Linux was timeing out here... */ acknowledge = 1; reply_expected = 0; @@ -595,7 +595,7 @@ static char * initialize_kbd(void) kbd_wait_for_input(); } - + kbd_write_output_w(KBD_CMD_ENABLE); if (kbd_wait_for_input() != KBD_REPLY_ACK) return "Enable keyboard: no ACK"; diff --git a/c/src/lib/libbsp/i386/pc386/console/ps2_drv.h b/c/src/lib/libbsp/i386/pc386/console/ps2_drv.h index 0a035c1a67..bfa9c2a32a 100644 --- a/c/src/lib/libbsp/i386/pc386/console/ps2_drv.h +++ b/c/src/lib/libbsp/i386/pc386/console/ps2_drv.h @@ -5,7 +5,7 @@ * $Header$ * * Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved. - * + * * MODULE DESCRIPTION: Prototype routines for the paux driver. * * by: Rosimildo da Silva: @@ -15,6 +15,9 @@ * MODIFICATION/HISTORY: * * $Log$ + * Revision 1.2 2004/04/15 13:26:12 ralf + * Remove stray white spaces. + * * Revision 1.1 2000/08/30 08:15:30 joel * 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> * diff --git a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c index 8f24e1a706..5149822229 100644 --- a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c +++ b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c @@ -82,7 +82,7 @@ isr_on(const rtems_irq_connect_data *unused) { return; } - + static void isr_off(const rtems_irq_connect_data *unused) { @@ -126,7 +126,7 @@ static void kb_wait(void) if (! (status & KBD_STAT_IBF)) return; - mdelay(1); + mdelay(1); timeout--; } while (timeout); @@ -463,11 +463,11 @@ size_t read_aux(char * buffer, size_t count ) size_t i = count; unsigned char c; - if (queue_empty()) + if (queue_empty()) { return 0; } - while (i > 0 && !queue_empty()) + while (i > 0 && !queue_empty()) { c = get_from_queue(); *buffer++ = c; @@ -591,7 +591,7 @@ static int paux_last_close(int major, int minor, void *arg) * It does nothing write now. */ static int write_aux_echo( int minor, const char * buffer, int count ) -{ +{ return 0; } @@ -617,7 +617,7 @@ paux_open(rtems_device_major_number major, void *arg) { rtems_status_code status; - static rtems_termios_callbacks cb = + static rtems_termios_callbacks cb = { NULL, /* firstOpen */ paux_last_close, /* lastClose */ @@ -645,7 +645,7 @@ paux_close(rtems_device_major_number major, return (rtems_termios_close (arg)); } - + /* * paux device driver READ entry point. * Read characters from the PS/2 mouse. @@ -657,7 +657,7 @@ paux_read(rtems_device_major_number major, { return rtems_termios_read (arg); } /* tty_read */ - + /* * paux device driver WRITE entry point. @@ -675,18 +675,18 @@ paux_write(rtems_device_major_number major, return RTEMS_SUCCESSFUL; } /* tty_write */ - + /* * Handle ioctl request. */ -rtems_device_driver +rtems_device_driver paux_control(rtems_device_major_number major, rtems_device_minor_number minor, void * arg ) -{ +{ rtems_libio_ioctl_args_t *args = arg; - switch( args->command ) + switch( args->command ) { default: return rtems_termios_ioctl (arg); diff --git a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.h b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.h index 1236e8cff2..4a3d083f1c 100644 --- a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.h +++ b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.h @@ -6,7 +6,7 @@ * RTEMS port: by Rosimildo da Silva. * * This module was ported from Linux. - * + * */ /* diff --git a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c index 184911c58f..b34d13b41c 100644 --- a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c +++ b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c @@ -7,7 +7,7 @@ * as /dev/ttyS1 for COM1 and /dev/ttyS2 as COM2. If one of the ports * is used as the console, this driver would fail to initialize. * - * This code was based on the console driver. It is based on the + * This code was based on the console driver. It is based on the * current termios framework. This is just a shell around the * termios support. * @@ -18,6 +18,12 @@ * MODIFICATION/HISTORY: * * $Log$ + * Revision 1.5 2000/12/05 16:37:38 joel + * 2000-12-01 Joel Sherrill <joel@OARcorp.com> + * + * * pc386/console/console.c, pc386/console/serial_mouse.c, + * pc386/console/vgainit.c, shared/comm/tty_drv.c: Remove warnings. + * * Revision 1.4 2000/10/23 14:10:25 joel * 2000-10-23 Joel Sherrill <joel@OARcorp.com> * @@ -80,8 +86,8 @@ extern int BSPConsolePort; /* * Interrupt structure for serial_mouse */ -static rtems_irq_connect_data serial_mouse_isr_data = -{ +static rtems_irq_connect_data serial_mouse_isr_data = +{ BSP_UART_IRQ, BSP_ISR_FUNC, isr_on, @@ -92,7 +98,7 @@ static void isr_on(const rtems_irq_connect_data *unused) { return; } - + static void isr_off(const rtems_irq_connect_data *unused) { return; @@ -131,7 +137,7 @@ serial_mouse_initialize(rtems_device_major_number major, * Set up TERMIOS */ rtems_termios_initialize(); - + /* * Do device-specific initialization */ @@ -172,7 +178,7 @@ serial_mouse_open(rtems_device_major_number major, void *arg) { rtems_status_code status; - static rtems_termios_callbacks cb = + static rtems_termios_callbacks cb = { NULL, /* firstOpen */ serial_mouse_last_close, /* lastClose */ @@ -194,7 +200,7 @@ serial_mouse_open(rtems_device_major_number major, /* * Pass data area info down to driver */ - BSP_uart_termios_set( BSP_UART_PORT, + BSP_uart_termios_set( BSP_UART_PORT, ((rtems_libio_open_close_args_t *)arg)->iop->data1 ); /* Enable interrupts on channel */ BSP_uart_intr_ctrl( BSP_UART_PORT, BSP_UART_INTR_CTRL_TERMIOS); @@ -211,10 +217,10 @@ serial_mouse_close(rtems_device_major_number major, { return (rtems_termios_close (arg)); - + } /* tty_close */ - + /* * TTY device driver READ entry point. * Read characters from the tty device. @@ -226,7 +232,7 @@ serial_mouse_read(rtems_device_major_number major, { return rtems_termios_read (arg); } /* tty_read */ - + /* * TTY device driver WRITE entry point. @@ -238,7 +244,7 @@ serial_mouse_write(rtems_device_major_number major, void * arg) { return rtems_termios_write (arg); - + } /* tty_write */ /* @@ -246,9 +252,9 @@ serial_mouse_write(rtems_device_major_number major, * routine to handle both devices. */ static rtems_device_driver serial_mouse_control_internal( int port, void *arg ) -{ +{ rtems_libio_ioctl_args_t *args = arg; - switch( args->command ) + switch( args->command ) { default: return rtems_termios_ioctl (arg); @@ -271,12 +277,12 @@ static rtems_device_driver serial_mouse_control_internal( int port, void *arg ) /* * Handle ioctl request for ttyS1. */ -rtems_device_driver +rtems_device_driver serial_mouse_control(rtems_device_major_number major, rtems_device_minor_number minor, void * arg ) -{ +{ return serial_mouse_control_internal( BSP_UART_PORT, arg ); } @@ -287,45 +293,45 @@ conSetAttr(int port, int minor, const struct termios *t) { unsigned long baud, databits, parity, stopbits; - switch (t->c_cflag & CBAUD) + switch (t->c_cflag & CBAUD) { - case B50: + case B50: baud = 50; break; - case B75: - baud = 75; + case B75: + baud = 75; break; - case B110: - baud = 110; + case B110: + baud = 110; break; - case B134: - baud = 134; + case B134: + baud = 134; break; - case B150: - baud = 150; + case B150: + baud = 150; break; case B200: - baud = 200; + baud = 200; break; - case B300: + case B300: baud = 300; break; - case B600: - baud = 600; + case B600: + baud = 600; break; - case B1200: + case B1200: baud = 1200; break; - case B1800: - baud = 1800; + case B1800: + baud = 1800; break; - case B2400: + case B2400: baud = 2400; break; - case B4800: + case B4800: baud = 4800; break; - case B9600: + case B9600: baud = 9600; break; case B19200: @@ -334,7 +340,7 @@ conSetAttr(int port, int minor, const struct termios *t) case B38400: baud = 38400; break; - case B57600: + case B57600: baud = 57600; break; case B115200: @@ -360,7 +366,7 @@ conSetAttr(int port, int minor, const struct termios *t) /* No parity */ parity = 0; } - + switch (t->c_cflag & CSIZE) { case CS5: databits = CHR_5_BITS; break; case CS6: databits = CHR_6_BITS; break; diff --git a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h index ded9b469f5..2a7385d453 100644 --- a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h +++ b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h @@ -5,7 +5,7 @@ * $Header$ * * Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved. - * + * * MODULE DESCRIPTION: Prototype routines for the /dev/mouse driver. * * by: Rosimildo da Silva: @@ -15,6 +15,9 @@ * MODIFICATION/HISTORY: * * $Log$ + * Revision 1.2 2004/04/15 13:26:12 ralf + * Remove stray white spaces. + * * Revision 1.1 2000/08/30 08:15:30 joel * 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> * @@ -98,7 +101,7 @@ rtems_device_driver serial_mouse_write( /* Select the mouse type: "ms","pc","ps2" */ -#define MOUSE_TYPE "ms" +#define MOUSE_TYPE "ms" /* Select the serial port for the serial mouse driver */ #define SERIAL_MOUSE_COM1 1 diff --git a/c/src/lib/libbsp/i386/pc386/console/videoAsm.S b/c/src/lib/libbsp/i386/pc386/console/videoAsm.S index 6c9b56e4af..e78b100c1c 100644 --- a/c/src/lib/libbsp/i386/pc386/console/videoAsm.S +++ b/c/src/lib/libbsp/i386/pc386/console/videoAsm.S @@ -1,7 +1,7 @@ /* * videoAsm.S - This file contains code for displaying cursor on the console * - * Copyright (C) 1998 valette@crf.canon.fr + * Copyright (C) 1998 valette@crf.canon.fr * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/c/src/lib/libbsp/i386/pc386/console/vt.c b/c/src/lib/libbsp/i386/pc386/console/vt.c index 0f38106332..631a7d532f 100644 --- a/c/src/lib/libbsp/i386/pc386/console/vt.c +++ b/c/src/lib/libbsp/i386/pc386/console/vt.c @@ -73,7 +73,7 @@ _kd_mksound(unsigned int hz, unsigned int ticks) if (hz > 20 && hz < 32767) count = 1193180 / hz; - + _CPU_ISR_Disable(level); /* del_timer(&sound_timer); */ if (count) { @@ -121,7 +121,7 @@ do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kb tmp = *user_kbe; if (i >= NR_KEYS || s >= MAX_NR_KEYMAPS) - return -EINVAL; + return -EINVAL; switch (cmd) { case KDGKBENT: @@ -147,7 +147,7 @@ do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kb #define HZ 100 -static inline int +static inline int do_kbkeycode_ioctl(int cmd, struct kbkeycode *user_kbkc, int perm) { struct kbkeycode tmp; @@ -177,7 +177,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm) /* * We handle the console-specific ioctl's here. We allow the - * capability to modify any console, not just the fg_console. + * capability to modify any console, not just the fg_console. */ int vt_ioctl( unsigned int cmd, unsigned long arg) { @@ -207,7 +207,7 @@ int vt_ioctl( unsigned int cmd, unsigned long arg) return -EPERM; { unsigned int ticks, count; - + /* * Generate the tone for the appropriate number of ticks. * If the time is zero, turn off sound ourselves. diff --git a/c/src/lib/libbsp/i386/pc386/ide/ide.c b/c/src/lib/libbsp/i386/pc386/ide/ide.c index 29f1f8a349..482fabd0eb 100644 --- a/c/src/lib/libbsp/i386/pc386/ide/ide.c +++ b/c/src/lib/libbsp/i386/pc386/ide/ide.c @@ -30,8 +30,8 @@ #include <libchip/ide_ctrl_io.h> /* #define DEBUG_OUT */ -/* - * support functions for IDE harddisk IF +/* + * support functions for IDE harddisk IF */ /*=========================================================================*\ | Function: | @@ -52,7 +52,7 @@ boolean pc386_ide_probe \*=========================================================================*/ { boolean ide_card_plugged = TRUE; /* assume: we have a disk here */ - + return ide_card_plugged; } @@ -160,9 +160,9 @@ void pc386_ide_read_block +---------------------------------------------------------------------------+ | Input Parameters: | \*-------------------------------------------------------------------------*/ - int minor, - uint16_t block_size, - blkdev_sg_buffer *bufs, + int minor, + uint16_t block_size, + blkdev_sg_buffer *bufs, uint32_t *cbuf, uint32_t *pos ) @@ -179,7 +179,7 @@ void pc386_ide_read_block ((uint8_t*)(bufs[(*cbuf)].buffer) + (*pos)); inport_byte(port+IDE_REGISTER_STATUS,status_val); - while ((status_val & IDE_REGISTER_STATUS_DRQ) && + while ((status_val & IDE_REGISTER_STATUS_DRQ) && (cnt < block_size)) { inport_word(port+IDE_REGISTER_DATA,*lbuf); @@ -187,7 +187,7 @@ void pc386_ide_read_block printk("0x%x ",*lbuf); #endif lbuf++; - cnt += sizeof(*lbuf); + cnt += sizeof(*lbuf); (*pos) += sizeof(*lbuf); if ((*pos) == llength) { (*pos) = 0; @@ -196,7 +196,7 @@ void pc386_ide_read_block llength = bufs[(*cbuf)].length; } inport_byte(port+IDE_REGISTER_STATUS,status_val); - } + } #ifdef DEBUG_OUT printk("pc386_ide_read_block()\r\n"); #endif @@ -213,9 +213,9 @@ void pc386_ide_write_block +---------------------------------------------------------------------------+ | Input Parameters: | \*-------------------------------------------------------------------------*/ - int minor, - uint16_t block_size, - blkdev_sg_buffer *bufs, + int minor, + uint16_t block_size, + blkdev_sg_buffer *bufs, uint32_t *cbuf, uint32_t *pos ) @@ -230,19 +230,19 @@ void pc386_ide_write_block uint8_t status_val; uint16_t *lbuf = (uint16_t*) ((uint8_t*)(bufs[(*cbuf)].buffer) + (*pos)); - + #ifdef DEBUG_OUT printk("pc386_ide_write_block()\r\n"); #endif inport_byte(port+IDE_REGISTER_STATUS,status_val); - while ((status_val & IDE_REGISTER_STATUS_DRQ) && + while ((status_val & IDE_REGISTER_STATUS_DRQ) && (cnt < block_size)) { #ifdef DEBUG_OUT printk("0x%x ",*lbuf); #endif outport_word(port+IDE_REGISTER_DATA,*lbuf); lbuf++; - cnt += sizeof(*lbuf); + cnt += sizeof(*lbuf); (*pos) += sizeof(*lbuf); if ((*pos) == llength) { (*pos) = 0; @@ -300,7 +300,7 @@ rtems_status_code pc386_ide_config_io_speed } /* - * The following table configures the functions used for IDE drivers + * The following table configures the functions used for IDE drivers * in this BSP. */ diff --git a/c/src/lib/libbsp/i386/pc386/ide/idecfg.c b/c/src/lib/libbsp/i386/pc386/ide/idecfg.c index d254bb5827..b84855a7b8 100644 --- a/c/src/lib/libbsp/i386/pc386/ide/idecfg.c +++ b/c/src/lib/libbsp/i386/pc386/ide/idecfg.c @@ -25,7 +25,7 @@ /* - * The following table configures the functions used for IDE drivers + * The following table configures the functions used for IDE drivers * in this BSP. */ @@ -48,5 +48,5 @@ ide_controller_bsp_table_t IDE_Controller_Table[] = { }; /* Number of rows in IDE_Controller_Table */ -unsigned long IDE_Controller_Count = +unsigned long IDE_Controller_Count = sizeof(IDE_Controller_Table)/sizeof(IDE_Controller_Table[0]); diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h index e9edef177a..ef5d43ea84 100644 --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h +++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h @@ -54,7 +54,7 @@ extern "C" { #include <rtems/clockdrv.h> #include <libcpu/cpu.h> #include <rtems/bspIo.h> - + /* * confdefs.h overrides for this BSP: * - number of termios serial ports @@ -104,8 +104,8 @@ extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int); | Video (console) related constants. +--------------------------------------------------------------------------*/ -#include <crt.h> - +#include <crt.h> + /*-------------------------------------------------------------------------+ | Constants relating to the 8254 (or 8253) programmable interval timers. +--------------------------------------------------------------------------*/ @@ -192,7 +192,7 @@ extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int); extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE]; extern segment_descriptors Global_descriptor_table [GDT_SIZE]; - + extern rtems_configuration_table BSP_Configuration; /* User provided BSP configuration table. */ extern uint32_t rtemsFreeMemStart; @@ -204,8 +204,8 @@ extern uint32_t rtemsFreeMemStart; +--------------------------------------------------------------------------*/ void _IBMPC_initVideo(void); /* from 'outch.c' */ void _IBMPC_outch (char); /* from 'outch.c' */ -char _IBMPC_inch (void); /* from 'inch.c' */ -char _IBMPC_inch_sleep (void); /* from 'inch.c' */ +char _IBMPC_inch (void); /* from 'inch.c' */ +char _IBMPC_inch_sleep (void); /* from 'inch.c' */ void rtemsReboot(void); /* from 'exit.c' */ diff --git a/c/src/lib/libbsp/i386/pc386/include/crt.h b/c/src/lib/libbsp/i386/pc386/include/crt.h index 526fcbe62a..c750777cfb 100644 --- a/c/src/lib/libbsp/i386/pc386/include/crt.h +++ b/c/src/lib/libbsp/i386/pc386/include/crt.h @@ -21,7 +21,7 @@ */ /* In monochrome */ -#define V_MONO 0xb0000 +#define V_MONO 0xb0000 /* In color */ #define V_COLOR 0xb8000 @@ -73,7 +73,7 @@ #define ON 1 -/* +/* * CRT Controller register offset definitions */ diff --git a/c/src/lib/libbsp/i386/pc386/include/wd80x3.h b/c/src/lib/libbsp/i386/pc386/include/wd80x3.h index 282faabdd1..5f7a1fa970 100644 --- a/c/src/lib/libbsp/i386/pc386/include/wd80x3.h +++ b/c/src/lib/libbsp/i386/pc386/include/wd80x3.h @@ -17,7 +17,7 @@ /* page 0 read or read/write registers */ -#define CMDR 0x00+RO +#define CMDR 0x00+RO #define CLDA0 0x01+RO /* current local dma addr 0 for read */ #define CLDA1 0x02+RO /* current local dma addr 1 for read */ #define BNRY 0x03+RO /* boundary reg for rd and wr */ @@ -63,7 +63,7 @@ /*-----CMDR command bits-----*/ #define MSK_STP 0x01 /* stop the chip */ -#define MSK_STA 0x02 /* start the chip */ +#define MSK_STA 0x02 /* start the chip */ #define MSK_TXP 0x04 /* initial txing of a frm */ #define MSK_RRE 0x08 /* remote read */ #define MSK_RWR 0x10 /* remote write */ diff --git a/c/src/lib/libbsp/i386/pc386/start/start.S b/c/src/lib/libbsp/i386/pc386/start/start.S index 135ae90496..bef9448bc8 100644 --- a/c/src/lib/libbsp/i386/pc386/start/start.S +++ b/c/src/lib/libbsp/i386/pc386/start/start.S @@ -25,7 +25,7 @@ | | ************************************************************************** | * COPYRIGHT (c) 1989-1999. -| * On-Line Applications Research Corporation (OAR). +| * On-Line Applications Research Corporation (OAR). | * | * The license and distribution terms for this file may be | * found in the file LICENSE in this distribution or at @@ -44,7 +44,7 @@ #include <rtems/asm.h> /*----------------------------------------------------------------------------+ -| Size of heap and stack: +| Size of heap and stack: +----------------------------------------------------------------------------*/ .set STACK_SIZE, 0x1000 @@ -63,7 +63,7 @@ BEGIN_CODE EXTERN (_IBMPC_initVideo) EXTERN (debugPollingGetChar) EXTERN (checkCPUtypeSetCr0) - + /* * In case this crashes on your machine and this is not due @@ -75,7 +75,7 @@ BEGIN_CODE SYM (start): /* * When things are really, REALLY!, bad -- turn on the speaker and - * lock up. This shows whether or not we make it to a certain + * lock up. This shows whether or not we make it to a certain * location. */ #if 0 @@ -91,7 +91,7 @@ speakl: jmp speakl # and SPIN!!! #ifdef DEBUG_EARLY_START /* * Must get video attribute to have a working printk. - * Note that the following code assume we already have + * Note that the following code assume we already have * valid segments and a stack. It should be true for * any loader starting RTEMS in protected mode (or * at least I hope so : -)). @@ -105,13 +105,13 @@ speakl: jmp speakl # and SPIN!!! addl $4, esp /* call debugPollingGetChar */ - -#endif + +#endif /*----------------------------------------------------------------------------+ | Load the segment registers (this is done by the board's BSP) and perform any | other board specific initialization procedures, this piece of code -| does not know anything about +| does not know anything about | | NOTE: Upon return, gs will contain the segment descriptor for a segment which | maps directly to all of physical memory. @@ -153,12 +153,12 @@ SYM (zero_bss): | So from now we can use printk +-------------------------------------------------------------------*/ call _IBMPC_initVideo - + /*---------------------------------------------------------------------+ | Check CPU type. Enable Cache and init coprocessor if needed. +---------------------------------------------------------------------*/ call checkCPUtypeSetCr0 - + /*---------------------------------------------------------------------+ | Transfer control to User's Board Support Package +---------------------------------------------------------------------*/ diff --git a/c/src/lib/libbsp/i386/pc386/start/start16.S b/c/src/lib/libbsp/i386/pc386/start/start16.S index 6b53b6e19d..cfc2b92771 100644 --- a/c/src/lib/libbsp/i386/pc386/start/start16.S +++ b/c/src/lib/libbsp/i386/pc386/start/start16.S @@ -53,10 +53,10 @@ _start16: movw %ax, %ss # #if defined(RTEMS_VIDEO_80x50) - + movl $0x0040,%eax # use 32 bit constant to ensure 16 MSB=0 mov %ax,%es - movw %es:0x4a, %ax # get 16 bit number of columns + movw %es:0x4a, %ax # get 16 bit number of columns cmpw $0, %ax # or 0 if no video adapter je 1f # if no video, skip touching it /*---------------------------------------------------------------------+ @@ -87,12 +87,12 @@ _start16: movl %cr0, %eax orl $CR0_PE, %eax movl %eax, %cr0 # turn on protected mode - + #ifdef NEW_GAS ljmpl $PROT_CODE_SEG, $1f # flush prefetch queue, and reload %cs #else ljmp $PROT_CODE_SEG, $1f # flush prefetch queue, and reload %cs -#endif +#endif .code32 1: /*---------------------------------------------------------------------+ @@ -127,10 +127,10 @@ _start16: /*----------------------------------------------------------------------------+ | pc386_delay +------------------------------------------------------------------------------ -| Delay is needed after doing I/O. +| Delay is needed after doing I/O. | | The outb version is OK on most machines BUT the loop version ... -| +| | will delay for 1us on 1Gz machine, it will take a little bit | longer on slower machines, however, it does not matter because we | are going to call this function only a few times @@ -180,7 +180,7 @@ no_output: test $0x02, %al # is input buffer full? jnz empty_8042 # yes - loop ret - + /*----------------------------------------------------------------------------+ | DATA section +----------------------------------------------------------------------------*/ diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c index 3535f2b735..56a4e3ad60 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @@ -1,7 +1,7 @@ /*-------------------------------------------------------------------------+ | This file contains the PC386 BSP startup package. It includes application, | board, and monitor specific initialization and configuration. The generic CPU -| dependent initialization has been performed before this routine is invoked. +| dependent initialization has been performed before this routine is invoked. +--------------------------------------------------------------------------+ | (C) Copyright 1997 - | - NavIST Group - Real-Time Distributed Systems and Industrial Automation @@ -40,11 +40,11 @@ | Global Variables +--------------------------------------------------------------------------*/ extern uint32_t _end; /* End of BSS. Defined in 'linkcmds'. */ -/* - * Size of heap if it is 0 it will be dynamically defined by memory size, - * otherwise the value should be changed by binary patch +/* + * Size of heap if it is 0 it will be dynamically defined by memory size, + * otherwise the value should be changed by binary patch */ -uint32_t _heap_size = 0; +uint32_t _heap_size = 0; /* Size of stack used during initialization. Defined in 'start.s'. */ extern uint32_t _stack_size; @@ -77,20 +77,20 @@ void bsp_postdriver_hook(void); | since drivers are not yet initialized. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void bsp_pretasking_hook(void) { uint32_t topAddr, val; int i; - - + + if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); if(_heap_size == 0) { - /* + /* * We have to dynamically size memory. Memory size can be anything * between 2M and 2048M. * let us first write @@ -110,12 +110,12 @@ void bsp_pretasking_hook(void) break; } } - + topAddr = (i-1)*1024*1024 - 4; _heap_size = topAddr - rtemsFreeMemStart; } - + bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0); rtemsFreeMemStart += _heap_size; /* HEAP_SIZE in KBytes */ @@ -126,19 +126,19 @@ void bsp_pretasking_hook(void) #endif /* RTEMS_DEBUG */ } /* bsp_pretasking_hook */ - + /*-------------------------------------------------------------------------+ | Function: bsp_start | Description: Called before main is invoked. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void bsp_start_default( void ) { void Calibrate_loop_1ms(void); - + /* * Calibrate variable for 1ms-loop (see timer.c) */ diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S index 1ca9b1b415..f9279c292b 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S +++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S @@ -41,7 +41,7 @@ | CODE section +----------------------------------------------------------------------------*/ EXTERN (rtems_i8259_masks) - + BEGIN_CODE EXTERN (_establish_stack) @@ -51,17 +51,17 @@ BEGIN_CODE /*----------------------------------------------------------------------------+ | pc386_delay +------------------------------------------------------------------------------ -| Delay is needed after doing I/O. +| Delay is needed after doing I/O. | | The outb version is OK on most machines BUT the loop version ... -| +| | will delay for 1us on 1Gz machine, it will take a little bit | longer on slower machines, however, it does not matter because we | are going to call this function only a few times +----------------------------------------------------------------------------*/ #define DELAY_USE_OUTB - + .p2align 4 .globl _pc386_delay .globl pc386_delay @@ -88,10 +88,10 @@ pc386_delay1: | with apropriate values + reprogram PIC. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ .p2align 4 - + PUBLIC (_load_segments) SYM (_load_segments): @@ -101,7 +101,7 @@ SYM (_load_segments): /* Load CS, flush prefetched queue */ ljmp $0x8, $next_step -next_step: +next_step: /* Load segment registers */ movw $0x10, ax movw ax, ss @@ -125,27 +125,27 @@ next_step: call SYM(pc386_delay) outb al, $0xA0 /* and to 8259A-2 */ call SYM(pc386_delay) - + movb $0x20, al /* start of hardware int's (0x20) */ outb al, $0x21 call SYM(pc386_delay) movb $0x28, al /* start of hardware int's 2 (0x28) */ outb al, $0xA1 call SYM(pc386_delay) - + movb $0x04, al /* 8259-1 is master */ outb al, $0x21 call SYM(pc386_delay) movb $0x02, al /* 8259-2 is slave */ outb al, $0xA1 call SYM(pc386_delay) - + movb $0x01, al /* 8086 mode for both */ outb al, $0x21 call SYM(pc386_delay) outb al, $0xA1 call SYM(pc386_delay) - + movb $0xFF, al /* mask off all interrupts for now */ outb al, $0xA1 call SYM(pc386_delay) @@ -154,7 +154,7 @@ next_step: call SYM(pc386_delay) movw $0xFFFB, SYM(i8259s_cache) /* set up same values in cache */ - + jmp SYM (_establish_stack) # return to the bsp entry code /*-------------------------------------------------------------------------+ @@ -162,11 +162,11 @@ next_step: | Description: Return to board's monitor (we have none so simply restart). | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ .p2align 4 - + PUBLIC (_return_to_monitor) SYM (_return_to_monitor): @@ -179,21 +179,21 @@ SYM (_return_to_monitor): | Description: default interrupt handler | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ .p2align 4 - + /*---------------------------------------------------------------------------+ | GDT itself +--------------------------------------------------------------------------*/ .p2align 4 - + PUBLIC (_Global_descriptor_table) SYM (_Global_descriptor_table): /* NULL segment */ - .word 0, 0 + .word 0, 0 .byte 0, 0, 0, 0 /* code segment */ @@ -203,13 +203,13 @@ SYM (_Global_descriptor_table): /* data segment */ .word 0xffff, 0 .byte 0, 0x92, 0xcf, 0 - + /*---------------------------------------------------------------------------+ | Descriptor of GDT +--------------------------------------------------------------------------*/ SYM (gdtdesc): - .word (3*8 - 1) + .word (3*8 - 1) .long SYM (_Global_descriptor_table) @@ -218,23 +218,23 @@ SYM (gdtdesc): +---------------------------------------------------------------------------*/ BEGIN_DATA .p2align 4 - + PUBLIC(Interrupt_descriptor_table) SYM(Interrupt_descriptor_table): .rept 256 .word 0,0,0,0 .endr END_DATA - + /*---------------------------------------------------------------------------+ | Descriptor of IDT +--------------------------------------------------------------------------*/ BEGIN_CODE .p2align 4 -SYM(idtdesc): +SYM(idtdesc): .word (256*8 - 1) .long SYM (Interrupt_descriptor_table) - + END_CODE .section .m_hdr diff --git a/c/src/lib/libbsp/i386/pc386/timer/timer.c b/c/src/lib/libbsp/i386/pc386/timer/timer.c index db152cffac..3024ac70c7 100644 --- a/c/src/lib/libbsp/i386/pc386/timer/timer.c +++ b/c/src/lib/libbsp/i386/pc386/timer/timer.c @@ -79,7 +79,7 @@ extern void timerisr(void); | Description: Read the value of PENTIUM on-chip cycle counter. | Global Variables: None. | Arguments: None. -| Returns: Value of PENTIUM on-chip cycle counter. +| Returns: Value of PENTIUM on-chip cycle counter. +--------------------------------------------------------------------------*/ static inline unsigned long long rdtsc(void) @@ -97,7 +97,7 @@ rdtsc(void) | not really necessary, since there will be a reset at exit. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Timer_exit(void) @@ -110,7 +110,7 @@ Timer_exit(void) | Description: Timer initialization routine. | Global Variables: Ttimer_val. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Timer_initialize(void) @@ -132,9 +132,9 @@ Timer_initialize(void) | Description: Read hardware timer value. | Global Variables: Ttimer_val, Timer_driver_Find_average_overhead. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ -uint32_t +uint32_t Read_timer(void) { register uint32_t total; @@ -163,7 +163,7 @@ Read_timer(void) | not really necessary, since there will be a reset at exit. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ static void timerOff(const rtems_raw_irq_connect_data* used) @@ -179,7 +179,7 @@ timerOff(const rtems_raw_irq_connect_data* used) } /* Timer_exit */ -static void +static void timerOn(const rtems_raw_irq_connect_data* used) { /* load timer for US_PER_ISR microsecond period */ @@ -192,7 +192,7 @@ timerOn(const rtems_raw_irq_connect_data* used) BSP_irq_enable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE); } -static int +static int timerIsOn(const rtems_raw_irq_connect_data *used) { return BSP_irq_enabled_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);} @@ -211,7 +211,7 @@ static rtems_raw_irq_connect_data timer_raw_irq_data = { | not really necessary, since there will be a reset at exit. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Timer_exit(void) @@ -224,7 +224,7 @@ Timer_exit(void) | Description: Timer initialization routine. | Global Variables: Ttimer_val. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Timer_initialize(void) @@ -254,9 +254,9 @@ Timer_initialize(void) | Description: Read hardware timer value. | Global Variables: Ttimer_val, Timer_driver_Find_average_overhead. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ -uint32_t +uint32_t Read_timer(void) { register uint32_t total, clicks; @@ -284,20 +284,20 @@ Read_timer(void) | Description: Empty function used in time tests. | Global Variables: None. | Arguments: None. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ rtems_status_code Empty_function(void) { return RTEMS_SUCCESSFUL; } /* Empty function */ - + /*-------------------------------------------------------------------------+ | Function: Set_find_average_overhead | Description: Set internal Timer_driver_Find_average_overhead flag value. | Global Variables: Timer_driver_Find_average_overhead. | Arguments: find_flag - new value of the flag. -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Set_find_average_overhead(rtems_boolean find_flag) @@ -321,9 +321,9 @@ void loadTimerValue( unsigned short loadedValue ) /*-------------------------------------------------------------------------+ -| Description: Reads the current value of the timer, and converts the -| number of ticks to micro-seconds. -| Returns: number of clock bits elapsed since last load. +| Description: Reads the current value of the timer, and converts the +| number of ticks to micro-seconds. +| Returns: number of clock bits elapsed since last load. +--------------------------------------------------------------------------*/ unsigned int readTimer0() { @@ -338,7 +338,7 @@ unsigned int readTimer0() count = ( msb << 8 ) | lsb ; if (status & RB_OUTPUT ) count += lastLoadedValue; - + return (2*lastLoadedValue - count); } @@ -372,19 +372,19 @@ Calibrate_loop_1ms(void) unsigned int targetClockBits, currentClockBits; unsigned int slowLoopGranularity, fastLoopGranularity; rtems_interrupt_level level; - + #ifdef DEBUG_CALIBRATE printk( "Calibrate_loop_1ms is starting, please wait ( but not too loooong. )\n" ); -#endif +#endif targetClockBits = US_TO_TICK(1000); - + rtems_interrupt_disable(level); /* * Fill up the cache to get a correct offset */ Timer0Reset(); readTimer0(); - /* + /* * Compute the minimal offset to apply due to read counter register. */ offset = 0xffffffff; @@ -437,24 +437,24 @@ Calibrate_loop_1ms(void) while (1); } slowLoopGranularity = (res - offset - emptyCall)/ 10; - + if (slowLoopGranularity == 0) { printk("Problem #3 in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n"); while (1); } targetClockBits += offset; -#ifdef DEBUG_CALIBRATE +#ifdef DEBUG_CALIBRATE printk("offset = %u, emptyCall = %u, targetClockBits = %u\n", offset, emptyCall, targetClockBits); printk("slowLoopGranularity = %u fastLoopGranularity = %u\n", slowLoopGranularity, fastLoopGranularity); -#endif +#endif slowLoop1ms = (targetClockBits - emptyCall) / slowLoopGranularity; if (slowLoop1ms != 0) { fastLoop1ms = targetClockBits % slowLoopGranularity; if (fastLoop1ms > emptyCall) fastLoop1ms -= emptyCall; - } + } else fastLoop1ms = targetClockBits - emptyCall / fastLoopGranularity; @@ -462,7 +462,7 @@ Calibrate_loop_1ms(void) /* * calibrate slow loop */ - + while(1) { int previousSign = 0; /* 0 = unset, 1 = incrementing, 2 = decrementing */ @@ -497,7 +497,7 @@ Calibrate_loop_1ms(void) /* * calibrate fast loop */ - + if (fastLoopGranularity != 0 ) { while(1) { int previousSign = 0; /* 0 = unset, 1 = incrementing, 2 = decrementing */ @@ -525,11 +525,11 @@ Calibrate_loop_1ms(void) } } } -#ifdef DEBUG_CALIBRATE +#ifdef DEBUG_CALIBRATE printk("slowLoop1ms = %u, fastLoop1ms = %u\n", slowLoop1ms, fastLoop1ms); -#endif +#endif rtems_interrupt_enable(level); - + } /*-------------------------------------------------------------------------+ @@ -537,7 +537,7 @@ Calibrate_loop_1ms(void) | Description: loop which waits at least timeToWait ms | Global Variables: loop1ms | Arguments: timeToWait -| Returns: Nothing. +| Returns: Nothing. +--------------------------------------------------------------------------*/ void Wait_X_ms( unsigned int timeToWait){ diff --git a/c/src/lib/libbsp/i386/pc386/timer/timerisr.S b/c/src/lib/libbsp/i386/pc386/timer/timerisr.S index ce5fd95239..b7afdfefee 100644 --- a/c/src/lib/libbsp/i386/pc386/timer/timerisr.S +++ b/c/src/lib/libbsp/i386/pc386/timer/timerisr.S @@ -43,10 +43,10 @@ BEGIN_CODE | interrupt at maximum intervals. | Global Variables: None. | Arguments: standard - see RTEMS documentation. -| Returns: standard return value - see RTEMS documentation. +| Returns: standard return value - see RTEMS documentation. +--------------------------------------------------------------------------*/ PUBLIC(timerisr) -SYM (timerisr): +SYM (timerisr): incl Ttimer_val # another tick pushl eax movb $0x20, al diff --git a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c b/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c index d60d4d99f0..fed169eac8 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c +++ b/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) unsigned long headerAddr, addr1, addr2; int size1, size2, len1, len2, len, imageCnt, cnt; char *ofile, *ifile, *end; - + verbose = 0; /* parse command line options */ @@ -60,13 +60,13 @@ int main(int argc, char* argv[]) return 1; } } - + if((argc - optind) != 8 && (argc - optind) != 5) { usage(); return 1; } - + ofile = argv[optind]; ofp = fopen(ofile, "wb"); if(ofp == NULL) @@ -74,15 +74,15 @@ int main(int argc, char* argv[]) fprintf(stderr, "unable to open file %s\n", ofile); return 1; } - - /* - * Layout is very simple first 512 is header shared by all + + /* + * Layout is very simple first 512 is header shared by all * images, then images at 512 bytes border */ - + /* Fill buffer with 0's */ memset(buf, 0, sizeof(buf)); - + fwrite(buf, 1, sizeof(buf), ofp); optind++; @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) fclose(ofp); return 1; } - + /* Copy the first image */ optind++; ifile = argv[optind]; @@ -183,7 +183,7 @@ int main(int argc, char* argv[]) { /* Areas overlapped */ printf("area overlapping: \n"); - printf("header address 0x%08lx, its memory size 0x%08x\n", + printf("header address 0x%08lx, its memory size 0x%08x\n", headerAddr, sizeof(buf)); printf("first image address 0x%08lx, its memory size 0x%08x\n", addr1, size1); @@ -198,7 +198,7 @@ int main(int argc, char* argv[]) fclose(ofp); return 1; } - + if(optind == (argc - 1)) { @@ -242,12 +242,12 @@ int main(int argc, char* argv[]) for(;;) { len = fread(buf, 1, sizeof(buf), ifp); - + if(len != 0) { fwrite(buf, len, 1, ofp); cnt += sizeof(buf); - + if(len != sizeof(buf)) { memset(buf, 0, sizeof(buf) - len); @@ -287,13 +287,13 @@ int main(int argc, char* argv[]) (addr2 < addr1 && addr2 < headerAddr) || (addr1 > headerAddr && addr2 > (headerAddr + sizeof(buf)) && (addr2 + size2) <= addr1) || - (addr1 < headerAddr && addr2 > (addr1 + size1) && + (addr1 < headerAddr && addr2 > (addr1 + size1) && (addr2 + size2) <= headerAddr))) - + { /* Areas overlapped */ printf("area overlapping: \n"); - printf("header address 0x%08lx, its memory size 0x%08x\n", + printf("header address 0x%08lx, its memory size 0x%08x\n", headerAddr, sizeof(buf)); printf("first image address 0x%08lx, its memory size 0x%08x\n", addr1, size1); @@ -322,8 +322,8 @@ writeHeader: buf[0xa] = (headerAddr >> 4) & 0xff; buf[0xb] = (headerAddr >> 12) & 0xff; - /* - * Execute address in cs:ip format, which addr1 + /* + * Execute address in cs:ip format, which addr1 */ buf[0xc] = addr1 & 0xf; buf[0xd] = 0; @@ -361,7 +361,7 @@ writeHeader: /* Flags, tags and lengths */ buf[0x20] = 4; - + buf[0x23] = 4; @@ -370,13 +370,13 @@ writeHeader: buf[0x25] = (addr2 >> 8) & 0xff; buf[0x26] = (addr2 >> 16) & 0xff; buf[0x27] = (addr2 >> 24) & 0xff; - + /* Image Length */ buf[0x28] = len2 & 0xff; buf[0x29] = (len2 >> 8) & 0xff; buf[0x2a] = (len2 >> 16) & 0xff; buf[0x2b] = (len2 >> 24) & 0xff; - + /* Memory Size */ buf[0x2c] = size2 & 0xff; buf[0x2d] = (size2 >> 8) & 0xff; @@ -392,7 +392,7 @@ writeHeader: if(verbose) { - printf("header address 0x%08lx, its memory size 0x%08x\n", + printf("header address 0x%08lx, its memory size 0x%08x\n", headerAddr, sizeof(buf)); printf("first image address 0x%08lx, its memory size 0x%08x\n", addr1, size1); diff --git a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c index ad0f0d7672..1e336f6f4f 100644 --- a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c +++ b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c @@ -89,7 +89,7 @@ struct wd_softc { unsigned int port; unsigned char *base; unsigned long bpar; - + /* * Statistics */ @@ -102,7 +102,7 @@ struct wd_softc { unsigned long rxBadCRC; unsigned long rxOverrun; unsigned long rxCollision; - + unsigned long txInterrupts; unsigned long txDeferred; unsigned long txHeartbeat; @@ -165,7 +165,7 @@ wd8003Enet_interrupt_handler (void) if (status & (MSK_PRX+MSK_RXE)) { outport_byte(tport+ISR, status & (MSK_PRX+MSK_RXE)); wd_softc[0].rxInterrupts++; - rtems_event_send (wd_softc[0].rxDaemonTid, INTERRUPT_EVENT); + rtems_event_send (wd_softc[0].rxDaemonTid, INTERRUPT_EVENT); } } @@ -209,8 +209,8 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc) if (i1 < 6) hwaddr[i1] = cc1; } - - inport_byte(tport+0x04, temp); + + inport_byte(tport+0x04, temp); outport_byte(tport+0x04, temp | 0x80); /* alternate registers */ outport_byte(tport+W83CREG, MSK_RESET); /* reset board, set buffer */ outport_byte(tport+W83CREG, 0); @@ -219,7 +219,7 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc) outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); cc1 = MSK_BMS + MSK_FT10; /* configure 8 or 16 bits */ - inport_byte(tport+0x07, temp) ; + inport_byte(tport+0x07, temp) ; ultra = ((temp & 0xf0) == 0x20 || (temp & 0xf0) == 0x40); if (ultra) @@ -247,14 +247,14 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc) outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); outport_byte(tport+CMDR, MSK_STA + MSK_RD2); /* put 8390 on line */ outport_byte(tport+RCR, MSK_AB); /* MSK_AB accept broadcast */ - + if (ultra) { inport_byte(tport+0x0c, temp); outport_byte(tport+0x0c, temp | 0x80); outport_byte(tport+0x05, 0x80); outport_byte(tport+0x06, 0x01); } - + /* * Set up interrupts */ @@ -262,7 +262,7 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc) sc->irqInfo.on = nopOn; sc->irqInfo.off = nopOn; sc->irqInfo.isOn = wdIsOn; - + st = BSP_install_rtems_irq_handler (&sc->irqInfo); if (!st) rtems_panic ("Can't attach WD interrupt handler for irq %d\n", @@ -298,7 +298,7 @@ wd_rxDaemon (void *arg) outport_byte(tport+CMDR, MSK_PG1 + MSK_RD2); inport_byte(tport+CURR, current); - outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); + outport_byte(tport+CMDR, MSK_PG0 + MSK_RD2); start += 1; if (start >= OUTPAGE){ @@ -307,7 +307,7 @@ wd_rxDaemon (void *arg) if (current == start) break; - + shp = dp->base + 1 + (SHAPAGE * start); next = *shp++; len = *((short *)shp)++ - 4; @@ -315,14 +315,14 @@ wd_rxDaemon (void *arg) if (next >= OUTPAGE){ next = 0; } - + MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); m->m_pkthdr.rcvif = ifp; - + temp = m->m_data; m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header); - + if ((i2 = (OUTPAGE - start) * SHAPAGE - 4) < len){ memcpy(temp, shp, i2); len -= i2; @@ -330,18 +330,18 @@ wd_rxDaemon (void *arg) shp = dp->base; } memcpy(temp, shp, len); - + eh = mtod (m, struct ether_header *); m->m_data += sizeof(struct ether_header); ether_input (ifp, eh, m); - + outport_byte(tport+BNRY, next-1); } - + /* * Ring overwrite */ - if (overrun){ + if (overrun){ outport_byte(tport+ISR, MSK_OVW); /* reset IR */ outport_byte(tport+TCR, 0); /* out of loopback */ if (resend == 1) @@ -349,9 +349,9 @@ wd_rxDaemon (void *arg) resend = 0; overrun = 0; } - + outport_byte(tport+IMR, 0x15); /* re-enable IT rx */ - } + } } static void @@ -366,16 +366,16 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) /* * Waiting for Transmitter ready - */ - inport_byte(tport+CMDR, txReady); + */ + inport_byte(tport+CMDR, txReady); while(txReady & MSK_TXP) - inport_byte(tport+CMDR, txReady); + inport_byte(tport+CMDR, txReady); len = 0; shp = dp->base + (SHAPAGE * OUTPAGE); n = m; - + for (;;){ len += m->m_len; memcpy(shp, (char *)m->m_data, m->m_len); @@ -385,7 +385,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) } m_freem(n); - + if (len < ET_MINLEN) len = ET_MINLEN; outport_byte(tport+TBCR0, len); outport_byte(tport+TBCR1, (len >> 8) ); @@ -448,12 +448,12 @@ wd_init (void *arg) struct ifnet *ifp = &sc->arpcom.ac_if; if (sc->txDaemonTid == 0) { - + /* * Set up WD hardware */ wd8003Enet_initialize_hardware (sc); - + /* * Start driver tasks */ @@ -555,7 +555,7 @@ wd_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: wd_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -625,7 +625,7 @@ rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc->bpar = 0xD0000; sc->base = (unsigned char*) 0xD0000; } - + sc->acceptBroadcast = !config->ignore_broadcast; /* |