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


Ignore:
Timestamp:
May 6, 2016, 10:17:51 PM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
8cb397b2
Parents:
02ef5d9
git-author:
Chris Johns <chrisj@…> (05/06/16 22:17:51)
git-committer:
Chris Johns <chrisj@…> (05/11/16 01:45:02)
Message:

i386/pc386: EOI the master and slave for slave IRQ signals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c

    r02ef5d9 rfc138a10  
    1010
    1111#include <bsp.h>
    12 #include <bsp/irq.h>
     12#include <bsp/irq-generic.h>
    1313#include <libchip/serial.h>
    1414
     
    3232/* Current uart and port used by the gdb stub */
    3333static int          uart_current;
     34static int          uart_vector;
    3435static console_tbl* port_current;
    3536
     
    6768__asm__ ("    movl  i386_gdb_uart_isr_regsav + 8, %edx");    /* Restore edx */
    6869__asm__ ("i386_gdb_uart_isr_1:");
    69 __asm__ ("    movb  $0x20, %al");
    70 __asm__ ("    outb  %al, $0x20");
    7170__asm__ ("    movl  i386_gdb_uart_isr_regsav, %eax");        /* Restore eax */
    7271__asm__ ("    iret");                                        /* Done */
     
    7574static const char const* gdb_hello = "+";
    7675
     76static inline uint8_t BSP_i8259a_irq_in_service_reg(uint32_t ioport)
     77{
     78  uint8_t isr;
     79  outport_byte(ioport, PIC_OCW3_SEL | PIC_OCW3_RR | PIC_OCW3_RIS);
     80  inport_byte(ioport, isr);
     81  outport_byte(ioport, PIC_OCW3_SEL | PIC_OCW3_RR);
     82  return isr;
     83}
     84
     85static inline void BSP_irq_ack_at_i8259a(const int irqLine)
     86{
     87  uint8_t slave_isr = 0;
     88  if (irqLine >= 8) {
     89   outport_byte(PIC_SLAVE_COMMAND_IO_PORT, PIC_EOI);
     90   slave_isr = BSP_i8259a_irq_in_service_reg(PIC_SLAVE_COMMAND_IO_PORT);
     91  }
     92
     93  /*
     94   * Only issue the EOI to the master if there are no more interrupts in
     95   * service for the slave. i8259a data sheet page 18, The Special Fully Nested
     96   * Mode, b.
     97   */
     98  if (slave_isr == 0)
     99    outport_byte(PIC_MASTER_COMMAND_IO_PORT, PIC_EOI);
     100}
     101
    77102int i386_gdb_uart_ctrl_c_check(void)
    78103{
     104  BSP_irq_ack_at_i8259a(uart_vector);
    79105  if (port_current) {
    80106    int c = 0;
     
    140166static void BSP_uart_on(const rtems_raw_irq_connect_data* used)
    141167{
    142   BSP_irq_enable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);
     168  bsp_interrupt_vector_enable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
    143169}
    144170
    145171static void BSP_uart_off(const rtems_raw_irq_connect_data* used)
    146172{
    147   BSP_irq_disable_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);
     173  bsp_interrupt_vector_disable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
    148174}
    149175
    150176static int BSP_uart_isOn(const rtems_raw_irq_connect_data* used)
    151177{
    152   return BSP_irq_enabled_at_i8259s(used->idtIndex - BSP_IRQ_VECTOR_BASE);
     178  return bsp_interrupt_vector_enable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
    153179}
    154180
     
    170196  }
    171197  else {
     198    uart_vector = port_current->ulIntVector;
    172199    uart_raw_irq_data.idtIndex = port_current->ulIntVector + BSP_IRQ_VECTOR_BASE;
    173200
Note: See TracChangeset for help on using the changeset viewer.