141480Smckusick /* 241480Smckusick * Copyright (c) 1988 University of Utah. 3*63148Sbostic * Copyright (c) 1990, 1993 4*63148Sbostic * The Regents of the University of California. All rights reserved. 541480Smckusick * 641480Smckusick * This code is derived from software contributed to Berkeley by 741480Smckusick * the Systems Programming Group of the University of Utah Computer 841480Smckusick * Science Department. 941480Smckusick * 1041480Smckusick * %sccs.include.redist.c% 1141480Smckusick * 1253923Shibler * from: Utah $Hdr: hilioctl.h 1.10 92/01/21$ 1341480Smckusick * 14*63148Sbostic * @(#)hilioctl.h 8.1 (Berkeley) 06/10/93 1541480Smckusick */ 1641480Smckusick 1741480Smckusick struct _hilbell { 1841480Smckusick u_char duration; 1941480Smckusick u_char frequency; 2041480Smckusick }; 2141480Smckusick 2241480Smckusick struct _hilbuf16 { 2341480Smckusick u_char string[16]; 2441480Smckusick }; 2541480Smckusick 2641480Smckusick struct _hilbuf11 { 2741480Smckusick u_char string[11]; 2841480Smckusick }; 2941480Smckusick 3041480Smckusick struct _hilbuf5 { 3141480Smckusick u_char string[5]; 3241480Smckusick }; 3341480Smckusick 3441480Smckusick struct _hilbuf4 { 3541480Smckusick u_char string[4]; 3641480Smckusick }; 3741480Smckusick 3841480Smckusick struct _hilbuf2 { 3941480Smckusick u_char string[2]; 4041480Smckusick }; 4141480Smckusick 4241480Smckusick struct hilqinfo { 4341480Smckusick int qid; 4441480Smckusick char *addr; 4541480Smckusick }; 4641480Smckusick 4741480Smckusick /* 4841480Smckusick * HPUX ioctls (here for the benefit of the HIL driver). 4941480Smckusick * Named as they are under HPUX. 5041480Smckusick * The first set are loop device ioctls. 5141480Smckusick * The second set are ioctls for the 8042. 5241480Smckusick * Note that some are not defined as in HPUX 5341480Smckusick * due to the difference in the definitions of IOC_VOID. 5441480Smckusick */ 5553923Shibler #ifdef hp800 5653923Shibler #define _IOHpux(x,y) _IO(x,y) 5753923Shibler #else 5841480Smckusick #define _IOHpux(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */ 5953923Shibler #endif 6041480Smckusick 6157310Shibler /* 6257310Shibler * The HP compiler (at least as of HP-UX 7.X) pads odd sized structures 6357310Shibler * to a short boundary. To avoid issues of whether our compiler pads 6457310Shibler * and, if so to what boundary, we explicitly state the values for 6557310Shibler * troublesome ioctls: 6657310Shibler * 6757310Shibler * HILID (HILIOCID) _IOR('h',0x03, struct _hilbuf11), 6857310Shibler * EFTRRT (HILIOCRRT) _IOR('H',0x31, struct _hilbuf5). 6957310Shibler */ 7057310Shibler #define HILID 0x400C6803 /* Identify & describe */ 7141480Smckusick #define HILSC _IOR('h',0x33, struct _hilbuf16) /* Security code */ 7241480Smckusick #define HILRN _IOR('h',0x30, struct _hilbuf16) /* Report name */ 7341480Smckusick #define HILRS _IOR('h',0x31, struct _hilbuf16) /* Report status */ 7441480Smckusick #define HILED _IOR('h',0x32, struct _hilbuf16) /* Extended describe*/ 7541480Smckusick #define HILDKR _IOHpux('h',0x3D) /* Disable autorepeat */ 7641480Smckusick #define HILER1 _IOHpux('h',0x3E) /* Autorepeat 1/30 */ 7741480Smckusick #define HILER2 _IOHpux('h',0x3F) /* Autorepeat 1/60 */ 7841480Smckusick #define HILP1 _IOHpux('h',0x40) /* Prompt 1 */ 7941480Smckusick #define HILP2 _IOHpux('h',0x41) /* Prompt 2 */ 8041480Smckusick #define HILP3 _IOHpux('h',0x42) /* Prompt 3 */ 8141480Smckusick #define HILP4 _IOHpux('h',0x43) /* Prompt 4 */ 8241480Smckusick #define HILP5 _IOHpux('h',0x44) /* Prompt 5 */ 8341480Smckusick #define HILP6 _IOHpux('h',0x45) /* Prompt 6 */ 8441480Smckusick #define HILP7 _IOHpux('h',0x46) /* Prompt 7 */ 8541480Smckusick #define HILP _IOHpux('h',0x47) /* Prompt */ 8641480Smckusick #define HILA1 _IOHpux('h',0x48) /* Acknowledge 1 */ 8741480Smckusick #define HILA2 _IOHpux('h',0x49) /* Acknowledge 2 */ 8841480Smckusick #define HILA3 _IOHpux('h',0x4A) /* Acknowledge 3 */ 8941480Smckusick #define HILA4 _IOHpux('h',0x4B) /* Acknowledge 4 */ 9041480Smckusick #define HILA5 _IOHpux('h',0x4C) /* Acknowledge 5 */ 9141480Smckusick #define HILA6 _IOHpux('h',0x4D) /* Acknowledge 6 */ 9241480Smckusick #define HILA7 _IOHpux('h',0x4E) /* Acknowledge 7 */ 9341480Smckusick #define HILA _IOHpux('h',0x4F) /* Acknowledge */ 9441480Smckusick 9541480Smckusick #define EFTSRD _IOW('H',0xa0,char) /* Set the repeat delay. */ 9641480Smckusick #define EFTSRR _IOW('H',0xa2,char) /* Set the repeat rate. */ 9741480Smckusick #define EFTSRPG _IOW('H',0xa6,char) /* Set RPG interrupt rate. */ 9841480Smckusick #define EFTSBP _IOW('H',0xc4,struct _hilbuf4) /* Send data to the beeper. */ 9941480Smckusick #define EFTRLC _IOR('H',0x12,char) /* Read the language code. */ 10041480Smckusick #define EFTRCC _IOR('H',0x11,char) /* Read configuration code. */ 10157310Shibler #define EFTRRT 0x40064831 /* Read the real time. */ 10241480Smckusick #define EFTRT _IOR('H',0xf4,struct _hilbuf4) /* Read the timers for the 10341480Smckusick four voices. */ 10453923Shibler #ifdef hp800 10553923Shibler #define EFTSBI _IOW('H',0xa3,char) /* Do the beep thing. */ 10653923Shibler #else 10741480Smckusick #define EFTSBI _IOW('H',0xa3,struct _hilbuf2) /* Set the bell information. */ 10853923Shibler #endif 10941480Smckusick 11041480Smckusick /* 11141480Smckusick * BSD ioctls. 11241480Smckusick * Mostly the same as the HPUX versions except for shared-queue ioctls. 11341480Smckusick */ 11457310Shibler #define OHILIOCID 0x400B6803 /* XXX compat */ 11557310Shibler #define HILIOCID HILID 11641480Smckusick #define HILIOCSC _IOR('h',0x33, struct _hilbuf16) 11741480Smckusick #define HILIOCRN _IOR('h',0x30, struct _hilbuf16) 11841480Smckusick #define HILIOCRS _IOR('h',0x31, struct _hilbuf16) 11941480Smckusick #define HILIOCED _IOR('h',0x32, struct _hilbuf16) 12041480Smckusick #define HILIOCAROFF _IO('h',0x3D) 12141480Smckusick #define HILIOCAR1 _IO('h',0x3E) 12241480Smckusick #define HILIOCAR2 _IO('h',0x3F) 12341480Smckusick #define HILIOCSBP _IOW('H',0xc4,struct _hilbuf4) 12457310Shibler #define OHILIOCRRT 0x40054831 /* XXX compat */ 12557310Shibler #define HILIOCRRT EFTRRT 12641480Smckusick #define HILIOCRT _IOR('H',0xf4,struct _hilbuf4) 12741480Smckusick #define HILIOCBEEP _IOW('H',0xA3,struct _hilbell) 12841480Smckusick # define BELLDUR 80 /* tone duration in msec (10 - 2560) */ 12941480Smckusick # define BELLFREQ 8 /* tone frequency (0 - 63) */ 13041480Smckusick 13141480Smckusick #define HILIOCALLOCQ _IOWR('H',0x72, struct hilqinfo) /* allocate queue */ 13241480Smckusick #define HILIOCFREEQ _IOW('H',0x73, struct hilqinfo) /* deallocate queue */ 13341480Smckusick #define HILIOCMAPQ _IOW('H',0x74, int) /* map device to queue */ 13441480Smckusick #define HILIOCUNMAPQ _IOW('H',0x75, int) /* unmap device from dev */ 13541480Smckusick #define HILIOCTEST _IOW('H',0x76, int) /* Toggle debugging mode */ 13641480Smckusick #define HILIOCHPUX _IO('H',0x77) /* use HPUX (read) semantics */ 13741480Smckusick #define HILIOCRESET _IO('H',0x78) /* Reset the HIL loop. */ 13841480Smckusick 13941480Smckusick /* 14041480Smckusick * HIL input queue. 14141480Smckusick * This is the circular queue (allocated by HILIOCALLOC) shared by kernel 14241480Smckusick * and user. It consists of a sixteen byte header followed by space for 14341480Smckusick * 255 input data packets (a total of 4096 bytes). The kernel adds packets 14441480Smckusick * at tail. The user is expected to remove packets from head. This is the 14541480Smckusick * only field in the header that the user should modify. 14641480Smckusick */ 14741480Smckusick typedef struct hil_packet { 14841480Smckusick u_char size; /* total packet size */ 14941480Smckusick u_char dev; /* loop device packet was generated by */ 15041480Smckusick long tstamp; /* time stamp */ 15141480Smckusick u_char data[10]; /* device data */ 15241480Smckusick } hil_packet; 15341480Smckusick 15441480Smckusick typedef struct hil_eventqueue { 15541480Smckusick int size; 15641480Smckusick int head; 15741480Smckusick int tail; 15841480Smckusick int pad; 15941480Smckusick } hil_eventqueue; 16041480Smckusick 16141480Smckusick typedef union hilqueue { 16241480Smckusick char hqu_size[0x1000]; 16341480Smckusick struct q_data { 16441480Smckusick hil_eventqueue h_eventqueue; 16541480Smckusick hil_packet h_event[1]; 16641480Smckusick } q_data; 16741480Smckusick #define hil_evqueue q_data.h_eventqueue 16841480Smckusick #define hil_event q_data.h_event 16941480Smckusick } HILQ; 17041480Smckusick 17141480Smckusick #define HEVQSIZE \ 17241480Smckusick ((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1) 173