ucb1200var.h revision 1.1 1 1.1 uch /* $NetBSD: ucb1200var.h,v 1.1 2000/01/08 21:07:04 uch Exp $ */
2 1.1 uch
3 1.1 uch /*
4 1.1 uch * Copyright (c) 2000, by UCHIYAMA Yasushi
5 1.1 uch * All rights reserved.
6 1.1 uch *
7 1.1 uch * Redistribution and use in source and binary forms, with or without
8 1.1 uch * modification, are permitted provided that the following conditions
9 1.1 uch * are met:
10 1.1 uch * 1. Redistributions of source code must retain the above copyright
11 1.1 uch * notice, this list of conditions and the following disclaimer.
12 1.1 uch * 2. The name of the developer may NOT be used to endorse or promote products
13 1.1 uch * derived from this software without specific prior written permission.
14 1.1 uch *
15 1.1 uch * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 1.1 uch * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.1 uch * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.1 uch * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 1.1 uch * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.1 uch * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 1.1 uch * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.1 uch * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.1 uch * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.1 uch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.1 uch * SUCH DAMAGE.
26 1.1 uch *
27 1.1 uch */
28 1.1 uch
29 1.1 uch enum ucbts_stat {
30 1.1 uch UCBTS_STAT_DISABLE,
31 1.1 uch UCBTS_STAT_RELEASE,
32 1.1 uch UCBTS_STAT_TOUCH,
33 1.1 uch UCBTS_STAT_DRAG,
34 1.1 uch };
35 1.1 uch
36 1.1 uch #define UCBTS_POSX 1
37 1.1 uch #define UCBTS_POSY 2
38 1.1 uch #define UCBTS_PRESS 3
39 1.1 uch
40 1.1 uch #define UCBTS_PRESS_THRESHOLD 100
41 1.1 uch #define UCBTS_TAP_THRESHOLD 5
42 1.1 uch
43 1.1 uch enum ucbadc_state {
44 1.1 uch /* 0 */ UCBADC_IDLE,
45 1.1 uch /* 1 */ UCBADC_ADC_INIT,
46 1.1 uch /* 2 */ UCBADC_ADC_FINI,
47 1.1 uch /* 3 */ UCBADC_MEASUMENT_INIT,
48 1.1 uch /* 4 */ UCBADC_MEASUMENT_FINI,
49 1.1 uch /* 5 */ UCBADC_ADC_ENABLE,
50 1.1 uch /* 6 */ UCBADC_ADC_START0,
51 1.1 uch /* 7 */ UCBADC_ADC_START1,
52 1.1 uch /* 8 */ UCBADC_ADC_DATAREAD,
53 1.1 uch /* 9 */ UCBADC_ADC_DATAREAD_WAIT,
54 1.1 uch /*10 */ UCBADC_ADC_DISABLE,
55 1.1 uch /*11 */ UCBADC_ADC_INTRMODE,
56 1.1 uch /*12 */ UCBADC_ADC_INPUT,
57 1.1 uch /*13 */ UCBADC_INTR_ACK0,
58 1.1 uch /*14 */ UCBADC_INTR_ACK1,
59 1.1 uch /*15 */ UCBADC_INTR_ACK2,
60 1.1 uch /*16 */ UCBADC_REGREAD,
61 1.1 uch /*17 */ UCBADC_REGWRITE
62 1.1 uch };
63 1.1 uch
64 1.1 uch struct ucb1200_softc {
65 1.1 uch struct device sc_dev;
66 1.1 uch struct device *sc_parent; /* parent (TX39 SIB module) */
67 1.1 uch tx_chipset_tag_t sc_tc;
68 1.1 uch
69 1.1 uch enum ucbts_stat sc_stat;
70 1.1 uch int sc_polling;
71 1.1 uch int sc_polling_finish;
72 1.1 uch void *sc_pollh;
73 1.1 uch
74 1.1 uch /* correction parameters */
75 1.1 uch int sc_prmax, sc_prmbx, sc_prmcx, sc_prmxs;
76 1.1 uch int sc_prmay, sc_prmby, sc_prmcy, sc_prmys;
77 1.1 uch /* limit */
78 1.1 uch int sc_maxx, sc_maxy;
79 1.1 uch
80 1.1 uch /* measurement value */
81 1.1 uch int sc_x, sc_y, sc_p;
82 1.1 uch
83 1.1 uch /* SIB frame 0 state machine */
84 1.1 uch void *sm_ih; /* TX39 SIB subframe 0 interrupt handler */
85 1.1 uch
86 1.1 uch int sm_addr; /* UCB1200 register address */
87 1.1 uch u_int32_t sm_reg; /* UCB1200 register data & TX39 SIB header */
88 1.1 uch int sm_tmpreg;
89 1.1 uch int sm_retry; /* retry counter */
90 1.1 uch
91 1.1 uch enum ucbadc_state sm_state;
92 1.1 uch int sm_measurement; /* X, Y, Pressure */
93 1.1 uch #define UCBADC_MEASUREMENT_X 0
94 1.1 uch #define UCBADC_MEASUREMENT_Y 1
95 1.1 uch #define UCBADC_MEASUREMENT_PRESSURE 2
96 1.1 uch int sm_returnstate;
97 1.1 uch
98 1.1 uch int sm_read_state, sm_write_state;
99 1.1 uch int sm_writing; /* writing state flag */
100 1.1 uch u_int32_t sm_write_val; /* temporary buffer */
101 1.1 uch
102 1.1 uch int sm_rw_retry; /* retry counter for r/w */
103 1.1 uch
104 1.1 uch /* wsmouse */
105 1.1 uch struct device *sc_wsmousedev;
106 1.1 uch };
107 1.1 uch
108