[PATCH] Updated Legacy code in i386 pc386
Vipul Nayyar
nayyar_vipul at yahoo.com
Thu Jul 11 19:32:23 UTC 2013
---
c/src/lib/libbsp/i386/pc386/3c509/3c509.c | 105 +++++-------------------
c/src/lib/libbsp/i386/pc386/clock/ckinit.c | 54 ++++++------
c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c | 53 +++++-------
c/src/lib/libbsp/i386/pc386/console/vgacons.c | 34 +++-----
c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c | 57 ++++---------
c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c | 41 ++++-----
c/src/lib/libbsp/i386/shared/comm/tty_drv.c | 89 +++++++-------------
c/src/lib/libbsp/i386/shared/smp/smp-imps.c | 22 +++--
8 files changed, 158 insertions(+), 297 deletions(-)
diff --git a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
index ec309ba..6047d19 100644
--- a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
+++ b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
@@ -60,6 +60,7 @@
#include <errno.h>
#include <rtems/error.h>
#include <rtems/rtems_bsdnet.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -163,11 +164,11 @@ struct ep_softc
struct ep_board *epb;
int unit;
- rtems_irq_connect_data irqInfo;
- rtems_id rxDaemonTid;
- rtems_id txDaemonTid;
+ rtems_id rxDaemonTid;
+ rtems_id txDaemonTid;
+ rtems_vector_number name;
- int acceptBroadcast;
+ int acceptBroadcast;
short tx_underrun;
short rx_no_first;
@@ -210,6 +211,8 @@ static void epread( register struct ep_softc *sc );
static int ep_isa_attach( struct isa_device *is );
static int get_eeprom_data( int id_port, int offset );
static void ep_intr( struct ep_softc *sc );
+int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config );
+void __inline outb( unsigned short io_addr, uint8_t out_data );
/* external functions */
extern void Wait_X_ms( unsigned int timeToWait ); /* timer.c ??? */
@@ -403,46 +406,6 @@ 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
- *
- **********************************************************************************/
-static int eeprom_rdy( struct ep_softc *sc )
-{
- int i;
-
- for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++)
- continue;
- if (i >= MAX_EEPROMBUSY)
- {
- printf("ep%d: eeprom failed to come ready.\n", sc->unit);
- return (0);
- }
- return (1);
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
- * get_e: gets a 16 bits word from the EEPROM.
- * We must have set the window before call this routine.
- *
- * RETURNS: data from EEPROM
- *
- **********************************************************************************/
-u_short get_e( struct ep_softc *sc, int offset )
-{
- if( !eeprom_rdy(sc) )
- return (0xffff);
- outw(BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset );
- if( !eeprom_rdy(sc) )
- return( 0xffff );
- return( inw( BASE + EP_W0_EEPROM_DATA ) );
-}
-
-/**********************************************************************************
- *
* DESCRIPTION:
* Driver interrupt handler. This routine is called by the RTEMS kernel when this
* interrupt is raised.
@@ -464,30 +427,6 @@ static rtems_isr ap_interrupt_handler( rtems_vector_number v )
/**********************************************************************************
*
* DESCRIPTION:
- *
- * RETURNS:
- *
- **********************************************************************************/
-static void nopOn(const rtems_irq_connect_data* notUsed)
-{
- /* does nothing */
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
- *
- * RETURNS:
- *
- **********************************************************************************/
-static int _3c509_IsOn(const rtems_irq_connect_data* irq)
-{
- return BSP_irq_enabled_at_i8259s (irq->name);
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
* Initializes the ethernet hardware.
*
* RETURNS: nothing.
@@ -495,24 +434,22 @@ static int _3c509_IsOn(const rtems_irq_connect_data* irq)
**********************************************************************************/
static void _3c509_initialize_hardware (struct ep_softc *sc)
{
- rtems_status_code st;
+ rtems_status_code status;
epinit( sc );
/*
* 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 )
- {
- rtems_panic ("Can't attach WD interrupt handler for irq %d\n", sc->irqInfo.name );
- }
+ printf ("3c509: IRQ with Kernel: %d\n", (int)sc->name );
+ status = rtems_interrupt_handler_install(
+ sc->name,
+ "3c509",
+ RTEMS_INTERRUPT_UNIQUE,
+ ( rtems_irq_hdl )ap_interrupt_handler,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
/**********************************************************************************
@@ -782,9 +719,9 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config )
mtu = ETHERMTU;
if (config->irno)
- sc->irqInfo.name = config->irno;
+ sc->name = config->irno;
else
- sc->irqInfo.name = 10;
+ sc->name = 10;
if (config->port)
sc->ep_io_addr = config->port;
@@ -1046,13 +983,13 @@ static int ep_isa_attach( struct isa_device *is )
irq = is->id_irq;
/* update the interrupt line number to registered with kernel */
- sc->irqInfo.name = irq;
+ sc->name = irq;
GO_WINDOW( 0 );
SET_IRQ( BASE, irq );
printf( "3C509: I/O=0x%x, IRQ=%d, CONNECTOR=%s, ",
- sc->ep_io_addr, sc->irqInfo.name,ep_conn_type[ sc->ep_connector ] );
+ sc->ep_io_addr, (int)sc->name,ep_conn_type[ sc->ep_connector ] );
ep_attach( sc );
return 1;
diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
index 37b0408..b6ebd43 100644
--- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
+++ b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
@@ -27,6 +27,7 @@
#include <bsp/irq.h>
#include <bspopts.h>
#include <libcpu/cpuModel.h>
+#include <assert.h>
#define CLOCK_VECTOR 0
@@ -41,8 +42,8 @@ void Clock_driver_support_at_tick_empty(void);
uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void);
uint32_t bsp_clock_nanoseconds_since_last_tick_i8254(void);
void Clock_isr_handler(rtems_irq_hdl_param param);
-int clockIsOn(const rtems_irq_connect_data* unused);
-void clockOff(const rtems_irq_connect_data* unused);
+int clockIsOn(void);
+void clockOff(void);
void Clock_driver_install_handler(void);
void Clock_driver_support_initialize_hardware(void);
@@ -232,9 +233,7 @@ static void calibrate_tsc(void)
pc586_tsc_per_tick /= rtems_clock_get_ticks_per_second();
}
-static void clockOn(
- const rtems_irq_connect_data* unused
-)
+static void clockOn(void)
{
pc386_isrs_per_tick = 1;
pc386_microseconds_per_isr = rtems_configuration_get_microseconds_per_tick();
@@ -267,7 +266,7 @@ static void clockOn(
calibrate_tsc();
}
-void clockOff(const rtems_irq_connect_data* unused)
+void clockOff(void)
{
/* reset timer mode to standard (BIOS) value */
outport_byte(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
@@ -275,35 +274,31 @@ void clockOff(const rtems_irq_connect_data* unused)
outport_byte(TIMER_CNTR0, 0);
} /* Clock_exit */
-int clockIsOn(const rtems_irq_connect_data* unused)
+int clockIsOn(void)
{
return ((i8259s_cache & 0x1) == 0);
}
bool Clock_isr_enabled = false;
-void Clock_isr_handler(
- rtems_irq_hdl_param param
-)
+
+void Clock_isr_handler(rtems_irq_hdl_param param )
{
if ( Clock_isr_enabled )
Clock_isr( param );
}
-static rtems_irq_connect_data clockIrqData = {
- BSP_PERIODIC_TIMER,
- Clock_isr_handler,
- 0,
- clockOn,
- clockOff,
- clockIsOn
-};
-
void Clock_driver_install_handler(void)
{
- if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
- printk("Unable to install system clock ISR handler\n");
- rtems_fatal_error_occurred(1);
- }
+ rtems_status_code status = RTEMS_SUCCESSFUL;
+ status = rtems_interrupt_handler_install(
+ BSP_PERIODIC_TIMER,
+ "Clock",
+ RTEMS_INTERRUPT_UNIQUE,
+ Clock_isr_handler,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+ clockOn();
}
void Clock_driver_support_initialize_hardware(void)
@@ -347,9 +342,16 @@ void Clock_driver_support_initialize_hardware(void)
Clock_isr_enabled = true;
}
-#define Clock_driver_support_shutdown_hardware() \
- do { \
- BSP_remove_rtems_irq_handler (&clockIrqData); \
+#define Clock_driver_support_shutdown_hardware() \
+ do { \
+ rtems_status_code status = RTEMS_SUCCESSFUL; \
+ clockOff(); \
+ status = rtems_interrupt_handler_remove( \
+ BSP_PERIODIC_TIMER, \
+ Clock_isr_handler, \
+ 0 \
+ ); \
+ assert(status == RTEMS_SUCCESSFUL); \
} while (0)
#include "../../../shared/clockdrv_shell.h"
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 d0af6b9..99c6720 100644
--- a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c
+++ b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <errno.h>
#include <sys/types.h>
+#include <assert.h>
#include <bsp.h>
#include <bsp/irq.h>
@@ -57,6 +58,8 @@ static unsigned char mouse_reply_expected = 0;
#define MAX_RETRIES 60 /* some aux operations take long time*/
static void ps2_mouse_interrupt(rtems_irq_hdl_param);
+void ps2_set_driver_handler(int port, mouse_parser_enqueue_handler handler);
+size_t read_aux(char * buffer, size_t count );
static mouse_parser_enqueue_handler driver_input_handler_ps2 = NULL;
/*
@@ -78,30 +81,6 @@ static void mdelay( unsigned long t )
static void* termios_ttyp_paux = NULL;
-static void
-isr_on(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static void
-isr_off(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static int isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s( irq->name );
-}
-
-static rtems_irq_connect_data ps2_isr_data = { AUX_IRQ,
- ps2_mouse_interrupt,
- 0,
- isr_on,
- isr_off,
- isr_is_on };
-
/*
* Wait for keyboard controller input buffer to drain.
*
@@ -323,11 +302,18 @@ static int queue_empty(void)
static int release_aux(void)
{
+ rtems_status_code status;
+
if (--aux_count)
return 0;
kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints */
kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE);
- BSP_remove_rtems_irq_handler( &ps2_isr_data );
+ status = rtems_interrupt_handler_remove(
+ AUX_IRQ,
+ ps2_mouse_interrupt,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
@@ -338,18 +324,21 @@ static int release_aux(void)
static int open_aux(void)
{
- int status;
+ rtems_status_code status;
if (aux_count++) {
return 0;
}
queue->head = queue->tail = 0; /* Flush input queue */
- status = BSP_install_rtems_irq_handler( &ps2_isr_data );
- if( !status ) {
- printk("Error installing ps2-mouse interrupt handler!\n" );
- rtems_fatal_error_occurred( status );
- }
+ status = rtems_interrupt_handler_install(
+ AUX_IRQ,
+ "PS2_Mouse",
+ RTEMS_INTERRUPT_UNIQUE,
+ ps2_mouse_interrupt,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE); /* Enable the auxiliary port on
controller. */
@@ -429,7 +418,7 @@ static int psaux_init( void )
/*
* paux device driver INITIALIZE entry point.
*/
-rtems_device_driver paux_initialize(
+rtems_device_driver paux_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg)
diff --git a/c/src/lib/libbsp/i386/pc386/console/vgacons.c b/c/src/lib/libbsp/i386/pc386/console/vgacons.c
index d1143da..9f26388 100644
--- a/c/src/lib/libbsp/i386/pc386/console/vgacons.c
+++ b/c/src/lib/libbsp/i386/pc386/console/vgacons.c
@@ -1,5 +1,5 @@
/*
- * This file contains the termios TTY driver for the i386
+ * This file contains the termios TTY driver for the i386
* vga.
*
* COPYRIGHT (c) 1989-2011.
@@ -20,23 +20,10 @@
#include <bsp/irq.h>
#include <bsp.h>
#include <crt.h>
+#include <assert.h>
#define VGACONS_STATIC static
-static int isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s(irq->name);
-}
-
-static rtems_irq_connect_data keyboard_isr_data = {
- BSP_KEYBOARD,
- keyboard_interrupt,
- 0,
- NULL,
- NULL,
- isr_is_on
-};
-
/*
* vgacons_init
*
@@ -44,7 +31,7 @@ static rtems_irq_connect_data keyboard_isr_data = {
*/
VGACONS_STATIC void vgacons_init(int minor)
{
- /*
+ /*
* Note: We do not initialize the KBD interface here since
* it was initialized regardless of whether the
* vga is available or not. Therefore it is initialized
@@ -160,7 +147,7 @@ bool vgacons_probe(
int minor
)
{
- int status;
+ rtems_status_code status;
static bool firstTime = true;
if ((*(unsigned char*) NB_MAX_ROW_ADDR == 0) &&
@@ -175,11 +162,14 @@ bool vgacons_probe(
* can be COM1 and you can still use the mouse/VGA for graphics.
*/
if ( firstTime ) {
- status = BSP_install_rtems_irq_handler(&keyboard_isr_data);
- if (!status) {
- printk("Error installing keyboard interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_KEYBOARD,
+ "VGACONS",
+ RTEMS_INTERRUPT_UNIQUE,
+ keyboard_interrupt,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
firstTime = false;
diff --git a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
index b23699d..f3d0ddd 100644
--- a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
+++ b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
@@ -401,41 +401,18 @@ ne_interrupt_handler (rtems_irq_hdl_param cdata)
/* Turn NE2000 interrupts on. */
static void
-ne_interrupt_on (const rtems_irq_connect_data *irq)
+ne_interrupt_on (const rtems_vector_number name)
{
struct ne_softc *sc;
#ifdef DEBUG_NE
printk ("ne_interrupt_on()\n");
#endif
- sc = ne_device_for_irno (irq->name);
+ sc = ne_device_for_irno (name);
if (sc != NULL)
outport_byte (sc->port + IMR, NE_INTERRUPTS);
}
-/* Turn NE2000 interrupts off. See ne_interrupt_on. */
-
-static void
-ne_interrupt_off (const rtems_irq_connect_data *irq)
-{
- struct ne_softc *sc;
-
-#ifdef DEBUG_NE
- printk ("ne_interrupt_off()\n");
-#endif
- sc = ne_device_for_irno (irq->name);
- if (sc != NULL)
- outport_byte (sc->port + IMR, 0);
-}
-
-/* Return whether NE2000 interrupts are on. */
-
-static int
-ne_interrupt_is_on (const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s (irq->name);
-}
-
/* Initialize the NE2000 hardware. */
static void
@@ -516,20 +493,22 @@ ne_init_hardware (struct ne_softc *sc)
static void
ne_init_irq_handler(int irno)
{
- rtems_irq_connect_data irq;
+ rtems_status_code status;
#ifdef DEBUG_NE
printk("ne_init_irq_handler(%d)\n", irno);
#endif
- irq.name = irno;
- irq.hdl = ne_interrupt_handler;
- irq.handle = (rtems_irq_hdl) irno;
- irq.on = ne_interrupt_on;
- irq.off = ne_interrupt_off;
- irq.isOn = ne_interrupt_is_on;
-
- if (!BSP_install_rtems_irq_handler (&irq))
- rtems_panic ("Can't attach NE interrupt handler for irq %d\n", irno);
+
+ status = rtems_interrupt_handler_install(
+ irno,
+ "ne2000",
+ RTEMS_INTERRUPT_UNIQUE,
+ ne_interrupt_handler,
+ (rtems_irq_hdl) irno
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+ ne_interrupt_on(irno);
+
}
/* The NE2000 packet receive daemon. This task is started when the
@@ -1075,7 +1054,7 @@ static int ne_set_multicast_filter(struct ne_softc* sc)
int i=0;
unsigned int port = sc->port;
unsigned char cmd = 0;
-
+
/* Save CMDR settings */
inport_byte(port + CMDR, cmd);
/* Change to page 1 */
@@ -1087,7 +1066,7 @@ static int ne_set_multicast_filter(struct ne_softc* sc)
}
/* Revert to original CMDR settings */
- outport_byte(port + CMDR, cmd);
+ outport_byte(port + CMDR, cmd);
return 0;
}
@@ -1125,12 +1104,12 @@ ne_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
break;
}
break;
-
+
case SIOCADDMULTI:
case SIOCDELMULTI:
{
struct ifreq* ifr = (struct ifreq*) data;
- error = (command == SIOCADDMULTI ?
+ error = (command == SIOCADDMULTI ?
ether_addmulti(ifr, &(sc->arpcom)) :
ether_delmulti(ifr, &(sc->arpcom)) );
/* ENETRESET indicates that driver should update its multicast filters */
diff --git a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
index d26464c..79ed3dd 100644
--- a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
+++ b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <rtems/error.h>
#include <rtems/rtems_bsdnet.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -73,7 +74,6 @@
*/
struct wd_softc {
struct arpcom arpcom;
- rtems_irq_connect_data irqInfo;
struct mbuf **rxMbuf;
struct mbuf **txMbuf;
int acceptBroadcast;
@@ -84,6 +84,7 @@ struct wd_softc {
int txBdActiveCount;
rtems_id rxDaemonTid;
rtems_id txDaemonTid;
+ rtems_vector_number name;
unsigned int port;
unsigned char *base;
@@ -169,19 +170,6 @@ wd8003Enet_interrupt_handler (void *unused)
}
-static void nopOn(const rtems_irq_connect_data* notUsed)
-{
- /*
- * code should be moved from wd8003Enet_initialize_hardware
- * to this location
- */
-}
-
-static int wdIsOn(const rtems_irq_connect_data* irq)
-{
- return BSP_irq_enabled_at_i8259s (irq->name);
-}
-
/*
* Initialize the ethernet hardware
*/
@@ -191,7 +179,7 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc)
int i1, ultra;
char cc1, cc2;
unsigned char temp;
- rtems_status_code st;
+ rtems_status_code status;
unsigned int tport;
unsigned char *hwaddr;
@@ -257,15 +245,14 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc)
/*
* Set up interrupts
*/
- sc->irqInfo.hdl = wd8003Enet_interrupt_handler;
- 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",
- sc->irqInfo.name);
+ status = rtems_interrupt_handler_install(
+ sc->name,
+ "wd8003",
+ RTEMS_INTERRUPT_UNIQUE,
+ wd8003Enet_interrupt_handler,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
static void
@@ -397,7 +384,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m)
/*
* Driver transmit daemon
*/
-void
+static void
wd_txDaemon (void *arg)
{
struct wd_softc *sc = (struct wd_softc *)arg;
@@ -607,9 +594,9 @@ rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
mtu = ETHERMTU;
if (config->irno)
- sc->irqInfo.name = config->irno;
+ sc->name = config->irno;
else
- sc->irqInfo.name = 5;
+ sc->name = 5;
if (config->port)
sc->port = config->port;
diff --git a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
index aafb02a..a0ffbb5 100644
--- a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
+++ b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
@@ -33,57 +33,12 @@ int BSP_poll_read(int);
/* Internal routines */
static int tty1_conSetAttr( int minor, const struct termios *t);
static int tty2_conSetAttr( int minor, const struct termios *t);
-static void isr_on(const rtems_irq_connect_data *);
-static void isr_off(const rtems_irq_connect_data *);
-static int isr_is_on(const rtems_irq_connect_data *);
extern BSP_polling_getchar_function_type BSP_poll_char;
extern int BSPConsolePort;
extern void rtems_set_waiting_id_comx( int port, rtems_id id, rtems_event_set event );
/*
- * Interrupt structure for tty1
- */
-static rtems_irq_connect_data tty1_isr_data =
-{
- BSP_UART_COM1_IRQ,
- BSP_uart_termios_isr_com1,
- 0,
- isr_on,
- isr_off,
- isr_is_on};
-
-/*
- * Interrupt structure for tty2
- */
-static rtems_irq_connect_data tty2_isr_data =
-{
- BSP_UART_COM2_IRQ,
- BSP_uart_termios_isr_com2,
- 0,
- isr_on,
- isr_off,
- isr_is_on};
-
-static void
-isr_on(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static void
-isr_off(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static int
-isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s(irq->name);
-}
-
-/*
* TTYS1 - device driver INITIALIZE entry point.
*/
rtems_device_driver
@@ -111,12 +66,14 @@ tty1_initialize(rtems_device_major_number major,
*/
/* 9600-8-N-1, without hardware flow control */
BSP_uart_init( BSP_UART_COM1, 9600, CHR_8_BITS, 0, 0, 0 );
- status = BSP_install_rtems_irq_handler( &tty1_isr_data );
- if( !status )
- {
- printk("Error installing ttyS1 interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_UART_COM1_IRQ,
+ "tty_drv",
+ RTEMS_INTERRUPT_UNIQUE,
+ BSP_uart_termios_isr_com1,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
/*
* Register the device
*/
@@ -132,7 +89,13 @@ tty1_initialize(rtems_device_major_number major,
static int tty1_last_close(int major, int minor, void *arg)
{
- BSP_remove_rtems_irq_handler( &tty1_isr_data );
+ rtems_status_code status;
+ status = rtems_interrupt_handler_remove(
+ BSP_UART_COM1_IRQ,
+ BSP_uart_termios_isr_com1,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
@@ -339,12 +302,14 @@ tty2_initialize(rtems_device_major_number major,
*/
/* 9600-8-N-1, without hardware flow control */
BSP_uart_init( BSP_UART_COM2, 9600, CHR_8_BITS, 0, 0, 0);
- status = BSP_install_rtems_irq_handler( &tty2_isr_data );
- if( !status )
- {
- printk("Error installing serial console interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_UART_COM2_IRQ,
+ "tty_drv",
+ RTEMS_INTERRUPT_UNIQUE,
+ BSP_uart_termios_isr_com2,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
/*
* Register the device
*/
@@ -360,7 +325,13 @@ tty2_initialize(rtems_device_major_number major,
static int tty2_last_close(int major, int minor, void *arg)
{
- BSP_remove_rtems_irq_handler( &tty2_isr_data );
+ rtems_status_code status;
+ status = rtems_interrupt_handler_remove(
+ BSP_UART_COM2_IRQ,
+ BSP_uart_termios_isr_com2,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index f1be625..76b4244 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -55,6 +55,7 @@
#include <bsp/apic.h>
#include <bsp/smp-imps.h>
+#include <assert.h>
/*
* XXXXX The following absolutely must be defined!!!
@@ -121,7 +122,7 @@ static void UDELAY(int x)
while ( _i-- )
_pc386_delay();
}
-
+
#define READ_MSR_LO(_x) \
(unsigned int)(read_msr(_x) & 0xffffffff)
@@ -131,7 +132,7 @@ static void UDELAY(int x)
static inline unsigned long long read_msr(unsigned int msr)
{
unsigned long long value;
-
+
asm volatile("rdmsr" : "=A" (value) : "c" (msr));
return value;
}
@@ -403,7 +404,7 @@ imps_read_config_table(unsigned start, int count)
case IMPS_BCT_PROCESSOR:
if ( imps_num_cpus < rtems_configuration_smp_maximum_processors ) {
add_processor((imps_processor *)start);
- } else
+ } else
imps_num_cpus++;
start += 12; /* 20 total */
break;
@@ -781,10 +782,15 @@ static rtems_irq_connect_data apIPIIrqData = {
extern void bsp_reset(void);
void ipi_install_irq(void)
{
- if (!BSP_install_rtems_irq_handler (&apIPIIrqData)) {
- printk("Unable to initialize IPI\n");
- bsp_reset();
- }
+ rtems_status_code status;
+ status = rtems_interrupt_handler_install(
+ 16,
+ "smp-imps",
+ RTEMS_INTERRUPT_UNIQUE,
+ (void *)ap_ipi_isr,
+ 0
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
#ifdef __SSE__
@@ -856,7 +862,7 @@ void bsp_smp_wait_for(
/*
* Until i386 ms delay does not depend upon the clock we
- * will use this less sophisticated delay.
+ * will use this less sophisticated delay.
*/
for(i=5000; i>0; i--)
;
--
1.7.11.7
More information about the devel
mailing list