Changeset bd8c8b2a in rtems for c/src/lib/libbsp/i386


Ignore:
Timestamp:
08/05/98 16:51:39 (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
dddc0557
Parents:
0e3c0096
Message:

Patch from Eric Valette <valette@…> which brings the i386ex BSP
inline with the new IRQ structure.

Location:
c/src/lib/libbsp/i386
Files:
3 added
18 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/i386ex/clock/ckinit.c

    r0e3c0096 rbd8c8b2a  
    2222
    2323#include <bsp.h>
     24#include <irq.h>
    2425
    2526#include <rtems/libio.h>
     
    2728#include <stdlib.h>
    2829
    29 #define CLOCK_VECTOR 0x20
    30 
    3130rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
    3231
    3332volatile rtems_unsigned32 Clock_driver_ticks;
    34 
    35 rtems_isr_entry  Old_ticker;
    3633
    3734void Clock_exit( void );
     
    4845 */
    4946
    50 rtems_isr Clock_isr(
    51   rtems_vector_number vector
    52 )
     47void Clock_isr()
    5348{
    5449  /* enable_tracing(); */
     
    6257}
    6358
    64 void Install_clock(
    65   rtems_isr_entry clock_isr
    66 )
     59void ClockOff(const rtems_irq_connect_data* unused)
    6760{
    68   Clock_driver_ticks = 0;
    69   Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
     61     /* should do something here */;
     62}
    7063
    71   if ( BSP_Configuration.ticks_per_timeslice ) {
    72     Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 );
    73 
     64void ClockOn(const rtems_irq_connect_data* unused)
     65{
    7466/*  The following is already set up in interns.s ->
    7567    ( This is test code only... production code will move the
     
    8274#define TMRCFG    0xF834
    8375       
    84         outport_byte    ( TMRCFG , 0x80 );
     76  outport_byte  ( TMRCFG , 0x80 );
    8577
    86         outport_byte    ( TMRCON , 0x34 );
    87         outport_byte    ( TMR0   , 0xA8 );
    88         outport_byte    ( TMR0   , 0x04 );
     78  outport_byte    ( TMRCON , 0x34 );
     79  outport_byte  ( TMR0   , 0xA8 );
     80  outport_byte    ( TMR0   , 0x04 );
    8981
    90         outport_byte    ( TMRCFG , 0x00 );
    91   }
    92   atexit( Clock_exit );
     82  outport_byte    ( TMRCFG , 0x00 );
    9383}
    9484
    95 void Clock_exit( void )
     85int ClockIsOn(const rtems_irq_connect_data* unused)
    9686{
    97   if ( BSP_Configuration.ticks_per_timeslice ) {
    98      /* should do something here */;
    99   }
     87  return ((i8259s_cache & 0x1) == 0);
    10088}
    10189
     90static rtems_irq_connect_data clockIrqData = {PC_386_PERIODIC_TIMER,
     91                                              Clock_isr,
     92                                              ClockOn,
     93                                              ClockOff,
     94                                              ClockIsOn};
    10295
    10396rtems_device_driver Clock_initialize(
     
    107100)
    108101{
    109   Install_clock( Clock_isr );
    110 
     102  Clock_driver_ticks = 0;
     103  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
     104  if (!pc386_install_rtems_irq_handler (&clockIrqData)) {
     105    printk("Unable to initialize system clock\n");
     106    rtems_fatal_error_occurred(1);
     107  }
    111108  /*
    112109   * make major/minor avail to others such as shared memory driver
     
    125122)
    126123{
    127     rtems_unsigned32 isrlevel;
    128124    rtems_libio_ioctl_args_t *args = pargp;
    129125 
     
    138134    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
    139135    {
    140         Clock_isr(CLOCK_VECTOR);
     136        Clock_isr();
    141137    }
    142138    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
    143139    {
    144       rtems_interrupt_disable( isrlevel );
    145        (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
    146       rtems_interrupt_enable( isrlevel );
     140      if (!pc386_install_rtems_irq_handler (&clockIrqData)) {
     141        printk("Error installing clock interrupt handler!\n");
     142        rtems_fatal_error_occurred(1);
     143      }
    147144    }
    148145 
     
    151148}
    152149
     150void Clock_exit()
     151{
     152  pc386_remove_rtems_irq_handler (&clockIrqData);
     153}
  • c/src/lib/libbsp/i386/i386ex/console/Makefile.in

    r0e3c0096 rbd8c8b2a  
    1111PGM=${ARCH}/console.rel
    1212
     13IMPORT_SRC=$(srcdir)/../../shared/io/printk.c
     14
    1315# C source names, if any, go here -- minus the .c
    14 C_PIECES=console
     16C_PIECES=console printk
    1517C_FILES=$(C_PIECES:%=%.c)
    1618C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
     
    5052CLOBBER_ADDITIONS +=
    5153
     54preinstall:
     55        ${CP} ${IMPORT_SRC} .
     56
    5257${PGM}: ${SRCS} ${OBJS}
    5358        $(make-rel)
    5459
    55 all:    ${ARCH} $(SRCS) $(PGM)
     60all:    ${ARCH} preinstall $(SRCS) $(PGM)
    5661
    5762# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
  • c/src/lib/libbsp/i386/i386ex/console/console.c

    r0e3c0096 rbd8c8b2a  
    1717#include <bsp.h>
    1818#include <rtems/libio.h>
    19  
     19#include <bspIo.h>
    2020#include <stdlib.h>
    2121
     
    110110}
    111111
     112/*
     113 * Wait for an input. May be used before  intr are ON.
     114 */
     115char BSP_wait_polled_input( void )
     116{
     117  char c;
     118  while (!is_character_ready(&c))
     119    continue;
     120
     121  return c;
     122}
     123     
    112124/*  inbyte
    113125 *
     
    278290  return RTEMS_SUCCESSFUL;
    279291}
     292
     293BSP_output_char_function_type           BSP_output_char = outbyte;
     294BSP_polling_getchar_function_type       BSP_poll_char = BSP_wait_polled_input;
     295
     296void BSP_emergency_output_init() {}
  • c/src/lib/libbsp/i386/i386ex/include/bsp.h

    r0e3c0096 rbd8c8b2a  
    2424#include <console.h>
    2525#include <clockdrv.h>
    26 
     26#include <bspIo.h>
     27#include <irq.h>
     28 
    2729/*
    2830 *  Define the time limits for RTEMS Test Suite test durations.
     
    130132/* routines */
    131133
    132 i386_isr_entry set_vector(
    133   rtems_isr_entry     handler,
    134   rtems_vector_number vector,
    135   int                 type
    136 );
    137 
    138134#ifdef __cplusplus
    139135}
  • c/src/lib/libbsp/i386/i386ex/start/start.s

    r0e3c0096 rbd8c8b2a  
    3434#include "80386ex.inc"
    3535
     36/*
     37 * Needed for binutils 2.9.1.0.7 and higher
     38 * #define NEXT_GAS
     39 */                     
    3640
    3741        EXTERN (main)              /* exits to bspstart   */
     
    180184        nop
    181185        cli
     186#ifdef NEXT_GAS
     187        addr32
     188#endif 
    182189        jmp     SYM(_initInternalRegisters) /* different section in this file */
    183190        .code32                             /* in case this section moves     */
     
    193200 * Enable access to peripheral register at expanded I/O addresses
    194201 */
     202SYM(_initInternalRegisters):   
    195203        .code16
    196 SYM(_initInternalRegisters):   
    197204        movw    $0x8000 , ax           
    198205        outb    al      , $REMAPCFGH
     
    407414        SetExRegByte(ICW1M  , 0x11 ) # edge triggered
    408415        SetExRegByte(ICW2M  , 0x20 )  # base vector starts at byte 32
    409         SetExRegByte(ICW3M  , 0x04 ) # IR2 is cascaded internally
    410         SetExRegByte(ICW4M  , 0X03 ) # AEOI MODE FIRST!
     416        SetExRegByte(ICW3M  , 0x02 ) # IR2 is cascaded internally
     417        SetExRegByte(ICW4M  , 0x01 ) # idem
    411418       
    412419        SetExRegByte(OCW1M  , 0xde ) # IR0  only = 0xfe.  for IR5 and IR0 active use 0xde
     
    482489        movw $ _ram_gdt_segment, ax
    483490        mov    ax              , ds
    484 
     491#ifdef NEXT_GAS
     492        data32
     493        addr32
     494#endif 
    485495        lgdt    _ram_gdt_offset     #  location of GDT
    486496
     
    495505 * Switch to Protected Mode
    496506 ***************************/
    497         mov     %cr0, eax
     507        mov     cr0, eax
    498508        orw     $0x1, ax
    499         mov     eax, %cr0
     509        mov     eax, cr0
    500510       
    501511/**************************
     
    504514 *********************/
    505515
    506         ljmp $ GDT_CODE_PTR , $  SYM(_copy_data) # sets the code selector
     516        ljmpl $ GDT_CODE_PTR , $  SYM(_copy_data) # sets the code selector
    507517/*
    508518 * Copy the data section down to RAM
  • c/src/lib/libbsp/i386/i386ex/startup/Makefile.in

    r0e3c0096 rbd8c8b2a  
    1111PGM=${ARCH}/startup.rel
    1212
     13IMPORT_SRC=$(srcdir)/../../shared/irq/irq.c \
     14   $(srcdir)/../../shared/irq/irq_init.c $(srcdir)/../../shared/irq/irq_asm.s
     15
    1316# C source names, if any, go here -- minus the .c
    14 C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec
     17C_PIECES=bspclean bsplibc bsppost bspstart main sbrk irq irq_init
    1518C_FILES=$(C_PIECES:%=%.c)
    1619C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
     
    2023# Assembly source names, if any, go here -- minus the .s
    2124# removed initcsu piece, ldsegs piece and flush
    22 S_PIECES= 
     25S_PIECES=irq_asm
    2326S_FILES=$(S_PIECES:%=%.s)
    2427S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
     
    5356CLOBBER_ADDITIONS +=
    5457
     58preinstall:
     59        ${CP} ${IMPORT_SRC} .
     60
    5561${PGM}: ${SRCS} ${OBJS}
    5662        $(make-rel)
    57 all:    ${ARCH} $(SRCS) $(PGM)
     63all:    ${ARCH} preinstall $(SRCS) $(PGM)
    5864        $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
    5965
  • c/src/lib/libbsp/i386/i386ex/startup/bspstart.c

    r0e3c0096 rbd8c8b2a  
    115115
    116116  /*   console_reserve_resources( &BSP_Configuration ); */
    117 
     117  /*
     118   * Init rtems_interrupt_management
     119   */
     120  rtems_irq_mngt_init();
    118121}
  • c/src/lib/libbsp/i386/i386ex/timer/timer.c

    r0e3c0096 rbd8c8b2a  
    2828#include <rtems.h>
    2929#include <bsp.h>
     30#include <stdlib.h>
    3031
    3132int Ttimer_val;
    3233rtems_boolean Timer_driver_Find_average_overhead;
    3334
    34 rtems_isr timerisr();
     35extern void timerisr();
     36extern int ClockIsOn(const rtems_raw_irq_connect_data*);
    3537
    3638#define TMR0      0xF040
     
    4042#define TMRCFG    0xF834
    4143
    42 void Timer_initialize()
     44void TimerOn(const rtems_raw_irq_connect_data* used)
    4345{
    44 
    45   (void) set_vector( timerisr, 0x2a, 0 );   /* install ISR ( IR2 ) was 0x38*/
    4646
    4747  Ttimer_val = 0;                           /* clear timer ISR count */
     
    5252  outport_byte  ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */
    5353                                   /* interrupts ARE enabled */
    54 /*  outport_byte( IERA, 0x41 );             enable interrupt */
     54  /*  outport_byte( IERA, 0x41 );             enable interrupt */
     55  /*
     56   * enable interrrupt at i8259 level
     57   */
     58  pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
     59}
    5560
     61void TimerOff(const rtems_raw_irq_connect_data* used)
     62{
     63    /*
     64     * disable interrrupt at i8259 level
     65     */
     66     pc386_irq_disable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
     67     /* reset timer mode to standard (DOS) value */
     68}
     69
     70static rtems_raw_irq_connect_data timer_raw_irq_data = {
     71  PC_386_RT_TIMER3 + PC386_IRQ_VECTOR_BASE,
     72  timerisr,
     73  TimerOn,
     74  TimerOff,
     75  ClockIsOn
     76};
     77
     78void Timer_exit()
     79{
     80 if (!i386_delete_idt_entry(&timer_raw_irq_data)) {
     81      printk("Timer raw handler deconnexion failed\n");
     82      rtems_fatal_error_occurred(1);
     83 }
     84}
     85
     86void Timer_initialize()
     87{
     88
     89  static rtems_boolean First = TRUE;
     90
     91  if (First)
     92  {
     93    First = FALSE;
     94
     95    atexit(Timer_exit); /* Try not to hose the system at exit. */
     96    if (!i386_set_idt_entry (&timer_raw_irq_data)) {
     97      printk("raw handler connexion failed\n");
     98      rtems_fatal_error_occurred(1);
     99    }
     100  }
     101  /* wait for ISR to be called at least once */
     102  Ttimer_val = 0;
     103  while (Ttimer_val == 0)
     104    continue;
     105  Ttimer_val = 0;
    56106}
    57107
  • c/src/lib/libbsp/i386/i386ex/timer/timerisr.s

    r0e3c0096 rbd8c8b2a  
    2929SYM (timerisr):
    3030        addl    $250, SYM (Ttimer_val)   # another 250 microseconds
     31        pushl   eax
     32        movb    0xa0,al         /* signal generic End Of Interrupt (EOI) to slave PIC */
     33        outb    al, $0x20
     34        movb    $0x20, al
     35        outb    al, $0x20       /* signal generic EOI to Master PIC */
     36        popl    eax
    3137        iret
    3238
  • c/src/lib/libbsp/i386/pc386/console/Makefile.in

    r0e3c0096 rbd8c8b2a  
    1010
    1111PGM=${ARCH}/console.rel
     12
     13IMPORT_SRC=$(srcdir)/../../shared/io/printk.c
    1214
    1315# C source names, if any, go here -- minus the .c
     
    5153CLOBBER_ADDITIONS +=
    5254
     55preinstall:
     56        ${CP} ${IMPORT_SRC} .
     57
    5358${PGM}: ${SRCS} ${OBJS}
    5459        $(make-rel)
    5560
    56 all:    ${ARCH} $(SRCS) $(PGM)
     61all:    ${ARCH} preinstall $(SRCS) $(PGM)
    5762
    5863# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
  • c/src/lib/libbsp/i386/pc386/console/console.c

    r0e3c0096 rbd8c8b2a  
    6262
    6363extern rtems_boolean _IBMPC_scankey(char *);  /* defined in 'inch.c' */
     64extern BSP_polling_getchar_function_type BSP_wait_polled_input();
     65extern void _IBMPC_initVideo();
    6466
    6567void console_reserve_resources(rtems_configuration_table *conf)
     
    476478}
    477479
    478 
    479 
    480 
    481 
    482 
    483 
    484 
    485 
     480/*
     481 * BSP initialization
     482 */
     483
     484BSP_output_char_function_type BSP_output_char = (BSP_output_char_function_type) _IBMPC_outch;
     485BSP_polling_getchar_function_type       BSP_poll_char = BSP_wait_polled_input;
     486void BSP_emergency_output_init()
     487{
     488  _IBMPC_initVideo();
     489}
     490
     491
     492
     493
     494
     495
     496
     497
  • c/src/lib/libbsp/i386/pc386/console/inch.c

    r0e3c0096 rbd8c8b2a  
    296296 
    297297char
    298 debugPollingGetChar(void)
     298BSP_wait_polled_input(void)
    299299{
    300300  char c;
  • c/src/lib/libbsp/i386/pc386/include/bsp.h

    r0e3c0096 rbd8c8b2a  
    5353#include <clockdrv.h>
    5454#include <libcpu/cpu.h>
     55#include <bspIo.h>
    5556 
    5657/*-------------------------------------------------------------------------+
  • c/src/lib/libbsp/i386/pc386/startup/Makefile.in

    r0e3c0096 rbd8c8b2a  
    5959${PGM}: ${SRCS} ${OBJS}
    6060        $(make-rel)
    61 all:    ${ARCH} $(SRCS) $(PGM)
     61all:    ${ARCH} preinstall $(SRCS) $(PGM)
    6262        $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
    6363
  • c/src/lib/libbsp/i386/pc386/timer/timer.c

    r0e3c0096 rbd8c8b2a  
    177177     outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 8 & 0xff);
    178178    /*
    179      * disable interrrupt at i8259 level
     179     * enable interrrupt at i8259 level
    180180     */
    181181     pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
  • c/src/lib/libbsp/i386/shared/Makefile.in

    r0e3c0096 rbd8c8b2a  
    1313
    1414# Descend into the $(RTEMS_BSP_FAMILY) directory
    15 SUB_DIRS=irq
     15SUB_DIRS=irq io
    1616
  • c/src/lib/libbsp/i386/shared/irq/irq.h

    r0e3c0096 rbd8c8b2a  
    5656  PC386_UART_COM1_IRQ           =       4,
    5757
    58   PC_386_RT_TIMER1              =       8
    59 
     58  PC_386_RT_TIMER1              =       8,
     59 
     60  PC_386_RT_TIMER3              =       10
    6061}rtems_irq_symbolic_name;
    6162
  • c/src/lib/libbsp/i386/shared/irq/irq_init.c

    r0e3c0096 rbd8c8b2a  
    1616#include <irq.h>
    1717#include <bsp.h>
     18#include <bspIo.h>
    1819
    1920/*
     
    138139       * put something here that will show the failure...
    139140       */
    140       _IBMPC_initVideo();
     141      BSP_emergency_output_init();
    141142      printk("Unable to initialize IDT!!! System locked\n");
    142143      while (1);
     
    173174       * put something here that will show the failure...
    174175       */
    175       _IBMPC_initVideo();
     176      BSP_emergency_output_init();
    176177      printk("Unable to initialize RTEMS interrupt Management!!! System locked\n");
    177178      while (1);
     
    188189      unsigned tmp;
    189190
    190       _IBMPC_initVideo();
     191      BSP_emergency_output_init();
    191192     
    192193      printk("idt_entry_tbl =  %x Interrupt_descriptor_table addr = %x\n",
     
    197198    }
    198199    printk("i8259s_cache = %x\n", * (unsigned short*) &i8259s_cache);
    199     debugPollingGetChar();
     200    BSP_wait_polled_input();
    200201#endif   
    201202    asm volatile ("sti");
Note: See TracChangeset for help on using the changeset viewer.