xref: /haiku/src/add-ons/kernel/drivers/audio/ice1712/io.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  * ice1712 BeOS/Haiku Driver for VIA - VT1712 Multi Channel Audio Controller
3  *
4  * Copyright (c) 2002, Jerome Duval		(jerome.duval@free.fr)
5  * Copyright (c) 2003, Marcus Overhagen	(marcus@overhagen.de)
6  * Copyright (c) 2007, Jerome Leveque	(leveque.jerome@neuf.fr)
7  *
8  * All rights reserved
9  * Distributed under the terms of the MIT license.
10  */
11 
12 #ifndef _IO_H_
13 #define _IO_H_
14 
15 #include "ice1712.h"
16 
17 #include <SupportDefs.h>
18 
19 //------------------------------------------------------
20 //------------------------------------------------------
21 //Address are [PCI_10] + xx
22 uint8	read_ccs_uint8(ice1712 *ice,	int8 regno);
23 uint16	read_ccs_uint16(ice1712 *ice,	int8 regno);
24 uint32	read_ccs_uint32(ice1712 *ice,	int8 regno);
25 
26 void	write_ccs_uint8(ice1712 *ice,	int8 regno,	uint8 value);
27 void	write_ccs_uint16(ice1712 *ice,	int8 regno,	uint16 value);
28 void	write_ccs_uint32(ice1712 *ice,	int8 regno,	uint32 value);
29 //------------------------------------------------------
30 //------------------------------------------------------
31 uint8	read_cci_uint8(ice1712 *ice,	int8 index);
32 void	write_cci_uint8(ice1712 *ice,	int8 index,	uint8 value);
33 //------------------------------------------------------
34 //------------------------------------------------------
35 //Address are [PCI_14] + xx
36 uint8	read_ddma_uint8(ice1712 *ice,	int8 regno);
37 uint16	read_ddma_uint16(ice1712 *ice,	int8 regno);
38 uint32	read_ddma_uint32(ice1712 *ice,	int8 regno);
39 
40 void	write_ddma_uint8(ice1712 *ice,	int8 regno,	uint8 value);
41 void	write_ddma_uint16(ice1712 *ice,	int8 regno,	uint16 value);
42 void	write_ddma_uint32(ice1712 *ice,	int8 regno,	uint32 value);
43 //------------------------------------------------------
44 //------------------------------------------------------
45 //Address are [PCI_18] + x
46 uint8	read_ds_uint8(ice1712 *ice,		int8 regno);
47 uint16	read_ds_uint16(ice1712 *ice,	int8 regno);
48 uint32	read_ds_uint32(ice1712 *ice,	int8 regno);
49 
50 void	write_ds_uint8(ice1712 *ice,	int8 regno,	uint8 value);
51 void	write_ds_uint16(ice1712 *ice,	int8 regno,	uint16 value);
52 void	write_ds_uint32(ice1712 *ice,	int8 regno,	uint32 value);
53 
54 typedef enum {
55 	DS8_REGISTER_BUFFER_0_BASE_ADDRESS = 0,
56 	DS8_REGISTER_BUFFER_0_BASE_COUNT,
57 	DS8_REGISTER_BUFFER_1_BASE_ADDRESS,
58 	DS8_REGISTER_BUFFER_1_BASE_COUNT,
59 	DS8_REGISTER_CONTROL_AND_STATUS,
60 	DS8_REGISTER_SAMPLING_RATE,
61 	DS8_REGISTER_LEFT_RIGHT_VOLUME,
62 } ds8_register;
63 
64 uint32	read_ds_channel_data(ice1712 *ice, uint8 channel, ds8_register index);
65 void	write_ds_channel_data(ice1712 *ice, uint8 channel, ds8_register index, uint32 data);
66 //------------------------------------------------------
67 //------------------------------------------------------
68 //Address are [PCI_1C] + xx
69 uint8	read_mt_uint8(ice1712 *ice,		int8 regno);
70 uint16	read_mt_uint16(ice1712 *ice,	int8 regno);
71 uint32	read_mt_uint32(ice1712 *ice,	int8 regno);
72 
73 void	write_mt_uint8(ice1712 *ice,	int8 regno,	uint8 value);
74 void	write_mt_uint16(ice1712 *ice,	int8 regno,	uint16 value);
75 void	write_mt_uint32(ice1712 *ice,	int8 regno,	uint32 value);
76 //------------------------------------------------------
77 //------------------------------------------------------
78 
79 int16	read_i2c(ice1712 *ice, uint8 dev_addr, uint8 byte_addr);
80 //return -1 if error else return an uint8
81 
82 int16	write_i2c(ice1712 *ice, uint8 dev_addr, uint8 byte_addr, uint8 value);
83 //return -1 if error else return 0
84 
85 //------------------------------------------------------
86 
87 int16 read_eeprom(ice1712 *ice, uint8 eeprom[32]);
88 
89 //------------------------------------------------------
90 
91 void codec_write(ice1712 *ice, uint8 reg_addr, uint8 data);
92 void spdif_write(ice1712 *ice, uint8 reg_addr, uint8 data);
93 void codec_write_mult(ice1712 *ice, uint8 reg_addr, uint8 datas[], uint8 size);
94 void spdif_write_mult(ice1712 *ice, uint8 reg_addr, uint8 datas[], uint8 size);
95 
96 uint8 codec_read(ice1712 *ice, uint8 reg_addr);
97 uint8 spdif_read(ice1712 *ice, uint8 reg_addr);
98 uint8 codec_read_mult(ice1712 *ice, uint8 reg_addr, uint8 datas[], uint8 size);
99 uint8 spdif_read_mult(ice1712 *ice, uint8 reg_addr, uint8 datas[], uint8 size);
100 
101 //------------------------------------------------------
102 
103 uint8	read_gpio(ice1712 *ice);
104 //return -1 if error else return an uint8
105 
106 void	write_gpio(ice1712 *ice, uint8 value);
107 
108 #endif
109