diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-04-09 20:24:57 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-04-09 20:24:57 +0000 |
commit | c193baadaf4ba825374104b150eceaed203800b0 (patch) | |
tree | 6933fe6b62789da022c05b5400f36cd2d7b80a57 /c/src/lib/libcpu/arm | |
parent | removed over-paranoid warning switches (diff) | |
download | rtems-c193baadaf4ba825374104b150eceaed203800b0.tar.bz2 |
unify irq data types and code, merge s3c2400/s3c2410 support
Diffstat (limited to 'c/src/lib/libcpu/arm')
30 files changed, 205 insertions, 1171 deletions
diff --git a/c/src/lib/libcpu/arm/ChangeLog b/c/src/lib/libcpu/arm/ChangeLog index 4cc6232b5d..3e4348e3e4 100644 --- a/c/src/lib/libcpu/arm/ChangeLog +++ b/c/src/lib/libcpu/arm/ChangeLog @@ -1,3 +1,25 @@ +2010-04-09 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> + + * configure.ac, Makefile.am, at91rm9200/clock/clock.c, + at91rm9200/irq/bsp_irq_init.c, + at91rm9200/irq/irq.h, at91rm9200/usart/usart.c, + lpc22xx/clock/clockdrv.c, lpc22xx/irq/bsp_irq_init.c, + lpc22xx/irq/irq.h, mc9328mxl/irq/bsp_irq_init.c, + mc9328mxl/irq/irq.h libcpu/arm/pxa255/clock/clock.c, + pxa255/irq/bsp_irq_init.c, pxa255/irq/irq.h, + s3c24xx/clock/clockdrv.c, s3c24xx/irq/bsp_irq_init.c, + s3c24xx/irq/irq.h: changes to consolidate s3c24xx support and to + make irq system warning-free + * s3c2400/clock/clockdrv.c, s3c2400/clock/support.c, + s3c2400/include/s3c2400.h, s3c2400/irq/bsp_irq_asm.S, + s3c2400/irq/bsp_irq_init.c, s3c2400/irq/irq.c + libcpu/arm/s3c2400/irq/irq.h, s3c2400/timer/timer.c, + s3c2410/include/s3c2410.h, s3c2410/irq/bsp_irq_asm.S, + s3c2410/irq/irq.h: removed after merge into s3c24xx + + * s3c24xx/include/s3c2400.h, s3c24xx/include/s3c2410.h, + s3c24xx/rq/bsp_irq_asm.S: moved from s3c2400 or s3c2410 tree + 2010-04-08 Sebastian Huber <sebastian.huber@embedded-brains.de> * shared/include/arm-cp15.h: Documentation. Fixed mask defines. diff --git a/c/src/lib/libcpu/arm/Makefile.am b/c/src/lib/libcpu/arm/Makefile.am index 8ad15ed4b9..d2e18e4f26 100644 --- a/c/src/lib/libcpu/arm/Makefile.am +++ b/c/src/lib/libcpu/arm/Makefile.am @@ -134,56 +134,30 @@ mc9328mxl_irq_rel_CPPFLAGS = $(AM_CPPFLAGS) mc9328mxl_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) endif -if s3c2400 -include_HEADERS = s3c24xx/include/s3c24xx.h s3c2400/include/s3c2400.h - -## s3c2400/clock -noinst_PROGRAMS += s3c2400/clock.rel -s3c2400_clock_rel_SOURCES = s3c2400/clock/clockdrv.c s3c2400/clock/support.c -s3c2400_clock_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2400_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) - -## s3c2400/timer -noinst_PROGRAMS += s3c2400/timer.rel -s3c2400_timer_rel_SOURCES = s3c2400/timer/timer.c -s3c2400_timer_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2400_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) - -## s3c2400/interrupt -include_HEADERS += s3c2400/irq/irq.h - -noinst_PROGRAMS += s3c2400/irq.rel -s3c2400_irq_rel_SOURCES = s3c24xx/irq/irq.c s3c24xx/irq/bsp_irq_init.c \ - ../../libbsp/arm/shared/irq/irq_init.c s3c2400/irq/bsp_irq_asm.S \ - s3c2400/irq/irq.h -s3c2400_irq_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2400_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) -endif - -if s3c2410 -include_HEADERS = s3c24xx/include/s3c24xx.h s3c2410/include/s3c2410.h - -## s3c2410/clock -noinst_PROGRAMS += s3c2410/clock.rel -s3c2410_clock_rel_SOURCES = s3c24xx/clock/clockdrv.c s3c24xx/clock/support.c -s3c2410_clock_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2410_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) - -## s3c2410/timer -noinst_PROGRAMS += s3c2410/timer.rel -s3c2410_timer_rel_SOURCES = s3c24xx/timer/timer.c -s3c2410_timer_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2410_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) - -## s3c2410/interrupt -include_HEADERS += s3c2410/irq/irq.h - -noinst_PROGRAMS += s3c2410/irq.rel -s3c2410_irq_rel_SOURCES = s3c24xx/irq/irq.c s3c24xx/irq/bsp_irq_init.c \ - ../../libbsp/arm/shared/irq/irq_init.c s3c2410/irq/bsp_irq_asm.S \ - s3c2410/irq/irq.h -s3c2410_irq_rel_CPPFLAGS = $(AM_CPPFLAGS) -s3c2410_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) +if s3c24xx +include_HEADERS = s3c24xx/include/s3c24xx.h s3c24xx/include/s3c2400.h s3c24xx/include/s3c2410.h + +## s3c24xx/clock +noinst_PROGRAMS += s3c24xx/clock.rel +s3c24xx_clock_rel_SOURCES = s3c24xx/clock/clockdrv.c s3c24xx/clock/support.c +s3c24xx_clock_rel_CPPFLAGS = $(AM_CPPFLAGS) +s3c24xx_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +## s3c24xx/timer +noinst_PROGRAMS += s3c24xx/timer.rel +s3c24xx_timer_rel_SOURCES = s3c24xx/timer/timer.c +s3c24xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS) +s3c24xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +## s3c24xx/interrupt +include_HEADERS += s3c24xx/irq/irq.h + +noinst_PROGRAMS += s3c24xx/irq.rel +s3c24xx_irq_rel_SOURCES = s3c24xx/irq/irq.c s3c24xx/irq/bsp_irq_init.c \ + ../../libbsp/arm/shared/irq/irq_init.c s3c24xx/irq/bsp_irq_asm.S \ + s3c24xx/irq/irq.h +s3c24xx_irq_rel_CPPFLAGS = $(AM_CPPFLAGS) +s3c24xx_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) endif if lpc22xx diff --git a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c index 7a9cf6af07..503239613b 100644 --- a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c +++ b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c @@ -66,15 +66,17 @@ rtems_isr Clock_isr(rtems_vector_number vector); /* Replace the first value with the clock's interrupt name. */ rtems_irq_connect_data clock_isr_data = {AT91RM9200_INT_SYSIRQ, (rtems_irq_hdl)Clock_isr, + NULL, clock_isr_on, clock_isr_off, - clock_isr_is_on, - 3, /* unused for ARM cpus */ - 0 }; /* unused for ARM cpus */ + clock_isr_is_on}; #define Clock_driver_support_install_isr( _new, _old ) \ - BSP_install_rtems_irq_handler(&clock_isr_data) + do { \ + (_old) = NULL; \ + BSP_install_rtems_irq_handler(&clock_isr_data); \ + } while(0) uint16_t st_pimr_value; void Clock_driver_support_initialize_hardware(void) diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c index 99cf822570..eaf21e37b1 100644 --- a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c @@ -15,8 +15,6 @@ #include <bsp.h> #include <at91rm9200.h> -extern void default_int_handler(void); - /* * Interrupt system initialization. Disable interrupts, clear * any that are pending. diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h index 320c4415e5..1219c07e26 100644 --- a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h +++ b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h @@ -25,10 +25,11 @@ extern "C" { * Include some preprocessor value also used by assember code */ +#include <rtems/irq.h> #include <rtems.h> #include <at91rm9200.h> -extern void default_int_handler(); +extern void default_int_handler(rtems_irq_hdl_param unused); /*********************************************************************** * Constants **********************************************************************/ @@ -72,60 +73,11 @@ extern void default_int_handler(); /* a vector table */ #define VECTOR_TABLE AIC_SVR_BASE -typedef unsigned char rtems_irq_level; -typedef unsigned char rtems_irq_trigger; - -struct __rtems_irq_connect_data__; /* forward declaratiuon */ -typedef unsigned int rtems_irq_number; -typedef void (*rtems_irq_hdl) (uint32_t vector); -typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); -typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); -typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*); - -typedef struct __rtems_irq_connect_data__ { - /* IRQ line */ - rtems_irq_number name; - - /* Handler */ - rtems_irq_hdl hdl; - - /* function for enabling interrupts at device level. */ - rtems_irq_enable on; - - /* function for disabling interrupts at device level. */ - rtems_irq_disable off; - - /* Function to test if interrupt is enabled */ - rtems_irq_is_enabled isOn; - - /* priority level of interrupt */ - rtems_irq_level irqLevel; - - /* Trigger method (rising/falling edge or high/low level) */ - rtems_irq_trigger irqTrigger; -} rtems_irq_connect_data; - /* * function to initialize the interrupt for a specific BSP */ void BSP_rtems_irq_mngt_init(); - -/* - * function to connect a particular irq handler. - */ -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); - -/* - * function to get the current RTEMS irq handler for ptr->name. - */ -int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); - -/* - * function to disconnect the RTEMS irq handler for ptr->name. - */ -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); - #endif /* __asm__ */ #ifdef __cplusplus diff --git a/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c b/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c index 7633f05291..6c52570054 100644 --- a/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c +++ b/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c @@ -257,6 +257,7 @@ static int usart_set_attributes(int minor, const struct termios *t) usart->mr = mode; usart->brgr = brgr; + return 0; } /* diff --git a/c/src/lib/libcpu/arm/configure.ac b/c/src/lib/libcpu/arm/configure.ac index a63ce6b263..36c9133d09 100644 --- a/c/src/lib/libcpu/arm/configure.ac +++ b/c/src/lib/libcpu/arm/configure.ac @@ -29,10 +29,10 @@ AM_CONDITIONAL(shared, test "$RTEMS_CPU_MODEL" = "at91rm9200" || \ AM_CONDITIONAL(at91rm9200, test "$RTEMS_CPU_MODEL" = "at91rm9200") AM_CONDITIONAL(mc9328mxl, test "$RTEMS_CPU_MODEL" = "mc9328mxl") -AM_CONDITIONAL(s3c2400, test "$RTEMS_CPU_MODEL" = "s3c2400") -AM_CONDITIONAL(s3c2410, test "$RTEMS_CPU_MODEL" = "s3c2410") AM_CONDITIONAL(lpc22xx, test "$RTEMS_CPU_MODEL" = "lpc22xx") AM_CONDITIONAL(pxa255, test "$RTEMS_CPU_MODEL" = "pxa255") +AM_CONDITIONAL(s3c24xx, test "$RTEMS_CPU_MODEL" = "s3c2400" ||\ + test "$RTEMS_CPU_MODEL" = "s3c2410") RTEMS_AMPOLISH3 diff --git a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c index c277c8ee2f..4f8a31bd9a 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c +++ b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c @@ -29,11 +29,10 @@ static int clock_isr_is_on(const rtems_irq_connect_data *irq); /* Replace the first value with the clock's interrupt name. */ rtems_irq_connect_data clock_isr_data = {LPC22xx_INTERRUPT_TIMER0, (rtems_irq_hdl)Clock_isr, + NULL, clock_isr_on, clock_isr_off, - clock_isr_is_on, - 3, /* unused for ARM cpus */ - 0 }; /* unused for ARM cpus */ + clock_isr_is_on}; /* If you follow the code, this is never used, so any value * should work diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c index 4c5b7850ad..365b69604f 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c @@ -14,8 +14,6 @@ #include <lpc22xx.h> -extern void default_int_handler(void); - /* * Interrupt system initialization. Disable interrupts, clear * any that are pending. diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h index 11f8de1bba..3904484585 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h @@ -25,11 +25,12 @@ extern "C" { /* * Include some preprocessor value also used by assember code */ - +#include <rtems/irq.h> #include <rtems.h> #include <lpc22xx.h> -extern void default_int_handler(); +extern void default_int_handler(rtems_irq_hdl_param unused); + /*********************************************************************** * Constants **********************************************************************/ @@ -78,63 +79,14 @@ extern void default_int_handler(); #define FIQ_ISR_ADDR (*(u_long *)0x0000003CL) -typedef unsigned char rtems_irq_level; -typedef unsigned char rtems_irq_trigger; - -typedef unsigned int rtems_irq_number; -struct __rtems_irq_connect_data__; /* forward declaratiuon */ - -typedef void (*rtems_irq_hdl) (void); -typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); -typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); -typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*); - //extern rtems_irq_hdl bsp_vector_table[BSP_MAX_INT]; #define VECTOR_TABLE VICVectAddrBase -typedef struct __rtems_irq_connect_data__ { - /* IRQ line */ - rtems_irq_number name; - - /* Handler */ - rtems_irq_hdl hdl; - - /* function for enabling interrupts at device level. */ - rtems_irq_enable on; - - /* function for disabling interrupts at device level. */ - rtems_irq_disable off; - - /* Function to test if interrupt is enabled */ - rtems_irq_is_enabled isOn; - - /* priority level of interrupt */ - rtems_irq_level irqLevel; - - /* Trigger method (rising/falling edge or high/low level) */ - rtems_irq_trigger irqTrigger; -} rtems_irq_connect_data; /* * function to initialize the interrupt for a specific BSP */ -void BSP_rtems_irq_mngt_init(); - - -/* - * function to connect a particular irq handler. - */ -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); - -/* - * function to get the current RTEMS irq handler for ptr->name. - */ -int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); - -/* - * function to disconnect the RTEMS irq handler for ptr->name. - */ -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); +void BSP_rtems_irq_mngt_init(void); #endif /* __asm__ */ diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c index 90e854440e..078d246b49 100644 --- a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c @@ -13,9 +13,6 @@ */ #include <irq.h> #include <bsp.h> -#include <mc9328mxl.h> - -extern void default_int_handler(void); /* * Interrupt system initialization. Disable interrupts, clear diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h index 6cc5c22f07..9998d2903c 100644 --- a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h +++ b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h @@ -31,7 +31,7 @@ extern "C" { #include <rtems.h> #include <mc9328mxl.h> -extern void default_int_handler(); +extern void default_int_handler(rtems_irq_hdl_param); /*********************************************************************** * Constants **********************************************************************/ @@ -115,8 +115,7 @@ extern mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT]; /* * function to initialize the interrupt for a specific BSP */ -void BSP_rtems_irq_mngt_init(); - +void BSP_rtems_irq_mngt_init(void); #endif /* __asm__ */ diff --git a/c/src/lib/libcpu/arm/preinstall.am b/c/src/lib/libcpu/arm/preinstall.am index a40ee5d945..7077f0e142 100644 --- a/c/src/lib/libcpu/arm/preinstall.am +++ b/c/src/lib/libcpu/arm/preinstall.am @@ -91,29 +91,20 @@ $(PROJECT_INCLUDE)/irq.h: mc9328mxl/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h endif -if s3c2400 +if s3c24xx $(PROJECT_INCLUDE)/s3c24xx.h: s3c24xx/include/s3c24xx.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/s3c24xx.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c24xx.h -$(PROJECT_INCLUDE)/s3c2400.h: s3c2400/include/s3c2400.h $(PROJECT_INCLUDE)/$(dirstamp) +$(PROJECT_INCLUDE)/s3c2400.h: s3c24xx/include/s3c2400.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/s3c2400.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c2400.h -$(PROJECT_INCLUDE)/irq.h: s3c2400/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h -endif -if s3c2410 -$(PROJECT_INCLUDE)/s3c24xx.h: s3c24xx/include/s3c24xx.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/s3c24xx.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c24xx.h - -$(PROJECT_INCLUDE)/s3c2410.h: s3c2410/include/s3c2410.h $(PROJECT_INCLUDE)/$(dirstamp) +$(PROJECT_INCLUDE)/s3c2410.h: s3c24xx/include/s3c2410.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/s3c2410.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c2410.h -$(PROJECT_INCLUDE)/irq.h: s3c2410/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp) +$(PROJECT_INCLUDE)/irq.h: s3c24xx/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h endif diff --git a/c/src/lib/libcpu/arm/pxa255/clock/clock.c b/c/src/lib/libcpu/arm/pxa255/clock/clock.c index c5d8cc9862..bb9e85c698 100755 --- a/c/src/lib/libcpu/arm/pxa255/clock/clock.c +++ b/c/src/lib/libcpu/arm/pxa255/clock/clock.c @@ -92,16 +92,18 @@ rtems_isr Clock_isr(rtems_vector_number vector); rtems_irq_connect_data clock_isr_data = { XSCALE_IRQ_OS_TIMER, (rtems_irq_hdl)Clock_isr, + NULL, clock_isr_on, clock_isr_off, - clock_isr_is_on, - 3, /* unused for ARM cpus */ - 0 /* unused for ARM cpus */ + clock_isr_is_on }; #define Clock_driver_support_install_isr( _new, _old ) \ - BSP_install_rtems_irq_handler(&clock_isr_data) + do { \ + _old = NULL; \ + BSP_install_rtems_irq_handler(&clock_isr_data); \ + } while (0) void Clock_driver_support_initialize_hardware(void) { diff --git a/c/src/lib/libcpu/arm/pxa255/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/pxa255/irq/bsp_irq_init.c index 0470c88ce9..42bdf396a1 100755 --- a/c/src/lib/libcpu/arm/pxa255/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/pxa255/irq/bsp_irq_init.c @@ -13,12 +13,12 @@ #include <bsp.h> #include <pxa255.h> -void dummy_handler(uint32_t vector) +void dummy_handler(rtems_irq_hdl_param unused) { printk("I am dummy handler\n"); } -void (*IRQ_table[PRIMARY_IRQS])(uint32_t vector); +void (*IRQ_table[PRIMARY_IRQS])(rtems_irq_hdl_param param); /* * Interrupt system initialization. Disable interrupts, clear diff --git a/c/src/lib/libcpu/arm/pxa255/irq/irq.h b/c/src/lib/libcpu/arm/pxa255/irq/irq.h index dcc86384c7..40ad888696 100755 --- a/c/src/lib/libcpu/arm/pxa255/irq/irq.h +++ b/c/src/lib/libcpu/arm/pxa255/irq/irq.h @@ -22,69 +22,15 @@ extern "C" { * Include some preprocessor value also used by assember code */ +#include <rtems/irq.h> #include <rtems.h> #include <pxa255.h> -extern void default_int_handler(); -extern void (*IRQ_table[PRIMARY_IRQS])(uint32_t vector); -extern void dummy_handler(uint32_t vector); +extern void default_int_handler(rtems_irq_hdl_param unused); +extern void (*IRQ_table[PRIMARY_IRQS])(rtems_irq_hdl_param param); +extern void dummy_handler(rtems_irq_hdl_param unused); - - -/* vector table used by shared/irq_init.c */ - -typedef unsigned char rtems_irq_level; -typedef unsigned char rtems_irq_trigger; -struct __rtems_irq_connect_data__; /* forward declaratiuon */ -typedef unsigned int rtems_irq_number; -typedef void (*rtems_irq_hdl) (uint32_t vector); -typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); -typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); -typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*); - -typedef struct __rtems_irq_connect_data__ { - /* IRQ line */ - rtems_irq_number name; - - /* Handler */ - rtems_irq_hdl hdl; - - /* function for enabling interrupts at device level. */ - rtems_irq_enable on; - - /* function for disabling interrupts at device level. */ - rtems_irq_disable off; - - /* Function to test if interrupt is enabled */ - rtems_irq_is_enabled isOn; - - /* priority level of interrupt */ - rtems_irq_level irqLevel; - - /* Trigger method (rising/falling edge or high/low level) */ - rtems_irq_trigger irqTrigger; -} rtems_irq_connect_data; - -/* - * function to initialize the interrupt for a specific BSP - */ -void BSP_rtems_irq_mngt_init(); - - -/* - * function to connect a particular irq handler. - */ -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); - -/* - * function to get the current RTEMS irq handler for ptr->name. - */ -int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); - -/* - * function to disconnect the RTEMS irq handler for ptr->name. - */ -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); +extern void BSP_rtems_irq_mngt_init(void); #endif /* __asm__ */ diff --git a/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c b/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c deleted file mode 100644 index 8de0864d73..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * S3C2400 clock specific using the System Timer - * - * This is hardware specific part of the clock driver. At the end of this - * file, the generic part of the driver is #included. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * - * http://www.rtems.com/license/LICENSE. - * - * - * $Id$ -*/ -#include <rtems.h> -#include <irq.h> -#include <bsp.h> -#include <s3c2400.h> - -/* this is defined in ../../../shared/clockdrv_shell.h */ -rtems_isr Clock_isr(rtems_vector_number vector); -static void clock_isr_on(const rtems_irq_connect_data *unused); -static void clock_isr_off(const rtems_irq_connect_data *unused); -static int clock_isr_is_on(const rtems_irq_connect_data *irq); - -/* Replace the first value with the clock's interrupt name. */ -rtems_irq_connect_data clock_isr_data = {BSP_INT_TIMER4, - (rtems_irq_hdl)Clock_isr, - clock_isr_on, - clock_isr_off, - clock_isr_is_on, - 3, /* unused for ARM cpus */ - 0 }; /* unused for ARM cpus */ - -/* If you follow the code, this is never used, so any value - * should work - */ -#define CLOCK_VECTOR 0 - -/** - * Return the nanoseconds since last tick - */ -uint32_t clock_driver_get_nanoseconds_since_last_tick(void) -{ - return 0; -} - -#define Clock_driver_nanoseconds_since_last_tick \ - clock_driver_get_nanoseconds_since_last_tick - -/** - * When we get the clock interrupt - * - clear the interrupt bit? - * - restart the timer? - */ -#define Clock_driver_support_at_tick() \ - do { \ - ClearPending(BIT_TIMER4); \ - } while(0) - - -/** - * Installs the clock ISR. You shouldn't need to change this. - */ -#define Clock_driver_support_install_isr( _new, _old ) \ - do { \ - _old = NULL; \ - BSP_install_rtems_irq_handler(&clock_isr_data); \ - } while(0) - - -/** - * Initialize the hardware for the clock - * - Set the frequency - * - enable it - * - clear any pending interrupts - * - * Since you may want the clock always running, you can - * enable interrupts here. If you do so, the clock_isr_on(), - * clock_isr_off(), and clock_isr_is_on() functions can be - * NOPs. - */ -#define Clock_driver_support_initialize_hardware() \ - do { \ - uint32_t cr; \ - uint32_t freq,m,p,s; \ - /* set MUX for Timer4 to 1/16 */ \ - cr=rTCFG1 & 0xFFF0FFFF; \ - rTCFG1=(cr | (3<<16)); \ - freq = get_PCLK(); \ - /* set TIMER4 counter, input freq=PLCK/16/16Mhz*/ \ - freq = (freq /16)/16; \ - rTCNTB4 = ((freq / 1000) * rtems_configuration_get_microseconds_per_tick()) / 1000; \ - /*unmask TIMER4 irq*/ \ - rINTMSK&=~BIT_TIMER4; \ - /* start TIMER4 with autoreload */ \ - cr=rTCON & 0xFF8FFFFF; \ - rTCON=(cr|(0x6<<20)); \ - rTCON=(cr|(0x5<<20)); \ - } while (0) - -/** - * Do whatever you need to shut the clock down and remove the - * interrupt handler. Since this normally only gets called on - * RTEMS shutdown, you may not need to do anything other than - * remove the ISR. - */ -#define Clock_driver_support_shutdown_hardware() \ - do { \ - /* Disable timer */ \ - BSP_remove_rtems_irq_handler(&clock_isr_data); \ - } while (0) - -/** - * Enables clock interrupt. - * - * If the interrupt is always on, this can be a NOP. - */ -static void clock_isr_on(const rtems_irq_connect_data *unused) -{ - return; -} - -/** - * Disables clock interrupts - * - * If the interrupt is always on, this can be a NOP. - */ -static void clock_isr_off(const rtems_irq_connect_data *unused) -{ - return; -} - -/** - * Tests to see if clock interrupt is enabled, and returns 1 if so. - * If interrupt is not enabled, returns 0. - * - * If the interrupt is always on, this always returns 1. - */ -static int clock_isr_is_on(const rtems_irq_connect_data *irq) -{ - return 1; -} - - -/* Make sure to include this, and only at the end of the file */ -#include "../../../../libbsp/shared/clockdrv_shell.h" diff --git a/c/src/lib/libcpu/arm/s3c2400/clock/support.c b/c/src/lib/libcpu/arm/s3c2400/clock/support.c deleted file mode 100644 index 99bd21168a..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/clock/support.c +++ /dev/null @@ -1,57 +0,0 @@ -#include <rtems.h> -#include <bsp.h> -#include <s3c2400.h> - -/* ------------------------------------------------------------------------- */ -/* NOTE: This describes the proper use of this file. - * - * BSP_OSC_FREQ should be defined as the input frequency of the PLL. - * - * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of - * the specified bus in HZ. - */ -/* ------------------------------------------------------------------------- */ - -/* return FCLK frequency */ -uint32_t get_FCLK(void) -{ - uint32_t r, m, p, s; - - r = rMPLLCON; - m = ((r & 0xFF000) >> 12) + 8; - p = ((r & 0x003F0) >> 4) + 2; - s = r & 0x3; - - return((BSP_OSC_FREQ * m) / (p << s)); -} - -/* return UCLK frequency */ -uint32_t get_UCLK(void) -{ - uint32_t r, m, p, s; - - r = rUPLLCON; - m = ((r & 0xFF000) >> 12) + 8; - p = ((r & 0x003F0) >> 4) + 2; - s = r & 0x3; - - return((BSP_OSC_FREQ * m) / (p << s)); -} - -/* return HCLK frequency */ -uint32_t get_HCLK(void) -{ - if (rCLKDIVN & 0x2) - return get_FCLK()/2; - else - return get_FCLK(); -} - -/* return PCLK frequency */ -uint32_t get_PCLK(void) -{ - if (rCLKDIVN & 0x1) - return get_HCLK()/2; - else - return get_HCLK(); -} diff --git a/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_asm.S deleted file mode 100644 index d3df84dd11..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_asm.S +++ /dev/null @@ -1,40 +0,0 @@ -/* bsp_irq_asm.S - * - * This file contains the implementation of the IRQ handler - * for a specific BSP - * - * CopyRight (C) 2000 Canon Research France SA. - * Emmanuel Raguet, mailto:raguet@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#define __asm__ - -/* - * Function to obtain, execute an IT handler and acknowledge the IT - */ - - .globl bsp_interrupt_dispatch - -bsp_interrupt_dispatch : - - ldr r0, =0x14400014 /* Read rINTOFFSET */ - ldr r1, [r0] - - ldr r0, =bsp_vector_table - ldr r0, [r0, r1, LSL #2] /* Read the address */ - - stmdb sp!,{lr} - ldr lr, =IRQ_return /* prepare the return from handler */ - - mov pc, r0 - -IRQ_return: - ldmia sp!,{lr} - - mov pc, lr diff --git a/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c deleted file mode 100644 index 2e1e0c4ae1..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c +++ /dev/null @@ -1,37 +0,0 @@ -/* irq_init.c - * - * This file contains the implementation of rtems initialization - * related to interrupt handling. - * - * CopyRight (C) 2000 Canon Research Centre France SA. - * Emmanuel Raguet, mailto:raguet@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ -#include <irq.h> -#include <bsp.h> -#include <s3c2400.h> - -extern void default_int_handler(); - -void BSP_rtems_irq_mngt_init() -{ - long *vectorTable; - int i; - - vectorTable = (long *) VECTOR_TABLE; - - /* Initialize the vector table contents with default handler */ - for (i=0; i<BSP_MAX_INT; i++) { - *(vectorTable + i) = (long)(default_int_handler); - } - - /* - * Here is the code to initialize the INT for - * the specified BSP - */ -} diff --git a/c/src/lib/libcpu/arm/s3c2400/irq/irq.c b/c/src/lib/libcpu/arm/s3c2400/irq/irq.c deleted file mode 100644 index 20bcbb409f..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/irq/irq.c +++ /dev/null @@ -1,110 +0,0 @@ -/* irq.c - * - * This file contains the implementation of the function described in irq.h - * - * CopyRight (C) 2000 Canon Research France SA. - * Emmanuel Raguet, mailto:raguet@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - - -#include <bsp.h> -#include <irq.h> -#include <rtems/score/thread.h> -#include <rtems/score/apiext.h> -#include <s3c2400.h> - -/* - * This function check that the value given for the irq line - * is valid. - */ - -static int isValidInterrupt(int irq) -{ - if ( (irq < 0) || (irq > BSP_MAX_INT)) { - return 0; - } - - return 1; -} - -/* - * ------------------- RTEMS Single Irq Handler Mngt Routines ---------------- - */ - -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq) -{ - rtems_irq_hdl *HdlTable; - rtems_interrupt_level level; - - if (!isValidInterrupt(irq->name)) { - return 0; - } - - /* - * Check if default handler is actually connected. If not issue an error. - */ - HdlTable = (rtems_irq_hdl *)VECTOR_TABLE; - if (*(HdlTable + irq->name) != default_int_handler) { - return 0; - } - - rtems_interrupt_disable(level); - - /* - * store the new handler - */ - *(HdlTable + irq->name) = irq->hdl; - - /* - * Enable interrupt on device - */ - if(irq->on) - { - irq->on(irq); - } - - rtems_interrupt_enable(level); - - return 1; -} - -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq) -{ - rtems_irq_hdl *HdlTable; - rtems_interrupt_level level; - - if (!isValidInterrupt(irq->name)) { - return 0; - } - - /* - * Check if the handler is actually connected. If not issue an error. - */ - HdlTable = (rtems_irq_hdl *)VECTOR_TABLE; - if (*(HdlTable + irq->name) != irq->hdl) { - return 0; - } - rtems_interrupt_disable(level); - - /* - * Disable interrupt on device - */ - if(irq->off) { - irq->off(irq); - } - - /* - * restore the default irq value - */ - *(HdlTable + irq->name) = default_int_handler; - - rtems_interrupt_enable(level); - - return 1; -} diff --git a/c/src/lib/libcpu/arm/s3c2400/irq/irq.h b/c/src/lib/libcpu/arm/s3c2400/irq/irq.h deleted file mode 100644 index 1700285df5..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/irq/irq.h +++ /dev/null @@ -1,204 +0,0 @@ -/* irq.h - * - * This include file describe the data structure and the functions implemented - * by rtems to write interrupt handlers. - * - * Copyright (c) 2000 Canon Research Centre France SA. - * Emmanuel Raguet, mailto:raguet@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#ifndef _IRQ_H_ -#define _IRQ_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Include some preprocessor value also used by assember code - */ - -#include <rtems.h> -#include <s3c2400.h> - -extern void default_int_handler(); -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ - - /* possible interrupt sources */ -#define BSP_EINT0 0 -#define BSP_EINT1 1 -#define BSP_EINT2 2 -#define BSP_EINT3 3 -#define BSP_EINT4 4 -#define BSP_EINT5 5 -#define BSP_EINT6 6 -#define BSP_EINT7 7 -#define BSP_INT_TICK 8 -#define BSP_INT_WDT 9 -#define BSP_INT_TIMER0 10 -#define BSP_INT_TIMER1 11 -#define BSP_INT_TIMER2 12 -#define BSP_INT_TIMER3 13 -#define BSP_INT_TIMER4 14 -#define BSP_INT_UERR01 15 -#define _res0 16 -#define BSP_INT_DMA0 17 -#define BSP_INT_DMA1 18 -#define BSP_INT_DMA2 19 -#define BSP_INT_DMA3 20 -#define BSP_INT_MMC 21 -#define BSP_INT_SPI 22 -#define BSP_INT_URXD0 23 -#define BSP_INT_URXD1 24 -#define BSP_INT_USBD 25 -#define BSP_INT_USBH 26 -#define BSP_INT_IIC 27 -#define BSP_INT_UTXD0 28 -#define BSP_INT_UTXD1 29 -#define BSP_INT_RTC 30 -#define BSP_INT_ADC 31 -#define BSP_MAX_INT 32 - -extern void *bsp_vector_table; -#define VECTOR_TABLE &bsp_vector_table - -/* - * Type definition for RTEMS managed interrupts - */ -typedef unsigned char rtems_irq_level; -typedef unsigned char rtems_irq_trigger; - -struct __rtems_irq_connect_data__; /* forward declaratiuon */ -typedef unsigned int rtems_irq_number; -typedef void (*rtems_irq_hdl) (void); -typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); -typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); -typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*); - -typedef struct __rtems_irq_connect_data__ { - /* - * IRQ line - */ - rtems_irq_number name; - - /* - * handler. See comment on handler properties below in function prototype. - */ - rtems_irq_hdl hdl; - - /* - * function for enabling interrupts at device level (ONLY!). - * The BSP code will automatically enable it at i8259s level. - * RATIONALE : anyway such code has to exist in current driver code. - * It is usually called immediately AFTER connecting the interrupt handler. - * RTEMS may well need such a function when restoring normal interrupt - * processing after a debug session. - * - */ - rtems_irq_enable on; - - /* - * function for disabling interrupts at device level (ONLY!). - * The code will disable it at i8259s level. RATIONALE : anyway - * such code has to exist for clean shutdown. It is usually called - * BEFORE disconnecting the interrupt. RTEMS may well need such - * a function when disabling normal interrupt processing for - * a debug session. May well be a NOP function. - */ - rtems_irq_disable off; - - /* - * function enabling to know what interrupt may currently occur - * if someone manipulates the i8259s interrupt mask without care... - */ - rtems_irq_is_enabled isOn; - - /* - * priority level at the vplus level - */ - rtems_irq_level irqLevel; - - /* - * Trigger way : Rising or falling edge or High or low level - */ - rtems_irq_trigger irqTrigger; - -} rtems_irq_connect_data; - -/*-------------------------------------------------------------------------+ -| Function Prototypes. -+--------------------------------------------------------------------------*/ -/* - * ------------------ RTEMS Single Irq Handler Mngt Routines ---------------- - */ - -/* - * function to initialize the interrupt for a specific BSP - */ -void BSP_rtems_irq_mngt_init(); - - -/* - * function to connect a particular irq handler. This hanlder will NOT be called - * directly as the result of the corresponding interrupt. Instead, a RTEMS - * irq prologue will be called that will : - * - * 1) save the C scratch registers, - * 2) switch to a interrupt stack if the interrupt is not nested, - * 3) store the current i8259s' interrupt masks - * 4) modify them to disable the current interrupt at 8259 level (and may - * be others depending on software priorities) - * 5) aknowledge the i8259s', - * 6) demask the processor, - * 7) call the application handler - * - * As a result the hdl function provided - * - * a) can perfectly be written is C, - * b) may also well directly call the part of the RTEMS API that can be used - * from interrupt level, - * c) It only responsible for handling the jobs that need to be done at - * the device level including (aknowledging/re-enabling the interrupt at device, - * level, getting the data,...) - * - * When returning from the function, the following will be performed by - * the RTEMS irq epilogue : - * - * 1) masks the interrupts again, - * 2) restore the original i8259s' interrupt masks - * 3) switch back on the orinal stack if needed, - * 4) perform rescheduling when necessary, - * 5) restore the C scratch registers... - * 6) restore initial execution flow - * - */ -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); - -/* - * function to get the current RTEMS irq handler for ptr->name. It enables to - * define hanlder chain... - */ -int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); - -/* - * function to get disconnect the RTEMS irq handler for ptr->name. - * This function checks that the value given is the current one for safety reason. - * The user can use the previous function to get it. - */ -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); - - -#ifdef __cplusplus -} -#endif - -#endif /* _IRQ_H_ */ -/* end of include file */ diff --git a/c/src/lib/libcpu/arm/s3c2400/timer/timer.c b/c/src/lib/libcpu/arm/s3c2400/timer/timer.c deleted file mode 100644 index 171ce4e5a6..0000000000 --- a/c/src/lib/libcpu/arm/s3c2400/timer/timer.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * S3C2400 Timer driver - * - * This uses timer 1 for timing measurments. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * - * http://www.rtems.com/license/LICENSE. - * - * Notes: - * This file manages the benchmark timer used by the RTEMS Timing Test - * Suite. Each measured time period is demarcated by calls to - * benchmark_timer_initialize() and benchmark_timer_read(). benchmark_timer_read() usually returns - * the number of microseconds since benchmark_timer_initialize() exitted. - * - * It is important that the timer start/stop overhead be determined - * when porting or modifying this code. - * - * $Id$ -*/ - -#include <rtems.h> -#include <bsp.h> -#include <s3c2400.h> - -uint32_t g_start; -uint32_t g_freq; - -bool benchmark_timer_find_average_overhead; - - -/* - * Set up Timer 1 - */ -void benchmark_timer_initialize( void ) -{ - uint32_t cr; - - /* stop TIMER1*/ - cr=rTCON & 0xFFFFF0FF; - rTCON=(cr | (0x0 << 8)); - - /* set MUX for Timer1 to 1/2 */ - cr=rTCFG1 & 0xFFFFFF0F; - rTCFG1=(cr | (0<<4)); - - /* input freq=PLCK/2 Mhz*/ - g_freq = get_PCLK() / 2000; - rTCNTB1 = 0xFFFF; - - /* start TIMER1 with manual reload */ - cr=rTCON & 0xFFFFF0FF; - rTCON=(cr | (0x1 << 9)); - rTCON=(cr | (0x1 << 8)); - - g_start = rTCNTO1; -} - -/* - * The following controls the behavior of benchmark_timer_read(). - * - * AVG_OVEREHAD is the overhead for starting and stopping the timer. It - * is usually deducted from the number returned. - * - * LEAST_VALID is the lowest number this routine should trust. Numbers - * below this are "noise" and zero is returned. - */ - -#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ - /* (Y countdowns) to start/stop the timer. */ - /* This value is in microseconds. */ -#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ - -int benchmark_timer_read( void ) -{ - uint32_t t; - unsigned long long total; - - t = rTCNTO1; - /* - * Total is calculated by taking into account the number of timer overflow - * interrupts since the timer was initialized and clicks since the last - * interrupts. - */ - - total = (g_start - t); - - /* convert to microseconds */ - total = (total*1000) / g_freq; - - if ( benchmark_timer_find_average_overhead == 1 ) { - return (int) total; - } else if ( total < LEAST_VALID ) { - return 0; - } - - /* - * Somehow convert total into microseconds - */ - return (total - AVG_OVERHEAD); -} - -void benchmark_timer_disable_subtracting_average_overhead(bool find_flag) -{ - benchmark_timer_find_average_overhead = find_flag; -} - diff --git a/c/src/lib/libcpu/arm/s3c2410/irq/irq.h b/c/src/lib/libcpu/arm/s3c2410/irq/irq.h deleted file mode 100644 index de3accbf71..0000000000 --- a/c/src/lib/libcpu/arm/s3c2410/irq/irq.h +++ /dev/null @@ -1,202 +0,0 @@ -/* irq.h - * - * This include file describe the data structure and the functions implemented - * by rtems to write interrupt handlers. - * - * Copyright (c) 2000 Canon Research Centre France SA. - * Emmanuel Raguet, mailto:raguet@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#ifndef _IRQ_H_ -#define _IRQ_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Include some preprocessor value also used by assember code - */ - -#include <rtems.h> -#include <s3c2410.h> - -extern void default_int_handler(); -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ - - /* possible interrupt sources */ -#define BSP_EINT0 0 -#define BSP_EINT1 1 -#define BSP_EINT2 2 -#define BSP_EINT3 3 -#define BSP_EINT4_7 4 -#define BSP_EINT8_23 5 -#define BSP_nBATT_FLT 7 -#define BSP_INT_TICK 8 -#define BSP_INT_WDT 9 -#define BSP_INT_TIMER0 10 -#define BSP_INT_TIMER1 11 -#define BSP_INT_TIMER2 12 -#define BSP_INT_TIMER3 13 -#define BSP_INT_TIMER4 14 -#define BSP_INT_UART2 15 -#define BSP_INT_LCD 16 -#define BSP_INT_DMA0 17 -#define BSP_INT_DMA1 18 -#define BSP_INT_DMA2 19 -#define BSP_INT_DMA3 20 -#define BSP_INT_SDI 21 -#define BSP_INT_SPI0 22 -#define BSP_INT_UART1 23 -#define BSP_INT_USBD 25 -#define BSP_INT_USBH 26 -#define BSP_INT_IIC 27 -#define BSP_INT_UART0 28 -#define BSP_INT_SPI1 29 -#define BSP_INT_RTC 30 -#define BSP_INT_ADC 31 -#define BSP_MAX_INT 32 - -extern void *bsp_vector_table; -#define VECTOR_TABLE &bsp_vector_table - -/* - * Type definition for RTEMS managed interrupts - */ -typedef unsigned char rtems_irq_level; -typedef unsigned char rtems_irq_trigger; - -struct __rtems_irq_connect_data__; /* forward declaratiuon */ -typedef unsigned int rtems_irq_number; -typedef void (*rtems_irq_hdl) (void); -typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); -typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); -typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*); - -typedef struct __rtems_irq_connect_data__ { - /* - * IRQ line - */ - rtems_irq_number name; - - /* - * handler. See comment on handler properties below in function prototype. - */ - rtems_irq_hdl hdl; - - /* - * function for enabling interrupts at device level (ONLY!). - * The BSP code will automatically enable it at i8259s level. - * RATIONALE : anyway such code has to exist in current driver code. - * It is usually called immediately AFTER connecting the interrupt handler. - * RTEMS may well need such a function when restoring normal interrupt - * processing after a debug session. - * - */ - rtems_irq_enable on; - - /* - * function for disabling interrupts at device level (ONLY!). - * The code will disable it at i8259s level. RATIONALE : anyway - * such code has to exist for clean shutdown. It is usually called - * BEFORE disconnecting the interrupt. RTEMS may well need such - * a function when disabling normal interrupt processing for - * a debug session. May well be a NOP function. - */ - rtems_irq_disable off; - - /* - * function enabling to know what interrupt may currently occur - * if someone manipulates the i8259s interrupt mask without care... - */ - rtems_irq_is_enabled isOn; - - /* - * priority level at the vplus level - */ - rtems_irq_level irqLevel; - - /* - * Trigger way : Rising or falling edge or High or low level - */ - rtems_irq_trigger irqTrigger; - -} rtems_irq_connect_data; - -/*-------------------------------------------------------------------------+ -| Function Prototypes. -+--------------------------------------------------------------------------*/ -/* - * ------------------ RTEMS Single Irq Handler Mngt Routines ---------------- - */ - -/* - * function to initialize the interrupt for a specific BSP - */ -void BSP_rtems_irq_mngt_init(); - - -/* - * function to connect a particular irq handler. This hanlder will NOT be called - * directly as the result of the corresponding interrupt. Instead, a RTEMS - * irq prologue will be called that will : - * - * 1) save the C scratch registers, - * 2) switch to a interrupt stack if the interrupt is not nested, - * 3) store the current i8259s' interrupt masks - * 4) modify them to disable the current interrupt at 8259 level (and may - * be others depending on software priorities) - * 5) aknowledge the i8259s', - * 6) demask the processor, - * 7) call the application handler - * - * As a result the hdl function provided - * - * a) can perfectly be written is C, - * b) may also well directly call the part of the RTEMS API that can be used - * from interrupt level, - * c) It only responsible for handling the jobs that need to be done at - * the device level including (aknowledging/re-enabling the interrupt at device, - * level, getting the data,...) - * - * When returning from the function, the following will be performed by - * the RTEMS irq epilogue : - * - * 1) masks the interrupts again, - * 2) restore the original i8259s' interrupt masks - * 3) switch back on the orinal stack if needed, - * 4) perform rescheduling when necessary, - * 5) restore the C scratch registers... - * 6) restore initial execution flow - * - */ -int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); - -/* - * function to get the current RTEMS irq handler for ptr->name. It enables to - * define hanlder chain... - */ -int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); - -/* - * function to get disconnect the RTEMS irq handler for ptr->name. - * This function checks that the value given is the current one for safety reason. - * The user can use the previous function to get it. - */ -int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); - - -#ifdef __cplusplus -} -#endif - -#endif /* _IRQ_H_ */ -/* end of include file */ diff --git a/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c index 04edef54cf..76ff9376e1 100644 --- a/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c +++ b/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c @@ -26,11 +26,11 @@ static int clock_isr_is_on(const rtems_irq_connect_data *irq); /* Replace the first value with the clock's interrupt name. */ rtems_irq_connect_data clock_isr_data = {BSP_INT_TIMER4, (rtems_irq_hdl)Clock_isr, + NULL, clock_isr_on, clock_isr_off, - clock_isr_is_on, - 3, /* unused for ARM cpus */ - 0 }; /* unused for ARM cpus */ + clock_isr_is_on +}; /* If you follow the code, this is never used, so any value * should work diff --git a/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h b/c/src/lib/libcpu/arm/s3c24xx/include/s3c2400.h index b8243a7790..092dcffe5c 100644 --- a/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h +++ b/c/src/lib/libcpu/arm/s3c24xx/include/s3c2400.h @@ -8,6 +8,8 @@ #ifndef S3C2400_H_ #define S3C2400_H_ +/* to be used in assembly code */ +#define rINTOFFSET_ADDR 0x14400014 /* Memory control */ #define rBWSCON (*(volatile unsigned *)0x14000000) #define rBANKCON0 (*(volatile unsigned *)0x14000004) @@ -427,7 +429,7 @@ } /* Wait until rINTPND is changed for the case that the ISR is very short. */ -#ifndef __asm__ +#ifndef ASM /* Typedefs */ typedef union { struct _reg { @@ -654,7 +656,7 @@ typedef union { } reg; unsigned long all; } IISSFIF; -#endif //__asm__ +#endif //ASM #define LCD_WIDTH 240 #define LCD_HEIGHT 320 diff --git a/c/src/lib/libcpu/arm/s3c2410/include/s3c2410.h b/c/src/lib/libcpu/arm/s3c24xx/include/s3c2410.h index 4e064a1805..d11bcf9d21 100644 --- a/c/src/lib/libcpu/arm/s3c2410/include/s3c2410.h +++ b/c/src/lib/libcpu/arm/s3c24xx/include/s3c2410.h @@ -7,6 +7,9 @@ #ifndef S3C2410_H_ #define S3C2410_H_ + +/* to be used in assembly code */ +#define rINTOFFSET_ADDR 0x4A000014 /* Memory control */ #define rBWSCON (*(volatile unsigned *)0x48000000) #define rBANKCON0 (*(volatile unsigned *)0x48000004) @@ -576,7 +579,7 @@ rINTPND;\ } /* Wait until rINTPND is changed for the case that the ISR is very short. */ -#ifndef __asm__ +#ifndef ASM /* Typedefs */ typedef union { struct _reg { @@ -802,7 +805,7 @@ typedef union { } reg; unsigned long all; } IISSFIF; -#endif //__asm__ +#endif //ASM #define LCD_WIDTH 240 #define LCD_HEIGHT 320 diff --git a/c/src/lib/libcpu/arm/s3c2410/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S index b381bbd471..78d0c5ce44 100644 --- a/c/src/lib/libcpu/arm/s3c2410/irq/bsp_irq_asm.S +++ b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S @@ -6,6 +6,8 @@ * CopyRight (C) 2000 Canon Research France SA. * Emmanuel Raguet, mailto:raguet@crf.canon.fr * + * merged to common file for s32400 and s32410 by Thomas Doerfler, embedded brains + * * The license and distribution terms for this file may be * found in found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. @@ -13,7 +15,7 @@ * $Id$ */ -#define __asm__ +#include <s3c24xx.h> /* * Function to obtain, execute an IT handler and acknowledge the IT @@ -23,7 +25,7 @@ bsp_interrupt_dispatch : - ldr r0, =0x4A000014 /* Read rINTOFFSET */ + ldr r0, =rINTOFFSET_ADDR /* Read rINTOFFSET */ ldr r1, [r0] ldr r0, =bsp_vector_table diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c index d4a9f4ebdb..97c24c4fb4 100644 --- a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c @@ -16,8 +16,6 @@ #include <bsp.h> #include <s3c24xx.h> -extern void default_int_handler(void); - void BSP_rtems_irq_mngt_init(void) { long *vectorTable; diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h index b8f2868f28..5870f06377 100644 --- a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h +++ b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h @@ -1,16 +1,117 @@ /* irq.h * - * Note: This file will not be compiled, it just a place holder by now + * Common file, merged from s3c2400/irq/irq.h and s3c2410/irq/irq.h */ #ifndef _IRQ_H_ #define _IRQ_H_ +#ifdef __cplusplus +extern "C" { +#endif -// This file is a place holder -// The real irq.h preinstalled is s3c2410/irq/irq.h and s3c2410/irq/irq.h -// change/refer to this files -// TODO: clean irq.h in ARM BSP. there is lots of duplicated codes in cpu_name/irq/irq.h with cpukit/include/rtems/irq.h -// +/* + * Include some preprocessor value also used by assember code + */ + +#include <rtems/irq.h> +#include <rtems.h> +#include <s3c24xx.h> + +extern void default_int_handler(rtems_irq_hdl_param unused); +/*-------------------------------------------------------------------------+ +| Constants ++--------------------------------------------------------------------------*/ + +#ifdef CPU_S3C2400 + /* possible interrupt sources */ +#define BSP_EINT0 0 +#define BSP_EINT1 1 +#define BSP_EINT2 2 +#define BSP_EINT3 3 +#define BSP_EINT4 4 +#define BSP_EINT5 5 +#define BSP_EINT6 6 +#define BSP_EINT7 7 +#define BSP_INT_TICK 8 +#define BSP_INT_WDT 9 +#define BSP_INT_TIMER0 10 +#define BSP_INT_TIMER1 11 +#define BSP_INT_TIMER2 12 +#define BSP_INT_TIMER3 13 +#define BSP_INT_TIMER4 14 +#define BSP_INT_UERR01 15 +#define _res0 16 +#define BSP_INT_DMA0 17 +#define BSP_INT_DMA1 18 +#define BSP_INT_DMA2 19 +#define BSP_INT_DMA3 20 +#define BSP_INT_MMC 21 +#define BSP_INT_SPI 22 +#define BSP_INT_URXD0 23 +#define BSP_INT_URXD1 24 +#define BSP_INT_USBD 25 +#define BSP_INT_USBH 26 +#define BSP_INT_IIC 27 +#define BSP_INT_UTXD0 28 +#define BSP_INT_UTXD1 29 +#define BSP_INT_RTC 30 +#define BSP_INT_ADC 31 +#define BSP_MAX_INT 32 + +#elif defined CPU_S3C2410 + /* possible interrupt sources */ +#define BSP_EINT0 0 +#define BSP_EINT1 1 +#define BSP_EINT2 2 +#define BSP_EINT3 3 +#define BSP_EINT4_7 4 +#define BSP_EINT8_23 5 +#define BSP_nBATT_FLT 7 +#define BSP_INT_TICK 8 +#define BSP_INT_WDT 9 +#define BSP_INT_TIMER0 10 +#define BSP_INT_TIMER1 11 +#define BSP_INT_TIMER2 12 +#define BSP_INT_TIMER3 13 +#define BSP_INT_TIMER4 14 +#define BSP_INT_UART2 15 +#define BSP_INT_LCD 16 +#define BSP_INT_DMA0 17 +#define BSP_INT_DMA1 18 +#define BSP_INT_DMA2 19 +#define BSP_INT_DMA3 20 +#define BSP_INT_SDI 21 +#define BSP_INT_SPI0 22 +#define BSP_INT_UART1 23 +#define BSP_INT_USBD 25 +#define BSP_INT_USBH 26 +#define BSP_INT_IIC 27 +#define BSP_INT_UART0 28 +#define BSP_INT_SPI1 29 +#define BSP_INT_RTC 30 +#define BSP_INT_ADC 31 +#define BSP_MAX_INT 32 +#endif + +extern void *bsp_vector_table; +#define VECTOR_TABLE &bsp_vector_table + +/*-------------------------------------------------------------------------+ +| Function Prototypes. ++--------------------------------------------------------------------------*/ +/* + * ------------------ RTEMS Single Irq Handler Mngt Routines ---------------- + */ + +/* + * function to initialize the interrupt for a specific BSP + */ +void BSP_rtems_irq_mngt_init(); + + +#ifdef __cplusplus +} +#endif #endif /* _IRQ_H_ */ /* end of include file */ |