| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "board.h"
- #include "os_adapt.h"
- #include "FreeRTOS.h"
- #include "soc-dai.h"
- #include <string.h>
- #include <stdio.h>
- #define MAX_CODEC_NUM 4
- static struct codec_register_inf codec_tab[MAX_CODEC_NUM] = {0};
- static int codec_count = 0;
- extern void es7243e_init(void);
- extern void es8156_init(void);
- int audio_codec_register(struct codec_register_inf codec_reg_info)
- {
- if (codec_count < MAX_CODEC_NUM) {
- codec_tab[codec_count++] = codec_reg_info;
- } else {
- printf("%s, failed to register the codec!\n", __func__);
- return -1;
- }
- return 0;
- }
- struct codec_register_inf *get_codec_register_inf(const char *name)
- {
- int i;
- if (!name) {
- printf("%s, name null !\n", __func__);
- return NULL;
- }
- for (i=0; i<MAX_CODEC_NUM; i++) {
- if (strcmp(name, codec_tab[i].name) == 0) {
- return &codec_tab[i];
- }
- }
- return NULL;
- }
- void audio_codec_init(void)
- {
- #if (AUDIO_CODEC_ADC_IC == AUDIO_CODEC_ADC_ES7243E)
- es7243e_init();
- #endif
- #if (AUDIO_CODEC_DAC_IC == AUDIO_CODEC_DAC_ES8156)
- es8156_init();
- #endif
- }
|