Author: Alan Carvalho de Assis <acassis@gmail.com> Verify all .c and .h against nxstyle, fixed the Mixed cases Author: Alin Jerpelea <alin.jerpelea@sony.com> cxd56xx improvements (#48) * arch: cxd56xx: Add size limitation for I2C SCU xfer This is a fw restriction, unroll loop because it can be transfer up to 16 bytes. * arch: cxd56xx: Fix lack of leave_critical_section add the missing leave_critical_section * arch: cxd56xx: Remove unnecessary file this header is duplicate and we can remove it * arch: cxd56xx: Cosmetic change remove space after function * arch: cxd56xx: update topreg registers the topreg registers are updated to match the cxd5602 HW * arch: cxd56xx: Add voltage setting for low battery notification Add voltage setting for low battery notification * arch: cxd56xx: Improve perfomance of SD card Improve a problem that the clock of SD Host Controller is lower than the expected value in SDR25 transfer mode. * arch: cxd56xx: Cosmetic changes cleanup to comply with coding standard * boards: cxd56xx: Cosmetic changes updates to comply with coding standard * boards: cxd56xx: Fix SD card cannot mount issue SD card cannot mount when connecting and disconnecting three times or more due to wrong state of parameter 'initialized'. This change enables to skip swtching initialized state when mount failed.
313 lines
11 KiB
C
313 lines
11 KiB
C
/***************************************************************************
|
|
* boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.h
|
|
*
|
|
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
|
|
* the names of its contributors may be used to endorse or promote
|
|
* products derived from this software without specific prior written
|
|
* permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_BCA_REG_H
|
|
#define __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_BCA_REG_H
|
|
|
|
/***************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <arch/chip/audio.h>
|
|
|
|
/***************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
typedef enum
|
|
{
|
|
BCA_MIC_IN_START_ADR,
|
|
BCA_MIC_IN_SAMPLE_NO,
|
|
BCA_MIC_IN_RTD_TRG,
|
|
BCA_MIC_IN_NOINTR,
|
|
BCA_MIC_IN_BITWT,
|
|
BCA_MIC_IN_CH8_SEL,
|
|
BCA_MIC_IN_CH7_SEL,
|
|
BCA_MIC_IN_CH6_SEL,
|
|
BCA_MIC_IN_CH5_SEL,
|
|
BCA_MIC_IN_CH4_SEL,
|
|
BCA_MIC_IN_CH3_SEL,
|
|
BCA_M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_IN_DONE 4
|
|
#define DMA_STATE_BIT_I2S_IN_ERR 8
|
|
#define DMA_STATE_BIT_I2S_CMB 32
|
|
|
|
#define DMA_MSTATE_START 1
|
|
#define DMA_MSTART_READY 0
|
|
|
|
#define DMA_MSTATE_ERR_OK
|
|
#define DMA_MSTATE_ERR_NO_ENABLE_CH 1
|
|
#define DMA_MSTATE_ERR_CH1_4_INVALID 2
|
|
#define DMA_MSTATE_ERR_CH5_8_INVALID 4
|
|
|
|
#define DMA_MSTATE_BUF_EMPTY 3
|
|
|
|
#define DMA_CMD_FIFO_NOT_FULL 1
|
|
|
|
/***************************************************************************
|
|
* Public Types
|
|
****************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* Public Data
|
|
****************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* Inline Functions
|
|
****************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* Public Function Prototypes
|
|
****************************************************************************/
|
|
|
|
void cxd56_audio_bca_reg_clear_bck_err_int(void);
|
|
void cxd56_audio_bca_reg_set_smaster(void);
|
|
void cxd56_audio_bca_reg_set_datarate(uint8_t clk_mode);
|
|
|
|
void cxd56_audio_bca_reg_en_fmt24(cxd56_audio_dma_t handle, uint8_t ch_num);
|
|
void cxd56_audio_bca_reg_en_fmt16(cxd56_audio_dma_t handle, uint8_t ch_num);
|
|
|
|
void cxd56_audio_bca_reg_en_bus_err_int(void);
|
|
void cxd56_audio_bca_reg_dis_bus_err_int(void);
|
|
|
|
void cxd56_audio_bca_reg_get_dma_mstate(cxd56_audio_dma_t handle,
|
|
FAR cxd56_audio_dma_mstate_t *state);
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_mic(void);
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s1(void);
|
|
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s2(void);
|
|
|
|
void cxd56_audio_bca_reg_mask_done_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_unmask_done_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_clear_done_int(cxd56_audio_dma_t handle);
|
|
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_mic(uint32_t value);
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_i2s1(uint32_t value);
|
|
void cxd56_audio_bca_reg_clear_dma_done_state_i2s2(uint32_t value);
|
|
|
|
bool cxd56_audio_bca_reg_is_dma_fifo_empty(cxd56_audio_dma_t handle);
|
|
|
|
void cxd56_audio_bca_reg_mask_err_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_unmask_err_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_clear_err_int(cxd56_audio_dma_t handle);
|
|
|
|
void cxd56_audio_bca_reg_mask_cmb_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_unmask_cmb_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_clear_cmb_int(cxd56_audio_dma_t handle);
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_int_status(void);
|
|
void cxd56_audio_bca_reg_clear_int_status(uint32_t int_au);
|
|
|
|
void cxd56_audio_bca_reg_mask_bus_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_unmask_bus_int(cxd56_audio_dma_t handle);
|
|
|
|
void cxd56_audio_bca_reg_set_start_addr(cxd56_audio_dma_t handle,
|
|
uint32_t addr);
|
|
void cxd56_audio_bca_reg_set_sample_no(cxd56_audio_dma_t handle,
|
|
uint32_t sample);
|
|
void cxd56_audio_bca_reg_start_dma(cxd56_audio_dma_t handle,
|
|
bool nointr);
|
|
void cxd56_audio_bca_reg_stop_dma(cxd56_audio_dma_t handle);
|
|
|
|
bool cxd56_audio_bca_reg_is_done_int(cxd56_audio_dma_t handle);
|
|
bool cxd56_audio_bca_reg_is_err_int(cxd56_audio_dma_t handle);
|
|
|
|
bool cxd56_audio_bca_reg_is_smp_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_mask_smp_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_unmask_smp_int(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_clear_smp_int(cxd56_audio_dma_t handle);
|
|
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_err(cxd56_audio_dma_t handle);
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_start(cxd56_audio_dma_t handle);
|
|
uint32_t cxd56_audio_bca_reg_get_mon_state_buf(cxd56_audio_dma_t handle);
|
|
uint32_t cxd56_audio_bca_reg_get_dma_state(cxd56_audio_dma_t handle);
|
|
void cxd56_audio_bca_reg_reset_chsel(cxd56_audio_dma_t handle);
|
|
|
|
#endif /* __BOARDS_ARM_CXD56XX_DRIVERS_AUDIO_CXD56_AUDIO_BCA_REG_H */
|