home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / ddi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  4.7 KB  |  182 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_DDI_H
  11. #define _SYS_DDI_H
  12.  
  13. #ident    "@(#)/usr/include/sys/ddi.h.sl 1.1 4.0 12/08/90 35208 AT&T-USL"
  14.  
  15. /*
  16.  * ddi.h -- the flag and function definitions needed by DDI-conforming
  17.  * drivers.  This header file contains #undefs to undefine macros that
  18.  * drivers would otherwise pick up in order that function definitions
  19.  * may be used. Programmers should place the include of "sys/ddi.h"
  20.  * after any header files that define the macros #undef'ed or the code
  21.  * may compile incorrectly.
  22.  */
  23.  
  24. /*
  25.  * define min() and max() as macros so that drivers will not pick up the
  26.  * min() and max() kernel functions since they do unsigned comparison only.
  27.  */
  28. #define min(a, b)   ((a) < (b) ? (a) : (b))
  29. #define max(a, b)   ((a) < (b) ? (b) : (a))
  30.  
  31.  
  32. /*
  33.  * The following macros designate a kernel parameter for drv_getparm 
  34.  * and drv_setparm. Implementation-specific parameter defines should
  35.  * start at 100.
  36.  */
  37.  
  38. #define    TIME    1
  39. #define    UPROCP    2
  40. #define    PPGRP    3
  41. #define    LBOLT    4
  42. #define    SYSRINT    5
  43. #define    SYSXINT    6
  44. #define    SYSMINT    7
  45. #define    SYSRAWC    8
  46. #define    SYSCANC    9
  47. #define    SYSOUTC    10
  48. #define    PPID    11
  49. #define    PSID    12
  50. #define UCRED    13
  51.  
  52. #ifndef NMAJORENTRY
  53. #define NMAJORENTRY    256
  54. #endif
  55.  
  56. extern int drv_getparm();
  57. extern int drv_setparm();
  58.  
  59. extern int drv_getevtoken();
  60. extern void drv_relevtoken();
  61.  
  62. extern void drv_usecwait();
  63. extern clock_t drv_hztousec();
  64. extern clock_t drv_usectohz();
  65.  
  66. /* convert external to internal major number */
  67. extern int etoimajor();
  68. /* convert internal to extern major number */
  69. extern int itoemajor();
  70.  
  71. extern addr_t physmap();
  72. extern void physmap_free();
  73.  
  74. extern u_int hat_getkpfnum();
  75. extern u_int hat_getppfnum();
  76.  
  77. /* The following declaration takes the place of an inline function
  78.  * defined in sys/inline.h .
  79.  */
  80.  
  81. extern paddr_t kvtophys();    
  82.  
  83. #include    <sys/buf.h>
  84. #include    <sys/uio.h>
  85.  
  86. #if defined(__STDC__)
  87. extern int physiock(void(*)(), struct buf*, dev_t, int, daddr_t, struct uio*);
  88. extern int drv_priv(struct cred *);
  89. #else
  90. extern int drv_priv();
  91. extern int physiock();
  92. #endif
  93.  
  94. /* The following declarations take the place of macros in 
  95.  * sysmacros.h The undefs are for any case where a driver includes 
  96.  * sysmacros.h, even though DDI conforming drivers must not.
  97.  */
  98.  
  99. #undef getemajor
  100. #undef geteminor
  101. #undef getmajor
  102. #undef getminor
  103. #undef makedevice
  104. #undef cmpdev
  105. #undef expdev
  106.  
  107. extern major_t getemajor();
  108. extern minor_t geteminor();
  109. extern major_t getmajor();
  110. extern minor_t getminor();
  111. extern dev_t makedevice();
  112. extern dev_t cmpdev();
  113. extern dev_t expdev();
  114.  
  115. /* The following macros from param.h are also being converted to
  116.  * functions and #undefs must be done here as well since param.h
  117.  * will be included by most if not every driver 
  118.  */
  119.  
  120. #undef btop
  121. #undef btopr
  122. #undef ptob
  123.  
  124. extern unsigned long btop();
  125. extern unsigned long btopr();
  126. extern unsigned long ptob();
  127.  
  128.  
  129. /* Drivers must include map.h to pick up the structure definition */
  130. /* for the map structure and the declaration of the function malloc(). */
  131. /* Unfortunately, map.h also includes definitions of macros that */
  132. /* drivers should be calling as functions. The following #undefs allow */
  133. /* kernel code to use the macros while drivers call the functions */
  134.  
  135. #undef mapinit
  136. #undef mapwant
  137.  
  138. extern void mapinit();
  139. extern unsigned long mapwant();
  140. extern void setmapwant();
  141.  
  142. /* when DKI changes are folded back in to DDI, the functions mapinit
  143.  * mapwant and setmapwant should be updated to be the following DKI
  144.  * functions:
  145.  */
  146.  
  147. extern void rminit();
  148. extern unsigned long rmwant();
  149. extern void rmsetwant();
  150.  
  151.  
  152.  
  153. /* STREAMS drivers and modules must include stream.h to pick up the */
  154. /* needed structure and flag definitions. As was the case with map.h, */
  155. /* macros used by both the kernel and drivers in times past now have */
  156. /* a macro definition for the kernel and a function definition for */
  157. /* drivers. The following #undefs allow drivers to include stream.h */
  158. /* but call the functions rather than macros. */
  159.  
  160. #undef OTHERQ
  161. #undef RD
  162. #undef WR
  163. #undef datamsg
  164. #undef putnext
  165. #undef splstr
  166.  
  167. extern struct queue *OTHERQ();    /* stream.h */
  168. extern struct queue *RD();
  169. extern struct queue *WR();
  170. extern int datamsg();
  171. extern int putnext();
  172. extern int splstr();
  173.  
  174. /* declarations of functions for allocating and deallocating the space */
  175. /* for a buffer header (just a header, not the associated buffer) */
  176.  
  177. extern struct buf *getrbuf();
  178. extern void freerbuf();
  179.  
  180. /* end of ddi.h */
  181. #endif    /* _SYS_DDI_H */
  182.