nuttx/boards/arm/cxd56xx/drivers/audio/cxd56_audio_ac_reg.h
Alin Jerpelea 0881e0e8db boards: arm: cxd56xx: drivers: update license to Apache 2.0
This is a license change to Apache 2.0 license.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-01-25 04:34:41 -08:00

444 lines
11 KiB
C

/****************************************************************************
* boards/arm/cxd56xx/drivers/audio/cxd56_audio_ac_reg.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_AC_REG_H
#define __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_AC_REG_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/chip/audio.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
enum audio_codec_register_id_e
{
RI_REVID = 0,
RI_DEVICEID,
RI_PDN_AMICEXT,
RI_PDN_AMIC1,
RI_PDN_AMIC2,
RI_PDN_DAC,
RI_PDN_LINEIN,
RI_PDN_MIC,
RI_PDN_DMIC,
RI_PDN_DSPB,
RI_PDN_ANC,
RI_PDN_DNC1,
RI_PDN_DNC2,
RI_PDN_SMSTR,
RI_PDN_DSPS2,
RI_PDN_DSPS1,
RI_PDN_DSPC,
RI_FS_FS,
RI_DECIM0_EN,
RI_DECIM1_EN,
RI_SDES_EN,
RI_MCK_AHBMSTR_EN,
RI_AU_DAT_SEL2,
RI_AU_DAT_SEL1,
RI_COD_INSEL3,
RI_COD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F_1B1,
RI_DEQ_COEF_1B2,
RI_DEQ_COEF_1A1,
RI_DEQ_COEF_1A2,
RI_DEQ_COEF_2B0,
RI_DEQ_COEF_2B1,
RI_DEQ_COEF_2B2,
RI_DEQ_COEF_2A1,
RI_DEQ_COEF_2A2,
RI_DEQ_COEF_3B0,
RI_DEQ_COEF_3B1,
RI_DEQ_COEF_3B2,
RI_DEQ_COEF_3A1,
RI_DEQ_COEF_3A2,
RI_DEQ_COEF_4B0,
RI_DEQ_COEF_4B1,
RI_DEQ_COEF_4B2,
RI_DEQ_COEF_4A1,
RI_DEQ_COEF_4A2,
RI_DEQ_COEF_5B0,
RI_DEQ_COEF_5B1,
RI_DEQ_COEF_5B2,
RI_DEQ_COEF_5A1,
RI_DEQ_COEF_5A2,
RI_DEQ_COEF_6B0,
RI_DEQ_COEF_6B1,
RI_DEQ_COEF_6B2,
RI_DEQ_COEF_6A1,
RI_DEQ_COEF_6A2,
RI_LR_SWAP1,
RI_LR_SWAP2,
RI_DUMMY_0,
RI_DUMMY_1,
RI_DUMMY_2,
RI_DUMMY_3,
RI_DUMMY_4,
RI_DUMMY_5,
RI_DUMMY_6,
RI_DUMMY_7,
RI_DUMMY_8,
RI_DUMMY_9,
RI_DUMMY_10,
RI_DUMMY_11,
RI_DUMMY_12,
RI_DUMMY_13,
RI_DUMMY_14,
RI_DUMMY_15,
RI_DUMMY_16,
RI_DUMMY_17,
RI_DUMMY_18,
RI_DUMMY_19,
RI_DUMMY_20,
RI_DUMMY_21,
RI_DUMMY_22,
RI_DUMMY_23,
RI_DUMMY_24,
RI_DUMMY_25,
RI_DUMMY_26,
RI_DUMMY_27,
RI_DUMMY_28,
RI_DUMMY_29,
RI_DUMMY_30,
RI_DUMMY_31,
RI_RAM_RW_EN,
RI_REG_MAX_ENTRY
};
typedef enum audio_codec_register_id_e AC_REG_ID;
/****************************************************************************
* Public Types
****************************************************************************/
struct cxd56_audio_ac_reg_seloutch_s
{
uint8_t ch[CXD56_AUDIO_MIC_CH_MAX];
};
typedef struct cxd56_audio_ac_reg_seloutch_s cxd56_audio_ac_reg_seloutch_t;
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_checkid(void);
void cxd56_audio_ac_reg_resetdsp(void);
void cxd56_audio_ac_reg_initdsp(void);
void cxd56_audio_ac_reg_poweron_sdes(void);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_set_micmode(uint8_t mic_mode);
void cxd56_audio_ac_reg_poweron_codec(void);
void cxd56_audio_ac_reg_poweroff_codec(void);
void cxd56_audio_ac_reg_enable_serialif(void);
void cxd56_audio_ac_reg_init_selector(void);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_set_alcspc(void);
void cxd56_audio_ac_reg_poweron_dnc(void);
void cxd56_audio_ac_reg_poweroff_dnc(void);
void cxd56_audio_ac_reg_disable_dnc(cxd56_audio_dnc_id_t id);
void cxd56_audio_ac_reg_enable_dnc(cxd56_audio_dnc_id_t id);
void cxd56_audio_ac_reg_mute_dnc(cxd56_audio_dnc_id_t id);
void cxd56_audio_ac_reg_unmute_dnc(cxd56_audio_dnc_id_t id);
void cxd56_audio_ac_reg_set_dncram(cxd56_audio_dnc_id_t id,
FAR cxd56_audio_dnc_bin_t *bin);
void cxd56_audio_ac_reg_enable_deq(void);
void cxd56_audio_ac_reg_disable_deq(void);
void cxd56_audio_ac_reg_set_deq_param(FAR cxd56_audio_deq_coef_t *deq);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_poweron_cic(
uint8_t mic_in,
uint8_t mic_mode,
uint8_t cic_num,
FAR cxd56_audio_mic_gain_t *gain);
void cxd56_audio_ac_reg_poweroff_cic(void);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_poweron_decim(uint8_t mic_mode,
uint8_t clk_mode);
void cxd56_audio_ac_reg_poweroff_decim(void);
void cxd56_audio_ac_reg_poweron_smaster(uint8_t clk_mode);
void cxd56_audio_ac_reg_poweroff_smaster(void);
void cxd56_audio_ac_reg_enable_smaster(void);
void cxd56_audio_ac_reg_disable_smaster(void);
void cxd56_audio_ac_reg_enable_beep(void);
void cxd56_audio_ac_reg_disable_beep(void);
void cxd56_audio_ac_reg_set_beep_freq(uint32_t freq);
void cxd56_audio_ac_reg_set_beep_vol(uint32_t vol);
void cxd56_audio_ac_reg_set_cicgain(uint8_t cic_num,
FAR cxd56_audio_mic_gain_t *gain);
void cxd56_audio_ac_reg_enable_digsft(void);
void cxd56_audio_ac_reg_disable_digsft(void);
void cxd56_audio_ac_reg_set_dsrrate(uint32_t rate);
void cxd56_audio_ac_reg_set_seloutch(
FAR cxd56_audio_ac_reg_seloutch_t *seloutch);
void cxd56_audio_ac_reg_enable_dma(void);
void cxd56_audio_ac_reg_poweron_i2s(uint8_t clk_mode);
void cxd56_audio_ac_reg_enable_i2s_src1(void);
void cxd56_audio_ac_reg_enable_i2s_src2(void);
void cxd56_audio_ac_reg_enable_i2s_bcklrckout(void);
void cxd56_audio_ac_reg_disable_i2s_bcklrckout(void);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_set_selector(
cxd56_audio_signal_t sig,
cxd56_audio_sel_t sel);
CXD56_AUDIO_ECODE cxd56_audio_ac_reg_enable_cstereo(bool sign_inv,
int16_t vol);
void cxd56_audio_ac_reg_disable_cstereo(void);
void cxd56_audio_ac_reg_set_vol_sdin1(uint32_t vol);
void cxd56_audio_ac_reg_set_vol_sdin2(uint32_t vol);
void cxd56_audio_ac_reg_set_vol_dac(uint32_t vol);
#endif /* __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_AC_REG_H */