Commit | Line | Data |
---|---|---|
8cc72361 WYC |
1 | /** |
2 | * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. | |
3 | * | |
4 | * This source file is released under GPL v2 license (no other versions). | |
5 | * See the COPYING file included in the main directory of this source | |
6 | * distribution for the license terms and conditions. | |
7 | * | |
8 | * @File cthardware.h | |
9 | * | |
10 | * @Brief | |
11 | * This file contains the definition of hardware access methord. | |
12 | * | |
13 | * @Author Liu Chun | |
14 | * @Date May 13 2008 | |
15 | * | |
16 | */ | |
17 | ||
18 | #ifndef CTHARDWARE_H | |
19 | #define CTHARDWARE_H | |
20 | ||
21 | #include <linux/types.h> | |
22 | #include <linux/pci.h> | |
23 | ||
24 | enum CHIPTYP { | |
25 | ATC20K1, | |
26 | ATC20K2, | |
27 | ATCNONE | |
28 | }; | |
29 | ||
30 | /* Type of input source for ADC */ | |
31 | enum ADCSRC{ | |
32 | ADC_MICIN, | |
33 | ADC_LINEIN, | |
34 | ADC_VIDEO, | |
35 | ADC_AUX, | |
36 | ADC_NONE /* Switch to digital input */ | |
37 | }; | |
38 | ||
39 | struct card_conf { | |
40 | /* device virtual mem page table page physical addr | |
41 | * (supporting one page table page now) */ | |
42 | unsigned long vm_pgt_phys; | |
43 | unsigned int rsr; /* reference sample rate in Hzs*/ | |
44 | unsigned int msr; /* master sample rate in rsrs */ | |
45 | }; | |
46 | ||
47 | struct hw { | |
48 | int (*card_init)(struct hw *hw, struct card_conf *info); | |
49 | int (*card_stop)(struct hw *hw); | |
50 | int (*pll_init)(struct hw *hw, unsigned int rsr); | |
51 | enum CHIPTYP (*get_chip_type)(struct hw *hw); | |
52 | int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source); | |
53 | int (*select_adc_source)(struct hw *hw, enum ADCSRC source); | |
54 | int (*have_digit_io_switch)(struct hw *hw); | |
55 | ||
56 | /* SRC operations */ | |
57 | int (*src_rsc_get_ctrl_blk)(void **rblk); | |
58 | int (*src_rsc_put_ctrl_blk)(void *blk); | |
59 | int (*src_set_state)(void *blk, unsigned int state); | |
60 | int (*src_set_bm)(void *blk, unsigned int bm); | |
61 | int (*src_set_rsr)(void *blk, unsigned int rsr); | |
62 | int (*src_set_sf)(void *blk, unsigned int sf); | |
63 | int (*src_set_wr)(void *blk, unsigned int wr); | |
64 | int (*src_set_pm)(void *blk, unsigned int pm); | |
65 | int (*src_set_rom)(void *blk, unsigned int rom); | |
66 | int (*src_set_vo)(void *blk, unsigned int vo); | |
67 | int (*src_set_st)(void *blk, unsigned int st); | |
68 | int (*src_set_ie)(void *blk, unsigned int ie); | |
69 | int (*src_set_ilsz)(void *blk, unsigned int ilsz); | |
70 | int (*src_set_bp)(void *blk, unsigned int bp); | |
71 | int (*src_set_cisz)(void *blk, unsigned int cisz); | |
72 | int (*src_set_ca)(void *blk, unsigned int ca); | |
73 | int (*src_set_sa)(void *blk, unsigned int sa); | |
74 | int (*src_set_la)(void *blk, unsigned int la); | |
75 | int (*src_set_pitch)(void *blk, unsigned int pitch); | |
76 | int (*src_set_clear_zbufs)(void *blk, unsigned int clear); | |
77 | int (*src_set_dirty)(void *blk, unsigned int flags); | |
78 | int (*src_set_dirty_all)(void *blk); | |
79 | int (*src_commit_write)(struct hw *hw, unsigned int idx, void *blk); | |
80 | int (*src_get_ca)(struct hw *hw, unsigned int idx, void *blk); | |
81 | unsigned int (*src_get_dirty)(void *blk); | |
82 | unsigned int (*src_dirty_conj_mask)(void); | |
83 | int (*src_mgr_get_ctrl_blk)(void **rblk); | |
84 | int (*src_mgr_put_ctrl_blk)(void *blk); | |
85 | /* syncly enable src @idx */ | |
86 | int (*src_mgr_enbs_src)(void *blk, unsigned int idx); | |
87 | /* enable src @idx */ | |
88 | int (*src_mgr_enb_src)(void *blk, unsigned int idx); | |
89 | /* disable src @idx */ | |
90 | int (*src_mgr_dsb_src)(void *blk, unsigned int idx); | |
91 | int (*src_mgr_commit_write)(struct hw *hw, void *blk); | |
92 | ||
93 | /* SRC Input Mapper operations */ | |
94 | int (*srcimp_mgr_get_ctrl_blk)(void **rblk); | |
95 | int (*srcimp_mgr_put_ctrl_blk)(void *blk); | |
96 | int (*srcimp_mgr_set_imaparc)(void *blk, unsigned int slot); | |
97 | int (*srcimp_mgr_set_imapuser)(void *blk, unsigned int user); | |
98 | int (*srcimp_mgr_set_imapnxt)(void *blk, unsigned int next); | |
99 | int (*srcimp_mgr_set_imapaddr)(void *blk, unsigned int addr); | |
100 | int (*srcimp_mgr_commit_write)(struct hw *hw, void *blk); | |
101 | ||
102 | /* AMIXER operations */ | |
103 | int (*amixer_rsc_get_ctrl_blk)(void **rblk); | |
104 | int (*amixer_rsc_put_ctrl_blk)(void *blk); | |
105 | int (*amixer_mgr_get_ctrl_blk)(void **rblk); | |
106 | int (*amixer_mgr_put_ctrl_blk)(void *blk); | |
107 | int (*amixer_set_mode)(void *blk, unsigned int mode); | |
108 | int (*amixer_set_iv)(void *blk, unsigned int iv); | |
109 | int (*amixer_set_x)(void *blk, unsigned int x); | |
110 | int (*amixer_set_y)(void *blk, unsigned int y); | |
111 | int (*amixer_set_sadr)(void *blk, unsigned int sadr); | |
112 | int (*amixer_set_se)(void *blk, unsigned int se); | |
113 | int (*amixer_set_dirty)(void *blk, unsigned int flags); | |
114 | int (*amixer_set_dirty_all)(void *blk); | |
115 | int (*amixer_commit_write)(struct hw *hw, unsigned int idx, void *blk); | |
116 | int (*amixer_get_y)(void *blk); | |
117 | unsigned int (*amixer_get_dirty)(void *blk); | |
118 | ||
119 | /* DAIO operations */ | |
120 | int (*dai_get_ctrl_blk)(void **rblk); | |
121 | int (*dai_put_ctrl_blk)(void *blk); | |
122 | int (*dai_srt_set_srco)(void *blk, unsigned int src); | |
123 | int (*dai_srt_set_srcm)(void *blk, unsigned int src); | |
124 | int (*dai_srt_set_rsr)(void *blk, unsigned int rsr); | |
125 | int (*dai_srt_set_drat)(void *blk, unsigned int drat); | |
126 | int (*dai_srt_set_ec)(void *blk, unsigned int ec); | |
127 | int (*dai_srt_set_et)(void *blk, unsigned int et); | |
128 | int (*dai_commit_write)(struct hw *hw, unsigned int idx, void *blk); | |
129 | int (*dao_get_ctrl_blk)(void **rblk); | |
130 | int (*dao_put_ctrl_blk)(void *blk); | |
131 | int (*dao_set_spos)(void *blk, unsigned int spos); | |
132 | int (*dao_commit_write)(struct hw *hw, unsigned int idx, void *blk); | |
133 | int (*dao_get_spos)(void *blk, unsigned int *spos); | |
134 | ||
135 | int (*daio_mgr_get_ctrl_blk)(struct hw *hw, void **rblk); | |
136 | int (*daio_mgr_put_ctrl_blk)(void *blk); | |
137 | int (*daio_mgr_enb_dai)(void *blk, unsigned int idx); | |
138 | int (*daio_mgr_dsb_dai)(void *blk, unsigned int idx); | |
139 | int (*daio_mgr_enb_dao)(void *blk, unsigned int idx); | |
140 | int (*daio_mgr_dsb_dao)(void *blk, unsigned int idx); | |
141 | int (*daio_mgr_dao_init)(void *blk, unsigned int idx, | |
142 | unsigned int conf); | |
143 | int (*daio_mgr_set_imaparc)(void *blk, unsigned int slot); | |
144 | int (*daio_mgr_set_imapnxt)(void *blk, unsigned int next); | |
145 | int (*daio_mgr_set_imapaddr)(void *blk, unsigned int addr); | |
146 | int (*daio_mgr_commit_write)(struct hw *hw, void *blk); | |
147 | ||
b7bbf876 TI |
148 | int (*set_timer_irq)(struct hw *hw, int enable); |
149 | int (*set_timer_tick)(struct hw *hw, unsigned int tick); | |
54de6bc8 | 150 | unsigned int (*get_wc)(struct hw *hw); |
b7bbf876 TI |
151 | |
152 | void (*irq_callback)(void *data, unsigned int bit); | |
153 | void *irq_callback_data; | |
154 | ||
8cc72361 WYC |
155 | struct pci_dev *pci; /* the pci kernel structure of this card */ |
156 | int irq; | |
157 | unsigned long io_base; | |
158 | unsigned long mem_base; | |
159 | }; | |
160 | ||
161 | int create_hw_obj(struct pci_dev *pci, struct hw **rhw); | |
162 | int destroy_hw_obj(struct hw *hw); | |
163 | ||
164 | unsigned int get_field(unsigned int data, unsigned int field); | |
165 | void set_field(unsigned int *data, unsigned int field, unsigned int value); | |
166 | ||
b7bbf876 TI |
167 | /* IRQ bits */ |
168 | #define PLL_INT (1 << 10) /* PLL input-clock out-of-range */ | |
169 | #define FI_INT (1 << 9) /* forced interrupt */ | |
170 | #define IT_INT (1 << 8) /* timer interrupt */ | |
171 | #define PCI_INT (1 << 7) /* PCI bus error pending */ | |
172 | #define URT_INT (1 << 6) /* UART Tx/Rx */ | |
173 | #define GPI_INT (1 << 5) /* GPI pin */ | |
174 | #define MIX_INT (1 << 4) /* mixer parameter segment FIFO channels */ | |
175 | #define DAI_INT (1 << 3) /* DAI (SR-tracker or SPDIF-receiver) */ | |
176 | #define TP_INT (1 << 2) /* transport priority queue */ | |
177 | #define DSP_INT (1 << 1) /* DSP */ | |
178 | #define SRC_INT (1 << 0) /* SRC channels */ | |
179 | ||
8cc72361 | 180 | #endif /* CTHARDWARE_H */ |