2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2020-01-07 15:21:58 +01:00
|
|
|
* boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.c
|
2019-10-10 01:55:20 +02:00
|
|
|
*
|
2021-01-25 08:52:15 +01:00
|
|
|
* 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
|
2019-10-10 01:55:20 +02:00
|
|
|
*
|
2021-01-25 08:52:15 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2019-10-10 01:55:20 +02:00
|
|
|
*
|
2021-01-25 08:52:15 +01:00
|
|
|
* 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.
|
2019-10-10 01:55:20 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2019-10-10 01:55:20 +02:00
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <arch/chip/audio.h>
|
|
|
|
|
|
|
|
#include "cxd56_audio_config.h"
|
|
|
|
#include "cxd56_audio_bca_reg.h"
|
|
|
|
|
2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2019-10-10 01:55:20 +02:00
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#define BCA_REG_BASE (0x0c000000 + 0x02300000)
|
|
|
|
|
|
|
|
#define TRANS_CH_NUM_MAX 8
|
|
|
|
#define TRANS_CH_NUM_24BIT 8
|
|
|
|
#define TRANS_CH_NUM_16BIT 4
|
|
|
|
#define TRANS_CH_NO_SELECT 8
|
|
|
|
|
|
|
|
enum dma_i2s_in_sel_e
|
|
|
|
{
|
|
|
|
I2S_IN_SEL_SRC1L = 0,
|
|
|
|
I2S_IN_SEL_SRC1R = 1,
|
|
|
|
I2S_IN_SEL_UNUSE
|
|
|
|
};
|
|
|
|
|
|
|
|
enum dma_i2s_out_sel_e
|
|
|
|
{
|
|
|
|
I2S_OUT_SEL_SD1L = 0,
|
|
|
|
I2S_OUT_SEL_SD1R = 1,
|
|
|
|
I2S_OUT_SEL_UNUSE
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BCA_REG_MAX_BIT 32
|
|
|
|
|
2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2019-10-10 01:55:20 +02:00
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct audio_bca_reg_s
|
|
|
|
{
|
|
|
|
uint32_t addr;
|
|
|
|
uint32_t pos;
|
|
|
|
uint32_t len;
|
|
|
|
uint32_t init;
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct audio_bca_reg_s g_bca_reg[BCA_REG_MAX_ENTRY] =
|
|
|
|
{
|
|
|
|
{0x1000, 2, 30, 0x00000000}, /* Mic_In_start_adr (0x00000000) */
|
|
|
|
{0x1004, 0, 32, 0x00000000}, /* Mic_In_sample_no (0x00000000) */
|
|
|
|
{0x1008, 0, 2, 0x00000000}, /* Mic_In_rtd_trg (0x00) */
|
|
|
|
{0x1008, 2, 1, 0x00000000}, /* Mic_In_nointr (0x00) */
|
|
|
|
{0x100c, 0, 1, 0x00000000}, /* Mic_In_bitwt (0x00) */
|
|
|
|
{0x1010, 0, 4, 0x00000000}, /* Mic_In_ch8_sel (0x00) */
|
|
|
|
{0x1010, 4, 4, 0x00000000}, /* Mic_In_ch7_sel (0x00) */
|
|
|
|
{0x1010, 8, 4, 0x00000000}, /* Mic_In_ch6_sel (0x00) */
|
|
|
|
{0x1010, 12, 4, 0x00000000}, /* Mic_In_ch5_sel (0x00) */
|
|
|
|
{0x1010, 16, 4, 0x00000000}, /* Mic_In_ch4_sel (0x00) */
|
|
|
|
{0x1010, 20, 4, 0x00000000}, /* Mic_In_ch3_sel (0x00) */
|
|
|
|
{0x1010, 24, 4, 0x00000000}, /* Mic_In_ch2_sel (0x00) */
|
|
|
|
{0x1010, 28, 4, 0x00000000}, /* Mic_In_ch1_sel (0x00) */
|
|
|
|
{0x1014, 0, 1, 0x00000000}, /* Mic_In_start (0x00) */
|
|
|
|
{0x1014, 8, 8, 0x00000000}, /* Mic_In_error_setting (0x00) */
|
|
|
|
{0x1014, 16, 4, 0x00000000}, /* Mic_In_monbuf (0x00) */
|
|
|
|
{0x1080, 2, 30, 0x00000000}, /* I2s1_In_start_adr (0x00000000) */
|
|
|
|
{0x1084, 0, 32, 0x00000000}, /* I2s1_In_sample_no (0x00000000) */
|
|
|
|
{0x1088, 0, 2, 0x00000000}, /* I2s1_In_rtd_trg (0x00) */
|
|
|
|
{0x1088, 2, 1, 0x00000000}, /* I2s1_In_nointr (0x00) */
|
|
|
|
{0x108c, 0, 1, 0x00000000}, /* I2s1_In_bitwt (0x00) */
|
|
|
|
{0x1090, 0, 2, 0x00000000}, /* I2s1_In_ch2_sel (0x00) */
|
|
|
|
{0x1090, 4, 2, 0x00000000}, /* I2s1_In_ch1_sel (0x00) */
|
|
|
|
{0x1094, 0, 1, 0x00000000}, /* I2s1_In_Mon_start (0x00) */
|
|
|
|
{0x1094, 8, 8, 0x00000000}, /* I2s1_In_Mon_error_setting (0x00) */
|
|
|
|
{0x1094, 16, 4, 0x00000000}, /* I2s1_In_Mon_monbuf (0x00) */
|
|
|
|
{0x10a0, 2, 30, 0x00000000}, /* I2s2_In_start_adr (0x00000000) */
|
|
|
|
{0x10a4, 0, 32, 0x00000000}, /* I2s2_In_sample_no (0x00000000) */
|
|
|
|
{0x10a8, 0, 2, 0x00000000}, /* I2s2_In_rtd_trg (0x00) */
|
|
|
|
{0x10a8, 2, 1, 0x00000000}, /* I2s2_In_nointr (0x00) */
|
|
|
|
{0x10ac, 0, 1, 0x00000000}, /* I2s2_In_bitwt (0x00) */
|
|
|
|
{0x10b0, 0, 2, 0x00000000}, /* I2s2_In_ch2_sel (0x00) */
|
|
|
|
{0x10b0, 4, 2, 0x00000000}, /* I2s2_In_ch1_sel (0x00) */
|
|
|
|
{0x10b4, 0, 1, 0x00000000}, /* I2s2_In_Mon_start (0x00) */
|
|
|
|
{0x10b4, 8, 8, 0x00000000}, /* I2s2_In_Mon_error_setting (0x00) */
|
|
|
|
{0x10b4, 16, 4, 0x00000000}, /* I2s2_In_Mon_monbuf (0x00) */
|
|
|
|
{0x10c0, 2, 30, 0x00000000}, /* I2s1_Out_start_adr (0x00000000) */
|
|
|
|
{0x10c4, 0, 32, 0x00000000}, /* I2s1_Out_sample_no (0x00000000) */
|
|
|
|
{0x10c8, 0, 2, 0x00000000}, /* I2s1_Out_rtd_trg (0x00) */
|
|
|
|
{0x10c8, 2, 1, 0x00000000}, /* I2s1_Out_nointr (0x00) */
|
|
|
|
{0x10cc, 0, 1, 0x00000000}, /* I2s1_Out_bitwt (0x00) */
|
|
|
|
{0x10d0, 0, 2, 0x00000000}, /* I2s1_Out_sd1_r_sel (0x00) */
|
|
|
|
{0x10d0, 4, 2, 0x00000000}, /* I2s1_Out_sd1_l_sel (0x00) */
|
|
|
|
{0x10d4, 0, 1, 0x00000000}, /* I2s1_Out_Mon_start (0x00) */
|
|
|
|
{0x10d4, 8, 8, 0x00000000}, /* I2s1_Out_Mon_error_setting (0x00) */
|
|
|
|
{0x10d4, 16, 4, 0x00000000}, /* I2s1_Out_Mon_monbuf (0x00) */
|
|
|
|
{0x10e0, 2, 30, 0x00000000}, /* I2s2_Out_start_adr (0x00000000) */
|
|
|
|
{0x10e4, 0, 32, 0x00000000}, /* I2s2_Out_sample_no (0x00000000) */
|
|
|
|
{0x10e8, 0, 2, 0x00000000}, /* I2s2_Out_rtd_trg (0x00) */
|
|
|
|
{0x10e8, 2, 1, 0x00000000}, /* I2s2_Out_nointr (0x00) */
|
|
|
|
{0x10ec, 0, 1, 0x00000000}, /* I2s2_Out_bitwt (0x00) */
|
|
|
|
{0x10f0, 0, 2, 0x00000000}, /* I2s2_Out_sd1_r_sel (0x00) */
|
|
|
|
{0x10f0, 4, 2, 0x00000000}, /* I2s2_Out_sd1_l_sel (0x00) */
|
|
|
|
{0x10f4, 0, 1, 0x00000000}, /* I2s2_Out_Mon_start (0x00) */
|
|
|
|
{0x10f4, 8, 8, 0x00000000}, /* I2s2_Out_Mon_error_setting (0x00) */
|
|
|
|
{0x10f4, 16, 4, 0x00000000}, /* I2s2_Out_Mon_monbuf (0x00) */
|
|
|
|
{0x1110, 0, 1, 0x00000000}, /* I2s_ensel (0x00) */
|
|
|
|
{0x1120, 0, 32, 0x00000000}, /* Mici_prdat_u (0x00000000) */
|
|
|
|
{0x1130, 0, 32, 0x00000000}, /* I2s1_In_prdat_u (0x00000000) */
|
|
|
|
{0x1134, 0, 32, 0x00000000}, /* I2s2_In_prdat_u (0x00000000) */
|
|
|
|
{0x1138, 0, 32, 0x00000000}, /* I2s1_Out_prdat_d (0x00000000) */
|
|
|
|
{0x113c, 0, 32, 0x00000000}, /* I2s2_Out_prdat_d (0x00000000) */
|
|
|
|
{0x1140, 0, 1, 0x00000000}, /* Mic_Int_Ctrl_done_mic (0x00) */
|
|
|
|
{0x1140, 1, 1, 0x00000000}, /* Mic_Int_Ctrl_err_mic (0x00) */
|
|
|
|
{0x1140, 2, 1, 0x00000000}, /* Mic_Int_Ctrl_smp_mic (0x00) */
|
|
|
|
{0x1140, 3, 1, 0x00000000}, /* Mic_Int_Ctrl_cmb_mic (0x00) */
|
|
|
|
{0x1144, 0, 1, 0x00000000}, /* I2s1_Int_Ctrl_done_i2so (0x00) */
|
|
|
|
{0x1144, 1, 1, 0x00000000}, /* I2s1_Int_Ctrl_err_i2so (0x00) */
|
|
|
|
{0x1144, 2, 1, 0x00000000}, /* I2s1_Int_Ctrl_done_i2si (0x00) */
|
|
|
|
{0x1144, 3, 1, 0x00000000}, /* I2s1_Int_Ctrl_err_i2si (0x00) */
|
|
|
|
{0x1144, 4, 1, 0x00000000}, /* I2s1_Int_Ctrl_smp_i2s (0x00) */
|
|
|
|
{0x1144, 5, 1, 0x00000000}, /* I2s1_Int_Ctrl_cmb_i2s (0x00) */
|
|
|
|
{0x1148, 0, 1, 0x00000000}, /* I2s2_Int_Ctrl_done_i2so (0x00) */
|
|
|
|
{0x1148, 1, 1, 0x00000000}, /* I2s2_Int_Ctrl_err_i2so (0x00) */
|
|
|
|
{0x1148, 2, 1, 0x00000000}, /* I2s2_Int_Ctrl_done_i2si (0x00) */
|
|
|
|
{0x1148, 3, 1, 0x00000000}, /* I2s2_Int_Ctrl_err_i2si (0x00) */
|
|
|
|
{0x1148, 4, 1, 0x00000000}, /* I2s2_Int_Ctrl_smp_i2s (0x00) */
|
|
|
|
{0x1148, 5, 1, 0x00000000}, /* I2s2_Int_Ctrl_cmb_i2s (0x00) */
|
|
|
|
{0x114c, 0, 1, 0x00000001}, /* Mic_Int_Mask_done_mic (0x00) */
|
|
|
|
{0x114c, 1, 1, 0x00000001}, /* Mic_Int_Mask_err_mic (0x00) */
|
|
|
|
{0x114c, 2, 1, 0x00000001}, /* Mic_Int_Mask_smp_mic (0x00) */
|
|
|
|
{0x114c, 3, 1, 0x00000001}, /* Mic_Int_Mask_cmb_mic (0x00) */
|
|
|
|
{0x114c, 30, 1, 0x00000000}, /* Mic_Int_Mask_nostpmsk (0x00) */
|
|
|
|
{0x114c, 31, 1, 0x00000000}, /* Mic_Int_Mask_srst_mic (0x00) */
|
|
|
|
{0x1150, 0, 1, 0x00000001}, /* I2s1_Int_Mask_done_i2so (0x00) */
|
|
|
|
{0x1150, 1, 1, 0x00000001}, /* I2s1_Int_Mask_err_i2so (0x00) */
|
|
|
|
{0x1150, 2, 1, 0x00000001}, /* I2s1_Int_Mask_done_i2si (0x00) */
|
|
|
|
{0x1150, 3, 1, 0x00000001}, /* I2s1_Int_Mask_err_i2si (0x00) */
|
|
|
|
{0x1150, 4, 1, 0x00000001}, /* I2s1_Int_Mask_smp_i2s (0x00) */
|
|
|
|
{0x1150, 5, 1, 0x00000001}, /* I2s1_Int_Mask_cmb_i2s (0x00) */
|
|
|
|
{0x1150, 30, 1, 0x00000000}, /* I2s1_Int_Mask_nostpmsk_i2s (0x00) */
|
|
|
|
{0x1150, 31, 1, 0x00000000}, /* I2s1_Int_Mask_srst_i2s (0x00) */
|
|
|
|
{0x1154, 0, 1, 0x00000001}, /* I2s2_Int_Mask_done_i2so (0x00) */
|
|
|
|
{0x1154, 1, 1, 0x00000001}, /* I2s2_Int_Mask_err_i2so (0x00) */
|
|
|
|
{0x1154, 2, 1, 0x00000001}, /* I2s2_Int_Mask_done_i2si (0x00) */
|
|
|
|
{0x1154, 3, 1, 0x00000001}, /* I2s2_Int_Mask_err_i2si (0x00) */
|
|
|
|
{0x1154, 4, 1, 0x00000001}, /* I2s2_Int_Mask_smp_i2s (0x00) */
|
|
|
|
{0x1154, 5, 1, 0x00000001}, /* I2s2_Int_Mask_cmb_i2s (0x00) */
|
|
|
|
{0x1154, 30, 1, 0x00000000}, /* I2s2_Int_Mask_nostpmsk_i2s (0x00) */
|
|
|
|
{0x1154, 31, 1, 0x00000000}, /* I2s2_Int_Mask_srst_i2s (0x00) */
|
|
|
|
{0x1158, 0, 1, 0x00000001}, /* Int_m_hresp_err (0x01) */
|
|
|
|
{0x1158, 8, 1, 0x00000001}, /* Int_m_I2s1_bck_err1 (0x01) */
|
|
|
|
{0x1158, 9, 1, 0x00000001}, /* Int_m_I2s1_bck_err2 (0x01) */
|
|
|
|
{0x1158, 10, 1, 0x00000001}, /* Int_m_anc_faint (0x01) */
|
|
|
|
{0x1158, 17, 1, 0x00000001}, /* Int_m_ovf_smasl (0x01) */
|
|
|
|
{0x1158, 18, 1, 0x00000001}, /* Int_m_ovf_smasr (0x01) */
|
|
|
|
{0x1158, 21, 1, 0x00000001}, /* Int_m_ovf_dnc1l (0x01) */
|
|
|
|
{0x1158, 22, 1, 0x00000001}, /* Int_m_ovf_dnc1r (0x01) */
|
|
|
|
{0x1158, 23, 1, 0x00000001}, /* Int_m_ovf_dnc2l (0x01) */
|
|
|
|
{0x1158, 24, 1, 0x00000001}, /* Int_m_ovf_dnc2r (0x01) */
|
|
|
|
{0x115c, 0, 1, 0x00000000}, /* Int_clr_hresp_err (0x00) */
|
|
|
|
{0x115c, 8, 1, 0x00000000}, /* Int_clr_I2s1_bck_err1 (0x00) */
|
|
|
|
{0x115c, 9, 1, 0x00000000}, /* Int_clr_I2s1_bck_err2 (0x00) */
|
|
|
|
{0x115c, 10, 1, 0x00000000}, /* Int_clr_anc_faint (0x00) */
|
|
|
|
{0x115c, 17, 1, 0x00000000}, /* Int_clr_ovf_smasl (0x00) */
|
|
|
|
{0x115c, 18, 1, 0x00000000}, /* Int_clr_ovf_smasr (0x00) */
|
|
|
|
{0x115c, 21, 1, 0x00000000}, /* Int_clr_ovf_dnc1l (0x00) */
|
|
|
|
{0x115c, 22, 1, 0x00000000}, /* Int_clr_ovf_dnc1r (0x00) */
|
|
|
|
{0x115c, 23, 1, 0x00000000}, /* Int_clr_ovf_dnc2l (0x00) */
|
|
|
|
{0x115c, 24, 1, 0x00000000}, /* Int_clr_ovf_dnc2r (0x00) */
|
|
|
|
{0x1160, 0, 1, 0x00000000}, /* Int_hresp_err (0x00) */
|
|
|
|
{0x1160, 8, 1, 0x00000000}, /* Int_i2s_bck_err1 (0x00) */
|
|
|
|
{0x1160, 9, 1, 0x00000000}, /* Int_i2s_bck_err2 (0x00) */
|
|
|
|
{0x1160, 10, 1, 0x00000000}, /* Int_anc_faint (0x00) */
|
|
|
|
{0x1160, 17, 1, 0x00000000}, /* Int_ovf_smasl (0x00) */
|
|
|
|
{0x1160, 18, 1, 0x00000000}, /* Int_ovf_smasr (0x00) */
|
|
|
|
{0x1160, 21, 1, 0x00000000}, /* Int_ovf_dnc1l (0x00) */
|
|
|
|
{0x1160, 22, 1, 0x00000000}, /* Int_ovf_dnc1r (0x00) */
|
|
|
|
{0x1160, 23, 1, 0x00000000}, /* Int_ovf_dnc2l (0x00) */
|
|
|
|
{0x1160, 24, 1, 0x00000000}, /* Int_ovf_dnc2r (0x00) */
|
|
|
|
{0x1180, 8, 24, 0x00000000}, /* Dbg_Mic_ch1_data (0x00) */
|
|
|
|
{0x1184, 8, 24, 0x00000000}, /* Dbg_Mic_ch2_data (0x00) */
|
|
|
|
{0x1188, 8, 24, 0x00000000}, /* Dbg_Mic_ch3_data (0x00) */
|
|
|
|
{0x118c, 8, 24, 0x00000000}, /* Dbg_Mic_ch4_data (0x00) */
|
|
|
|
{0x1190, 8, 24, 0x00000000}, /* Dbg_Mic_ch5_data (0x00) */
|
|
|
|
{0x1194, 8, 24, 0x00000000}, /* Dbg_Mic_ch6_data (0x00) */
|
|
|
|
{0x1198, 8, 24, 0x00000000}, /* Dbg_Mic_ch7_data (0x00) */
|
|
|
|
{0x119c, 8, 24, 0x00000000}, /* Dbg_Mic_ch8_data (0x00) */
|
|
|
|
{0x11a0, 8, 24, 0x00000000}, /* Dbg_I2s1_u_ch1_data (0x00) */
|
|
|
|
{0x11a4, 8, 24, 0x00000000}, /* Dbg_I2s1_u_ch2_data (0x00) */
|
|
|
|
{0x11a8, 8, 24, 0x00000000}, /* Dbg_I2s1_d_ch1_data (0x00) */
|
|
|
|
{0x11ac, 8, 24, 0x00000000}, /* Dbg_I2s1_d_ch2_data (0x00) */
|
|
|
|
{0x11b0, 8, 24, 0x00000000}, /* Dbg_I2s2_u_ch1_data (0x00) */
|
|
|
|
{0x11b4, 8, 24, 0x00000000}, /* Dbg_I2s2_u_ch2_data (0x00) */
|
|
|
|
{0x11b8, 8, 24, 0x00000000}, /* Dbg_I2s2_d_ch1_data (0x00) */
|
|
|
|
{0x11bc, 8, 24, 0x00000000}, /* Dbg_I2s2_d_ch2_data (0x00) */
|
|
|
|
{0x11c0, 0, 1, 0x00000000}, /* Dbg_Ctrl_mic_dbg_en (0x00) */
|
|
|
|
{0x11c0, 1, 1, 0x00000000}, /* Dbg_Ctrl_I2s1_dbg_u_en (0x00) */
|
|
|
|
{0x11c0, 2, 1, 0x00000000}, /* Dbg_Ctrl_I2s1_dbg_d_en (0x00) */
|
|
|
|
{0x11c0, 3, 1, 0x00000000}, /* Dbg_Ctrl_I2s2_dbg_u_en (0x00) */
|
|
|
|
{0x11c0, 4, 1, 0x00000000}, /* Dbg_Ctrl_I2s2_dbg_d_en (0x00) */
|
|
|
|
{0x11f0, 0, 1, 0x00000000}, /* Clk_En_ahbmstr_mic_en (0x00) */
|
|
|
|
{0x11f0, 1, 1, 0x00000000}, /* Clk_En_ahbmstr_I2s1_en (0x00) */
|
|
|
|
{0x11f0, 2, 1, 0x00000000}, /* Clk_En_ahbmstr_I2s2_en (0x00) */
|
|
|
|
{0x11fc, 0, 8, 0x00000064}, /* Mclk_Mon_thresh (0x64) */
|
|
|
|
{0x1730, 0, 32, 0x00000000}, /* AHB MASTER MIC MASK (0x00) */
|
|
|
|
{0x1f30, 0, 32, 0x00000000}, /* AHB MASTER I2S1 MASK (0x00) */
|
2020-01-07 22:29:52 +01:00
|
|
|
{0x2730, 0, 32, 0x00000000}, /* AHB MASTER I2S2 MASK (0x00) */
|
2019-10-10 01:55:20 +02:00
|
|
|
};
|
|
|
|
|
2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2019-10-10 01:55:20 +02:00
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
uint32_t write_bca_reg(BCA_REG_ID reg_id, uint32_t data)
|
|
|
|
{
|
|
|
|
volatile uint32_t *addr;
|
|
|
|
uint32_t curr;
|
|
|
|
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
|
|
|
|
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
|
|
|
|
|
|
|
|
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
|
|
|
|
|
|
|
|
curr = *addr & ~(mask << g_bca_reg[reg_id].pos);
|
|
|
|
*addr = curr | ((data & mask) << g_bca_reg[reg_id].pos);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t write_bca_reg_mask(BCA_REG_ID reg_id)
|
|
|
|
{
|
|
|
|
volatile uint32_t *addr;
|
|
|
|
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
|
|
|
|
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
|
|
|
|
|
|
|
|
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
|
|
|
|
*addr = mask << g_bca_reg[reg_id].pos;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t read_bca_reg(BCA_REG_ID reg_id)
|
|
|
|
{
|
|
|
|
volatile uint32_t *addr;
|
|
|
|
uint32_t data = 0;
|
|
|
|
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
|
|
|
|
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
|
|
|
|
|
|
|
|
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
|
|
|
|
data = (*addr >> g_bca_reg[reg_id].pos) & mask;
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t write32_bca_reg(uint32_t offset, uint32_t data)
|
|
|
|
{
|
|
|
|
volatile uint32_t *addr;
|
|
|
|
|
|
|
|
addr = (volatile uint32_t *)(BCA_REG_BASE + offset);
|
|
|
|
*addr = data;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t read32_bca_reg(uint32_t offset)
|
|
|
|
{
|
|
|
|
volatile uint32_t *addr;
|
|
|
|
uint32_t data = 0;
|
|
|
|
|
|
|
|
addr = (volatile uint32_t *)(BCA_REG_BASE + offset);
|
|
|
|
data = *addr;
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void enable_mic_in_fmt24(uint8_t mic_num)
|
|
|
|
{
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
BCA_REG_ID mic_ch_sell[TRANS_CH_NUM_MAX] =
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
BCA_MIC_IN_CH1_SEL,
|
|
|
|
BCA_MIC_IN_CH2_SEL,
|
|
|
|
BCA_MIC_IN_CH3_SEL,
|
|
|
|
BCA_MIC_IN_CH4_SEL,
|
|
|
|
BCA_MIC_IN_CH5_SEL,
|
|
|
|
BCA_MIC_IN_CH6_SEL,
|
|
|
|
BCA_MIC_IN_CH7_SEL,
|
|
|
|
BCA_MIC_IN_CH8_SEL
|
2019-10-10 01:55:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
mic_num = (mic_num > TRANS_CH_NUM_24BIT) ? TRANS_CH_NUM_24BIT : mic_num;
|
|
|
|
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_MIC_IN_BITWT, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
|
|
|
|
for (i = 0; i < mic_num; i++)
|
|
|
|
{
|
|
|
|
write_bca_reg(mic_ch_sell[i], i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = mic_num; i < TRANS_CH_NUM_24BIT; i++)
|
|
|
|
{
|
|
|
|
write_bca_reg(mic_ch_sell[i], TRANS_CH_NO_SELECT);
|
|
|
|
}
|
|
|
|
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_MIC_EN, 1);
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_MIC_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_MIC_IN_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enable_mic_in_fmt16(uint8_t mic_num)
|
|
|
|
{
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
BCA_REG_ID mic_ch_sell[TRANS_CH_NUM_MAX] =
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
BCA_MIC_IN_CH1_SEL,
|
|
|
|
BCA_MIC_IN_CH2_SEL,
|
|
|
|
BCA_MIC_IN_CH3_SEL,
|
|
|
|
BCA_MIC_IN_CH4_SEL,
|
|
|
|
BCA_MIC_IN_CH5_SEL,
|
|
|
|
BCA_MIC_IN_CH6_SEL,
|
|
|
|
BCA_MIC_IN_CH7_SEL,
|
|
|
|
BCA_MIC_IN_CH8_SEL
|
2019-10-10 01:55:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
mic_num = (mic_num > (TRANS_CH_NUM_16BIT * 2)) ?
|
|
|
|
TRANS_CH_NUM_16BIT : (mic_num + 1) / 2;
|
|
|
|
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_MIC_IN_BITWT, 1);
|
2019-10-10 01:55:20 +02:00
|
|
|
|
|
|
|
for (i = 0; i < mic_num; i++)
|
|
|
|
{
|
|
|
|
write_bca_reg(mic_ch_sell[i], i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = mic_num; i < TRANS_CH_NUM_MAX; i++)
|
|
|
|
{
|
|
|
|
write_bca_reg(mic_ch_sell[i], TRANS_CH_NO_SELECT);
|
|
|
|
}
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_MIC_EN, 1);
|
|
|
|
write_bca_reg(BCA_MIC_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_MIC_IN_SAMPLE_NO, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s1_in_fmt24(void)
|
|
|
|
{
|
|
|
|
write_bca_reg(BCA_I2S1_IN_BITWT, 0);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_CH2_SEL, I2S_IN_SEL_SRC1R);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
|
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_SAMPLE_NO, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s1_in_fmt16(void)
|
|
|
|
{
|
|
|
|
write_bca_reg(BCA_I2S1_IN_BITWT, 1);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_CH2_SEL, I2S_IN_SEL_UNUSE);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
|
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S1_IN_SAMPLE_NO, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s2_in_fmt24(void)
|
|
|
|
{
|
|
|
|
write_bca_reg(BCA_I2S2_IN_BITWT, 0);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_CH2_SEL, I2S_IN_SEL_SRC1R);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
|
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_SAMPLE_NO, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s2_in_fmt16(void)
|
|
|
|
{
|
|
|
|
write_bca_reg(BCA_I2S2_IN_BITWT, 0);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_CH2_SEL, I2S_IN_SEL_UNUSE);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
|
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_IN_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s1_out_fmt24(void)
|
|
|
|
{
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S1_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
|
|
|
|
write_bca_reg(BCA_I2S1_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
|
|
|
|
write_bca_reg(BCA_I2S1_OUT_BITWT, 0);
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S1_OUT_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s1_out_fmt16(void)
|
|
|
|
{
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S1_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
|
|
|
|
write_bca_reg(BCA_I2S1_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
|
|
|
|
write_bca_reg(BCA_I2S1_OUT_BITWT, 1);
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S1_OUT_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s2_out_fmt24(void)
|
|
|
|
{
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S2_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_BITWT, 0);
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S2_OUT_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enable_i2s2_out_fmt16(void)
|
|
|
|
{
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S2_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_BITWT, 1);
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
|
2022-02-08 03:08:09 +01:00
|
|
|
write_bca_reg(BCA_I2S2_OUT_START_ADR, 0x00000000);
|
|
|
|
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
2020-04-16 18:17:46 +02:00
|
|
|
/****************************************************************************
|
2019-10-10 01:55:20 +02:00
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_bck_err_int(void)
|
|
|
|
{
|
2020-01-08 19:55:46 +01:00
|
|
|
write_bca_reg(BCA_INT_M_I2S1_BCL_ERR1, 0);
|
|
|
|
write_bca_reg(BCA_INT_M_I2S1_BCL_ERR2, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_set_smaster(void)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_INT_M_OVF_SMASL, 0);
|
|
|
|
write_bca_reg(BCA_INT_M_OVF_SMASR, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_set_datarate(uint8_t clk_mode)
|
|
|
|
{
|
|
|
|
if (clk_mode == CXD56_AUDIO_CLKMODE_HIRES)
|
|
|
|
{
|
|
|
|
/* Set 4fs. */
|
|
|
|
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_I2S_ENSEL, 1);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Set 1fs. */
|
|
|
|
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_I2S_ENSEL, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_en_fmt24(cxd56_audio_dma_t handle, uint8_t ch_num)
|
|
|
|
{
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
|
|
|
enable_mic_in_fmt24(ch_num);
|
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
enable_i2s1_in_fmt24();
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
|
|
|
enable_i2s1_out_fmt24();
|
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
enable_i2s2_in_fmt24();
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
|
|
|
enable_i2s2_out_fmt24();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_en_fmt16(cxd56_audio_dma_t handle, uint8_t ch_num)
|
|
|
|
{
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
|
|
|
enable_mic_in_fmt16(ch_num);
|
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
enable_i2s1_in_fmt16();
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
|
|
|
enable_i2s1_out_fmt16();
|
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
enable_i2s2_in_fmt16();
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
|
|
|
enable_i2s2_out_fmt16();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_get_dma_mstate(cxd56_audio_dma_t handle,
|
2022-04-17 08:01:48 +02:00
|
|
|
cxd56_audio_dma_mstate_t *state)
|
2019-10-10 01:55:20 +02:00
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id_start;
|
|
|
|
BCA_REG_ID reg_id_error;
|
|
|
|
BCA_REG_ID reg_id_monbuf;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id_start = BCA_MIC_IN_START;
|
|
|
|
reg_id_error = BCA_MIC_IN_ERROR_SETTING;
|
|
|
|
reg_id_monbuf = BCA_MIC_IN_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id_start = BCA_I2S1_IN_MON_START;
|
|
|
|
reg_id_error = BCA_I2S1_IN_MON_ERROR_SETTING;
|
|
|
|
reg_id_monbuf = BCA_I2S1_IN_MON_MONBUF;
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id_start = BCA_I2S1_OUT_MON_START;
|
|
|
|
reg_id_error = BCA_I2S1_OUT_MON_ERROR_SETTING;
|
|
|
|
reg_id_monbuf = BCA_I2S1_OUT_MON_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id_start = BCA_I2S2_IN_MON_START;
|
|
|
|
reg_id_error = BCA_I2S2_IN_MON_ERROR_SETTING;
|
|
|
|
reg_id_monbuf = BCA_I2S2_IN_MON_MONBUF;
|
|
|
|
break;
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id_start = BCA_I2S2_OUT_MON_START;
|
|
|
|
reg_id_error = BCA_I2S2_OUT_MON_ERROR_SETTING;
|
|
|
|
reg_id_monbuf = BCA_I2S2_OUT_MON_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2020-01-07 22:29:52 +01:00
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
state->start = (uint8_t)read_bca_reg(reg_id_start);
|
|
|
|
state->err_setting = (uint8_t)read_bca_reg(reg_id_error);
|
|
|
|
state->buf_state = (uint8_t)read_bca_reg(reg_id_monbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_en_bus_err_int(void)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_INT_M_HRESP_ERR, 0);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_dis_bus_err_int(void)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write_bca_reg(BCA_INT_M_HRESP_ERR, 1);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_mic(void)
|
|
|
|
{
|
|
|
|
uint32_t int_ac =
|
2020-01-07 22:29:52 +01:00
|
|
|
read32_bca_reg(g_bca_reg[BCA_MIC_INT_CTRL_DONE_MIC].addr)
|
|
|
|
& ~(read32_bca_reg(g_bca_reg[BCA_MIC_INT_MASK_DONE_MIC].addr))
|
2019-10-10 01:55:20 +02:00
|
|
|
& 0x0f;
|
|
|
|
|
|
|
|
return int_ac;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s1(void)
|
|
|
|
{
|
|
|
|
uint32_t int_i2s =
|
2020-01-07 22:29:52 +01:00
|
|
|
read32_bca_reg(g_bca_reg[BCA_I2S1_INT_CTRL_DONE_I2SO].addr)
|
|
|
|
& ~(read32_bca_reg(g_bca_reg[BCA_I2S1_INT_MASK_DONE_I2SO].addr))
|
2019-10-10 01:55:20 +02:00
|
|
|
& 0x3f;
|
|
|
|
|
|
|
|
return int_i2s;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s2(void)
|
|
|
|
{
|
|
|
|
uint32_t int_i2s2 =
|
2020-01-07 22:29:52 +01:00
|
|
|
read32_bca_reg(g_bca_reg[BCA_I2S2_INT_CTRL_DONE_I2SO].addr)
|
|
|
|
& ~(read32_bca_reg(g_bca_reg[BCA_I2S2_INT_MASK_DONE_I2SO].addr))
|
2019-10-10 01:55:20 +02:00
|
|
|
& 0x3f;
|
|
|
|
|
|
|
|
return int_i2s2;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_mic(uint32_t value)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write32_bca_reg(g_bca_reg[BCA_MIC_INT_CTRL_DONE_MIC].addr, value);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_i2s1(uint32_t value)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write32_bca_reg(g_bca_reg[BCA_I2S1_INT_CTRL_DONE_I2SO].addr, value);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_i2s2(uint32_t value)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write32_bca_reg(g_bca_reg[BCA_I2S2_INT_CTRL_DONE_I2SO].addr, value);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_mask_done_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_DONE_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_MASK_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_unmask_done_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_DONE_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_MASK_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_done_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_DONE_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg_mask(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cxd56_audio_bca_reg_is_dma_fifo_empty(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2022-02-08 03:08:09 +01:00
|
|
|
reg_id = BCA_MIC_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_IN_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2022-02-08 03:08:09 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S2_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-01-07 22:29:52 +01:00
|
|
|
if (1 == read_bca_reg(reg_id))
|
2019-10-10 01:55:20 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2020-01-07 22:29:52 +01:00
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_mask_err_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_ERR_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_MASK_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_unmask_err_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_ERR_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_MASK_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_err_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_ERR_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg_mask(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_mask_cmb_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_CMB_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_unmask_cmb_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_CMB_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_cmb_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_CMB_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_CMB_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_CMB_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg_mask(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_int_status(void)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
return read32_bca_reg(g_bca_reg[BCA_INT_HRESP_ERR].addr);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_int_status(uint32_t int_au)
|
|
|
|
{
|
2020-01-07 22:29:52 +01:00
|
|
|
write32_bca_reg(g_bca_reg[BCA_INT_CLR_HRESP_ERR].addr, int_au);
|
2019-10-10 01:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_mask_bus_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_MIC_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_I2S1_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = AHB_MASTER_I2S2_MASK;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_I2S2_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2020-01-07 22:29:52 +01:00
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
write_bca_reg(reg_id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_unmask_bus_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
uint32_t val = 0;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_MIC_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
val = 0x00000303;
|
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = AHB_MASTER_I2S1_MASK;
|
|
|
|
val = 0x00000101;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_I2S1_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
val = 0x00000202;
|
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = AHB_MASTER_I2S2_MASK;
|
|
|
|
val = 0x00000101;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = AHB_MASTER_I2S2_MASK;
|
2019-10-10 01:55:20 +02:00
|
|
|
val = 0x00000202;
|
|
|
|
break;
|
|
|
|
}
|
2020-01-07 22:29:52 +01:00
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
write_bca_reg(reg_id, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_set_start_addr(cxd56_audio_dma_t handle,
|
|
|
|
uint32_t addr)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_START_ADR;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_START_ADR;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_START_ADR;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_START_ADR;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_START_ADR;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, addr >> 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_set_sample_no(cxd56_audio_dma_t handle,
|
|
|
|
uint32_t sample)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_SAMPLE_NO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_SAMPLE_NO;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S1_OUT_SAMPLE_NO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_SAMPLE_NO;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_SAMPLE_NO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, sample - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_start_dma(cxd56_audio_dma_t handle,
|
|
|
|
bool nointr)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
uint32_t val = nointr ? 0x05 : 0x01;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S1_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S2_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_stop_dma(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S1_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S2_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 0x04);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cxd56_audio_bca_reg_is_done_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_DONE_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_bca_reg(reg_id) == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cxd56_audio_bca_reg_is_err_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_ERR_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SI;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SO;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_bca_reg(reg_id) == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cxd56_audio_bca_reg_is_smp_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_SMP_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_bca_reg(reg_id) == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_mask_smp_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_SMP_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2022-02-08 03:08:09 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2020-01-07 22:29:52 +01:00
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
write_bca_reg(reg_id, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_unmask_smp_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_MASK_SMP_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_MASK_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2022-02-08 03:08:09 +01:00
|
|
|
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg(reg_id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_clear_smp_int(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_INT_CTRL_SMP_MIC;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_INT_CTRL_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bca_reg_mask(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_err(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_ERROR_SETTING;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_MON_ERROR_SETTING;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_MON_ERROR_SETTING;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_MON_ERROR_SETTING;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_MON_ERROR_SETTING;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return read_bca_reg(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_start(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_START;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_MON_START;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_MON_START;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_MON_START;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_MON_START;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return read_bca_reg(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_buf(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_MON_MONBUF;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_MON_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_MON_MONBUF;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_MON_MONBUF;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return read_bca_reg(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_dma_state(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S1_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_RTD_TRG;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-07-27 07:09:21 +02:00
|
|
|
reg_id = BCA_I2S2_OUT_RTD_TRG;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return read_bca_reg(reg_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cxd56_audio_bca_reg_reset_chsel(cxd56_audio_dma_t handle)
|
|
|
|
{
|
|
|
|
BCA_REG_ID reg_id;
|
|
|
|
uint32_t chsel;
|
|
|
|
switch (handle)
|
|
|
|
{
|
|
|
|
case CXD56_AUDIO_DMAC_MIC:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_MIC_IN_CH8_SEL;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_UP:
|
|
|
|
reg_id = BCA_I2S1_IN_CH2_SEL;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
case CXD56_AUDIO_DMAC_I2S0_DOWN:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S1_OUT_SD1_R_SEL;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
|
2022-02-08 03:08:09 +01:00
|
|
|
case CXD56_AUDIO_DMAC_I2S1_UP:
|
|
|
|
reg_id = BCA_I2S2_IN_CH2_SEL;
|
|
|
|
break;
|
|
|
|
|
2019-10-10 01:55:20 +02:00
|
|
|
default:
|
2020-01-07 22:29:52 +01:00
|
|
|
reg_id = BCA_I2S2_OUT_SD1_R_SEL;
|
2019-10-10 01:55:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
chsel = read32_bca_reg(g_bca_reg[reg_id].addr);
|
|
|
|
|
|
|
|
/* Clear ChSel. */
|
|
|
|
|
|
|
|
write32_bca_reg(g_bca_reg[reg_id].addr, 0xffffffff);
|
|
|
|
|
|
|
|
/* Set ChSel. */
|
|
|
|
|
|
|
|
write32_bca_reg(g_bca_reg[reg_id].addr, chsel);
|
|
|
|
}
|