home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / queue.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  5.8 KB  |  175 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8.  
  9. #ident    "@(#)head.sys:queue.h    1.3"
  10.  
  11. /* Express Queue Macros */
  12. #define R_EXP ((RQUEUE *)R_ADDR)->express
  13. #define C_EXP ((CQUEUE *)C_ADDR)->express
  14.  
  15. /* QUEUE POINTER MACROS */
  16.  
  17. /* all pointers */
  18. #define R_ALL(Q) ((RQUEUE *)R_ADDR)->queue[Q].p_queues.all
  19. #define C_ALL ((CQUEUE *)C_ADDR)->queue.p_queues.all
  20.  
  21. /* pointers as a sixteen bit quantity */
  22. #define R_SLOAD(Q) ((RQUEUE *)R_ADDR)->queue[Q].p_queues.bit16.load
  23. #define R_SULOAD(Q) ((RQUEUE *)R_ADDR)->queue[Q].p_queues.bit16.unload
  24.  
  25. #define C_SLOAD ((CQUEUE *)C_ADDR)->queue.p_queues.bit16.load
  26. #define C_SULOAD ((CQUEUE *)C_ADDR)->queue.p_queues.bit16.unload
  27.  
  28. /* pointers as an eight bit quantity  */
  29. #define R_BLOAD(Q) ((RQUEUE *)R_ADDR)->queue[Q].p_queues.bit8.unload
  30. #define R_BULOAD(Q) ((RQUEUE *)R_ADDR)->queue[Q].p_queues.bit8.unload
  31.  
  32. #define C_BLOAD ((CQUEUE *)C_ADDR)->queue.p_queues.bit8.load
  33. #define C_BULOAD ((CQUEUE *)C_ADDR)->queue.p_queues.bit8.unload
  34.  
  35. /* job entry at load pointer for 16 bit ptrs */
  36. #define Q_RSENTRY(Q) (RENTRY *)(R_SLOAD(Q)+(((RQUEUE *)R_ADDR)->queue[Q].entry))
  37.  
  38. /* job entry at load pointer for 8 bit ptrs */
  39. #define Q_RBENTRY(Q) (RENTRY *)(R_BLOAD(Q)+(((RQUEUE *)R_ADDR)->queue[Q].entry))
  40.  
  41. /* job completion at unload pointer for 16 bit ptrs */
  42. #define Q_CSENTRY (CENTRY *)(C_SULOAD+(((CQUEUE *)C_ADDR)->queue.entry))
  43.  
  44. /* job completion at unload pointer for 8 bit */
  45. #define Q_CBENTRY (CENTRY *)(C_BULOAD+(((CQUEUE *)C_ADDR)->queue.entry))
  46.  
  47. struct com_entry{
  48.        union{
  49.           struct {
  50.              unsigned bytcnt:16;     /* offset of last byte to transfer  */
  51.                                      /* 0 transfers byte 0               */
  52.  
  53. #ifdef x86
  54.          /* this for the Intel side since bit fields are assigned      */
  55.          /* opposite from WE32000                                    */
  56.              unsigned subdev:6;      /* Subdevice being addressed.       */
  57.              unsigned seqbit:1;      /* flag for block available         */
  58.              unsigned cmd_stat:1;    /* flag for command/status opcode   */
  59. #else
  60. #    ifdef b16
  61.          /* this for the Intel side since bit fields are assigned      */
  62.          /* opposite from WE32000                                    */
  63.              unsigned subdev:6;      /* Subdevice being addressed.       */
  64.              unsigned seqbit:1;      /* flag for block available         */
  65.              unsigned cmd_stat:1;    /* flag for command/status opcode   */
  66. #    else
  67.          /*                this for the m32 side                     */
  68.              unsigned cmd_stat:1;    /* flag for command/status opcode   */
  69.              unsigned seqbit:1;      /* flag for block available         */
  70.              unsigned subdev:6;      /* Subdevice being addressed.       */
  71.  
  72. #    endif
  73. #endif
  74.              unsigned opcode:8;      /* command or status opcode         */
  75.            }bits;
  76.            struct {
  77.              unsigned short bytcnt;
  78.              char subdev;
  79.              char opcode;
  80.            }bytes;
  81.         }codes;
  82.          long addr;     /* data or memory address of data       */
  83. };
  84.  
  85.  
  86. typedef struct {
  87.  
  88.      struct com_entry common;
  89.      CAPP appl;                      /* application defined area          */
  90.                                     /* CAPP for CENTRY         */
  91.  
  92. }CENTRY;                     /* CENTRY in completion queue        */
  93.  
  94.  
  95. typedef struct {
  96.  
  97.         /* entry for express requests */
  98.         CENTRY express;
  99.  
  100.         struct {
  101.                 /* Three ways of accessing load and unload ptrs */
  102.                 union {
  103.                         /* All pointers at once */
  104.                         long all;
  105.  
  106.                         /* 16 bit load ptr and 16 bit unload ptr */
  107.                         struct {
  108.                                 short load;
  109.                                 short unload;
  110.                         }bit16;
  111.  
  112.                         /* 8 bit load ptr and 8 bit unload ptr */
  113.                         struct {
  114.                                 char pad1;
  115.                                 char load;
  116.                                 char pad2;
  117.                                 char unload;
  118.                         }bit8;
  119.  
  120.                  }p_queues;
  121.  
  122.                  CENTRY entry[CQSIZE];
  123.  
  124.         }queue;            /* one for completion queue     */
  125.  
  126. } CQUEUE;
  127.  
  128. typedef struct {
  129.  
  130.          struct com_entry common;
  131.     RAPP appl;                  /* application defined area    */
  132. }RENTRY;            /* RENTRY in request queue        */
  133.  
  134. typedef struct {
  135.  
  136.         /* entry for express requests */
  137.         RENTRY express;
  138.  
  139.         struct {
  140.                 /* Three ways of accessing load and unload ptrs */
  141.                 union {
  142.                         /* All pointers at once */
  143.                         long all;
  144.  
  145.                         /* 16 bit load ptr and 16 bit unload ptr */
  146.                         struct {
  147.                                 short load;
  148.                                 short unload;
  149.                         }bit16;
  150.  
  151.                         /* 8 bit load ptr and 8 bit unload ptr */
  152.                         struct {
  153.                                 char pad1;
  154.                                 char load;
  155.                                 char pad2;
  156.                                 char unload;
  157.                         }bit8;
  158.  
  159.                  }p_queues;
  160.  
  161.                  RENTRY entry[RQSIZE];
  162.  
  163.         }queue[NUM_QUEUES];            /* #defined for request queue    */
  164.  
  165. } RQUEUE;
  166.  
  167. typedef struct {         /* sysgen data block */
  168.     long request;   /* address of request queue */
  169.     long complt;    /* address of cmplt queue   */
  170.     unsigned char req_size;  /* no entries in req q  */
  171.     unsigned char comp_size; /* no entries in cmplt q*/
  172.     unsigned char int_vect;  /* base intrpt vector   */
  173.     unsigned char no_rque;   /* number of req queues */
  174. }SG_DBLK;
  175.