home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / h / int_hndlr < prev    next >
Encoding:
Text File  |  1995-01-11  |  4.4 KB  |  143 lines

  1. /*
  2.  * $Header: /ax/networking:include/int_hndlr.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/int_hndlr.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    int_hndlr.h,v $
  8.  * Revision 1.1  95/01/11  10:21:35  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.9  89/06/21  08:24:09  mark
  12.  * Value of PRIO_SOFTVTE dropped a lot - now below all of
  13.  * FDC, soft-clock and soft-net.  This may well improve net
  14.  * performance in a context of lots of screen output, and is
  15.  * certainly much more reasonable.
  16.  * 
  17.  * Revision 1.8  89/06/09  15:15:26  mark
  18.  * Added PRIO_I2C for CMOS device access protection.
  19.  * 
  20.  * Revision 1.7  89/04/28  15:09:47  mark
  21.  * Changed to suit new XCB manager.
  22.  * 
  23.  * Revision 1.6  89/04/12  12:51:01  jwills
  24.  * Added a soft interrupt for the SCSI driver.
  25.  * 
  26.  * Revision 1.5  88/11/30  02:09:13  keith
  27.  * Mark's new interrupt handling stuff
  28.  * 
  29.  * Revision 1.4  88/11/11  08:36:19  keith
  30.  * Added recursive inclusion protection, and exported MAXSPL since int_prio_tbl
  31.  * has now moved down to page 0.
  32.  * 
  33.  * Revision 1.3  88/06/17  20:07:27  beta
  34.  * Acorn Unix initial beta version
  35.  * 
  36.  */
  37. /*
  38.  *      ARM Interrupt interface - interrupt control structures
  39.  *
  40.  *      Author: J.M. Collins, Xi Software Ltd 1986.
  41.  *      Revised: Mark Taunton, Acorn Computers Ltd, 1988.
  42.  */
  43.  
  44. #ifndef __INT_HNDLR__
  45. #define __INT_HNDLR__
  46.  
  47. /*
  48.  * Interrupt source types: one byte is allocated in the mask values
  49.  * for each type.  The order here matches ordering from least-sig
  50.  * byte to most-sig byte.  One of these values is passed to
  51.  * decl_interrupt (), along with a bit-mask for that source.
  52.  */
  53. #define INT_IRQA        0
  54. #define INT_IRQB        1
  55. #define INT_XCB         2
  56. #define INT_SOFT        3
  57.  
  58. #define INT_BIT(mask,type) ((mask) << ((type) * 8))
  59. #define SINT_SHIFT      (INT_SOFT * 8)
  60.  
  61. /* Define hardware force-interrupt bit (needs ioc.h)  */
  62. #define SOFTINT_BIT     INT_BIT(IRQA_FORCE,INT_IRQA)
  63.  
  64. /*
  65.  * At most 8 soft-ints can be defined as things currently 
  66.  * stand: 1 << 7 would be the last.  This could be modified
  67.  * by using some spare XCB type bits for soft-ints, and
  68.  * adjusting the INT_xxx and SOFTINT_BIT macros above.
  69.  */
  70. #define SOFTCLOCKMASK   (1 << 0)
  71. #define SOFTNETMASK     (1 << 1)
  72. #define SOFTFDCMASK     (1 << 2)
  73. #define SOFTVTEOUTPUT   (1 << 3)
  74. #define SOFTSERIAL      (1 << 4)
  75. #define SOFTSCSIMASK    (1 << 5)
  76.  
  77. /*
  78.  * To declare an interrupt, the routine
  79.  *
  80.  *      decl_interrupt(&thing, level, type)
  81.  *
  82.  * is called with the following structure as 'thing'.
  83.  */
  84.  
  85. struct int_hndlr
  86. {
  87.     unsigned int        ih_mask;                /* Mask (gets mangled) */
  88.     void                (*ih_fn)();             /* Function to call */
  89.     int                 ih_farg;                /* Argument to pass */
  90.     struct int_hndlr   *ih_next;                /* Next one */
  91. };
  92.  
  93. /*
  94.  *      This is the vector of masks or-ed from each of the declared
  95.  *      interrupts for each priority level.
  96.  */
  97.  
  98. struct int_prio_tbl
  99. {
  100.     struct int_prio_tbl *ip_next;       /* link to next lower active level */
  101.     unsigned int        ip_this_level;  /* bits for this level only */
  102.     unsigned int        ip_cum_bits;    /* bits for all levels < this */
  103.     struct int_hndlr    *ip_chain;      /* handler chain */
  104. };
  105.  
  106. /* Head of chain of active int levels */
  107. extern struct int_prio_tbl  *first_irq;
  108.  
  109. /* Hardware int priority table */
  110. extern struct int_prio_tbl  int_prio_tbl[];
  111.  
  112. /* Or of bits for pending software interrupts. This is unshifted. */
  113. extern unsigned int  sint_pending;
  114.  
  115. #define  PRIO_0         0x00
  116. #define  PRIO_1         0x01
  117. #define  PRIO_SOFTVTE   0x07
  118. #define  PRIO_SOFTCLOCK 0x08
  119. #define  PRIO_FDC       0x09                    /* floppy low-priority */
  120. #define  PRIO_SOFTNET   0x0c
  121. #define  PRIO_I2C       0x0f                    /* for i2c i/o activities */
  122. #define  PRIO_ET        0x10
  123. #define  PRIO_4         0x14
  124. #define  PRIO_5         0x15
  125. #define  PRIO_BIO       0x15
  126. #define  PRIO_TTY       0x15
  127. #define  PRIO_SCSI      PRIO_BIO
  128. #define  PRIO_WINC      PRIO_BIO
  129. #define  PRIO_CENT      PRIO_TTY
  130. #define  PRIO_SOUND     0x15
  131. #define  PRIO_6         0x16
  132. #define  PRIO_IMP       0x16                    /* ? */
  133. #define  PRIO_VFLY      0x16
  134. #define  PRIO_7         0x17
  135. #define  PRIO_HITTY     0x17
  136. #define  PRIO_CLOCK     0x18
  137. #define  PRIO_HIGH      0x1F                    /* maximum priority */
  138. #define  MAX_SPL        0x1F                    /* defined maximum */
  139.  
  140. #endif 
  141.  
  142. /* EOF int_hndlr.h */
  143.