Author: wmb Date: Tue Nov 29 01:26:41 2011 New Revision: 2709 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2709
Log: Added USB mouse class driver and included it in most active builds.
Added: dev/usb2/device/mouse/ dev/usb2/device/mouse/mouse.fth dev/usb2/device/mouse/usbmouse.bth Modified: cpu/arm/olpc/1.75/olpc.bth cpu/x86/pc/alex/ofw.bth cpu/x86/pc/biosload/ofw.bth cpu/x86/pc/newton/ofw.bth cpu/x86/pc/olpc/loaddropins.fth cpu/x86/pc/olpc/olpc.bth cpu/x86/pc/olpc/via/olpc.bth
Modified: cpu/arm/olpc/1.75/olpc.bth ============================================================================== --- cpu/arm/olpc/1.75/olpc.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/arm/olpc/1.75/olpc.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -11,6 +11,7 @@ in: ${BP}/dev/usb2/device/generic/build/generic.fc in: ${BP}/dev/usb2/device/net/build/usbnet.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: testicons.bin @@ -80,7 +81,8 @@ " ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-deflated-dropin " ${BP}/dev/usb2/device/generic/build/generic.fc" " usbdevice" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin
Modified: cpu/x86/pc/alex/ofw.bth ============================================================================== --- cpu/x86/pc/alex/ofw.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/alex/ofw.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -13,6 +13,7 @@ in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc in: ${BP}/dev/usb2/device/webcam/build/webcam.fc in: ${BP}/dev/pci/build/pcibridg.fc in: ${BP}/dev/ide/build/leghier.fc @@ -47,7 +48,8 @@ " ${BP}/dev/usb2/hcd/uhci/build/uhci.fc" " class0c0300" $add-deflated-dropin
" ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin
Modified: cpu/x86/pc/biosload/ofw.bth ============================================================================== --- cpu/x86/pc/biosload/ofw.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/biosload/ofw.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -14,6 +14,7 @@ in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc \ in: ${BP}/ofw/fs/nfs/build/nfs.di \ in: ${BP}/ofw/fs/cdfs/build/cdfs.di \ in: ${BP}/ofw/fs/fatfs/build/fatfs.di @@ -118,7 +119,8 @@ " ${BP}/dev/usb2/hcd/ehci/build/ehci.fc" " class0c0320" $add-deflated-dropin
" ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin
Modified: cpu/x86/pc/newton/ofw.bth ============================================================================== --- cpu/x86/pc/newton/ofw.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/newton/ofw.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -13,6 +13,7 @@ in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc in: ${BP}/dev/usb2/device/webcam/build/webcam.fc in: ${BP}/dev/pci/build/pcibridg.fc in: ${BP}/dev/ide/build/leghier.fc @@ -48,7 +49,8 @@ " ${BP}/dev/usb2/hcd/uhci/build/uhci.fc" " class0c0300" $add-deflated-dropin
" ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin
Modified: cpu/x86/pc/olpc/loaddropins.fth ============================================================================== --- cpu/x86/pc/olpc/loaddropins.fth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/olpc/loaddropins.fth Tue Nov 29 01:26:41 2011 (r2709) @@ -9,7 +9,8 @@ " ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-dropin " ${BP}/dev/usb2/device/generic/build/generic.fc" " usbdevice" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin " ${BP}/dev/usb2/device/wlan/build/usb8388.fc" " usb1286,2001" $add-deflated-dropin
Modified: cpu/x86/pc/olpc/olpc.bth ============================================================================== --- cpu/x86/pc/olpc/olpc.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/olpc/olpc.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -19,6 +19,7 @@ in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc in: ${BP}/dev/usb2/device/wlan/build/usb8388.fc in: ${BP}/dev/olpc/cafenand/build/cafenand.fc in: ${BP}/dev/olpc/cafecamera/build/cafecamera.fc
Modified: cpu/x86/pc/olpc/via/olpc.bth ============================================================================== --- cpu/x86/pc/olpc/via/olpc.bth Tue Nov 29 01:26:31 2011 (r2708) +++ cpu/x86/pc/olpc/via/olpc.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -20,6 +20,7 @@ in: ${BP}/dev/usb2/device/serial/build/usbserial.fc in: ${BP}/dev/usb2/device/storage/build/usbstorage.fc in: ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc +in: ${BP}/dev/usb2/device/mouse/build/usbmouse.fc in: ${BP}/clients/memtest86/memtest in: ${BP}/clients/emacs/x86/emacs in: ${BP}/cpu/x86/pc/olpc/via/build/verify.img @@ -88,7 +89,8 @@ " ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-dropin " ${BP}/dev/usb2/device/generic/build/generic.fc" " usbdevice" $add-deflated-dropin " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin - " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-dropin + " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1,1" $add-deflated-dropin + " ${BP}/dev/usb2/device/mouse/build/usbmouse.fc" " usb,class3,1,2" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin \ " mrv8686.bin" " mrv8686.bin" $add-deflated-dropin
Added: dev/usb2/device/mouse/mouse.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ dev/usb2/device/mouse/mouse.fth Tue Nov 29 01:26:41 2011 (r2709) @@ -0,0 +1,113 @@ +purpose: USB HID mouse driver using the mouse boot protocol +\ See license at end of file + +hex +headers + +\ >dr-request constants specific to HID +h# 0b constant SET_PROTOCOL + +\ Report buffer +8 constant /report-buf +0 value report-buf + +: init-buf ( -- ) + report-buf 0= if + /report-buf dma-alloc + to report-buf + then +; +: free-buf ( -- ) + report-buf if + report-buf /report-buf dma-free + 0 to report-buf + then +; + +: set-boot-protocol ( -- error? ) + 0 0 my-address ( interface ) 0 DR_HIDD DR_OUT or SET_PROTOCOL + control-set +; + +\ Retrieve report data. + +: begin-scan ( -- ) + report-buf /report-buf intr-in-pipe intr-in-interval begin-intr-in +; +: end-scan ( -- ) end-intr-in ; + +: get-data? ( adr len -- actual ) + intr-in? if nip nip restart-intr-in exit then \ USB error; restart + ?dup if ( adr len actual ) + min tuck report-buf -rot move ( actual ) + restart-intr-in ( actual ) + else + 2drop 0 ( actual ) + then +; +: b>n ( b -- n ) dup h# 80 and if h# ff invert or then ; +8 buffer: pkt-buf +: stream-poll? ( -- false | x y buttons true ) + pkt-buf 8 get-data? 0= if false exit then + pkt-buf c@ h# 42 = if false exit then + pkt-buf 1+ c@ b>n ( x ) + pkt-buf 2+ c@ b>n negate ( x y ) + pkt-buf c@ 7 and ( x y buttons ) + true +; + +variable refcount 0 refcount ! +: +refcount ( n -- ) refcount +! ; + +\ report-buf must have been allocated +: setup-hardware? ( -- error? ) + set-device? if true exit then + device set-target + reset? if + configuration set-config if + ." Failed to set USB mouse configuration" cr + true exit + then + then + set-boot-protocol if ." Failed to set USB mouse boot protocol" cr then + false +; + +: open ( -- flag ) + refcount @ if 1 +refcount true exit then + init-buf + setup-hardware? if free-buf false exit then + begin-scan + 1 +refcount + true +; +: close ( -- ) + -1 +refcount refcount @ if exit then + free-buf +; + +init + +\ LICENSE_BEGIN +\ Copyright (c) 2011 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Added: dev/usb2/device/mouse/usbmouse.bth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ dev/usb2/device/mouse/usbmouse.bth Tue Nov 29 01:26:41 2011 (r2709) @@ -0,0 +1,17 @@ +purpose: Load file for USB boot mouse driver + +command: &tokenize &this +build-now + +silent on + +begin-tokenizing usbmouse.fc + +FCode-version2 + +fload ${BP}/dev/usb2/device/common.fth \ USB device driver common routines +fload ${BP}/dev/usb2/device/mouse/mouse.fth \ HID requests + +end0 + +end-tokenizing
openfirmware@openfirmware.info