coramvar.h revision 1.4 1 1.4 jmcneill /* $NetBSD: coramvar.h,v 1.4 2011/08/09 01:42:24 jmcneill Exp $ */
2 1.1 jakllsch
3 1.1 jakllsch /*
4 1.1 jakllsch * Copyright (c) 2008, 2011 Jonathan A. Kollasch
5 1.1 jakllsch * All rights reserved.
6 1.1 jakllsch *
7 1.1 jakllsch * Redistribution and use in source and binary forms, with or without
8 1.1 jakllsch * modification, are permitted provided that the following conditions
9 1.1 jakllsch * are met:
10 1.1 jakllsch * 1. Redistributions of source code must retain the above copyright
11 1.1 jakllsch * notice, this list of conditions and the following disclaimer.
12 1.1 jakllsch * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jakllsch * notice, this list of conditions and the following disclaimer in the
14 1.1 jakllsch * documentation and/or other materials provided with the distribution.
15 1.1 jakllsch *
16 1.1 jakllsch * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 1.1 jakllsch * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1 jakllsch * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1 jakllsch * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 1.1 jakllsch * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 1.1 jakllsch * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 1.1 jakllsch * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 1.1 jakllsch * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 1.1 jakllsch * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 1.1 jakllsch * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 1.1 jakllsch * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1 jakllsch */
28 1.1 jakllsch
29 1.1 jakllsch #ifndef _DEV_PCI_CORAMVAR_H
30 1.1 jakllsch #define _DEV_PCI_CORAMVAR_H
31 1.1 jakllsch
32 1.1 jakllsch #include <sys/bus.h>
33 1.1 jakllsch #include <sys/mutex.h>
34 1.1 jakllsch #include <dev/pci/pcivar.h>
35 1.1 jakllsch #include <dev/pci/pcireg.h>
36 1.1 jakllsch #include <dev/i2c/i2cvar.h>
37 1.1 jakllsch
38 1.1 jakllsch #define KERNADDR(p) ((void *)((p)->addr))
39 1.1 jakllsch #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
40 1.1 jakllsch
41 1.3 jmcneill struct coram_board {
42 1.3 jmcneill uint16_t vendor;
43 1.3 jmcneill uint16_t product;
44 1.3 jmcneill const char *name;
45 1.3 jmcneill };
46 1.3 jmcneill
47 1.1 jakllsch struct coram_sram_ch {
48 1.1 jakllsch uint32_t csc_cmds;
49 1.1 jakllsch uint32_t csc_iq;
50 1.1 jakllsch uint32_t csc_iqsz;
51 1.1 jakllsch uint32_t csc_cdt;
52 1.1 jakllsch uint32_t csc_cdtsz;
53 1.1 jakllsch uint32_t csc_fifo;
54 1.1 jakllsch uint32_t csc_fifosz;
55 1.1 jakllsch uint32_t csc_risc;
56 1.1 jakllsch uint32_t csc_riscsz;
57 1.1 jakllsch uint32_t csc_ptr1;
58 1.1 jakllsch uint32_t csc_ptr2;
59 1.1 jakllsch uint32_t csc_cnt1;
60 1.1 jakllsch uint32_t csc_cnt2;
61 1.1 jakllsch };
62 1.1 jakllsch
63 1.1 jakllsch struct coram_dma {
64 1.1 jakllsch bus_dmamap_t map;
65 1.1 jakllsch void * addr;
66 1.1 jakllsch bus_dma_segment_t segs[1];
67 1.1 jakllsch int nsegs;
68 1.1 jakllsch size_t size;
69 1.1 jakllsch struct coram_dma * next;
70 1.1 jakllsch };
71 1.1 jakllsch
72 1.1 jakllsch struct coram_softc {
73 1.1 jakllsch device_t sc_dev;
74 1.1 jakllsch device_t sc_dtvdev;
75 1.1 jakllsch
76 1.1 jakllsch bus_space_tag_t sc_memt;
77 1.1 jakllsch bus_space_handle_t sc_memh;
78 1.1 jakllsch bus_size_t sc_mems;
79 1.1 jakllsch bus_dma_tag_t sc_dmat;
80 1.1 jakllsch
81 1.2 jmcneill pci_chipset_tag_t sc_pc;
82 1.1 jakllsch void * sc_ih;
83 1.1 jakllsch
84 1.1 jakllsch struct coram_iic_softc {
85 1.1 jakllsch struct coram_softc * cic_sc;
86 1.1 jakllsch bus_space_handle_t cic_regh;
87 1.1 jakllsch struct i2c_controller cic_i2c;
88 1.1 jakllsch kmutex_t cic_busmutex;
89 1.2 jmcneill device_t cic_i2cdev;
90 1.1 jakllsch } sc_iic[3];
91 1.1 jakllsch
92 1.1 jakllsch struct coram_sram_ch sc_vidc_sch;
93 1.1 jakllsch
94 1.1 jakllsch struct coram_dma * sc_dma;
95 1.1 jakllsch struct coram_dma * sc_tsbuf;
96 1.1 jakllsch
97 1.1 jakllsch uint32_t * sc_riscbuf;
98 1.1 jakllsch uint32_t sc_riscbufsz;
99 1.1 jakllsch
100 1.1 jakllsch void *sc_tuner;
101 1.1 jakllsch void *sc_demod;
102 1.1 jakllsch
103 1.4 jmcneill void (*sc_dtvsubmitcb)(void *,
104 1.4 jmcneill const struct dtv_payload *);
105 1.4 jmcneill void *sc_dtvsubmitarg;
106 1.4 jmcneill
107 1.3 jmcneill const struct coram_board *sc_board;
108 1.1 jakllsch };
109 1.1 jakllsch
110 1.1 jakllsch #endif /* !_DEV_PCI_CORAMVAR_H */
111