1*41480Smckusick /* 2*41480Smckusick * Copyright (c) 1988 University of Utah. 3*41480Smckusick * Copyright (c) 1990 The Regents of the University of California. 4*41480Smckusick * All rights reserved. 5*41480Smckusick * 6*41480Smckusick * This code is derived from software contributed to Berkeley by 7*41480Smckusick * the Systems Programming Group of the University of Utah Computer 8*41480Smckusick * Science Department. 9*41480Smckusick * 10*41480Smckusick * %sccs.include.redist.c% 11*41480Smckusick * 12*41480Smckusick * from: Utah $Hdr: hilioctl.h 1.9 89/01/18$ 13*41480Smckusick * 14*41480Smckusick * @(#)hilioctl.h 7.1 (Berkeley) 05/08/90 15*41480Smckusick */ 16*41480Smckusick 17*41480Smckusick struct _hilbell { 18*41480Smckusick u_char duration; 19*41480Smckusick u_char frequency; 20*41480Smckusick }; 21*41480Smckusick 22*41480Smckusick struct _hilbuf16 { 23*41480Smckusick u_char string[16]; 24*41480Smckusick }; 25*41480Smckusick 26*41480Smckusick struct _hilbuf11 { 27*41480Smckusick u_char string[11]; 28*41480Smckusick }; 29*41480Smckusick 30*41480Smckusick struct _hilbuf5 { 31*41480Smckusick u_char string[5]; 32*41480Smckusick }; 33*41480Smckusick 34*41480Smckusick struct _hilbuf4 { 35*41480Smckusick u_char string[4]; 36*41480Smckusick }; 37*41480Smckusick 38*41480Smckusick struct _hilbuf2 { 39*41480Smckusick u_char string[2]; 40*41480Smckusick }; 41*41480Smckusick 42*41480Smckusick struct hilqinfo { 43*41480Smckusick int qid; 44*41480Smckusick char *addr; 45*41480Smckusick }; 46*41480Smckusick 47*41480Smckusick /* 48*41480Smckusick * HPUX ioctls (here for the benefit of the HIL driver). 49*41480Smckusick * Named as they are under HPUX. 50*41480Smckusick * The first set are loop device ioctls. 51*41480Smckusick * The second set are ioctls for the 8042. 52*41480Smckusick * Note that some are not defined as in HPUX 53*41480Smckusick * due to the difference in the definitions of IOC_VOID. 54*41480Smckusick */ 55*41480Smckusick #define _IOHpux(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */ 56*41480Smckusick 57*41480Smckusick #define HILID _IOR('h',0x03, struct _hilbuf11) /* Identify & describe */ 58*41480Smckusick #define HILSC _IOR('h',0x33, struct _hilbuf16) /* Security code */ 59*41480Smckusick #define HILRN _IOR('h',0x30, struct _hilbuf16) /* Report name */ 60*41480Smckusick #define HILRS _IOR('h',0x31, struct _hilbuf16) /* Report status */ 61*41480Smckusick #define HILED _IOR('h',0x32, struct _hilbuf16) /* Extended describe*/ 62*41480Smckusick #define HILDKR _IOHpux('h',0x3D) /* Disable autorepeat */ 63*41480Smckusick #define HILER1 _IOHpux('h',0x3E) /* Autorepeat 1/30 */ 64*41480Smckusick #define HILER2 _IOHpux('h',0x3F) /* Autorepeat 1/60 */ 65*41480Smckusick #define HILP1 _IOHpux('h',0x40) /* Prompt 1 */ 66*41480Smckusick #define HILP2 _IOHpux('h',0x41) /* Prompt 2 */ 67*41480Smckusick #define HILP3 _IOHpux('h',0x42) /* Prompt 3 */ 68*41480Smckusick #define HILP4 _IOHpux('h',0x43) /* Prompt 4 */ 69*41480Smckusick #define HILP5 _IOHpux('h',0x44) /* Prompt 5 */ 70*41480Smckusick #define HILP6 _IOHpux('h',0x45) /* Prompt 6 */ 71*41480Smckusick #define HILP7 _IOHpux('h',0x46) /* Prompt 7 */ 72*41480Smckusick #define HILP _IOHpux('h',0x47) /* Prompt */ 73*41480Smckusick #define HILA1 _IOHpux('h',0x48) /* Acknowledge 1 */ 74*41480Smckusick #define HILA2 _IOHpux('h',0x49) /* Acknowledge 2 */ 75*41480Smckusick #define HILA3 _IOHpux('h',0x4A) /* Acknowledge 3 */ 76*41480Smckusick #define HILA4 _IOHpux('h',0x4B) /* Acknowledge 4 */ 77*41480Smckusick #define HILA5 _IOHpux('h',0x4C) /* Acknowledge 5 */ 78*41480Smckusick #define HILA6 _IOHpux('h',0x4D) /* Acknowledge 6 */ 79*41480Smckusick #define HILA7 _IOHpux('h',0x4E) /* Acknowledge 7 */ 80*41480Smckusick #define HILA _IOHpux('h',0x4F) /* Acknowledge */ 81*41480Smckusick 82*41480Smckusick #define EFTSRD _IOW('H',0xa0,char) /* Set the repeat delay. */ 83*41480Smckusick #define EFTSRR _IOW('H',0xa2,char) /* Set the repeat rate. */ 84*41480Smckusick #define EFTSRPG _IOW('H',0xa6,char) /* Set RPG interrupt rate. */ 85*41480Smckusick #define EFTSBP _IOW('H',0xc4,struct _hilbuf4) /* Send data to the beeper. */ 86*41480Smckusick #define EFTRLC _IOR('H',0x12,char) /* Read the language code. */ 87*41480Smckusick #define EFTRCC _IOR('H',0x11,char) /* Read configuration code. */ 88*41480Smckusick #define EFTRRT _IOR('H',0x31,struct _hilbuf5) /* Read the real time. */ 89*41480Smckusick #define EFTRT _IOR('H',0xf4,struct _hilbuf4) /* Read the timers for the 90*41480Smckusick four voices. */ 91*41480Smckusick #define EFTSBI _IOW('H',0xa3,struct _hilbuf2) /* Set the bell information. */ 92*41480Smckusick 93*41480Smckusick /* 94*41480Smckusick * BSD ioctls. 95*41480Smckusick * Mostly the same as the HPUX versions except for shared-queue ioctls. 96*41480Smckusick */ 97*41480Smckusick #define HILIOCID _IOR('h',0x03, struct _hilbuf11) 98*41480Smckusick #define HILIOCSC _IOR('h',0x33, struct _hilbuf16) 99*41480Smckusick #define HILIOCRN _IOR('h',0x30, struct _hilbuf16) 100*41480Smckusick #define HILIOCRS _IOR('h',0x31, struct _hilbuf16) 101*41480Smckusick #define HILIOCED _IOR('h',0x32, struct _hilbuf16) 102*41480Smckusick #define HILIOCAROFF _IO('h',0x3D) 103*41480Smckusick #define HILIOCAR1 _IO('h',0x3E) 104*41480Smckusick #define HILIOCAR2 _IO('h',0x3F) 105*41480Smckusick #define HILIOCSBP _IOW('H',0xc4,struct _hilbuf4) 106*41480Smckusick #define HILIOCRRT _IOR('H',0x31,struct _hilbuf5) 107*41480Smckusick #define HILIOCRT _IOR('H',0xf4,struct _hilbuf4) 108*41480Smckusick #define HILIOCBEEP _IOW('H',0xA3,struct _hilbell) 109*41480Smckusick # define BELLDUR 80 /* tone duration in msec (10 - 2560) */ 110*41480Smckusick # define BELLFREQ 8 /* tone frequency (0 - 63) */ 111*41480Smckusick 112*41480Smckusick #define HILIOCALLOCQ _IOWR('H',0x72, struct hilqinfo) /* allocate queue */ 113*41480Smckusick #define HILIOCFREEQ _IOW('H',0x73, struct hilqinfo) /* deallocate queue */ 114*41480Smckusick #define HILIOCMAPQ _IOW('H',0x74, int) /* map device to queue */ 115*41480Smckusick #define HILIOCUNMAPQ _IOW('H',0x75, int) /* unmap device from dev */ 116*41480Smckusick #define HILIOCTEST _IOW('H',0x76, int) /* Toggle debugging mode */ 117*41480Smckusick #define HILIOCHPUX _IO('H',0x77) /* use HPUX (read) semantics */ 118*41480Smckusick #define HILIOCRESET _IO('H',0x78) /* Reset the HIL loop. */ 119*41480Smckusick 120*41480Smckusick /* 121*41480Smckusick * HIL input queue. 122*41480Smckusick * This is the circular queue (allocated by HILIOCALLOC) shared by kernel 123*41480Smckusick * and user. It consists of a sixteen byte header followed by space for 124*41480Smckusick * 255 input data packets (a total of 4096 bytes). The kernel adds packets 125*41480Smckusick * at tail. The user is expected to remove packets from head. This is the 126*41480Smckusick * only field in the header that the user should modify. 127*41480Smckusick */ 128*41480Smckusick typedef struct hil_packet { 129*41480Smckusick u_char size; /* total packet size */ 130*41480Smckusick u_char dev; /* loop device packet was generated by */ 131*41480Smckusick long tstamp; /* time stamp */ 132*41480Smckusick u_char data[10]; /* device data */ 133*41480Smckusick } hil_packet; 134*41480Smckusick 135*41480Smckusick typedef struct hil_eventqueue { 136*41480Smckusick int size; 137*41480Smckusick int head; 138*41480Smckusick int tail; 139*41480Smckusick int pad; 140*41480Smckusick } hil_eventqueue; 141*41480Smckusick 142*41480Smckusick typedef union hilqueue { 143*41480Smckusick char hqu_size[0x1000]; 144*41480Smckusick struct q_data { 145*41480Smckusick hil_eventqueue h_eventqueue; 146*41480Smckusick hil_packet h_event[1]; 147*41480Smckusick } q_data; 148*41480Smckusick #define hil_evqueue q_data.h_eventqueue 149*41480Smckusick #define hil_event q_data.h_event 150*41480Smckusick } HILQ; 151*41480Smckusick 152*41480Smckusick #define HEVQSIZE \ 153*41480Smckusick ((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1) 154