aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h b/lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h
new file mode 100644
index 000000000..e4293eac2
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/components/codec/port/fsl_cs42888_adapter.h
@@ -0,0 +1,135 @@
1/*
2 * Copyright 2019-2020 NXP
3 * All rights reserved.
4 *
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _FSL_CS42888_ADAPTER_H_
10#define _FSL_CS42888_ADAPTER_H_
11
12#include "fsl_cs42888.h"
13/*******************************************************************************
14 * Definitions
15 ******************************************************************************/
16/*!@brief codec handler size */
17#define HAL_CODEC_CS42888_HANDLER_SIZE (CS42888_I2C_HANDLER_SIZE + 4)
18/*******************************************************************************
19 * API
20 ******************************************************************************/
21
22#if defined(__cplusplus)
23extern "C" {
24#endif
25/*!
26 * @brief Codec initilization.
27 *
28 * @param handle codec handle.
29 * @param config codec configuration.
30 * @return kStatus_Success is success, else initial failed.
31 */
32status_t HAL_CODEC_CS42888_Init(void *handle, void *config);
33
34/*!
35 * @brief Codec de-initilization.
36 *
37 * @param handle codec handle.
38 * @return kStatus_Success is success, else de-initial failed.
39 */
40status_t HAL_CODEC_CS42888_Deinit(void *handle);
41
42/*!
43 * @brief set audio data format.
44 *
45 * @param handle codec handle.
46 * @param mclk master clock frequency in HZ.
47 * @param sampleRate sample rate in HZ.
48 * @param bitWidth bit width.
49 * @return kStatus_Success is success, else configure failed.
50 */
51status_t HAL_CODEC_CS42888_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth);
52
53/*!
54 * @brief set audio codec module volume.
55 *
56 * @param handle codec handle.
57 * @param playChannel audio codec play channel, can be a value or combine value of _codec_play_channel.
58 * @param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value.
59 * @return kStatus_Success is success, else configure failed.
60 */
61status_t HAL_CODEC_CS42888_SetVolume(void *handle, uint32_t playChannel, uint32_t volume);
62
63/*!
64 * @brief set audio codec module mute.
65 *
66 * @param handle codec handle.
67 * @param playChannel audio codec play channel, can be a value or combine value of _codec_play_channel.
68 * @param isMute true is mute, false is unmute.
69 * @return kStatus_Success is success, else configure failed.
70 */
71status_t HAL_CODEC_CS42888_SetMute(void *handle, uint32_t playChannel, bool isMute);
72
73/*!
74 * @brief set audio codec module power.
75 *
76 * @param handle codec handle.
77 * @param module audio codec module.
78 * @param powerOn true is power on, false is power down.
79 * @return kStatus_Success is success, else configure failed.
80 */
81status_t HAL_CODEC_CS42888_SetPower(void *handle, uint32_t module, bool powerOn);
82
83/*!
84 * @brief codec set record source.
85 *
86 * @param handle codec handle.
87 * @param recordSource audio codec record source, can be a value or combine value of _codec_record_source.
88 *
89 * @return kStatus_Success is success, else configure failed.
90 */
91status_t HAL_CODEC_CS42888_SetRecord(void *handle, uint32_t recordSource);
92
93/*!
94 * @brief codec set record channel.
95 *
96 * @param handle codec handle.
97 * @param leftRecordChannel audio codec record channel, reference _codec_record_channel, can be a value or combine value
98 of member in _codec_record_channel.
99 * @param rightRecordChannel audio codec record channel, reference _codec_record_channel, can be a value combine of
100 member in _codec_record_channel.
101
102 * @return kStatus_Success is success, else configure failed.
103 */
104status_t HAL_CODEC_CS42888_SetRecordChannel(void *handle, uint32_t leftRecordChannel, uint32_t rightRecordChannel);
105
106/*!
107 * @brief codec set play source.
108 *
109 * @param handle codec handle.
110 * @param playSource audio codec play source, can be a value or combine value of _codec_play_source.
111 *
112 * @return kStatus_Success is success, else configure failed.
113 */
114status_t HAL_CODEC_CS42888_SetPlay(void *handle, uint32_t playSource);
115
116/*!
117 * @brief codec module control.
118 *
119 * This function is used for codec module control, support switch digital interface cmd, can be expand to support codec
120 * module specific feature
121 *
122 * @param handle codec handle.
123 * @param cmd module control cmd, reference _codec_module_ctrl_cmd.
124 * @param data value to write, when cmd is kCODEC_ModuleRecordSourceChannel, the data should be a value combine
125 * of channel and source, please reference macro CODEC_MODULE_RECORD_SOURCE_CHANNEL(source, LP, LN, RP, RN), reference
126 * codec specific driver for detail configurations.
127 * @return kStatus_Success is success, else configure failed.
128 */
129status_t HAL_CODEC_CS42888_ModuleControl(void *handle, uint32_t cmd, uint32_t data);
130
131#if defined(__cplusplus)
132}
133#endif
134
135#endif /* _FSL_CS42888_ADAPTER_H_ */