1 \ *****************************************************************************
2 \ * Copyright (c) 2006, 2012, 2013 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 \ * [OEX]HCI functions
15 \ ****************************************************************************
19 VALUE usb_type \ USB type
21 \ Open Firmware Properties
23 " usb" 2dup device-name
26 VALUE usb_num \ controller number
27 usb_num $cathex strdup \ create alias name
29 get-node node>path set-alias
32 /hci-dev BUFFER: hcidev
33 usb_num hcidev usb-setup-hcidev
34 TRUE VALUE first-time-init?
37 false VALUE dev-hci-debug?
39 1 encode-int s" #address-cells" property
40 0 encode-int s" #size-cells" property
42 \ converts physical address to text unit string
43 : encode-unit ( port -- unit-str unit-len ) 1 hex-encode-unit ;
45 \ Converts text unit string to phyical address
46 : decode-unit ( addr len -- port ) 1 hex-decode-unit ;
48 : get-hci-dev ( -- hcidev )
54 dev-hci-debug? IF ." USB-HCI: Cleaning up " pwd cr THEN
59 : open ( -- true | false )
66 \ create a new entry to cleanup and suspend HCI
69 ['] hc-cleanup add-quiesce-xt
70 false to first-time-init?