STM32Cube BSP FW for STM32F769I-Discovery
Dependents: mbed-os-example-blinky-5 DISCO-F769NI_TOUCHSCREEN_demo_custom_1 Datarecorder2 DISCO-F769NI_TOUCHSCREEN_demo ... more
Drivers/BSP/Components/adv7533/adv7533.c@1:3e58f8a39705, 2017-02-23 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Thu Feb 23 14:14:08 2017 +0100
- Revision:
- 1:3e58f8a39705
- Parent:
- 0:c0f3bbab73d2
- Child:
- 4:72a949940ad6
STM32Cube_FW_F7_V1.6.0 BSP_DISCO_F769NI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
0:c0f3bbab73d2
|
1
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
2
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
3
|
* @file adv7533.c
|
|
Jerome Coutant
0:c0f3bbab73d2
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
1:3e58f8a39705
|
5
|
* @version V1.0.1
|
|
Jerome Coutant
1:3e58f8a39705
|
6
|
* @date 05-December-2016
|
|
Jerome Coutant
0:c0f3bbab73d2
|
7
|
* @brief This file provides the ADV7533 DSI to HDMI bridge driver
|
|
Jerome Coutant
0:c0f3bbab73d2
|
8
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
9
|
* @attention
|
|
Jerome Coutant
0:c0f3bbab73d2
|
10
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
11
|
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
Jerome Coutant
0:c0f3bbab73d2
|
12
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
13
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
14
|
* are permitted provided that the following conditions are met:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
15
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
16
|
* this list of conditions and the following disclaimer.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
18
|
* this list of conditions and the following disclaimer in the documentation
|
|
Jerome Coutant
0:c0f3bbab73d2
|
19
|
* and/or other materials provided with the distribution.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
20
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
Jerome Coutant
0:c0f3bbab73d2
|
21
|
* may be used to endorse or promote products derived from this software
|
|
Jerome Coutant
0:c0f3bbab73d2
|
22
|
* without specific prior written permission.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
23
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
24
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Jerome Coutant
0:c0f3bbab73d2
|
25
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
26
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
27
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
28
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Jerome Coutant
0:c0f3bbab73d2
|
29
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Jerome Coutant
0:c0f3bbab73d2
|
30
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Jerome Coutant
0:c0f3bbab73d2
|
31
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
32
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Jerome Coutant
0:c0f3bbab73d2
|
33
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
34
|
*
|
|
Jerome Coutant
0:c0f3bbab73d2
|
35
|
******************************************************************************
|
|
Jerome Coutant
0:c0f3bbab73d2
|
36
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
37
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
38
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
39
|
#include "adv7533.h"
|
|
Jerome Coutant
0:c0f3bbab73d2
|
40
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
41
|
/** @addtogroup BSP
|
|
Jerome Coutant
0:c0f3bbab73d2
|
42
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
43
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
44
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
45
|
/** @addtogroup Components
|
|
Jerome Coutant
0:c0f3bbab73d2
|
46
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
47
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
48
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
49
|
/** @defgroup ADV7533 ADV7533
|
|
Jerome Coutant
0:c0f3bbab73d2
|
50
|
* @brief This file provides a set of functions needed to drive the
|
|
Jerome Coutant
0:c0f3bbab73d2
|
51
|
* adv7533 DSI-HDMI bridge.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
52
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
53
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
54
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
55
|
/* Private types -------------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
56
|
/* Private variables ---------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
57
|
/* Private constants ---------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
58
|
/** @defgroup ADV7533_Private_Constants ADV7533 Private Constants
|
|
Jerome Coutant
0:c0f3bbab73d2
|
59
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
60
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
61
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
62
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
63
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
64
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
65
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
66
|
/* Private macros ------------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
67
|
/* Private functions ---------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
68
|
/** @defgroup ADV7533_Exported_Variables
|
|
Jerome Coutant
0:c0f3bbab73d2
|
69
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
70
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
71
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
72
|
AUDIO_DrvTypeDef adv7533_drv =
|
|
Jerome Coutant
0:c0f3bbab73d2
|
73
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
74
|
adv7533_AudioInit,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
75
|
adv7533_DeInit,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
76
|
adv7533_ReadID,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
77
|
adv7533_Play,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
78
|
adv7533_Pause,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
79
|
adv7533_Resume,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
80
|
adv7533_Stop,
|
|
Jerome Coutant
0:c0f3bbab73d2
|
81
|
adv7533_SetFrequency,
|
|
Jerome Coutant
1:3e58f8a39705
|
82
|
adv7533_SetVolume, /* Not supported, added for compatibility */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
83
|
adv7533_SetMute,
|
|
Jerome Coutant
1:3e58f8a39705
|
84
|
adv7533_SetOutputMode, /* Not supported, added for compatibility */
|
|
Jerome Coutant
1:3e58f8a39705
|
85
|
adv7533_Reset /* Not supported, added for compatibility */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
86
|
};
|
|
Jerome Coutant
0:c0f3bbab73d2
|
87
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
88
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
89
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
90
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
91
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
92
|
/* Exported functions --------------------------------------------------------*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
93
|
/** @defgroup ADV7533_Exported_Functions ADV7533 Exported Functions
|
|
Jerome Coutant
0:c0f3bbab73d2
|
94
|
* @{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
95
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
96
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
97
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
98
|
* @brief Initializes the ADV7533 bridge.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
99
|
* @param None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
100
|
* @retval Status
|
|
Jerome Coutant
0:c0f3bbab73d2
|
101
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
102
|
uint8_t ADV7533_Init(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
103
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
104
|
HDMI_IO_Init();
|
|
Jerome Coutant
0:c0f3bbab73d2
|
105
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
106
|
/* Configure the IC2 address for CEC_DSI interface */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
107
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE1, ADV7533_CEC_DSI_I2C_ADDR);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
108
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
109
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
110
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
111
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
112
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
113
|
* @brief Power on the ADV7533 bridge.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
114
|
* @param None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
115
|
* @retval None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
116
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
117
|
void ADV7533_PowerOn(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
118
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
119
|
uint8_t tmp;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
120
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
121
|
/* Power on */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
122
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
123
|
tmp &= ~0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
124
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
125
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
126
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
127
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
128
|
* @brief Power off the ADV7533 bridge.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
129
|
* @param None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
130
|
* @retval None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
131
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
132
|
void ADV7533_PowerDown(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
133
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
134
|
uint8_t tmp;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
135
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
136
|
/* Power down */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
137
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
138
|
tmp |= 0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
139
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
140
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
141
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
142
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
143
|
* @brief Configure the DSI-HDMI ADV7533 bridge for video.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
144
|
* @param config : pointer to adv7533ConfigTypeDef that contains the
|
|
Jerome Coutant
0:c0f3bbab73d2
|
145
|
* video configuration parameters
|
|
Jerome Coutant
0:c0f3bbab73d2
|
146
|
* @retval None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
147
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
148
|
void ADV7533_Configure(adv7533ConfigTypeDef * config)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
149
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
150
|
uint8_t tmp;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
151
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
152
|
/* Sequence from Section 3 - Quick Start Guide */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
153
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
154
|
/* ADV7533 Power Settings */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
155
|
/* Power down */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
156
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
157
|
tmp &= ~0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
158
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
159
|
/* HPD Override */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
160
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xD6);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
161
|
tmp |= 0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
162
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xD6, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
163
|
/* Gate DSI LP Oscillator and DSI Bias Clock Powerdown */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
164
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
165
|
tmp &= ~0x02;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
166
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
167
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
168
|
/* Fixed registers that must be set on power-up */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
169
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x16);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
170
|
tmp &= ~0x3E;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
171
|
tmp |= 0x20;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
172
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x16, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
173
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x9A, 0xE0);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
174
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xBA);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
175
|
tmp &= ~0xF8;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
176
|
tmp |= 0x70;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
177
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xBA, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
178
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xDE, 0x82);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
179
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
180
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xE4);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
181
|
tmp |= 0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
182
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE4, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
183
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE5, 0x80);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
184
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
185
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x15);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
186
|
tmp &= ~0x30;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
187
|
tmp |= 0x10;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
188
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x17);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
189
|
tmp &= ~0xF0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
190
|
tmp |= 0xD0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
191
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x17, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
192
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x24);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
193
|
tmp &= ~0x10;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
194
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x24, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
195
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x57);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
196
|
tmp |= 0x01;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
197
|
tmp |= 0x10;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
198
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x57, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
199
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
200
|
/* Configure the number of DSI lanes */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
201
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x1C, (config->DSI_LANES << 4));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
202
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
203
|
/* Setup video output mode */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
204
|
/* Select HDMI mode */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
205
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xAF);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
206
|
tmp |= 0x02;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
207
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xAF, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
208
|
/* HDMI Output Enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
209
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
210
|
tmp |= 0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
211
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
212
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
213
|
/* GC packet enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
214
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x40);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
215
|
tmp |= 0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
216
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x40, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
217
|
/* Input color depth 24-bit per pixel */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
218
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x4C);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
219
|
tmp &= ~0x0F;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
220
|
tmp |= 0x03;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
221
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x4C, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
222
|
/* Down dither output color depth */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
223
|
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x49, 0xfc);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
224
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
225
|
/* Internal timing disabled */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
226
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x27);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
227
|
tmp &= ~0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
228
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x27, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
229
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
230
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
231
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
232
|
* @brief Enable video pattern generation.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
233
|
* @param None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
234
|
* @retval None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
235
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
236
|
void ADV7533_PatternEnable(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
237
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
238
|
/* Timing generator enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
239
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x80); /* Color bar */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
240
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0xA0); /* Color ramp */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
241
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
242
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, 0x89);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
243
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0xAF, 0x16);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
244
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
245
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
246
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
247
|
* @brief Disable video pattern generation.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
248
|
* @param none
|
|
Jerome Coutant
0:c0f3bbab73d2
|
249
|
* @retval none
|
|
Jerome Coutant
0:c0f3bbab73d2
|
250
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
251
|
void ADV7533_PatternDisable(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
252
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
253
|
/* Timing generator enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
254
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x00);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
255
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
256
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
257
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
258
|
* @brief Initializes the ADV7533 audio interface.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
259
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
260
|
* @param OutputDevice: Not used (for compatiblity only).
|
|
Jerome Coutant
0:c0f3bbab73d2
|
261
|
* @param Volume: Not used (for compatiblity only).
|
|
Jerome Coutant
0:c0f3bbab73d2
|
262
|
* @param AudioFreq: Audio Frequency
|
|
Jerome Coutant
0:c0f3bbab73d2
|
263
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
264
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
265
|
uint32_t adv7533_AudioInit(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume,uint32_t AudioFreq)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
266
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
267
|
uint32_t val = 4096;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
268
|
uint8_t tmp = 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
269
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
270
|
/* Audio data enable*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
271
|
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x05);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
272
|
tmp &= ~0x20;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
273
|
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x05, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
274
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
275
|
/* HDMI statup */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
276
|
tmp= (uint8_t)((val & 0xF0000)>>16);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
277
|
HDMI_IO_Write(DeviceAddr, 0x01, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
278
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
279
|
tmp= (uint8_t)((val & 0xFF00)>>8);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
280
|
HDMI_IO_Write(DeviceAddr, 0x02, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
281
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
282
|
tmp= (uint8_t)((val & 0xFF));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
283
|
HDMI_IO_Write(DeviceAddr, 0x03, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
284
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
285
|
/* Enable spdif */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
286
|
tmp = HDMI_IO_Read(DeviceAddr, 0x0B);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
287
|
tmp |= 0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
288
|
HDMI_IO_Write(DeviceAddr, 0x0B, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
289
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
290
|
/* Enable I2S */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
291
|
tmp = HDMI_IO_Read(DeviceAddr, 0x0C);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
292
|
tmp |=0x04;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
293
|
HDMI_IO_Write(DeviceAddr, 0x0C, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
294
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
295
|
/* Set audio sampling frequency */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
296
|
adv7533_SetFrequency(DeviceAddr, AudioFreq);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
297
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
298
|
/* Select SPDIF is 0x10 , I2S=0x00 */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
299
|
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x0A);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
300
|
tmp &=~ 0x10;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
301
|
HDMI_IO_Write(DeviceAddr, 0x0A, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
302
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
303
|
/* Set v1P2 enable */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
304
|
tmp = HDMI_IO_Read(DeviceAddr, 0xE4);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
305
|
tmp |= 0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
306
|
HDMI_IO_Write(DeviceAddr, 0xE4, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
307
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
308
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
309
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
310
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
311
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
312
|
* @brief Deinitializes the adv7533
|
|
Jerome Coutant
0:c0f3bbab73d2
|
313
|
* @param None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
314
|
* @retval None
|
|
Jerome Coutant
0:c0f3bbab73d2
|
315
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
316
|
void adv7533_DeInit(void)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
317
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
318
|
/* Deinitialize Audio adv7533 interface */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
319
|
AUDIO_IO_DeInit();
|
|
Jerome Coutant
0:c0f3bbab73d2
|
320
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
321
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
322
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
323
|
* @brief Get the adv7533 ID.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
324
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
325
|
* @retval The adv7533 ID
|
|
Jerome Coutant
0:c0f3bbab73d2
|
326
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
327
|
uint32_t adv7533_ReadID(uint16_t DeviceAddr)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
328
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
329
|
uint32_t tmp = 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
330
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
331
|
tmp = HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR0);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
332
|
tmp = (tmp<<8);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
333
|
tmp |= HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR1);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
334
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
335
|
return(tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
336
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
337
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
338
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
339
|
* @brief Pauses playing on the audio hdmi
|
|
Jerome Coutant
0:c0f3bbab73d2
|
340
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
341
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
342
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
343
|
uint32_t adv7533_Pause(uint16_t DeviceAddr)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
344
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
345
|
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
346
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
347
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
348
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
349
|
* @brief Resumes playing on the audio hdmi.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
350
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
351
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
352
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
353
|
uint32_t adv7533_Resume(uint16_t DeviceAddr)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
354
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
355
|
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
356
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
357
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
358
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
359
|
* @brief Start the audio hdmi play feature.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
360
|
* @note For this codec no Play options are required.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
361
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
362
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
363
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
364
|
uint32_t adv7533_Play(uint16_t DeviceAddr ,uint16_t* pBuffer ,uint16_t Size)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
365
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
366
|
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
367
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
368
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
369
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
370
|
* @brief Stop playing on the audio hdmi
|
|
Jerome Coutant
0:c0f3bbab73d2
|
371
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
372
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
373
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
374
|
uint32_t adv7533_Stop(uint16_t DeviceAddr,uint32_t cmd)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
375
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
376
|
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
|
|
Jerome Coutant
0:c0f3bbab73d2
|
377
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
378
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
379
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
380
|
* @brief Enables or disables the mute feature on the audio hdmi.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
381
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
382
|
* @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the
|
|
Jerome Coutant
0:c0f3bbab73d2
|
383
|
* mute mode.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
384
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
385
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
386
|
uint32_t adv7533_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
387
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
388
|
uint8_t tmp = 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
389
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
390
|
tmp = HDMI_IO_Read(DeviceAddr, 0x0D);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
391
|
if (Cmd == AUDIO_MUTE_ON)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
392
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
393
|
/* enable audio mute*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
394
|
tmp |= 0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
395
|
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
396
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
397
|
else
|
|
Jerome Coutant
0:c0f3bbab73d2
|
398
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
399
|
/*audio mute off disable the mute */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
400
|
tmp &= ~0x40;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
401
|
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
402
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
403
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
404
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
405
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
406
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
407
|
* @brief Sets output mode.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
408
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
409
|
* @param Output : hdmi output.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
410
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
411
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
412
|
uint32_t adv7533_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
413
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
414
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
415
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
416
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
417
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
418
|
* @brief Sets volumee.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
419
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
420
|
* @param Volume : volume value.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
421
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
422
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
423
|
uint32_t adv7533_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
424
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
425
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
426
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
427
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
428
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
429
|
* @brief Resets adv7533 registers.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
430
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
431
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
432
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
433
|
uint32_t adv7533_Reset(uint16_t DeviceAddr)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
434
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
435
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
436
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
437
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
438
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
439
|
* @brief Sets new frequency.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
440
|
* @param DeviceAddr: Device address on communication Bus.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
441
|
* @param AudioFreq: Audio frequency used to play the audio stream.
|
|
Jerome Coutant
0:c0f3bbab73d2
|
442
|
* @retval 0 if correct communication, else wrong communication
|
|
Jerome Coutant
0:c0f3bbab73d2
|
443
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
444
|
uint32_t adv7533_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
445
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
446
|
uint8_t tmp = 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
447
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
448
|
tmp = HDMI_IO_Read(DeviceAddr, 0x15);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
449
|
tmp &= (~0xF0);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
450
|
/* Clock Configurations */
|
|
Jerome Coutant
0:c0f3bbab73d2
|
451
|
switch (AudioFreq)
|
|
Jerome Coutant
0:c0f3bbab73d2
|
452
|
{
|
|
Jerome Coutant
0:c0f3bbab73d2
|
453
|
case AUDIO_FREQUENCY_32K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
454
|
/* Sampling Frequency =32 KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
455
|
tmp |= 0x30;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
456
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
457
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
458
|
case AUDIO_FREQUENCY_44K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
459
|
/* Sampling Frequency =44,1 KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
460
|
tmp |= 0x00;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
461
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
462
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
463
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
464
|
case AUDIO_FREQUENCY_48K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
465
|
/* Sampling Frequency =48KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
466
|
tmp |= 0x20;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
467
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
468
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
469
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
470
|
case AUDIO_FREQUENCY_96K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
471
|
/* Sampling Frequency =96 KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
472
|
tmp |= 0xA0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
473
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
474
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
475
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
476
|
case AUDIO_FREQUENCY_88K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
477
|
/* Sampling Frequency =88,2 KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
478
|
tmp |= 0x80;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
479
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
480
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
481
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
482
|
case AUDIO_FREQUENCY_176K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
483
|
/* Sampling Frequency =176,4 KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
484
|
tmp |= 0xC0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
485
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
486
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
487
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
488
|
case AUDIO_FREQUENCY_192K:
|
|
Jerome Coutant
0:c0f3bbab73d2
|
489
|
/* Sampling Frequency =192KHZ*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
490
|
tmp |= 0xE0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
491
|
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
|
Jerome Coutant
0:c0f3bbab73d2
|
492
|
break;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
493
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
494
|
return 0;
|
|
Jerome Coutant
0:c0f3bbab73d2
|
495
|
}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
496
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
497
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
498
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
499
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
500
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
501
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
502
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
503
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
504
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
505
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
506
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
507
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
508
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
509
|
/**
|
|
Jerome Coutant
0:c0f3bbab73d2
|
510
|
* @}
|
|
Jerome Coutant
0:c0f3bbab73d2
|
511
|
*/
|
|
Jerome Coutant
0:c0f3bbab73d2
|
512
|
|
|
Jerome Coutant
0:c0f3bbab73d2
|
513
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|