home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / machdep.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-09  |  12.2 KB  |  380 lines

  1. /*
  2.  *    @(#) machdep.h 2.10 88/12/09 
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
  5.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
  6.  *    This Module contains Proprietary Information of
  7.  *    The Santa Cruz Operation, Microsoft Corporation
  8.  *    and AT&T, and should be treated as Confidential.
  9.  */
  10.  
  11. /*
  12.  *    Various machine dependent things
  13.  */
  14.  
  15. #ifndef _INMACHDEP
  16. #define _INMACHDEP
  17.  
  18. /* PC/AT Floppy disk control  */
  19. #define FLIOC        ('F'<<8)
  20.  
  21. #define FLIOCFTRK    (FLIOC|1)    /* ioctl command to format a track */
  22. #define FLIOCSIZE    (FLIOC|2)    /* ioctl command to get floppy size */
  23. #define FLIOCPRT    (FLIOC|3)    /* ioctl command to turn on/off prtfs */
  24.  
  25. #ifdef VPIX
  26. #define F_RAW        (FLIOC|63)
  27. #define F_DOR        (FLIOC|62)
  28. #define F_FCR        (FLIOC|61)
  29. #define F_DTYP        (FLIOC|60)
  30.  
  31. #define CMD_BYTES    10
  32.  
  33. /* structure used by F_RAW ioctl command */
  34.  
  35. struct fdraw {
  36.     unsigned char fr_cmd[CMD_BYTES];    /* user-supplied command bytes */
  37.     short    fr_cnum;            /* number of command bytes */
  38.     unsigned char fr_result[CMD_BYTES]; /* controller result bytes */
  39.     short    fr_nbytes;            /* number to transfer if r/w */
  40.     char    *fr_addr;            /* where to transfer */
  41. };
  42. #endif
  43.  
  44. /* PC/AT Floppy tape control  */
  45. #define    MTIO            ('T' << 8)
  46. #define    MTTENSION        (MTIO | 1)    /* tension the tape */
  47. #define    MTTAPE_STATUS        (MTIO | 2)    /* get tape status */
  48.                         /* (see return values below) */
  49. #define    MTERASE_SERVO        (MTIO | 3)    /* erase the servo track */
  50. #define    MTWRITE_SERVO        (MTIO | 4)    /* write the servo track */
  51. #define    MTFORMAT_TRACK        (MTIO | 5)    /* format one tape track */
  52. #define    MTBUILD_BTT        (MTIO | 6)    /* build the bad block table */
  53.                         /* and return the number of */
  54.                         /* good blocks */
  55. #define    MTCART_TYPE        (MTIO | 7)    /* cartridge type     */
  56. #define    MTENABLE_BTT        (MTIO | 8)    /* enable bad track table */
  57. #define    MTDISABLE_BTT        (MTIO | 9)    /* disable bad track table */
  58. #define    MTENABLE_ECC        (MTIO | 0xA)    /* enable ecc         */
  59. #define    MTDISABLE_ECC        (MTIO | 0xB)    /* disable ecc         */
  60. #define    MTNUM_BB        (MTIO | 0xC)    /* change the number of bufs */
  61. #define MTDC1000        (MTIO | 0xD)
  62. #define MTDC2000        (MTIO | 0xE)
  63.  
  64. /* Drive types: */
  65.  
  66. #define    IRWIN_110        5        /* Irwin 10 M tape drive */
  67. #define    IRWIN_145        6        /* Irwin 40 M tape drive */
  68. #define IRWIN_125        7        /* Irwin 20 M tape drive */
  69.  
  70. /* cartridge tape ioctl commands */
  71.  
  72. #define    MTIOC        ('m'<<8)    /* ioctl code for tape commands */
  73. #define    MT_STATUS    (MTIOC | 0)    /* read tape status */
  74. #define    MT_RESET    (MTIOC | 1)    /* reset tape hardware */
  75. #define    MT_RETEN    (MTIOC | 2)    /* retention tape */
  76. #define    MT_REWIND    (MTIOC | 3)    /* rewind tape */
  77. #define    MT_ERASE    (MTIOC | 4)    /* erase tape */
  78. #define    MT_AMOUNT    (MTIOC | 5)    /* report on amount of data xfered */
  79. #define    MT_RFM        (MTIOC | 6)    /* find next filemark */
  80. #define    MT_WFM        (MTIOC | 7)    /* write filemark */
  81. #define MT_REPORT    (MTIOC | 64)    /* report device type */
  82.  
  83. /* device types returned by MT_REPORT */
  84.  
  85. #define MT_UNKNOWN_TYPE     0
  86. #define MT_CT_TYPE        1
  87. #define MT_FT_TYPE        2
  88.  
  89. /*
  90.  * structure returned from ioctl MT_STATUS
  91.  */
  92.  
  93. union tape_status {
  94.   struct {
  95.     unsigned  short fm        : 1 ;        /* file mark detected */
  96.     unsigned  short nobie    : 1 ;        /* big time booboo */
  97.     unsigned  short derr    : 1 ;        /* unrecoverable data error */
  98.     unsigned  short eot        : 1 ;        /* end of tape */
  99.     unsigned  short wprot    : 1 ;        /* write protected cartridge */
  100.     unsigned  short offln    : 1 ;        /* drive off line */
  101.     unsigned  short nocart    : 1 ;        /* no cartridge in drive */
  102.     unsigned  short eb0        : 1 ;        /* exception byte 0 valid */
  103.  
  104.     unsigned  short reset    : 1 ;        /* reset/power up occured */
  105.     unsigned  short reserved    : 2 ;
  106.     unsigned  short bot        : 1 ;        /* beginning of tape */
  107.     unsigned  short retry    : 1 ;        /* 8 or more read retrys */
  108.     unsigned  short nodata    : 1 ;        /* no data detected */
  109.     unsigned  short illcmd    : 1 ;        /* illegal command */
  110.     unsigned  short eb1        : 1 ;        /* exception byte 1 valid */
  111.  
  112.     unsigned  short sfterr;        /* blocks re-written / soft errors */
  113.     unsigned  short undrun;        /* number of underruns */
  114.   } status ;                /* read status' data goes here */
  115.   unsigned char stat[6] ;
  116. } ;
  117.  
  118. /* Magnetic tape, return values from MTTAPE_STATUS ioctl call: */
  119. #define    MTXENIX_TAPE        (MTIO | 32)    /* XENIX formatted tape */
  120. #define    MTNOT_XENIX_TAPE    (MTIO | 33)    /* formatted tape, not */
  121.                         /* XENIX format */
  122. #define    MTNO_SERVO        (MTIO | 34)    /* no servo track on tape */
  123. #define    MTNOT_FORMATTED        (MTIO | 35)    /* servo track on tape, */
  124.  
  125. /* VPIX serial ioctls */
  126.  
  127. #ifdef VPIX
  128.  
  129. #define AIOC    ('A'<<8)
  130. #define AIOCINTTYPE     (AIOC|60)        /* set pseudorupt personality */
  131. #define AIOCDOSMODE     (AIOC|61)        /* set DOSMODE */
  132. #define AIOCNONDOSMODE  (AIOC|62)        /* reset DOSMODE */
  133. #define AIOCSERIALOUT   (AIOC|63)        /* serial device data write */
  134. #define AIOCSERIALIN    (AIOC|64)        /* serial device data read */
  135. #define AIOCSETSS       (AIOC|65)        /* set start/stop chars */
  136. #define AIOCINFO        (AIOC|66)        /* tell user what device we are */
  137.  
  138. /* Ioctl alternate names for use by vpc */
  139.  
  140. #define VPC_SERIAL_DOS    AIOCDOSMODE
  141. #define VPC_SERIAL_NONDOS AIOCNONDOSMODE
  142. #define VPC_SERIAL_INFO   AIOCINFO
  143. #define VPC_SERIAL_OUT    AIOCSERIALOUT
  144. #define VPC_SERIAL_IN     AIOCSERIALIN
  145.  
  146. #endif /* VPIX */
  147.  
  148. /* PC/AT Cga adapter control */
  149. #define    CGAIOC    ('C' << 8)    
  150. #define    CGAMODE (CGAIOC | 1)        /* change cga mode */
  151. #define CGAIO    (CGAIOC | 2)        /* do inb/outb on cga port */
  152. #define CGA_GET (CGAIOC | 3)        /* get cga mode setting */
  153.  
  154. #define CPQVDUMODE0    (CGAIOC|72)    /* compaq Dual mode low res */
  155. #define CPQVDUMODE1    (CGAIOC|73)    /* compaq Dual mode high res */
  156.  
  157. /* PC/AT Pga adapter control */
  158. #define PGAIOC    ('P' << 8)
  159. #define PGAMODE (PGAIOC | 1)        /* change pga mode */
  160. #define PGAIO    (PGAIOC | 2)        /* do inb/outb on pga port */
  161. #define PGA_GET (PGAIOC | 3)        /* get pga mode setting */
  162.  
  163. /* PC/AT Ega adapter control */
  164. #define EGAIOC    ('E' << 8)
  165. #define EGAMODE (EGAIOC | 1)        /* change ega mode */
  166. #define EGAIO    (EGAIOC | 2)        /* do inb/outb on ega port */
  167. #define EGA_GET (EGAIOC | 3)        /* get ega mode setting */
  168. #define EGA_IOPRIVL (EGAIOC | 4)    /* get in/out privilege for ega ports */
  169.  
  170. /* PC/AT Vga adapter control */
  171. #define VGAIOC    ('E' << 8)
  172. #define VGAMODE (VGAIOC | 65)        /* change vga mode */
  173. #define VGAIO    (VGAIOC | 66)        /* do inb/outb on vga port */
  174. #define VGA_GET (VGAIOC | 67)        /* get vga mode setting */
  175. #define VGA_IOPRIVL (VGAIOC | 68)    /* get in/out privilege for vga ports */
  176.  
  177. /* PC/AT Mca adapter control */
  178. #define MCAIOC    ('M' << 8)
  179. #define MCAMODE    (MCAIOC | 1)        /* change mca mode */
  180. #define MCAIO    (MCAIOC | 2)        /* do inb/outb on mca port */
  181. #define MCA_GET (MCAIOC | 3)        /* get mca mode setting */
  182.  
  183. /* Hercules support */
  184. #define SW_HGC_P0  (MODESWITCH | M_HGC_P0)
  185. #define SW_HGC_P1  (MODESWITCH | M_HGC_P1)
  186.  
  187. /* Common PC/AT adapter control */
  188.  
  189. #include "comcrt.h"
  190.  
  191. /* Defines for console-switching ioctl -- MONO, CGA, PGA, and EGA */
  192. /* definitions are in comcrt.h                    */    
  193. #define SWAPCONS ('s' << 8)
  194. #define SWAPMONO (SWAPCONS | MONO)
  195. #define SWAPCGA  (SWAPCONS | CGA)
  196. #define SWAPPGA  (SWAPCONS | PGA)
  197. #define SWAPEGA  (SWAPCONS | EGA)
  198. #define SWAPVGA  (SWAPCONS | VGA)
  199.  
  200. /* defines for mode-switching ioctl -- modes are defined in comcrt.h */
  201. #define MODESWITCH ('S' << 8)
  202. #define SW_B40x25  (MODESWITCH | M_B40x25)
  203. #define SW_C40x25  (MODESWITCH | M_C40x25)
  204. #define SW_B80x25  (MODESWITCH | M_B80x25)
  205. #define SW_C80x25  (MODESWITCH | M_C80x25)
  206. #define SW_BG320   (MODESWITCH | M_BG320)
  207. #define SW_CG320   (MODESWITCH | M_CG320)
  208. #define SW_BG640   (MODESWITCH | M_BG640)
  209. #define SW_EGAMONO80x25 (MODESWITCH | M_EGAMONO80x25)
  210. #define SW_CG320_D    (MODESWITCH | M_CG320_D)
  211. #define SW_CG640_E    (MODESWITCH | M_CG640_E)
  212. #define SW_EGAMONOAPA (MODESWITCH | M_EGAMONOAPA)
  213. #define SW_CG640x350  (MODESWITCH | M_CG640x350)
  214. #define SW_ENH_MONOAPA2 (MODESWITCH | M_ENHMONOAPA2)
  215. #define SW_ENH_CG640  (MODESWITCH | M_ENH_CG640)
  216. #define SW_ENHB40x25  (MODESWITCH | M_ENH_B40x25)
  217. #define SW_ENHC40x25  (MODESWITCH | M_ENH_C40x25)
  218. #define SW_ENHB80x25  (MODESWITCH | M_ENH_B80x25)
  219. #define SW_ENHC80x25  (MODESWITCH | M_ENH_C80x25)
  220. #define SW_ENHB80x43  (MODESWITCH | M_ENH_B80x43)
  221. #define SW_ENHC80x43  (MODESWITCH | M_ENH_C80x43)
  222. #define SW_MCAMODE    (MODESWITCH | M_MCA_MODE)
  223. #define SW_VGA40x25    (MODESWITCH | M_VGA_40x25)
  224. #define SW_VGA80x25    (MODESWITCH | M_VGA_80x25)
  225. #define SW_VGAM80x25    (MODESWITCH | M_VGA_M80x25)
  226. #define SW_VGA11    (MODESWITCH | M_VGA11)
  227. #define SW_VGA12    (MODESWITCH | M_VGA12)
  228. #define SW_VGA13    (MODESWITCH | M_VGA13)
  229.  
  230. /* defines for display memory mapping ioctl (see consioctl in console.c) */
  231. #define MAPADAPTER ('m' << 8)
  232. #define MAPCONS (MAPADAPTER)  
  233. #define MAPMONO (MAPADAPTER | MONO)
  234. #define MAPCGA  (MAPADAPTER | CGA) 
  235. #define MAPPGA  (MAPADAPTER | PGA)
  236. #define MAPEGA  (MAPADAPTER | EGA)
  237. #define MAPVGA  (MAPADAPTER | VGA)
  238. #define MAPPGA1K  (MAPADAPTER | 0xff)
  239.  
  240. /* defines for ibm keyboard ioctls (see consioctl in console.c) */
  241. #define FKEYIOC   ('k' << 8)
  242. #define GETFKEY   (FKEYIOC)
  243. #define SETFKEY   (FKEYIOC | 1)
  244. #define TIOCKBON  (TIOC|8)
  245. #define TIOCKBOF  (TIOC|9)
  246. #define KBENABLED (TIOC|10)
  247.  
  248. #define SW_MCAMODE    (MODESWITCH | M_MCA_MODE)
  249.  
  250. #ifdef M_I386
  251. #pragma pack(2)
  252. #endif
  253.  
  254. /* structure used for SETFKEY and GETFKEY ioctls */
  255. struct fkeyarg {    
  256.     unsigned short    keynum;
  257.     char         keydef[MAXFK];
  258.     char        flen;            
  259. };
  260.  
  261. #ifdef M_I386
  262. #pragma pack()
  263. #endif
  264.  
  265. /* defines for ibm console ioctls */
  266. #define CONSIOC        ('c' << 8)
  267. #define CONS_CURRENT     (CONSIOC|1)
  268. #define CONS_GET    (CONSIOC|2)
  269. #define CONSIO        (CONSIOC|3)
  270.  
  271. #define PIO_FONT8x8    (CONSIOC|64)
  272. #define GIO_FONT8x8    (CONSIOC|65)
  273. #define PIO_FONT8x14    (CONSIOC|66)
  274. #define GIO_FONT8x14    (CONSIOC|67)
  275. #define PIO_FONT8x16    (CONSIOC|68)
  276. #define GIO_FONT8x16    (CONSIOC|69)
  277.  
  278. #define CONSADP        (CONSIOC|72)    /* get specific adapter screen */
  279.  
  280. /* defines for inb/outb ioctls for graphics adapter ports */
  281. #define IN_ON_PORT    1
  282. #define OUT_ON_PORT    0
  283.  
  284. #ifdef M_I386
  285. #pragma pack(2)
  286. #endif
  287.  
  288. /* structure used for inb/outb ioctls for graphics adapter ports */
  289. struct port_io_struct {
  290.     char    dir;    /* direction flag (in vs. out) */
  291.     unsigned short port;
  292.     char    data;
  293. };
  294. struct port_io_arg {
  295.     struct port_io_struct args[4];
  296. };    
  297.  
  298. #ifdef M_I386
  299. #pragma pack()
  300. #endif
  301.  
  302. /* defines for Adaptec AHA-1540 ioctls */
  303. #define    ADIOC        ('a'<<8)
  304. #define    ADFORMAT    (ADIOC|1)    /* format disk            */
  305. #define    ADMODESELECT    (ADIOC|2)    /* issue mode select        */
  306. #define    ADTEST        (ADIOC|3)    /* run diagnostics        */
  307. #define    ADBADSEC    (ADIOC|4)    /* set bad sector        */
  308.  
  309. /*
  310.  * Initialize clock constant for 50msec clock interrupts.
  311.  * Magic value to cause proper interrupt interval.
  312.  * Assumes a 1.193181MHz clock input. (1193181 / HZ)
  313.  */
  314.  
  315. #define CLKNUM 23864
  316.  
  317. /* 
  318.  * Various defines for 8259 special fully nested support
  319.  */
  320.  
  321. /* Yes 3 is correct for certain systems running this kernel */
  322. #define NUM_8259    3    /* number of 8259s on this system */
  323.  
  324. #define MAX8259        9     /* max number of 8259s possible */
  325. #define MAXLEV        8    /* max interrupt levels on an 8259 */
  326. #define MAXVEC        72    /* max vectors on fully cascaded system */
  327.  
  328. #define    HAS_REBOOT    /* This system has a software reboot capability */
  329.  
  330. #define CTLR_16BIT    /* This system has a device controller that cannot */
  331.                /* handle transfers across a 64k boundary. */
  332.  
  333. #define AUTOBOOT        /* This system has autoboot support */
  334. #define    POWERDOWN    2    /* 2nd argument to shutd() */
  335. #define    AUTOFLAG    0xbe11    /* 3rd argument to shutdown() */
  336.  
  337. /*
  338.  * event driver ioctls
  339.  */
  340. #define    EQIOC        ('Q' << 8)
  341. #define    EQIO_GETQP    (EQIOC | 1)
  342. #define    EQIO_SETEMASK    (EQIOC | 2)
  343. #define    EQIO_GETEMASK    (EQIOC | 3)
  344. #define    EQIO_SUSPEND    (EQIOC | 4)
  345. #define    EQIO_RESUME    (EQIOC | 5)
  346. #define    EQIO_BLOCK    (EQIOC | 6)
  347.  
  348. /* 
  349.  * line discipline specific ioctls to the mouse line discipline 
  350.  */
  351. #define    EVLD_IOC    (LDIOC)
  352. #define    LDEV_SETTYPE    (EVLD_IOC | 13)        /* set mouse type    */
  353. #define    LDEV_GETEV    (EVLD_IOC | 14)        /* get an event        */
  354. #define    LDEV_ATTACHQ    (EVLD_IOC | 15)        /* activate mouse    */
  355. #define    LDEV_SETRATIO    (EVLD_IOC | 16)        /* set a device ratio    */
  356.  
  357. struct mouseinfo {       
  358.     unsigned char status;
  359.     char xmotion, ymotion;
  360. };
  361.     
  362. /*
  363.  * ioctls to the busmouse driver
  364.  */
  365. #define MOUSEIOC        ('M'<<8)
  366. #define MOUSEIOCREAD    (MOUSEIOC|60)
  367. #define VPC_MOUSE_READ  MOUSEIOCREAD
  368. #define    MOUSEACQUIRE    (MOUSEIOC|61)
  369.  
  370. /* Mouse status register definitions */
  371. #define BUT3STAT        1
  372. #define BUT2STAT        2
  373. #define BUT1STAT        4
  374. #define BUT3CHNG        8
  375. #define BUT2CHNG        0x10
  376. #define BUT1CHNG        0x20
  377. #define MOVEMENT        0x40
  378.  
  379. #endif
  380.