Go to the documentation of this file.
15 #define HAL_WM8960_MODULE_CAPABILITY \
16 (kCODEC_SupportModuleADC | kCODEC_SupportModuleDAC | kCODEC_SupportModulePGA | kCODEC_SupportModuleHeadphone | \
17 kCODEC_SupportModuleLineout | kCODEC_SupportModuleSpeaker)
19 #define HAL_WM8960_PLAY_CAPABILITY \
20 (kCODEC_SupportPlayChannelLeft0 | kCODEC_SupportPlayChannelRight0 | kCODEC_SupportPlayChannelLeft1 | \
21 kCODEC_SupportPlayChannelRight1 | kCODEC_SupportPlaySourcePGA | kCODEC_SupportPlaySourceDAC | \
22 kCODEC_SupportPlaySourceInput)
24 #define HAL_WM8960_RECORD_CAPABILITY \
25 (kCODEC_SupportPlayChannelLeft0 | kCODEC_SupportPlayChannelLeft1 | kCODEC_SupportPlayChannelLeft2 | \
26 kCODEC_SupportPlayChannelRight0 | kCODEC_SupportPlayChannelRight1 | kCODEC_SupportPlayChannelRight2)
29 #define HAL_WM8960_MAP_PROTOCOL(protocol) \
30 (protocol == kCODEC_BusI2S ? \
32 protocol == kCODEC_BusLeftJustified ? \
33 kWM8960_BusLeftJustified : \
34 protocol == kCODEC_BusRightJustified ? \
35 kWM8960_BusRightJustified : \
36 protocol == kCODEC_BusPCMA ? kWM8960_BusPCMA : protocol == kCODEC_BusPCMB ? kWM8960_BusPCMB : kWM8960_BusI2S)
39 #define HAL_WM8960_MAP_MODULE(module) \
40 (module == kCODEC_ModuleADC ? \
42 module == kCODEC_ModuleDAC ? \
44 module == kCODEC_ModuleVref ? \
45 kWM8960_ModuleVREF : \
46 module == kCODEC_ModuleHeadphone ? \
48 module == kCODEC_ModuleMicbias ? \
49 kWM8960_ModuleMICB : \
50 module == kCODEC_ModuleMic ? \
52 module == kCODEC_ModuleLinein ? \
53 kWM8960_ModuleLineIn : \
54 module == kCODEC_ModuleSpeaker ? \
55 kWM8960_ModuleSpeaker : \
56 module == kCODEC_ModuleMxier ? kWM8960_ModuleOMIX : \
57 module == kCODEC_ModuleLineout ? kWM8960_ModuleLineOut : kWM8960_ModuleADC)
104 assert(handle !=
NULL);
120 assert(handle !=
NULL);
123 sampleRate, bitWidth);
136 assert(handle !=
NULL);
165 assert(handle !=
NULL);
194 assert(handle !=
NULL);
239 assert(handle !=
NULL);
status_t HAL_CODEC_SetPower(void *handle, uint32_t module, bool powerOn)
set audio codec module power.
status_t WM8960_SetVolume(wm8960_handle_t *handle, wm8960_module_t module, uint32_t volume)
Set the volume of different modules in WM8960.
status_t WM8960_SetMute(wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
Mute modules in WM8960.
status_t HAL_CODEC_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
set audio codec module volume.
Initialize structure of the codec.
uint32_t codecPlayCapability
#define HAL_WM8960_PLAY_CAPABILITY
status_t WM8960_SetModule(wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
Enable/disable expected devices.
status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
set audio data format.
#define HAL_WM8960_MODULE_CAPABILITY
module capability definition
status_t WM8960_ConfigDataFormat(wm8960_handle_t *handle, uint32_t sysclk, uint32_t sample_rate, uint32_t bits)
Configure the data format of audio data.
status_t HAL_CODEC_Deinit(void *handle)
Codec de-initilization.
#define HAL_WM8960_RECORD_CAPABILITY
status_t HAL_CODEC_ModuleControl(void *handle, uint32_t cmd, uint32_t data)
codec module control.
@ kStatus_CODEC_NotSupport
status_t WM8960_SetPlay(wm8960_handle_t *handle, uint32_t playSource)
SET the WM8960 play source.
status_t HAL_CODEC_SetPlay(void *handle, uint32_t playSource)
codec set play source.
Initialize structure of WM8960.
status_t WM8960_Init(wm8960_handle_t *handle, const wm8960_config_t *wm8960Config)
WM8960 initialize function.
status_t HAL_CODEC_SetMute(void *handle, uint32_t playChannel, bool isMute)
set audio codec module mute.
static const codec_capability_t s_wm8960_capability
static sai_transceiver_t config
status_t HAL_CODEC_SetRecordChannel(void *handle, uint32_t leftRecordChannel, uint32_t rightRecordChannel)
codec set record channel.
status_t HAL_CODEC_SetRecord(void *handle, uint32_t recordSource)
codec set record source.
int32_t status_t
Type used for all status and error return values.
status_t HAL_CODEC_Init(void *handle, void *config)
Codec initilization.
#define HAL_WM8960_MAP_MODULE(module)
wm8960 map module
status_t WM8960_Deinit(wm8960_handle_t *handle)
Deinit the WM8960 codec.