Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/Pmods/PmodAMP3/ssm2518.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ssm2518.h
3 * @brief Header File for SSM2518 Driver.
4 * @author ATofan ([email protected])
5 ********************************************************************************
6 * Copyright 2012(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 ********************************************************************************
40 * SVN Revision: $WCREV$
41 *******************************************************************************/
42
43 #include "xparameters.h"
44
45 #ifndef SSM2518_H_
46 #define SSM2518_H_
47 /* I2C Core Base Address */
48 #define I2C_BASEADDR XPAR_AXI_IIC_0_BASEADDR
49
50 /* SSM2518 I2C Address = 001101x0 */
51 #define SSM2518_I2C_ADDR 0x36
52
53 /* SSM2518 Registers Address */
54 #define SSM2518_Reset_Power_Control 0x00
55 #define SSM2518_Edge_Clock_Control 0x01
56 #define SSM2518_Serial_Interface_Sample_Rate_Control 0x02
57 #define SSM2518_Serial_Interface_Control 0x03
58 #define SSM2518_Channel_Mapping_Control 0x04
59 #define SSM2518_Left_Volume_Control 0x05
60 #define SSM2518_Right_Volume_Control 0x06
61 #define SSM2518_Volume_Mute_Control 0x07
62 #define SSM2518_Fault_Control_1 0x08
63 #define SSM2518_Power_Fault_Control 0x09
64 #define SSM2518_DRC_Control_1 0x0A
65 #define SSM2518_DRC_Control_2 0x0B
66 #define SSM2518_DRC_Control_3 0x0C
67 #define SSM2518_DRC_Control_4 0x0D
68 #define SSM2518_DRC_Control_5 0x0E
69 #define SSM2518_DRC_Control_6 0x0F
70 #define SSM2518_DRC_Control_7 0x10
71 #define SSM2518_DRC_Control_8 0x11
72 #define SSM2518_DRC_Control_9 0x12
73
74 /* SSM2518 Register Specific Bits */
75 // Reset Power Control 0x00
76 #define S_RST 7
77 #define NO_BCLK 5
78 #define MCS 1
79 #define SPWDN 0
80 // Edge Speed and Clocking Control 0x01
81 #define EDGE 1
82 #define ASR 0
83 // Serial Audio Interface and Sample Rate Control Register 0x02
84 #define SDATA_FMT 5
85 #define SAI 2
86 #define FS 0
87 // Serial Audio Interface Control Register 0x03
88 #define BCLK_GEN 7
89 #define LRCLK_MODE 6
90 #define LRCLK_POL 5
91 #define SAI_MSB 4
92 #define SLOT_WIDTH 2
93 #define BCLK_EDGE 1
94 // Channel Mapping Control Register 0x04
95 #define CH_SEL_R 4
96 #define CH_SEL_L 0
97 // Left Channel Volume Control Register 0x05
98 #define L_VOL 0
99 // Right Channel Volume Control Register 0x06
100 #define R_VOL 0
101 // Volume and Mute Control Register 0x07
102 #define AMUTE 7
103 #define ANA_GAIN 5
104 #define DEEMP_EN 4
105 #define VOL_LINK 3
106 #define R_MUTE 2
107 #define L_MUTE 1
108 #define M_MUTE 0
109 // Fault Control Register 0x08
110 #define OC_L 7
111 #define OC_R 6
112 #define OT 5
113 #define MRCV 4
114 #define MAX_AR 2
115 #define ARCV 0
116 // Power and Fault Control Register 0x09
117 #define AR_TIME 6
118 #define AMP_LPM 4
119 #define DAC_LPM 3
120 #define R_PWDN 2
121 #define L_PWDN 1
122 #define APWDN_EN 0
123 // DRC Control Register 1 0x0A
124 #define PRE_VOL 6
125 #define LIM_EN 5
126 #define COMP_EN 4
127 #define EXP_EN 3
128 #define NG_EN 2
129 #define DRC_EN 0
130 // DRC Control Register 2 0x0B
131 #define PEAK_ATT 4
132 #define PEAK_REL 0
133 // DRC Control Register 3 0x0C
134 #define DRC_LT 4
135 #define DRC_CT 0
136 // DRC Control Register 4 0x0D
137 #define DRC_ET 4
138 #define DRC_NT 0
139 // DRC Control Register 5 0x0E
140 #define DRC_SMAX 4
141 #define DRC_SMIN 0
142 // DRC Control Register 6 0x0F
143 #define DRC_ATT 4
144 #define DRC_DET 0
145 // DRC Control Register 7 0x10
146 #define HDT_NOR 4
147 #define HDT_NG 0
148 // DRC Control Register 8 0x11
149 #define DRC_POST_G 2
150 // DRC Control Register 9 0x12
151 #define RMS_TAV 0
152
153 void SSM2518_WriteReg(char regAddr, unsigned char data);
154 unsigned char SSM2518_ReadReg(char regAddr);
155 void SSM2518_Init(void);
156 void EnableIntc(void);
157 void EnableUartIntr(void);
158 void EnableExtIntr(void);
159
160 #endif /* SSM2518_H_ */