LPCOpen Platform for LPC18XX/43XX microcontrollers: C:/w/lpcopen_docs/software/lpc_core/lpc_board/board_common/uda1380.h Source File

| LPCOpen Platform for LPC18XX/43XX microcontrollers 18XX43XX LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

uda1380.h
Go to the documentation of this file.
1 /*
2 * @brief UDA1380 Audio Codec header
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #ifndef __UDA1380_H_
33 #define __UDA1380_H_
34
49 /* UDA1380 Registers */
50 #define UDA_EVALM_CLK 0x00
51 #define UDA_BUS_CTRL 0x01
52 #define UDA_POWER_CTRL 0x02
53 #define UDA_ANALOG_CTRL 0x03
54 #define UDA_HPAMP_CTRL 0x04
55 #define UDA_MASTER_VOL_CTRL 0x10
56 #define UDA_MIXER_VOL_CTRL 0x11
57 #define UDA_MODE_CTRL 0x12
58 #define UDA_MUTE_CTRL 0x13
59 #define UDA_MIXER_FILTER_CTRL 0x14
60 #define UDA_DEC_VOL_CTRL 0x20
61 #define UDA_PGA_CTRL 0x21
62 #define UDA_ADC_CTRL 0x22
63 #define UDA_AGC_CTRL 0x23
64 #define UDA_TOTAL_REG 0x24
65
67 #define EVCLK_EV2 (1 << 15)
68 #define EVCLK_EV1 (1 << 14)
69 #define EVCLK_EV0 (1 << 13)
70 #define EVCLK_EN_ADC (1 << 11)
71 #define EVCLK_EN_DEC (1 << 10)
72 #define EVCLK_EN_DAC (1 << 9)
73 #define EVCLK_EN_INT (1 << 8)
74 #define EVCLK_ADC_CLK (1 << 5)
75 #define EVCLK_DAC_CLK (1 << 4)
76 #define EVCLK_SYS_DIV1 (1 << 3)
77 #define EVCLK_SYS_DIV0 (1 << 2)
78 #define EVCLK_PLL1 (1 << 1)
79 #define EVCLK_PLL0 (1 << 0)
80
82 #define UDA1380_REG_EVALCLK_DEFAULT_VALUE (0xF << 8 | 0x3 << 4 | 1 << 1)
83 #define UDA1380_REG_I2S_DEFAULT_VALUE 0x0000
84
85 #define UDA1380_REG_PWRCTRL_DEFAULT_VALUE (1 << 15 | 1 << 13 | 1 << 10 | 1 << 8 | 1 << 6 | 1 << 4 | 0x0F)
86 #define UDA1380_REG_ANAMIX_DEFAULT_VALUE 0x0000
87 #define UDA1380_REG_HEADAMP_DEFAULT_VALUE ( 1 << 9 | 2)
88
89 #define UDA1380_REG_MSTRVOL_DEFAULT_VALUE 0x0000
90 #define UDA1380_REG_MIXVOL_DEFAULT_VALUE 0x0000
91 #define UDA1380_REG_MODEBBT_DEFAULT_VALUE 0x0000
92 #define UDA1380_REG_MSTRMUTE_DEFAULT_VALUE (2 << 8 | 2)
93 #define UDA1380_REG_MIXSDO_DEFAULT_VALUE 0x0000
94
95 #define UDA1380_REG_DECVOL_DEFAULT_VALUE 0xE4E4 /* Decrease Volume -28dB */
96 #define UDA1380_REG_PGA_DEFAULT_VALUE 0x0000
97 #define UDA1380_REG_ADC_DEFAULT_VALUE 0x0001 /* Apply 0bB VGA Gain, enable DC Filter */
98 #define UDA1380_REG_AGC_DEFAULT_VALUE 0x0000
99
100 #define UDA1380_REG_L3_DEFAULT_VALUE 0x0000
101
102 /* UDA1380 Audio input selection */
103 #define UDA1380_LINE_IN 0
104 #define UDA1380_MIC_IN_L (1 << 2)
105 #define UDA1380_MIC_IN_LR (3 << 2)
107 #ifdef __cplusplus
108 extern "C" {
109 #endif
110
116 #define UDA1380_U8(val) (((val) >> 8) & 0xFF), ((val) & 0xFF)
117
124 void UDA1380_REG_Write(uint8_t reg, uint16_t val);
125
131 uint16_t UDA1380_REG_Read(uint8_t reg);
132
139 int UDA1380_REG_WriteVerify(uint8_t reg, uint16_t val);
140
150 int UDA1380_REG_WriteMult(const uint8_t *buff, int len);
151
160 int UDA1380_REG_VerifyMult(uint8_t reg, const uint8_t *value, uint8_t *buff, int len);
161
168 int UDA1380_Init(int input);
169
170
171 #ifdef __cplusplus
172 }
173 #endif
174
178 #endif /* __UDA1380_H_ */