pic18/usb-cdc.ss
#lang scheme/base
(require "usb.ss")
(provide (all-defined-out))

;; usb descriptors for USBPicStamp

;; this is included using the 'load-usb' word, which will transform
;; this higher level representation to forth code implementing the
;; words 'device-descriptor' 'string-descriptor' and
;; 'configuration-descriptor', which implement standard staapl forth
;; flash strings. (they load the f register)

(define-usb-device
 ((bcd USB             #x110)
  (b   DeviceClass     0)
  (b   DeviceSubClass  0)
  (b   DeviceProtocol  0)
  (b   MaxPacketSize   64) ;; more convenient: fits all
  (id  Vendor        #x04D8) ; microchip
  (id  Product       #x0001)
  (bcd Device          0) ;; device release number
  (i   Manufacturer    "Microchip Technology, Inc.")
  (i   ProductName     "USB Hack")
  (i   SerialNumber    "0.0")
  (l   NumConfigurations
       
       (((i  Configuration  "Default Configuration")
         (b  ConfigurationValue 0)   ;; ???
         (bm Attributes     #xA0)    ;; remote wakeup
         (b  MaxPower       #x32)    ;; 100 mA
	 (w  TotalLength    -1)      ;; conf + int + endp
         (l  NumInterfaces
             
             (((i Interface         "Default Interface")
               (b InterfaceNumber   1)     ;; ???
               (b InterfaceClass    3)     ;; HID
               (b InterfaceSubClass 1)     ;; Boot
               (b InterfaceProtocol 1)     ;; Keyboard
               (b AlternateSetting 0)      ;; ???
               (l NumEndpoints
                  
                  (((bm Attributes #xA0)
                    (b  EndpointAddress #x80)
                    (w  MaxPacketSize 8)
                    (b  Interval 0))))))))))))