[OpenBIOS] usb driver to support usb keyboard
BALATON Zoltan
balaton at eik.bme.hu
Wed May 7 22:56:43 CEST 2014
On Wed, 7 May 2014, BALATON Zoltan wrote:
> I thought about starting with the ohci driver (it's in 9 files plus about the
> same ammount of others it uses) and try to get it compiled/loaded to see what
> functions it needs and then work on those.
I've tried this but could not successfully compile an fcode driver
probably due to openfirmware specific extensions that I don't know how to
implement as they seem to be dependent on openfirmware's Forth
implementation (just copying the definitions were not enough for these
because those words they use are also undefined but I may be wrong as I
don't know Forth very well). Here are the errors I got at the end:
Error: File ../drivers/usb2/hcd/device.fth, Line 286. (Output Position = 18459). Word push-package is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 287. (Output Position = 18461). Word new-instance is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 288. (Output Position = 18461). Word set-default-unit is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 290. (Output Position = 18462). Word destroy-instance is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 291. (Output Position = 18462). Word pop-package is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 536. (Output Position = 19787). Word push-package is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 537. (Output Position = 19789). Word new-instance is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 538. (Output Position = 19789). Word set-default-unit is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 540. (Output Position = 19790). Word destroy-instance is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 541. (Output Position = 19790). Word pop-package is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 567. (Output Position = 19907). Word push-package is not in dictionary.
Error: File ../drivers/usb2/hcd/device.fth, Line 573. (Output Position = 19931). Word pop-package is not in dictionary.
Error: File ../drivers/usb2/hcd/ohci/probe.fth, Line 80. (Output Position = 20234). Word push-package is not in dictionary.
Error: File ../drivers/usb2/hcd/ohci/probe.fth, Line 98. (Output Position = 20324). Word pop-package is not in dictionary.
I anyone wants to repeat what I did here it is:
- Copied dev/usb2 from openfirmware to drivers usb2
- added a \ before purpose: at the beginning of each file to comment this line
- replaced ${BP}/dev/ with ../drivers/ in all fload commands
(looks like toke has fload while the interpreter has include)
- Added a new file as drivers/usbohci.fs that replaces
drivers/usb2/hcd/ohci/ohci.bth incorporating
drivers/usb2/hcd/ohci/loadpkg.fth:
---begin---
fcode-version2
fload ../drivers/usb2/fwext.fs
\ Generic HCD stuff
fload ../drivers/usb2/align.fth \ DMA memory allocation
fload ../drivers/usb2/pkt-data.fth \ USB packet definitions
fload ../drivers/usb2/pkt-func.fth \ USB descriptor manipulations
fload ../drivers/usb2/hcd/hcd.fth \ Common HCD methods
fload ../drivers/usb2/hcd/error.fth \ Common HCD error manipulation
fload ../drivers/usb2/hcd/dev-info.fth \ Common internal device
info
\ OHCI HCD stuff
fload ../drivers/usb2/hcd/ohci/edtd.fth \ OHCI HCCA, ED & TD manipulations
fload ../drivers/usb2/hcd/ohci/ohci.fth \ OHCI methods
fload ../drivers/usb2/hcd/ohci/control.fth \ OHCI control pipe operations
fload ../drivers/usb2/hcd/ohci/bulk.fth \ OHCI bulk pipes operations
fload ../drivers/usb2/hcd/ohci/intr.fth \ OHCI interrupt pipes operations
fload ../drivers/usb2/hcd/control.fth \ Common control pipe API
\ OHCI usb bus probing stuff
fload ../drivers/usb2/vendor.fth \ Vendor/product table manipulation
fload ../drivers/usb2/device/vendor.fth \ Supported vendor/product tables
fload ../drivers/usb2/hcd/fcode.fth \ Load fcode driver for child
fload ../drivers/usb2/hcd/device.fth \ Make child node & its properties
fload ../drivers/usb2/hcd/ohci/probe.fth \ Probe root hub
fload ../drivers/usb2/hcd/probehub.fth \ Probe usb hub
end0
---end---
- Added these to build.xml:
Index: arch/ppc/build.xml
===================================================================
--- arch/ppc/build.xml (revision 1286)
+++ arch/ppc/build.xml (working copy)
@@ -20,6 +20,7 @@
<object source="qemu/tree.fs"/>
<object source="qemu/qemu.fs"/>
<object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/>
+ <object source="QEMU,OHCI.bin" target="fcode" condition="DRIVER_USB"/>
</dictionary>
<dictionary name="openbios-mol" init="openbios" target="forth" condition="MOL">
Index: drivers/build.xml
===================================================================
--- drivers/build.xml (revision 1286)
+++ drivers/build.xml (working copy)
@@ -33,5 +38,6 @@
<fcode source="tcx.fs" name="QEMU,tcx.bin" condition="DRIVER_SBUS" />
<fcode source="cgthree.fs" name="QEMU,cgthree.bin" condition="DRIVER_SBUS" />
<fcode source="vga.fs" name="QEMU,VGA.bin" condition="DRIVER_VGA" />
+ <fcode source="usbohci.fs" name="QEMU,OHCI.bin" condition="DRIVER_USB" />
</build>
- Then tried to compile and copied some more definitions into drivers/usb2/fwext.fs:
---begin---
\ --- Firmworks extensions ----------------------------------------------
: encode-null 0 0 encode-bytes ;
: +i encode-int encode+ ;
: string-property 2swap encode-string 2swap property ;
: integer-property rot encode-int 2swap property ;
: encode-reg >r encode-phys r> encode-int encode+ ;
: package( r> my-self >r >r is my-self ;
: )package r> r> is my-self >r ;
: push-hex r> base @ >r hex >r ;
: pop-base r> r> base ! >r ;
\ new-package is begin-package without the initial select
\ : begin-package select-dev new-package ;
: new-package new-device set-args ;
: end-package finish-device ;
---end---
(Only the last few are actually needed but these were in one group so I
copied all.)
Apart from the above errors I get a bunch of warnings that I don't know
how serious are but as it does not compile that's not an issue yet. I'm
afraid this is all I could do with this and as I don't want to get into
the details of the different forth implementations I just give up at this
point and try to find out why the ADB driver in Linux is not finding the
keyboard or if I can't figure that out I could still finish the C driver
that might work for the keyboard. If anyone wants to pick up this Forth
driver and experiment with it feel free to continue.
Regards,
BALATON Zoltan
More information about the OpenBIOS
mailing list