FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / export / mas.h
blob493ed6a63cf7dfdbb9fc2876b8430052c5ee1306
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _MAS_H_
22 #define _MAS_H_
24 #define MAS_BANK_D0 0
25 #define MAS_BANK_D1 1
27 #define MAX_PEAK 0x8000
30 MAS I2C defs
32 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
33 #define MAS_ADR 0x3c
34 #define MAS_DEV_WRITE (MAS_ADR | 0x00)
35 #define MAS_DEV_READ (MAS_ADR | 0x01)
36 #else
37 #define MAS_ADR 0x3a
38 #define MAS_DEV_WRITE (MAS_ADR | 0x00)
39 #define MAS_DEV_READ (MAS_ADR | 0x01)
40 #endif
42 /* registers..*/
43 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
44 #define MAS_DATA_WRITE 0x68
45 #define MAS_DATA_READ 0x69
46 #define MAS_CODEC_WRITE 0x6c
47 #define MAS_CODEC_READ 0x6d
48 #define MAS_CONTROL 0x6a
49 #define MAS_DCCF 0x76
50 #define MAS_DCFR 0x77
51 #else
52 #define MAS_DATA_WRITE 0x68
53 #define MAS_DATA_READ 0x69
54 #define MAS_CONTROL 0x6a
55 #endif
58 * MAS register
60 #define MAS_REG_DCCF 0x8e
61 #define MAS_REG_MUTE 0xaa
62 #define MAS_REG_PIODATA 0xc8
63 #define MAS_REG_StartUpConfig 0xe6
64 #define MAS_REG_KPRESCALE 0xe7
65 #define MAS_REG_KBASS 0x6b
66 #define MAS_REG_KTREBLE 0x6f
67 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
68 #define MAS_REG_KMDB_SWITCH 0x21
69 #define MAS_REG_KMDB_STR 0x22
70 #define MAS_REG_KMDB_HAR 0x23
71 #define MAS_REG_KMDB_FC 0x24
72 #define MAS_REG_KLOUDNESS 0x1e
73 #define MAS_REG_QPEAK_L 0x0a
74 #define MAS_REG_QPEAK_R 0x0b
75 #define MAS_REG_DQPEAK_L 0x0c
76 #define MAS_REG_DQPEAK_R 0x0d
77 #define MAS_REG_KAVC 0x12
78 #endif
81 * MAS commands
83 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
84 #define MAS_CMD_READ_ANCILLARY 0x50
85 #define MAS_CMD_FAST_PRG_DL 0x60
86 #define MAS_CMD_READ_IC_VER 0x70
87 #define MAS_CMD_READ_REG 0xa0
88 #define MAS_CMD_WRITE_REG 0xb0
89 #define MAS_CMD_READ_D0_MEM 0xc0
90 #define MAS_CMD_READ_D1_MEM 0xd0
91 #define MAS_CMD_WRITE_D0_MEM 0xe0
92 #define MAS_CMD_WRITE_D1_MEM 0xf0
93 #else
94 #define MAS_CMD_READ_ANCILLARY 0x30
95 #define MAS_CMD_WRITE_REG 0x90
96 #define MAS_CMD_WRITE_D0_MEM 0xa0
97 #define MAS_CMD_WRITE_D1_MEM 0xb0
98 #define MAS_CMD_READ_REG 0xd0
99 #define MAS_CMD_READ_D0_MEM 0xe0
100 #define MAS_CMD_READ_D1_MEM 0xf0
101 #endif
104 * MAS D0 memory cells (MAS3587F / MAS3539F)
106 #if CONFIG_CODEC == MAS3587F
107 #define MAS_D0_APP_SELECT 0x7f6
108 #define MAS_D0_APP_RUNNING 0x7f7
109 #define MAS_D0_ENCODER_CONTROL 0x7f0
110 #define MAS_D0_IO_CONTROL_MAIN 0x7f1
111 #define MAS_D0_INTERFACE_CONTROL 0x7f2
112 #define MAS_D0_OFREQ_CONTROL 0x7f3
113 #define MAS_D0_OUT_CLK_CONFIG 0x7f4
114 #define MAS_D0_SPD_OUT_BITS 0x7f8
115 #define MAS_D0_SOFT_MUTE 0x7f9
116 #define MAS_D0_OUT_LL 0x7fc
117 #define MAS_D0_OUT_LR 0x7fd
118 #define MAS_D0_OUT_RL 0x7fe
119 #define MAS_D0_OUT_RR 0x7ff
120 #define MAS_D0_MPEG_FRAME_COUNT 0xfd0
121 #define MAS_D0_MPEG_STATUS_1 0xfd1
122 #define MAS_D0_MPEG_STATUS_2 0xfd2
123 #define MAS_D0_CRC_ERROR_COUNT 0xfd3
125 #elif CONFIG_CODEC == MAS3539F
126 #define MAS_D0_APP_SELECT 0x34b
127 #define MAS_D0_APP_RUNNING 0x34c
128 /* no encoder :( */
129 #define MAS_D0_IO_CONTROL_MAIN 0x346
130 #define MAS_D0_INTERFACE_CONTROL 0x347
131 #define MAS_D0_OFREQ_CONTROL 0x348
132 #define MAS_D0_OUT_CLK_CONFIG 0x349
133 #define MAS_D0_SPD_OUT_BITS 0x351
134 #define MAS_D0_SOFT_MUTE 0x350
135 #define MAS_D0_OUT_LL 0x354
136 #define MAS_D0_OUT_LR 0x355
137 #define MAS_D0_OUT_RL 0x356
138 #define MAS_D0_OUT_RR 0x357
139 #define MAS_D0_MPEG_FRAME_COUNT 0xfd0
140 #define MAS_D0_MPEG_STATUS_1 0xfd1
141 #define MAS_D0_MPEG_STATUS_2 0xfd2
142 #define MAS_D0_CRC_ERROR_COUNT 0xfd3
144 #else /* MAS3507D */
145 #define MAS_D0_MPEG_FRAME_COUNT 0x300
146 #define MAS_D0_MPEG_STATUS_1 0x301
147 #define MAS_D0_MPEG_STATUS_2 0x302
148 #define MAS_D0_CRC_ERROR_COUNT 0x303
150 #endif
152 int mas_default_read(unsigned short *buf);
153 int mas_run(unsigned short address);
154 int mas_readmem(int bank, int addr, unsigned long* dest, int len);
155 int mas_writemem(int bank, int addr, const unsigned long* src, int len);
156 int mas_readreg(int reg);
157 int mas_writereg(int reg, unsigned int val);
158 void mas_reset(void);
159 int mas_direct_config_read(unsigned char reg);
160 int mas_direct_config_write(unsigned char reg, unsigned int val);
161 int mas_codec_writereg(int reg, unsigned int val);
162 int mas_codec_readreg(int reg);
163 unsigned long mas_readver(void);
165 #endif
167 #if CONFIG_TUNER & S1A0903X01
168 void mas_store_pllfreq(int freq);
169 int mas_get_pllfreq(void);
170 #endif