From bd8c8b2a855f3219e3c4c73c9e67eb4bd6d473d7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 5 Aug 1998 16:51:39 +0000 Subject: Patch from Eric Valette which brings the i386ex BSP inline with the new IRQ structure. --- c/src/lib/libbsp/i386/i386ex/clock/ckinit.c | 67 ++++++++-------- c/src/lib/libbsp/i386/i386ex/console/Makefile.in | 9 ++- c/src/lib/libbsp/i386/i386ex/console/console.c | 19 ++++- c/src/lib/libbsp/i386/i386ex/include/bsp.h | 10 +-- c/src/lib/libbsp/i386/i386ex/start/start.s | 24 ++++-- c/src/lib/libbsp/i386/i386ex/startup/Makefile.in | 12 ++- c/src/lib/libbsp/i386/i386ex/startup/bspstart.c | 5 +- c/src/lib/libbsp/i386/i386ex/timer/timer.c | 60 ++++++++++++-- c/src/lib/libbsp/i386/i386ex/timer/timerisr.s | 6 ++ c/src/lib/libbsp/i386/pc386/console/Makefile.in | 7 +- c/src/lib/libbsp/i386/pc386/console/console.c | 12 +++ c/src/lib/libbsp/i386/pc386/console/inch.c | 2 +- c/src/lib/libbsp/i386/pc386/include/bsp.h | 1 + c/src/lib/libbsp/i386/pc386/startup/Makefile.in | 2 +- c/src/lib/libbsp/i386/pc386/timer/timer.c | 2 +- c/src/lib/libbsp/i386/shared/Makefile.in | 2 +- c/src/lib/libbsp/i386/shared/io/Makefile.in | 33 ++++++++ c/src/lib/libbsp/i386/shared/io/bspIo.h | 38 +++++++++ c/src/lib/libbsp/i386/shared/io/printk.c | 99 ++++++++++++++++++++++++ c/src/lib/libbsp/i386/shared/irq/irq.h | 5 +- c/src/lib/libbsp/i386/shared/irq/irq_init.c | 9 ++- 21 files changed, 354 insertions(+), 70 deletions(-) create mode 100644 c/src/lib/libbsp/i386/shared/io/Makefile.in create mode 100644 c/src/lib/libbsp/i386/shared/io/bspIo.h create mode 100644 c/src/lib/libbsp/i386/shared/io/printk.c (limited to 'c/src/lib/libbsp/i386') diff --git a/c/src/lib/libbsp/i386/i386ex/clock/ckinit.c b/c/src/lib/libbsp/i386/i386ex/clock/ckinit.c index 9c3bbd7dc2..0ede2182b9 100644 --- a/c/src/lib/libbsp/i386/i386ex/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/i386ex/clock/ckinit.c @@ -21,19 +21,16 @@ */ #include +#include #include #include -#define CLOCK_VECTOR 0x20 - rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ volatile rtems_unsigned32 Clock_driver_ticks; -rtems_isr_entry Old_ticker; - void Clock_exit( void ); /* @@ -47,9 +44,7 @@ rtems_device_major_number rtems_clock_minor = 0; * This is the ISR handler. */ -rtems_isr Clock_isr( - rtems_vector_number vector -) +void Clock_isr() { /* enable_tracing(); */ Clock_driver_ticks += 1; @@ -61,16 +56,13 @@ rtems_isr Clock_isr( Clock_isrs -= 1; } -void Install_clock( - rtems_isr_entry clock_isr -) +void ClockOff(const rtems_irq_connect_data* unused) { - Clock_driver_ticks = 0; - Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; - - if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + /* should do something here */; +} +void ClockOn(const rtems_irq_connect_data* unused) +{ /* The following is already set up in interns.s -> ( This is test code only... production code will move the TMRCFG stuff here ) @@ -81,24 +73,25 @@ void Install_clock( #define TMRCON 0xF043 #define TMRCFG 0xF834 - outport_byte ( TMRCFG , 0x80 ); + outport_byte ( TMRCFG , 0x80 ); - outport_byte ( TMRCON , 0x34 ); - outport_byte ( TMR0 , 0xA8 ); - outport_byte ( TMR0 , 0x04 ); + outport_byte ( TMRCON , 0x34 ); + outport_byte ( TMR0 , 0xA8 ); + outport_byte ( TMR0 , 0x04 ); - outport_byte ( TMRCFG , 0x00 ); - } - atexit( Clock_exit ); + outport_byte ( TMRCFG , 0x00 ); } -void Clock_exit( void ) +int ClockIsOn(const rtems_irq_connect_data* unused) { - if ( BSP_Configuration.ticks_per_timeslice ) { - /* should do something here */; - } + return ((i8259s_cache & 0x1) == 0); } +static rtems_irq_connect_data clockIrqData = {PC_386_PERIODIC_TIMER, + Clock_isr, + ClockOn, + ClockOff, + ClockIsOn}; rtems_device_driver Clock_initialize( rtems_device_major_number major, @@ -106,8 +99,12 @@ rtems_device_driver Clock_initialize( void *pargp ) { - Install_clock( Clock_isr ); - + Clock_driver_ticks = 0; + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + if (!pc386_install_rtems_irq_handler (&clockIrqData)) { + printk("Unable to initialize system clock\n"); + rtems_fatal_error_occurred(1); + } /* * make major/minor avail to others such as shared memory driver */ @@ -124,7 +121,6 @@ rtems_device_driver Clock_control( void *pargp ) { - rtems_unsigned32 isrlevel; rtems_libio_ioctl_args_t *args = pargp; if (args == 0) @@ -137,16 +133,21 @@ rtems_device_driver Clock_control( if (args->command == rtems_build_name('I', 'S', 'R', ' ')) { - Clock_isr(CLOCK_VECTOR); + Clock_isr(); } else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) { - rtems_interrupt_disable( isrlevel ); - (void) set_vector( args->buffer, CLOCK_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); + if (!pc386_install_rtems_irq_handler (&clockIrqData)) { + printk("Error installing clock interrupt handler!\n"); + rtems_fatal_error_occurred(1); + } } done: return RTEMS_SUCCESSFUL; } +void Clock_exit() +{ + pc386_remove_rtems_irq_handler (&clockIrqData); +} diff --git a/c/src/lib/libbsp/i386/i386ex/console/Makefile.in b/c/src/lib/libbsp/i386/i386ex/console/Makefile.in index c1f28bc4c4..e774529a2b 100644 --- a/c/src/lib/libbsp/i386/i386ex/console/Makefile.in +++ b/c/src/lib/libbsp/i386/i386ex/console/Makefile.in @@ -10,8 +10,10 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/console.rel +IMPORT_SRC=$(srcdir)/../../shared/io/printk.c + # C source names, if any, go here -- minus the .c -C_PIECES=console +C_PIECES=console printk C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) @@ -49,10 +51,13 @@ LDFLAGS += CLEAN_ADDITIONS += CLOBBER_ADDITIONS += +preinstall: + ${CP} ${IMPORT_SRC} . + ${PGM}: ${SRCS} ${OBJS} $(make-rel) -all: ${ARCH} $(SRCS) $(PGM) +all: ${ARCH} preinstall $(SRCS) $(PGM) # the .rel file built here will be put into libbsp.a by ../wrapup/Makefile install: all diff --git a/c/src/lib/libbsp/i386/i386ex/console/console.c b/c/src/lib/libbsp/i386/i386ex/console/console.c index 0d05e84b30..03c2e3b4cd 100644 --- a/c/src/lib/libbsp/i386/i386ex/console/console.c +++ b/c/src/lib/libbsp/i386/i386ex/console/console.c @@ -16,7 +16,7 @@ #include #include - +#include #include #include "../start/80386ex.h" @@ -109,6 +109,18 @@ rtems_boolean is_character_ready( return FALSE; } +/* + * Wait for an input. May be used before intr are ON. + */ +char BSP_wait_polled_input( void ) +{ + char c; + while (!is_character_ready(&c)) + continue; + + return c; +} + /* inbyte * * This routine reads a character from the UART. @@ -277,3 +289,8 @@ rtems_device_driver console_control( { return RTEMS_SUCCESSFUL; } + +BSP_output_char_function_type BSP_output_char = outbyte; +BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input; + +void BSP_emergency_output_init() {} diff --git a/c/src/lib/libbsp/i386/i386ex/include/bsp.h b/c/src/lib/libbsp/i386/i386ex/include/bsp.h index 9c37d8248e..eef2d2559a 100644 --- a/c/src/lib/libbsp/i386/i386ex/include/bsp.h +++ b/c/src/lib/libbsp/i386/i386ex/include/bsp.h @@ -23,7 +23,9 @@ extern "C" { #include #include #include - +#include +#include + /* * Define the time limits for RTEMS Test Suite test durations. * Long test and short test duration limits are provided. These @@ -129,12 +131,6 @@ BSP_EXTERN unsigned int Gdt_base; /* routines */ -i386_isr_entry set_vector( - rtems_isr_entry handler, - rtems_vector_number vector, - int type -); - #ifdef __cplusplus } #endif diff --git a/c/src/lib/libbsp/i386/i386ex/start/start.s b/c/src/lib/libbsp/i386/i386ex/start/start.s index 51bbea97d4..02b4166eaf 100644 --- a/c/src/lib/libbsp/i386/i386ex/start/start.s +++ b/c/src/lib/libbsp/i386/i386ex/start/start.s @@ -33,6 +33,10 @@ #include "macros.inc" #include "80386ex.inc" +/* + * Needed for binutils 2.9.1.0.7 and higher + * #define NEXT_GAS + */ EXTERN (main) /* exits to bspstart */ EXTERN (stack_start) /* defined in startup/linkcmds */ @@ -179,6 +183,9 @@ SYM(reset): .code16 nop cli +#ifdef NEXT_GAS + addr32 +#endif jmp SYM(_initInternalRegisters) /* different section in this file */ .code32 /* in case this section moves */ nop /* required by CHIP LAB to pad out size */ @@ -192,8 +199,8 @@ SYM(reset): /* * Enable access to peripheral register at expanded I/O addresses */ - .code16 SYM(_initInternalRegisters): + .code16 movw $0x8000 , ax outb al , $REMAPCFGH xchg al , ah @@ -406,8 +413,8 @@ SYM(InitInt): SetExRegByte(ICW1M , 0x11 ) # edge triggered SetExRegByte(ICW2M , 0x20 ) # base vector starts at byte 32 - SetExRegByte(ICW3M , 0x04 ) # IR2 is cascaded internally - SetExRegByte(ICW4M , 0X03 ) # AEOI MODE FIRST! + SetExRegByte(ICW3M , 0x02 ) # IR2 is cascaded internally + SetExRegByte(ICW4M , 0x01 ) # idem SetExRegByte(OCW1M , 0xde ) # IR0 only = 0xfe. for IR5 and IR0 active use 0xde SetExRegByte(INTCFG , 0x00 ) @@ -481,7 +488,10 @@ SYM(xfer_gdt): movw $ _ram_gdt_segment, ax mov ax , ds - +#ifdef NEXT_GAS + data32 + addr32 +#endif lgdt _ram_gdt_offset # location of GDT @@ -494,16 +504,16 @@ SYM(SetUCS): /*************************** * Switch to Protected Mode ***************************/ - mov %cr0, eax + mov cr0, eax orw $0x1, ax - mov eax, %cr0 + mov eax, cr0 /************************** * Flush prefetch queue, * and load CS selector *********************/ - ljmp $ GDT_CODE_PTR , $ SYM(_copy_data) # sets the code selector + ljmpl $ GDT_CODE_PTR , $ SYM(_copy_data) # sets the code selector /* * Copy the data section down to RAM */ diff --git a/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in b/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in index 9f4b9ae2fb..ffd694f64f 100644 --- a/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in @@ -10,8 +10,11 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel +IMPORT_SRC=$(srcdir)/../../shared/irq/irq.c \ + $(srcdir)/../../shared/irq/irq_init.c $(srcdir)/../../shared/irq/irq_asm.s + # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk irq irq_init C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) @@ -19,7 +22,7 @@ H_FILES= # Assembly source names, if any, go here -- minus the .s # removed initcsu piece, ldsegs piece and flush -S_PIECES= +S_PIECES=irq_asm S_FILES=$(S_PIECES:%=%.s) S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) @@ -52,9 +55,12 @@ LDFLAGS += CLEAN_ADDITIONS += CLOBBER_ADDITIONS += +preinstall: + ${CP} ${IMPORT_SRC} . + ${PGM}: ${SRCS} ${OBJS} $(make-rel) -all: ${ARCH} $(SRCS) $(PGM) +all: ${ARCH} preinstall $(SRCS) $(PGM) $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib # the .rel file built here will be put into libbsp.a by ../wrapup/Makefile diff --git a/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c b/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c index d71f182230..fc519b430a 100644 --- a/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c @@ -114,5 +114,8 @@ void bsp_start( void ) */ /* console_reserve_resources( &BSP_Configuration ); */ - + /* + * Init rtems_interrupt_management + */ + rtems_irq_mngt_init(); } diff --git a/c/src/lib/libbsp/i386/i386ex/timer/timer.c b/c/src/lib/libbsp/i386/i386ex/timer/timer.c index af0217ef8d..4c29d6c57f 100644 --- a/c/src/lib/libbsp/i386/i386ex/timer/timer.c +++ b/c/src/lib/libbsp/i386/i386ex/timer/timer.c @@ -27,11 +27,13 @@ #include #include +#include int Ttimer_val; rtems_boolean Timer_driver_Find_average_overhead; -rtems_isr timerisr(); +extern void timerisr(); +extern int ClockIsOn(const rtems_raw_irq_connect_data*); #define TMR0 0xF040 #define TMR1 0xF041 @@ -39,11 +41,9 @@ rtems_isr timerisr(); #define TMRCON 0xF043 #define TMRCFG 0xF834 -void Timer_initialize() +void TimerOn(const rtems_raw_irq_connect_data* used) { - (void) set_vector( timerisr, 0x2a, 0 ); /* install ISR ( IR2 ) was 0x38*/ - Ttimer_val = 0; /* clear timer ISR count */ outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */ @@ -51,8 +51,58 @@ void Timer_initialize() outport_byte ( TMR1 , 0x00 ); outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */ /* interrupts ARE enabled */ -/* outport_byte( IERA, 0x41 ); enable interrupt */ + /* outport_byte( IERA, 0x41 ); enable interrupt */ + /* + * enable interrrupt at i8259 level + */ + pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE); +} + +void TimerOff(const rtems_raw_irq_connect_data* used) +{ + /* + * disable interrrupt at i8259 level + */ + pc386_irq_disable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE); + /* reset timer mode to standard (DOS) value */ +} + +static rtems_raw_irq_connect_data timer_raw_irq_data = { + PC_386_RT_TIMER3 + PC386_IRQ_VECTOR_BASE, + timerisr, + TimerOn, + TimerOff, + ClockIsOn +}; + +void Timer_exit() +{ + if (!i386_delete_idt_entry(&timer_raw_irq_data)) { + printk("Timer raw handler deconnexion failed\n"); + rtems_fatal_error_occurred(1); + } +} + +void Timer_initialize() +{ + + static rtems_boolean First = TRUE; + if (First) + { + First = FALSE; + + atexit(Timer_exit); /* Try not to hose the system at exit. */ + if (!i386_set_idt_entry (&timer_raw_irq_data)) { + printk("raw handler connexion failed\n"); + rtems_fatal_error_occurred(1); + } + } + /* wait for ISR to be called at least once */ + Ttimer_val = 0; + while (Ttimer_val == 0) + continue; + Ttimer_val = 0; } #define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */ diff --git a/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s b/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s index 3264248b05..53463e1e70 100644 --- a/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s +++ b/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s @@ -28,6 +28,12 @@ PUBLIC (timerisr) SYM (timerisr): addl $250, SYM (Ttimer_val) # another 250 microseconds + pushl eax + movb 0xa0,al /* signal generic End Of Interrupt (EOI) to slave PIC */ + outb al, $0x20 + movb $0x20, al + outb al, $0x20 /* signal generic EOI to Master PIC */ + popl eax iret END_CODE diff --git a/c/src/lib/libbsp/i386/pc386/console/Makefile.in b/c/src/lib/libbsp/i386/pc386/console/Makefile.in index bcfd781dd9..02a701c539 100644 --- a/c/src/lib/libbsp/i386/pc386/console/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/console/Makefile.in @@ -10,6 +10,8 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/console.rel +IMPORT_SRC=$(srcdir)/../../shared/io/printk.c + # C source names, if any, go here -- minus the .c C_PIECES=console inch outch printk C_FILES=$(C_PIECES:%=%.c) @@ -50,10 +52,13 @@ LDFLAGS += CLEAN_ADDITIONS += CLOBBER_ADDITIONS += +preinstall: + ${CP} ${IMPORT_SRC} . + ${PGM}: ${SRCS} ${OBJS} $(make-rel) -all: ${ARCH} $(SRCS) $(PGM) +all: ${ARCH} preinstall $(SRCS) $(PGM) # the .rel file built here will be put into libbsp.a by ../wrapup/Makefile install: all diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c index fb711ef578..f67072a3c4 100644 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ b/c/src/lib/libbsp/i386/pc386/console/console.c @@ -61,6 +61,8 @@ static rtems_irq_connect_data console_isr_data = {PC_386_KEYBOARD, extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */ +extern BSP_polling_getchar_function_type BSP_wait_polled_input(); +extern void _IBMPC_initVideo(); void console_reserve_resources(rtems_configuration_table *conf) { @@ -475,6 +477,16 @@ conSetAttr(int minor, const struct termios *t) return 0; } +/* + * BSP initialization + */ + +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; +void BSP_emergency_output_init() +{ + _IBMPC_initVideo(); +} diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c index 39c29f93e0..ee05f3bfa5 100644 --- a/c/src/lib/libbsp/i386/pc386/console/inch.c +++ b/c/src/lib/libbsp/i386/pc386/console/inch.c @@ -295,7 +295,7 @@ _IBMPC_inch(void) */ char -debugPollingGetChar(void) +BSP_wait_polled_input(void) { char c; while (!_IBMPC_scankey(&c)) diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h index 1e7a4a6506..002bf3b587 100644 --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h +++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h @@ -52,6 +52,7 @@ extern "C" { #include #include #include +#include /*-------------------------------------------------------------------------+ | Constants diff --git a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in index 0cf32409d4..3ac6b77792 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in @@ -58,7 +58,7 @@ preinstall: ${PGM}: ${SRCS} ${OBJS} $(make-rel) -all: ${ARCH} $(SRCS) $(PGM) +all: ${ARCH} preinstall $(SRCS) $(PGM) $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib # the .rel file built here will be put into libbsp.a by ../wrapup/Makefile diff --git a/c/src/lib/libbsp/i386/pc386/timer/timer.c b/c/src/lib/libbsp/i386/pc386/timer/timer.c index 650c6a5a5e..4fe0fb2cd9 100644 --- a/c/src/lib/libbsp/i386/pc386/timer/timer.c +++ b/c/src/lib/libbsp/i386/pc386/timer/timer.c @@ -176,7 +176,7 @@ void timerOn(const rtems_raw_irq_connect_data* used) outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 0 & 0xff); outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 8 & 0xff); /* - * disable interrrupt at i8259 level + * enable interrrupt at i8259 level */ pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE); } diff --git a/c/src/lib/libbsp/i386/shared/Makefile.in b/c/src/lib/libbsp/i386/shared/Makefile.in index feab84d468..6fc07991ea 100644 --- a/c/src/lib/libbsp/i386/shared/Makefile.in +++ b/c/src/lib/libbsp/i386/shared/Makefile.in @@ -12,5 +12,5 @@ include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg include $(RTEMS_ROOT)/make/directory.cfg # Descend into the $(RTEMS_BSP_FAMILY) directory -SUB_DIRS=irq +SUB_DIRS=irq io diff --git a/c/src/lib/libbsp/i386/shared/io/Makefile.in b/c/src/lib/libbsp/i386/shared/io/Makefile.in new file mode 100644 index 0000000000..01fb16150b --- /dev/null +++ b/c/src/lib/libbsp/i386/shared/io/Makefile.in @@ -0,0 +1,33 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +VPATH = @srcdir@ +RTEMS_ROOT = @top_srcdir@ +PROJECT_ROOT = @PROJECT_ROOT@ + +H_FILES = $(srcdir)/bspIo.h + +# +# Equate files are for including from assembly preprocessed by +# gm4 or gasp. No examples are provided except for those for +# other CPUs. The best way to generate them would be to +# provide a program which generates the constants used based +# on the C equivalents. +# + +EQ_FILES = + +SRCS=$(H_FILES) $(EQ_FILES) + +include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg +include $(RTEMS_ROOT)/make/leaf.cfg + +CLEAN_ADDITIONS += +CLOBBER_ADDITIONS += + +preinstall all: $(SRCS) + $(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE) + $(INSTALL) -m 444 $(EQ_FILES) $(PROJECT_INCLUDE) diff --git a/c/src/lib/libbsp/i386/shared/io/bspIo.h b/c/src/lib/libbsp/i386/shared/io/bspIo.h new file mode 100644 index 0000000000..337d46a699 --- /dev/null +++ b/c/src/lib/libbsp/i386/shared/io/bspIo.h @@ -0,0 +1,38 @@ +/* bspIo.h + * + * This include file contains declaration of interface that + * will be provided by the file contained in this directory. + * + * + * COPYRIGHT (c) 1998 valette@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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ +#ifndef _LIBBSP_I386_SHARED_IO_BSP_IO_H +#define _LIBBSP_I386_SHARED_IO_BSP_IO_H + +/* + * All the functions declared as extern after this comment + * MUST be implemented in each BSP. Using this function, + * this directory contains shared code that export higher level + * functionnality described after the next command. + */ +typedef void (*BSP_output_char_function_type) (char c); +typedef char (*BSP_polling_getchar_function_type) (char c); + +extern BSP_output_char_function_type BSP_output_char; +extern BSP_polling_getchar_function_type BSP_poll_char; +extern void BSP_emergency_output_init(); +/* + * All the function declared as extern after this comment + * are available for each ix86 BSP by compiling and linking + * the files contained in this directory PROVIDED definition + * and initialisation of the previous variable are done. + */ +void printk(char *fmt, ...); + +#endif diff --git a/c/src/lib/libbsp/i386/shared/io/printk.c b/c/src/lib/libbsp/i386/shared/io/printk.c new file mode 100644 index 0000000000..c34b20e730 --- /dev/null +++ b/c/src/lib/libbsp/i386/shared/io/printk.c @@ -0,0 +1,99 @@ +/*-------------------------------------------------------------------------+ +| printk.c v1.1 - PC386 BSP - 1997/08/07 ++--------------------------------------------------------------------------+ +| (C) Copyright 1997 - +| - NavIST Group - Real-Time Distributed Systems and Industrial Automation +| +| http://pandora.ist.utl.pt +| +| Instituto Superior Tecnico * Lisboa * PORTUGAL ++--------------------------------------------------------------------------+ +| Disclaimer: +| +| This file is provided "AS IS" without warranty of any kind, either +| expressed or implied. ++--------------------------------------------------------------------------+ +| This code is based on code by: Jose Rufino - IST +| +| $Id$ ++--------------------------------------------------------------------------*/ + + +#include + +#include + +/*-------------------------------------------------------------------------+ +| Function: printNum +| Description: print number in a given base. +| Global Variables: None. +| Arguments: num - number to print, base - base used to print the number. +| Returns: Nothing. ++--------------------------------------------------------------------------*/ +static void +printNum(long int num, int base) +{ + long int n; + + if ((n = num / base) > 0) + printNum(n, base); + BSP_output_char("0123456789ABCDEF"[(int)(num % base)]); +} /* printNum */ + + +/*-------------------------------------------------------------------------+ +| Function: printk +| Description: a simplified version of printf intended for use when the + console is not yet initialized or in ISR's. +| Global Variables: None. +| Arguments: as in printf: fmt - format string, ... - unnamed arguments. +| Returns: Nothing. ++--------------------------------------------------------------------------*/ +void +printk(char *fmt, ...) +{ + va_list ap; /* points to each unnamed argument in turn */ + char c, *str; + int lflag, base; + + va_start(ap, fmt); /* make ap point to 1st unnamed arg */ + for (; *fmt != '\0'; fmt++) + { + lflag = 0; + base = 0; + if (*fmt == '%') + { + if ((c = *++fmt) == 'l') + { + lflag = 1; + c = *++fmt; + } + switch (c) + { + case 'o': case 'O': base = 8; break; + case 'd': case 'D': base = 10; break; + case 'x': case 'X': base = 16; break; + case 's': + for (str = va_arg(ap, char *); *str; str++) + BSP_output_char(*str); + break; + case 'c': + BSP_output_char(va_arg(ap, char)); + break; + default: + BSP_output_char(c); + break; + } /* switch*/ + + if (base) + printNum(lflag ? va_arg(ap, long int) : (long int)va_arg(ap, int), + base); + } + else + { + BSP_output_char(*fmt); + } + } + va_end(ap); /* clean up when done */ +} /* printk */ + diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.h b/c/src/lib/libbsp/i386/shared/irq/irq.h index 3fba2db09e..5d628af83b 100644 --- a/c/src/lib/libbsp/i386/shared/irq/irq.h +++ b/c/src/lib/libbsp/i386/shared/irq/irq.h @@ -55,8 +55,9 @@ typedef enum { PC386_UART_COM1_IRQ = 4, - PC_386_RT_TIMER1 = 8 - + PC_386_RT_TIMER1 = 8, + + PC_386_RT_TIMER3 = 10 }rtems_irq_symbolic_name; diff --git a/c/src/lib/libbsp/i386/shared/irq/irq_init.c b/c/src/lib/libbsp/i386/shared/irq/irq_init.c index 3f57cf1107..3521bdd510 100644 --- a/c/src/lib/libbsp/i386/shared/irq/irq_init.c +++ b/c/src/lib/libbsp/i386/shared/irq/irq_init.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * rtems prologue generated in irq_asm.S @@ -137,7 +138,7 @@ void rtems_irq_mngt_init() /* * put something here that will show the failure... */ - _IBMPC_initVideo(); + BSP_emergency_output_init(); printk("Unable to initialize IDT!!! System locked\n"); while (1); } @@ -172,7 +173,7 @@ void rtems_irq_mngt_init() /* * put something here that will show the failure... */ - _IBMPC_initVideo(); + BSP_emergency_output_init(); printk("Unable to initialize RTEMS interrupt Management!!! System locked\n"); while (1); } @@ -187,7 +188,7 @@ void rtems_irq_mngt_init() */ unsigned tmp; - _IBMPC_initVideo(); + BSP_emergency_output_init(); printk("idt_entry_tbl = %x Interrupt_descriptor_table addr = %x\n", idt_entry_tbl, &Interrupt_descriptor_table); @@ -196,7 +197,7 @@ void rtems_irq_mngt_init() tmp, (unsigned) rtems_irq_prologue_0); } printk("i8259s_cache = %x\n", * (unsigned short*) &i8259s_cache); - debugPollingGetChar(); + BSP_wait_polled_input(); #endif asm volatile ("sti"); } -- cgit v1.2.3