[PATCH 27.0 2/3] SMC91111: updated to use shared IRQ service
Daniel Hellstrom
daniel at gaisler.com
Thu Apr 5 15:23:16 UTC 2012
Signed-off-by: Daniel Hellstrom <daniel at gaisler.com>
---
.../sparc/leon2/leon_smc91111/leon_smc91111.c | 10 ++++------
.../sparc/leon3/leon_smc91111/leon_smc91111.c | 4 ++--
c/src/libchip/network/smc91111.c | 19 ++++++++-----------
c/src/libchip/network/smc91111exp.h | 2 +-
4 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
index 47b4d7a..b459edd 100644
--- a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
+++ b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
@@ -26,12 +26,12 @@
#define SMC91111_BASE_ADDR (void*)0x20000300
-#define SMC91111_BASE_IRQ LEON_TRAP_TYPE(4)
+#define SMC91111_BASE_IRQ 4
#define SMC91111_BASE_PIO 4
scmv91111_configuration_t leon_scmv91111_configuration = {
SMC91111_BASE_ADDR, /* base address */
- SMC91111_BASE_IRQ, /* vector number */
+ SMC91111_BASE_IRQ, /* IRQ number (on LEON vector is irq) */
SMC91111_BASE_PIO, /* PIO */
100, /* 100b */
1, /* fulldx */
@@ -55,9 +55,7 @@ int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config)
*((volatile unsigned int *)0x80000000) |= 0x10f80000;
*((volatile unsigned int *)0x800000A8) |=
(0xe0 | leon_scmv91111_configuration.pio)
- << (8 * ((leon_scmv91111_configuration.vector & 0x0f) - 4));
+ << (8 * (leon_scmv91111_configuration.vector - 4)); /* vector = irq-no */
return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);
-
-};
-
+}
diff --git a/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
index 5ebdc12..841c4b6 100644
--- a/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
+++ b/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
@@ -13,9 +13,9 @@
scmv91111_configuration_t leon_scmv91111_configuration = {
SMC91111_BASE_ADDR, /* base address */
- LEON_TRAP_TYPE (SMC91111_BASE_IRQ), /* vector number */
+ SMC91111_BASE_IRQ, /* IRQ number (on LEON vector is irq) */
SMC91111_BASE_PIO, /* PIO */
- 100, /* 100b */
+ 100, /* 100b */
1, /* fulldx */
1 /* autoneg */
};
diff --git a/c/src/libchip/network/smc91111.c b/c/src/libchip/network/smc91111.c
index 7070108..864587a 100644
--- a/c/src/libchip/network/smc91111.c
+++ b/c/src/libchip/network/smc91111.c
@@ -61,12 +61,6 @@
#ifdef BSP_FEATURE_IRQ_EXTENSION
#include <rtems/irq-extension.h>
-#else
- #if defined(__m68k__)
- extern m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
- #else
- extern rtems_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
- #endif
#endif
struct lan91cxx_priv_data smc91111;
@@ -92,9 +86,9 @@ static void lan91cxx_phy_configure(struct lan91cxx_priv_data *cpd);
#define max(l,r) ((l) > (r) ? (l) : (r))
/* \ ------------- Interrupt ------------- \ */
-rtems_isr lan91cxx_interrupt_handler(rtems_vector_number v)
+void lan91cxx_interrupt_handler(void *arg)
{
- struct lan91cxx_priv_data *cpd = &smc91111;
+ struct lan91cxx_priv_data *cpd = arg;
unsigned short irq, event;
unsigned short oldbase;
unsigned short oldpointer;
@@ -1029,7 +1023,7 @@ static void smc91111_stop(struct lan91cxx_priv_data *cpd)
int lan91cxx_hardware_init(struct lan91cxx_priv_data *cpd)
{
unsigned short val;
- int i;
+ int i, rc;
DEBUG_FUNCTION();
@@ -1053,8 +1047,11 @@ int lan91cxx_hardware_init(struct lan91cxx_priv_data *cpd)
}
}
#else
- db_printf("Install lan91cxx irqvector at %d\n", cpd->config.vector);
- set_vector(lan91cxx_interrupt_handler, cpd->config.vector, 1);
+ db_printf("Install lan91cxx isr at vec/irq %d\n", cpd->config.vector);
+ rc = rtems_interrupt_handler_install(cpd->config.vector, "smc91cxx",
+ RTEMS_INTERRUPT_SHARED, lan91cxx_interrupt_handler, cpd);
+ if (rc != RTEMS_SUCCESSFUL)
+ return 0;
#endif
/* Reset chip */
diff --git a/c/src/libchip/network/smc91111exp.h b/c/src/libchip/network/smc91111exp.h
index 3f8ba1e..2ab62c1 100644
--- a/c/src/libchip/network/smc91111exp.h
+++ b/c/src/libchip/network/smc91111exp.h
@@ -9,7 +9,7 @@
typedef struct scmv91111_configuration {
void *baseaddr;
- unsigned int vector;
+ rtems_vector_number vector;
unsigned int pio;
unsigned int ctl_rspeed;
unsigned int ctl_rfduplx;
--
1.7.0.4
More information about the devel
mailing list