|
|
1.1 root 1: \ *****************************************************************************
2: \ * Copyright (c) 2004, 2008 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
8: \ *
9: \ * Contributors:
10: \ * IBM Corporation - initial implementation
11: \ ****************************************************************************/
12:
13:
14: 00 value kbd-addr
15: to kbd-addr
16: 8 alloc-mem to kbd-report
17: 4 chars alloc-mem value kbd-data
18:
19: : rw-endpoint
20: s" rw-endpoint" $call-parent ;
21:
22: : controlxfer
23: s" controlxfer" $call-parent ;
24:
25: : control-std-get-device-descriptor
26: s" control-std-get-device-descriptor" $call-parent ;
27:
28: : control-std-get-configuration-descriptor
29: s" control-std-get-configuration-descriptor" $call-parent ;
30:
31: : control-std-set-configuration
32: s" control-std-set-configuration" $call-parent ;
33:
34: : control-cls-set-protocol ( reportvalue FuncAddr -- TRUE|FALSE )
35: to temp1
36: to temp2
37: 210b000000000100 setup-packet !
38: temp2 kbd-data l!-le
39: 1 kbd-data 1 setup-packet DEFAULT-CONTROL-MPS temp1 controlxfer
40: ;
41:
42: : control-cls-set-idle ( reportvalue FuncAddr -- TRUE|FALSE )
43: to temp1
44: to temp2
45: 210a000000000000 setup-packet !
46: temp2 kbd-data l!-le
47: 0 kbd-data 0 setup-packet DEFAULT-CONTROL-MPS temp1 controlxfer
48: ;
49:
50: : control-std-get-report-descriptor ( data-buffer data-len MPS FuncAddr -- TRUE|FALSE )
51: to temp1
52: to temp2
53: to temp3
54: 8106002200000000 setup-packet !
55: temp3 setup-packet 6 + w!-le
56: 0 swap temp3 setup-packet temp2 temp1 controlxfer
57: ;
58:
59: : kbd-init
60: s" Starting to initialize keyboard" usb-debug-print
61: s" MPS-INTIN" get-my-property
62: if
63: s" not possible" usb-debug-print
64: else
65: decode-int nip nip to mps-int-in
66: then
67: s" INT-IN-EP-ADDR" get-my-property
68: if
69: s" not possible" usb-debug-print
70: else
71: decode-int nip nip to int-in-ep
72: then
73:
74: 7f alloc-mem to cfg-buffer
75: s" Allocated buffers!!" usb-debug-print
76:
77: cfg-buffer 12 8 kbd-addr \ get device descriptor
78: control-std-get-device-descriptor
79: drop
80: \ s" dev_desc=" type cfg-buffer 12 dump cr
81:
82: cfg-buffer 9 8 kbd-addr \ get config descriptor
83: control-std-get-configuration-descriptor
84: drop
85: \ s" cfg_desc=" type cfg-buffer 9 dump cr
86:
87: cfg-buffer 5 + c@ kbd-addr \ set configuration
88: control-std-set-configuration
89: drop
90: s" KBDS: Set config returned" usb-debug-print
91:
92: 0 kbd-addr control-cls-set-idle drop \ set idle
93: s" KBDS: Set idle returned" usb-debug-print
94:
95: cfg-buffer 40 8 kbd-addr \ get report descriptor
96: control-std-get-report-descriptor
97: drop
98: \ s" report_desc=" type cfg-buffer 40 dump cr
99:
100: s" Finished initializing keyboard" usb-debug-print
101: ;
102:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.