summaryrefslogtreecommitdiff
path: root/drivers/mxc/hdp/API_Audio.h
blob: 4147594d4cbaef02dee73a58a10fa68f7e70217c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/******************************************************************************
 *
 * Copyright (C) 2016-2017 Cadence Design Systems, Inc.
 * All rights reserved worldwide.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation and/or
 * other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 * may be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Copyright 2017 NXP
 *
 ******************************************************************************
 *
 * API_Audio.h
 *
 ******************************************************************************
 */

#ifndef API_AUDIO_H_
#define API_AUDIO_H_

#include "API_General.h"
/**
 * \addtogroup AUDIO_API
 * \{
 */
typedef enum {
	AUDIO_TYPE_I2S,
	AUDIO_TYPE_SPIDIF_INTERNAL,
	AUDIO_TYPE_SPIDIF_EXTERNAL,
} AUDIO_TYPE;

typedef enum {
	AUDIO_FREQ_32,
	AUDIO_FREQ_48,
	AUDIO_FREQ_96,
	AUDIO_FREQ_192,
	AUDIO_FREQ_44_1,
	AUDIO_FREQ_88_2,
	AUDIO_FREQ_176_4,
} AUDIO_FREQ;

typedef enum {
	AUDIO_WIDTH_16,
	AUDIO_WIDTH_24,
	AUDIO_WIDTH_32,
} AUDIO_WIDTH;

typedef enum {
	AUDIO_MODE_OFF,
	AUDIO_MODE_ON
} AUDIO_MODE;

typedef enum {
	AUDIO_MUTE_MODE_MUTE,
	AUDIO_MUTE_MODE_UNMUTE
} AUDIO_MUTE_MODE;

/**
 * \brief mute or unmute audio
 */
CDN_API_STATUS CDN_API_AudioMute(state_struct *state, AUDIO_MUTE_MODE mode);

/**
 * \brief blocking version of #CDN_API_AudioMute
 */
CDN_API_STATUS CDN_API_AudioMute_blocking(state_struct *state,
					  AUDIO_MUTE_MODE mode);

/**
 * \brief start playing audio with the input parameters
    ncts and mode are relevant only in HDMI TX mode , not relevant for DPTX mode
 */
CDN_API_STATUS CDN_API_AudioAutoConfig(state_struct *state,
				       AUDIO_TYPE audioType, int numOfChannels,
				       AUDIO_FREQ freq, int lanes,
				       AUDIO_WIDTH width,
				       CDN_PROTOCOL_TYPE protocol, int ncts,
				       AUDIO_MUTE_MODE mode);

/**
 * \brief blocking version of #CDN_API_AudioAutoConfig
 */
CDN_API_STATUS CDN_API_AudioAutoConfig_blocking(state_struct *state,
						AUDIO_TYPE audioType,
						int numOfChannels,
						AUDIO_FREQ freq, int lanes,
						AUDIO_WIDTH width,
						CDN_PROTOCOL_TYPE protocol,
						int ncts, AUDIO_MUTE_MODE mode);

/**
 * \brief audio off (use it to stop current audio and start new one using CDN_API_AudioAutoConfig)
 */
CDN_API_STATUS CDN_API_AudioOff(state_struct *state, AUDIO_TYPE audioType);

/**
 * \brief blocking version of #CDN_API_AudioOff
 */
CDN_API_STATUS CDN_API_AudioOff_blocking(state_struct *state,
					 AUDIO_TYPE audioType);

/**
 * \brief internal function to set audio on or off inside internal registers
 */
CDN_API_STATUS CDN_API_AudioMode(state_struct *state, AUDIO_MODE mode);

/**
 * \brief blocking version of #CDN_API_AudioMode
 */
CDN_API_STATUS CDN_API_AudioMode_blocking(state_struct *state,
					  AUDIO_MODE mode);

/**
 * \brief internal function to set audio core registers
 */
CDN_API_STATUS CDN_API_AudioConfigCore(state_struct *state,
				       AUDIO_TYPE audioType, int numOfChannels,
				       AUDIO_FREQ freq, int lanes,
				       AUDIO_WIDTH width);

/**
 * \brief blocking version of #CDN_API_AudioConfigCore
 */
CDN_API_STATUS CDN_API_AudioConfigCore_blocking(state_struct *state,
						AUDIO_TYPE audioType,
						int numOfChannels,
						AUDIO_FREQ freq, int lanes,
						AUDIO_WIDTH width);

#endif