1Usb: module 2{ 3 PATH: con "/dis/lib/usb/usb.dis"; 4 DATABASEPATH: con "/lib/usbdb"; 5 RH2D: con 0<<7; 6 RD2H: con 1<<7; 7 Rstandard: con 0<<5; 8 Rclass: con 1<<5; 9 Rvendor: con 2<<5; 10 Rdevice: con 0; 11 Rinterface: con 1; 12 Rendpt: con 2; 13 Rother: con 3; 14 15 GET_STATUS: con 0; 16 CLEAR_FEATURE: con 1; 17 SET_FEATURE: con 3; 18 SET_ADDRESS: con 5; 19 GET_DESCRIPTOR: con 6; 20 SET_DESCRIPTOR: con 7; 21 GET_CONFIGURATION: con 8; 22 SET_CONFIGURATION: con 9; 23 GET_INTERFACE: con 10; 24 SET_INTERFACE: con 11; 25 SYNCH_FRAME: con 12; 26 27 DEVICE: con 1; 28 CONFIGURATION: con 2; 29 STRING: con 3; 30 INTERFACE: con 4; 31 ENDPOINT: con 5; 32 HID: con 16r21; 33 REPORT: con 16r22; 34 PHYSICAL: con 16r23; 35 HUB: con 16r29; 36 37 CL_AUDIO: con 1; 38 CL_COMMS: con 2; 39 CL_HID: con 3; 40 CL_PRINTER: con 7; 41 CL_MASS: con 8; 42 CL_HUB: con 9; 43 CL_DATA: con 10; 44 45 DDEVLEN: con 18; 46 DCONFLEN: con 9; 47 DINTERLEN: con 9; 48 DENDPLEN: con 7; 49 DHUBLEN: con 9; 50 DHIDLEN: con 9; 51 52 PORT_CONNECTION: con 0; 53 PORT_ENABLE: con 1; 54 PORT_SUSPEND: con 2; 55 PORT_OVER_CURRENT: con 3; 56 PORT_RESET: con 4; 57 PORT_POWER: con 8; 58 PORT_LOW_SPEED: con 9; 59 60 Endpt: adt { 61 addr: int; 62 d2h: int; 63 attr: int; 64 etype: int; 65 isotype: int; 66 maxpkt: int; 67 interval: int; 68 }; 69 70 Econtrol, Eiso, Ebulk, Eintr: con iota; # Endpt.etype 71 Eunknown, Easync, Eadapt, Esync: con iota; # Endpt.isotype 72 73 NendPt: con 16; 74 75 Device: adt { 76 usbmajor, usbminor, relmajor, relminor: int; 77 class, subclass, proto, maxpkt0, vid, did, nconf: int; 78 }; 79 80 AltInterface: adt { 81 id: int; 82 class, subclass, proto: int; 83 ep: array of ref Endpt; 84 }; 85 86 Interface: adt { 87 altiface: list of ref AltInterface; 88 }; 89 90 Configuration: adt { 91 id: int; 92 attr: int; 93 powerma: int; 94 iface: array of Interface; 95 }; 96 97 init: fn(); 98 get2: fn(b: array of byte): int; 99 put2: fn(buf: array of byte, v: int); 100 get4: fn(b: array of byte): int; 101 put4: fn(buf: array of byte, v: int); 102 bigget2: fn(b: array of byte): int; 103 bigput2: fn(buf: array of byte, v: int); 104 bigget4: fn(b: array of byte): int; 105 bigput4: fn(buf: array of byte, v: int); 106 memset: fn(b: array of byte, v: int); 107 strtol: fn(s: string, base: int): (int, string); 108 sclass: fn(class, subclass, proto: int): string; 109 110 get_descriptor: fn(fd: ref Sys->FD, rtyp: int, dtyp: int, dindex: int, langid: int, buf: array of byte): int; 111 get_standard_descriptor: fn(fd: ref Sys->FD, dtyp: int, index: int, buf: array of byte): int; 112 get_class_descriptor: fn(fd: ref Sys->FD, dtyp: int, index: int, buf: array of byte): int; 113 get_vendor_descriptor: fn(fd: ref Sys->FD, dtyp: int, index: int, buf: array of byte): int; 114 get_status: fn(fd: ref Sys->FD, port: int): int; 115 set_address: fn(fd: ref Sys->FD, address: int): int; 116 set_configuration: fn(fd: ref Sys->FD, n: int): int; 117 setclear_feature: fn(fd: ref Sys->FD, rtyp: int, value: int, index: int, on: int): int; 118 setup: fn(setupfd: ref Sys->FD, typ, req, value, index: int, outbuf: array of byte, inbuf: array of byte): int; 119 get_parsed_configuration_descriptor: fn(fd: ref Sys->FD, n: int): ref Configuration; 120 get_parsed_device_descriptor: fn(fd: ref Sys->FD): ref Device; 121 122 dump_configuration: fn(fd: ref Sys->FD, conf: ref Configuration); 123}; 124 125UsbDriver: module 126{ 127 MOUSEPATH: con "/appl/cmd/usb/usbmouse.dis"; 128 init: fn(usb: Usb, setupfd, ctlfd: ref Sys->FD, dev: ref Usb->Device, conf: array of ref Usb->Configuration, path: string): int; 129 shutdown: fn(); 130}; 131