auvitekvar.h revision 1.2.6.2 1 1.2.6.2 rmind /* $NetBSD: auvitekvar.h,v 1.2.6.2 2011/03/05 20:54:10 rmind Exp $ */
2 1.2.6.2 rmind
3 1.2.6.2 rmind /*-
4 1.2.6.2 rmind * Copyright (c) 2010 Jared D. McNeill <jmcneill (at) invisible.ca>
5 1.2.6.2 rmind * All rights reserved.
6 1.2.6.2 rmind *
7 1.2.6.2 rmind * Redistribution and use in source and binary forms, with or without
8 1.2.6.2 rmind * modification, are permitted provided that the following conditions
9 1.2.6.2 rmind * are met:
10 1.2.6.2 rmind * 1. Redistributions of source code must retain the above copyright
11 1.2.6.2 rmind * notice, this list of conditions and the following disclaimer.
12 1.2.6.2 rmind * 2. Redistributions in binary form must reproduce the above copyright
13 1.2.6.2 rmind * notice, this list of conditions and the following disclaimer in the
14 1.2.6.2 rmind * documentation and/or other materials provided with the distribution.
15 1.2.6.2 rmind *
16 1.2.6.2 rmind * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.2.6.2 rmind * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.2.6.2 rmind * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.2.6.2 rmind * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.2.6.2 rmind * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.2.6.2 rmind * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.2.6.2 rmind * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.2.6.2 rmind * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.2.6.2 rmind * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.2.6.2 rmind * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.2.6.2 rmind * POSSIBILITY OF SUCH DAMAGE.
27 1.2.6.2 rmind */
28 1.2.6.2 rmind
29 1.2.6.2 rmind #ifndef _AUVITEKVAR_H
30 1.2.6.2 rmind #define _AUVITEKVAR_H
31 1.2.6.2 rmind
32 1.2.6.2 rmind #include <sys/mutex.h>
33 1.2.6.2 rmind
34 1.2.6.2 rmind #include <dev/usb/usb.h>
35 1.2.6.2 rmind #include <dev/usb/usbdi.h>
36 1.2.6.2 rmind #include <dev/usb/usbdi_util.h>
37 1.2.6.2 rmind #include <dev/i2c/i2cvar.h>
38 1.2.6.2 rmind
39 1.2.6.2 rmind #include <dev/i2c/au8522var.h>
40 1.2.6.2 rmind #include <dev/i2c/xc5kvar.h>
41 1.2.6.2 rmind #include <dev/i2c/xc5kreg.h>
42 1.2.6.2 rmind
43 1.2.6.2 rmind struct auvitek_softc;
44 1.2.6.2 rmind
45 1.2.6.2 rmind enum auvitek_board {
46 1.2.6.2 rmind AUVITEK_BOARD_HVR_850,
47 1.2.6.2 rmind AUVITEK_BOARD_HVR_950Q,
48 1.2.6.2 rmind };
49 1.2.6.2 rmind
50 1.2.6.2 rmind #define AUVITEK_NXFERS 8
51 1.2.6.2 rmind #define AUVITEK_XFER_ALTNO 5
52 1.2.6.2 rmind
53 1.2.6.2 rmind struct auvitek_isoc {
54 1.2.6.2 rmind struct auvitek_xfer *i_ax;
55 1.2.6.2 rmind usbd_xfer_handle i_xfer;
56 1.2.6.2 rmind uint8_t *i_buf;
57 1.2.6.2 rmind uint16_t *i_frlengths;
58 1.2.6.2 rmind };
59 1.2.6.2 rmind
60 1.2.6.2 rmind struct auvitek_videobuf {
61 1.2.6.2 rmind uint8_t av_buf[720*480*2];
62 1.2.6.2 rmind uint32_t av_el, av_eb;
63 1.2.6.2 rmind uint32_t av_ol, av_ob;
64 1.2.6.2 rmind uint32_t av_stride;
65 1.2.6.2 rmind };
66 1.2.6.2 rmind
67 1.2.6.2 rmind struct auvitek_xfer {
68 1.2.6.2 rmind struct auvitek_softc *ax_sc;
69 1.2.6.2 rmind int ax_endpt;
70 1.2.6.2 rmind uint16_t ax_maxpktlen;
71 1.2.6.2 rmind usbd_pipe_handle ax_pipe;
72 1.2.6.2 rmind struct auvitek_isoc ax_i[AUVITEK_NXFERS];
73 1.2.6.2 rmind uint32_t ax_nframes;
74 1.2.6.2 rmind uint32_t ax_uframe_len;
75 1.2.6.2 rmind uint8_t ax_frinfo;
76 1.2.6.2 rmind int ax_frno;
77 1.2.6.2 rmind struct auvitek_videobuf ax_av;
78 1.2.6.2 rmind };
79 1.2.6.2 rmind
80 1.2.6.2 rmind struct auvitek_softc {
81 1.2.6.2 rmind device_t sc_dev;
82 1.2.6.2 rmind device_t sc_videodev, sc_audiodev;
83 1.2.6.2 rmind struct i2c_controller sc_i2c;
84 1.2.6.2 rmind kmutex_t sc_i2c_lock;
85 1.2.6.2 rmind
86 1.2.6.2 rmind usbd_device_handle sc_udev;
87 1.2.6.2 rmind int sc_uport;
88 1.2.6.2 rmind usbd_interface_handle sc_iface;
89 1.2.6.2 rmind
90 1.2.6.2 rmind char sc_running;
91 1.2.6.2 rmind char sc_dying;
92 1.2.6.2 rmind
93 1.2.6.2 rmind enum auvitek_board sc_board;
94 1.2.6.2 rmind const char *sc_descr;
95 1.2.6.2 rmind uint8_t sc_i2c_clkdiv;
96 1.2.6.2 rmind
97 1.2.6.2 rmind struct au8522 *sc_au8522;
98 1.2.6.2 rmind struct xc5k *sc_xc5k;
99 1.2.6.2 rmind kmutex_t sc_subdev_lock;
100 1.2.6.2 rmind
101 1.2.6.2 rmind unsigned int sc_ainput, sc_vinput;
102 1.2.6.2 rmind uint32_t sc_curfreq;
103 1.2.6.2 rmind
104 1.2.6.2 rmind struct auvitek_xfer sc_ax;
105 1.2.6.2 rmind
106 1.2.6.2 rmind char sc_businfo[32];
107 1.2.6.2 rmind };
108 1.2.6.2 rmind
109 1.2.6.2 rmind /* auvitek.c */
110 1.2.6.2 rmind uint8_t auvitek_read_1(struct auvitek_softc *, uint16_t);
111 1.2.6.2 rmind void auvitek_write_1(struct auvitek_softc *, uint16_t, uint8_t);
112 1.2.6.2 rmind
113 1.2.6.2 rmind /* auvitek_audio.c */
114 1.2.6.2 rmind int auvitek_audio_attach(struct auvitek_softc *);
115 1.2.6.2 rmind int auvitek_audio_detach(struct auvitek_softc *, int);
116 1.2.6.2 rmind void auvitek_audio_childdet(struct auvitek_softc *, device_t);
117 1.2.6.2 rmind
118 1.2.6.2 rmind /* auvitek_board.c */
119 1.2.6.2 rmind void auvitek_board_init(struct auvitek_softc *);
120 1.2.6.2 rmind int auvitek_board_tuner_reset(struct auvitek_softc *);
121 1.2.6.2 rmind
122 1.2.6.2 rmind /* auvitek_i2c.c */
123 1.2.6.2 rmind int auvitek_i2c_attach(struct auvitek_softc *);
124 1.2.6.2 rmind int auvitek_i2c_detach(struct auvitek_softc *, int);
125 1.2.6.2 rmind
126 1.2.6.2 rmind /* auvitek_video.c */
127 1.2.6.2 rmind int auvitek_video_attach(struct auvitek_softc *);
128 1.2.6.2 rmind int auvitek_video_detach(struct auvitek_softc *, int);
129 1.2.6.2 rmind void auvitek_video_childdet(struct auvitek_softc *, device_t);
130 1.2.6.2 rmind
131 1.2.6.2 rmind #endif /* !_AUVITEKVAR_H */
132