Fork me on GitHub

root/include/fiwix/pic.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/pic.h
   3  *
   4  * Copyright 2018-2021, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_PIC_H
   9 #define _FIWIX_PIC_H
  10 
  11 #include <fiwix/sigcontext.h>
  12 
  13 #define NR_IRQS         16      /* hardware interrupts */
  14 #define PIC_MASTER      0x20    /* I/O base address for master PIC */
  15 #define PIC_SLAVE       0xA0    /* I/O base address for slave PIC */
  16 
  17 #define DATA            0x01    /* offset to data port */
  18 #define EOI             0x20    /* End-Of-Interrupt command code */
  19 
  20 /* Inicialization Command Words */
  21 #define ICW1_RESET      0x11    /* ICW1_INIT + ICW1_ICW4 */
  22 #define CASCADE_IRQ     0x02
  23 #define ICW4_8086EOI    0x01
  24 
  25 #define PIC_READ_IRR    0x0A    /* OCW3 irq ready */
  26 #define PIC_READ_ISR    0x0B    /* OCW3 irq service */
  27 
  28 /* Operational Command Words */
  29 #define OCW1            0xFF    /* mask (disable) all IRQs */
  30 
  31 struct interrupt {
  32         unsigned int ticks;
  33         char *name;
  34         void (*handler)(int, struct sigcontext *);
  35         struct interrupt *next;
  36 };
  37 extern struct interrupt *irq_table[NR_IRQS];
  38 
  39 
  40 #define BH_ACTIVE       0x01
  41 
  42 struct bh {
  43         int flags;
  44         void (*fn)(void);
  45         struct bh *next;
  46 };
  47 
  48 void add_bh(struct bh *);
  49 void enable_irq(int);
  50 void disable_irq(int);
  51 int register_irq(int, struct interrupt *);
  52 int unregister_irq(int, struct interrupt *);
  53 void irq_handler(int, struct sigcontext);
  54 void unknown_irq_handler(void);
  55 void do_bh(void);
  56 void pic_init(void);
  57 
  58 #endif /* _FIWIX_PIC_H */

/* [previous][next][first][last][top][bottom][index][help] */