27#ifndef __ARCH_ARM_INCLUDE_CXD56XX_AUDIO_H
28#define __ARCH_ARM_INCLUDE_CXD56XX_AUDIO_H
45#include <nuttx/config.h>
50#include "arch/chip/cxd56_audio_lower.h"
58#define CXD56AUD_SET_SYSVOLUME (0x01)
59#define CXD56AUD_SET_AUDIOPATH (0x02)
60#define CXD56AUD_SET_I2SMODE (0x03)
61#define CXD56AUD_GET_SYSPARAM (0x04)
62#define CXD56AUD_SET_SAMPLERATE (0x05)
63#define CXD56AUD_SET_BWCH (0x06)
67#define CXD56_AUDIO_MIC_CH_MAX 8
71#define CXD56_AUDIO_DNC_FW_SIZE 512
72#define CXD56_AUDIO_DNC_CFG_SIZE 128
76#define CXD56_AUDIO_DEQ_BAND_NUM 6
80#define CXD56_AUDIO_ECODE uint16_t
82#define CXD56_AUDIO_ECODE_OK 0x0000
83#define CXD56_AUDIO_ECODE_POW 0x1000
84#define CXD56_AUDIO_ECODE_FIL 0x2000
85#define CXD56_AUDIO_ECODE_MIC 0x3000
86#define CXD56_AUDIO_ECODE_VOL 0x4000
87#define CXD56_AUDIO_ECODE_DIG 0x5000
88#define CXD56_AUDIO_ECODE_BEP 0x6000
89#define CXD56_AUDIO_ECODE_INT 0x7000
90#define CXD56_AUDIO_ECODE_DMA 0x8000
91#define CXD56_AUDIO_ECODE_ANA 0x9000
92#define CXD56_AUDIO_ECODE_REG 0xA000
93#define CXD56_AUDIO_ECODE_CFG 0xB000
97#define CXD56_AUDIO_ECODE_POW_STATE (CXD56_AUDIO_ECODE_POW | 0x01)
101#define CXD56_AUDIO_ECODE_FIL_DNC_BIN (CXD56_AUDIO_ECODE_FIL | 0x01)
105#define CXD56_AUDIO_ECODE_MIC_NO_ANA (CXD56_AUDIO_ECODE_MIC | 0x01)
106#define CXD56_AUDIO_ECODE_MIC_ARG_NULL (CXD56_AUDIO_ECODE_MIC | 0x02)
110#define CXD56_AUDIO_ECODE_VOL_ID (CXD56_AUDIO_ECODE_VOL | 0x01)
111#define CXD56_AUDIO_ECODE_VOL_MAX (CXD56_AUDIO_ECODE_VOL | 0x02)
112#define CXD56_AUDIO_ECODE_VOL_MIN (CXD56_AUDIO_ECODE_VOL | 0x03)
118#define CXD56_AUDIO_ECODE_BEP_FREQ_MAX (CXD56_AUDIO_ECODE_BEP | 0x01)
119#define CXD56_AUDIO_ECODE_BEP_FREQ_MIN (CXD56_AUDIO_ECODE_BEP | 0x02)
120#define CXD56_AUDIO_ECODE_BEP_VOL_MAX (CXD56_AUDIO_ECODE_BEP | 0x03)
121#define CXD56_AUDIO_ECODE_BEP_VOL_MIN (CXD56_AUDIO_ECODE_BEP | 0x04)
127#define CXD56_AUDIO_ECODE_DMA_ARG_NULL (CXD56_AUDIO_ECODE_DMA | 0x01)
128#define CXD56_AUDIO_ECODE_DMA_PATH_INV (CXD56_AUDIO_ECODE_DMA | 0x02)
129#define CXD56_AUDIO_ECODE_DMA_PATH_COMB (CXD56_AUDIO_ECODE_DMA | 0x03)
130#define CXD56_AUDIO_ECODE_DMA_PATH_DUP (CXD56_AUDIO_ECODE_DMA | 0x04)
131#define CXD56_AUDIO_ECODE_DMA_PATH_MAX (CXD56_AUDIO_ECODE_DMA | 0x05)
132#define CXD56_AUDIO_ECODE_DMA_HANDLE_NULL (CXD56_AUDIO_ECODE_DMA | 0x06)
133#define CXD56_AUDIO_ECODE_DMA_HANDLE_INV (CXD56_AUDIO_ECODE_DMA | 0x07)
134#define CXD56_AUDIO_ECODE_DMA_CH_NO_ENABLE (CXD56_AUDIO_ECODE_DMA | 0x08)
135#define CXD56_AUDIO_ECODE_DMA_CH1_4_INV (CXD56_AUDIO_ECODE_DMA | 0x09)
136#define CXD56_AUDIO_ECODE_DMA_CH5_8_INV (CXD56_AUDIO_ECODE_DMA | 0x0a)
137#define CXD56_AUDIO_ECODE_DMA_SMP_TIMEOUT (CXD56_AUDIO_ECODE_DMA | 0x0b)
138#define CXD56_AUDIO_ECODE_DMA_BUSY (CXD56_AUDIO_ECODE_DMA | 0x0c)
140#define CXD56_AUDIO_ECODE_DMA_CMPLT (CXD56_AUDIO_ECODE_DMA | 0x11)
141#define CXD56_AUDIO_ECODE_DMA_TRANS (CXD56_AUDIO_ECODE_DMA | 0x12)
142#define CXD56_AUDIO_ECODE_DMA_CMB (CXD56_AUDIO_ECODE_DMA | 0x13)
146#define CXD56_AUDIO_ECODE_ANA_DISABLE (CXD56_AUDIO_ECODE_ANA | 0x01)
147#define CXD56_AUDIO_ECODE_ANA_PWON (CXD56_AUDIO_ECODE_ANA | 0x02)
148#define CXD56_AUDIO_ECODE_ANA_PWOFF (CXD56_AUDIO_ECODE_ANA | 0x03)
149#define CXD56_AUDIO_ECODE_ANA_CLK_EN (CXD56_AUDIO_ECODE_ANA | 0x04)
150#define CXD56_AUDIO_ECODE_ANA_CHKID (CXD56_AUDIO_ECODE_ANA | 0x05)
151#define CXD56_AUDIO_ECODE_ANA_SERIAL (CXD56_AUDIO_ECODE_ANA | 0x06)
152#define CXD56_AUDIO_ECODE_ANA_PWON_MBIAS (CXD56_AUDIO_ECODE_ANA | 0x07)
153#define CXD56_AUDIO_ECODE_ANA_PWON_INPUT (CXD56_AUDIO_ECODE_ANA | 0x08)
154#define CXD56_AUDIO_ECODE_ANA_SET_SMASTER (CXD56_AUDIO_ECODE_ANA | 0x09)
155#define CXD56_AUDIO_ECODE_ANA_PWON_OUTPUT (CXD56_AUDIO_ECODE_ANA | 0x0A)
156#define CXD56_AUDIO_ECODE_ANA_PWOFF_INPUT (CXD56_AUDIO_ECODE_ANA | 0x0B)
157#define CXD56_AUDIO_ECODE_ANA_PWOFF_OUTPUT (CXD56_AUDIO_ECODE_ANA | 0x0C)
158#define CXD56_AUDIO_ECODE_ANA_ENABLE_OUTPUT (CXD56_AUDIO_ECODE_ANA | 0x0D)
159#define CXD56_AUDIO_ECODE_ANA_DISABLE_OUTPUT (CXD56_AUDIO_ECODE_ANA | 0x0E)
160#define CXD56_AUDIO_ECODE_ANA_SET_MICGAIN (CXD56_AUDIO_ECODE_ANA | 0x0F)
161#define CXD56_AUDIO_ECODE_ANA_NOTIFY_MICBOOT (CXD56_AUDIO_ECODE_ANA | 0x10)
165#define CXD56_AUDIO_ECODE_REG_AC (CXD56_AUDIO_ECODE_REG | 0x100)
166#define CXD56_AUDIO_ECODE_REG_BCA (CXD56_AUDIO_ECODE_REG | 0x200)
168#define CXD56_AUDIO_ECODE_REG_AC_REVID (CXD56_AUDIO_ECODE_REG_AC | 0x01)
169#define CXD56_AUDIO_ECODE_REG_AC_DEVID (CXD56_AUDIO_ECODE_REG_AC | 0x02)
170#define CXD56_AUDIO_ECODE_REG_AC_MICMODE (CXD56_AUDIO_ECODE_REG_AC | 0x03)
171#define CXD56_AUDIO_ECODE_REG_AC_ALCTGT (CXD56_AUDIO_ECODE_REG_AC | 0x04)
172#define CXD56_AUDIO_ECODE_REG_AC_ALCKNEE (CXD56_AUDIO_ECODE_REG_AC | 0x05)
173#define CXD56_AUDIO_ECODE_REG_AC_SPCLIMT (CXD56_AUDIO_ECODE_REG_AC | 0x06)
174#define CXD56_AUDIO_ECODE_REG_AC_CLKMODE (CXD56_AUDIO_ECODE_REG_AC | 0x07)
175#define CXD56_AUDIO_ECODE_REG_AC_SEL_INV (CXD56_AUDIO_ECODE_REG_AC | 0x08)
176#define CXD56_AUDIO_ECODE_REG_AC_CSTE_VOL (CXD56_AUDIO_ECODE_REG_AC | 0x09)
190 unsigned short argh[2];
203#define CXD56_AUDIO_ECODE_CFG_CLK_MODE (CXD56_AUDIO_ECODE_CFG | 0x01)
205enum cxd56_audio_state_e
209 CXD56_AUDIO_POWER_STATE_OFF = 0,
213 CXD56_AUDIO_POWER_STATE_ON
216typedef enum cxd56_audio_state_e cxd56_audio_state_t;
364 CXD56_AUDIO_OUTDEV_OFF = 0,
365 CXD56_AUDIO_OUTDEV_SP,
366 CXD56_AUDIO_OUTDEV_I2S
371enum cxd56_audio_clkmode_e
373 CXD56_AUDIO_CLKMODE_NORMAL = 0,
374 CXD56_AUDIO_CLKMODE_HIRES,
377typedef enum cxd56_audio_clkmode_e cxd56_audio_clkmode_t;
379enum cxd56_audio_dmafmt_e
381 CXD56_AUDIO_DMA_FMT_LR = 0,
382 CXD56_AUDIO_DMA_FMT_RL,
385typedef enum cxd56_audio_dmafmt_e cxd56_audio_dmafmt_t;
387enum cxd56_audio_samp_fmt_e
389 CXD56_AUDIO_SAMP_FMT_24 = 0,
390 CXD56_AUDIO_SAMP_FMT_16
393typedef enum cxd56_audio_samp_fmt_e cxd56_audio_samp_fmt_t;
395enum cxd56_audio_dsr_rate_e
397 CXD56_AUDIO_DSR_1STEP = 0x0,
398 CXD56_AUDIO_DSR_2STEP,
399 CXD56_AUDIO_DSR_4STEP,
400 CXD56_AUDIO_DSR_6STEP,
401 CXD56_AUDIO_DSR_8STEP,
402 CXD56_AUDIO_DSR_11STEP,
403 CXD56_AUDIO_DSR_12STEP,
404 CXD56_AUDIO_DSR_16STEP,
407typedef enum cxd56_audio_dsr_rate_e cxd56_audio_dsr_rate_t;
409enum cxd56_audio_dma_state_e
411 CXD56_AUDIO_DMA_STATE_REDY = 0x0,
412 CXD56_AUDIO_DMA_STATE_RUN,
415typedef enum cxd56_audio_dma_state_e cxd56_audio_dma_state_t;
417enum cxd56_audio_micdev_e
419 CXD56_AUDIO_MIC_DEV_NONE = 0,
420 CXD56_AUDIO_MIC_DEV_ANALOG,
421 CXD56_AUDIO_MIC_DEV_DIGITAL,
422 CXD56_AUDIO_MIC_DEV_ANADIG
425typedef enum cxd56_audio_micdev_e cxd56_audio_micdev_t;
427enum cxd56_audio_sp_drv_e
429 CXD56_AUDIO_SP_DRV_LINEOUT = 0,
430 CXD56_AUDIO_SP_DRV_1DRIVER,
431 CXD56_AUDIO_SP_DRV_2DRIVER,
432 CXD56_AUDIO_SP_DRV_4DRIVER
435typedef enum cxd56_audio_sp_drv_e cxd56_audio_sp_drv_t;
440 cxd56_audio_i2s_src_byp_t bypass_mode;
455 uint32_t config[CXD56_AUDIO_DNC_CFG_SIZE];
529#define EXTERN extern "C"
543struct audio_lowerhalf_s *cxd56_aud_miclower(
void);
544struct audio_lowerhalf_s *cxd56_aud_spk0out(
void);
545struct audio_lowerhalf_s *cxd56_aud_spk1out(
void);
546struct audio_lowerhalf_s *cxd56_aud_i2sin(
void);
804 cxd56_audio_dma_t *handle);
839 cxd56_audio_samp_fmt_t fmt,
1041bool board_audio_tone_generator(
bool en, int16_t vol, uint16_t freq);
CXD56_AUDIO_ECODE cxd56_audio_dis_dmaint(void)
Disable dma interrupt.
cxd56_audio_volid_e
Definition: audio.h:232
CXD56_AUDIO_ECODE cxd56_audio_set_dmacb(cxd56_audio_dma_t handle, cxd56_audio_dma_cb_t cb)
Initialize dma transfer function.
CXD56_AUDIO_ECODE cxd56_audio_get_dmahandle(cxd56_audio_dma_path_t path, cxd56_audio_dma_t *handle)
Get dma handle.
CXD56_AUDIO_ECODE cxd56_audio_set_datapath(cxd56_audio_signal_t sig, cxd56_audio_sel_t sel)
Set internal data path.
CXD56_AUDIO_ECODE cxd56_audio_en_output(void)
Enable BaseBand driver output.
#define CXD56_AUDIO_DEQ_BAND_NUM
Definition: audio.h:76
cxd56_audio_state_t cxd56_audio_get_status(void)
Get audio driver status.
uint32_t cxd56_audio_get_micmap(void)
Get Mic mapping.
cxd56_audio_dmafmt_t cxd56_audio_get_dmafmt(void)
Get data format type of dma.
cxd56_audio_dnc_id_e
Definition: audio.h:251
CXD56_AUDIO_ECODE cxd56_audio_clear_dmaerrint(cxd56_audio_dma_t handle)
Clear dma error interrupt state.
CXD56_AUDIO_ECODE cxd56_audio_unmask_dmaerrint(cxd56_audio_dma_t handle)
Unmask dma error interrupt.
cxd56_audio_clkmode_t cxd56_audio_get_clkmode(void)
Get audio clock mode.
CXD56_AUDIO_ECODE cxd56_audio_dis_i2s_io(void)
Disable I2S I/O.
CXD56_AUDIO_ECODE cxd56_audio_en_i2s_io(void)
Enable I2S I/O.
CXD56_AUDIO_ECODE cxd56_audio_en_dnc(cxd56_audio_dnc_id_t id, cxd56_audio_dnc_bin_t *bin)
Enable DNC.
CXD56_AUDIO_ECODE cxd56_audio_mask_dmaerrint(cxd56_audio_dma_t handle)
Mask dma error interrupt.
CXD56_AUDIO_ECODE cxd56_audio_poweroff(void)
Power off BaseBand driver.
CXD56_AUDIO_ECODE cxd56_audio_dis_deq(void)
Disable DEQ.
CXD56_AUDIO_ECODE cxd56_audio_play_beep(void)
Play beep.
CXD56_AUDIO_ECODE cxd56_audio_set_clkmode(cxd56_audio_clkmode_t mode)
Set audio clock mode.
CXD56_AUDIO_ECODE cxd56_audio_set_micmap(uint32_t map)
Set Mic mapping.
cxd56_audio_sp_drv_t cxd56_audio_get_spdriver(void)
Get audio speaker driver mode.
CXD56_AUDIO_ECODE cxd56_audio_stop_dma(cxd56_audio_dma_t handle)
Stop dma transfer.
CXD56_AUDIO_ECODE cxd56_audio_set_vol(cxd56_audio_volid_t id, int16_t vol)
Set volume.
CXD56_AUDIO_ECODE cxd56_audio_free_dmahandle(cxd56_audio_dma_t handle)
Free dma handle.
CXD56_AUDIO_ECODE cxd56_audio_unmute_vol_fade(cxd56_audio_volid_t id, bool wait)
unmute volume with fade-in
CXD56_AUDIO_ECODE cxd56_audio_en_dmaint(void)
Enable dma interrupt.
CXD56_AUDIO_ECODE cxd56_audio_start_dma(cxd56_audio_dma_t handle, uint32_t addr, uint32_t sample)
Start dma transfer.
CXD56_AUDIO_ECODE cxd56_audio_set_spout(bool sp_out_en)
Set speaker output status.
CXD56_AUDIO_ECODE cxd56_audio_en_cstereo(bool sign_inv, int16_t vol)
Enable clear stereo.
#define CXD56_AUDIO_MIC_CH_MAX
Definition: audio.h:67
void(* cxd56_audio_dma_cb_t)(cxd56_audio_dma_t handle, uint32_t code)
Definition: audio.h:517
CXD56_AUDIO_ECODE cxd56_audio_poweron_dnc(void)
Power on DNC.
CXD56_AUDIO_ECODE cxd56_audio_mute_vol_fade(cxd56_audio_volid_t id, bool wait)
mute volume with fade-out
cxd56_audio_signal_e
Definition: audio.h:293
CXD56_AUDIO_ECODE cxd56_audio_unmute_vol(cxd56_audio_volid_t id)
Unmute volume.
CXD56_AUDIO_ECODE cxd56_audio_en_input(void)
Enable BaseBand driver input.
cxd56_audio_outdev_e
Definition: audio.h:363
CXD56_AUDIO_ECODE cxd56_audio_dis_input(void)
Disable BaseBand driver input.
CXD56_AUDIO_ECODE cxd56_audio_set_spdriver(cxd56_audio_sp_drv_t sp_driver)
Set audio speaker driver mode.
CXD56_AUDIO_ECODE cxd56_audio_set_beep_freq(uint16_t freq)
Set beep frequency parameter.
CXD56_AUDIO_ECODE cxd56_audio_set_beep_vol(int16_t vol)
Set beep volume parameter.
CXD56_AUDIO_ECODE cxd56_audio_en_digsft(cxd56_audio_dsr_rate_t rate)
Enable digital soft ramp rate control.
CXD56_AUDIO_ECODE cxd56_audio_init_dma(cxd56_audio_dma_t handle, cxd56_audio_samp_fmt_t fmt, uint8_t *ch_num)
Initialize dma transfer function.
CXD56_AUDIO_ECODE cxd56_audio_dis_output(void)
Disable BaseBand driver output.
cxd56_audio_dma_path_e
Definition: audio.h:266
CXD56_AUDIO_ECODE cxd56_audio_mute_vol(cxd56_audio_volid_t id)
Mute volume.
CXD56_AUDIO_ECODE cxd56_audio_dis_digsft(void)
Disable digital soft ramp rate control.
cxd56_audio_micdev_t cxd56_audio_get_micdev(void)
Get mic device type.
int cxd56_audsystem_initialize(FAR cxd56_audio_lower_t *low)
#define CXD56_AUDIO_DNC_FW_SIZE
Definition: audio.h:71
#define CXD56_AUDIO_ECODE
Definition: audio.h:80
CXD56_AUDIO_ECODE cxd56_audio_set_micgain(cxd56_audio_mic_gain_t *gain)
Set MIC gain.
cxd56_audio_i2s_src_byp_e
Definition: audio.h:219
CXD56_AUDIO_ECODE cxd56_audio_dis_cstereo(void)
Disable clear stereo.
cxd56_audio_dma_e
Definition: audio.h:336
CXD56_AUDIO_ECODE cxd56_audio_set_deq(bool en, cxd56_audio_deq_coef_t *deq)
Set DEQ table.
CXD56_AUDIO_ECODE cxd56_audio_en_deq(cxd56_audio_deq_coef_t *coef)
Disable DEQ.
CXD56_AUDIO_ECODE cxd56_audio_dis_dnc(cxd56_audio_dnc_id_t id)
Disable DNC.
CXD56_AUDIO_ECODE cxd56_audio_poweroff_dnc(void)
Power off DNC.
CXD56_AUDIO_ECODE cxd56_audio_poweron(void)
Power on Audio driver.
CXD56_AUDIO_ECODE cxd56_audio_stop_beep(void)
Stop beep.
@ CXD56_AUDIO_VOLID_MIXER_OUT
Definition: audio.h:243
@ CXD56_AUDIO_VOLID_MIXER_IN2
Definition: audio.h:239
@ CXD56_AUDIO_VOLID_MIXER_IN1
Definition: audio.h:235
@ CXD56_AUDIO_DNC_ID_FB
Definition: audio.h:254
@ CXD56_AUDIO_DNC_ID_FF
Definition: audio.h:258
@ CXD56_AUDIO_SIG_I2S1
Definition: audio.h:316
@ CXD56_AUDIO_SIG_BUSIF2
Definition: audio.h:324
@ CXD56_AUDIO_SIG_I2S0
Definition: audio.h:312
@ CXD56_AUDIO_SIG_MIC2
Definition: audio.h:300
@ CXD56_AUDIO_SIG_MIC3
Definition: audio.h:304
@ CXD56_AUDIO_SIG_BUSIF1
Definition: audio.h:320
@ CXD56_AUDIO_SIG_MIC4
Definition: audio.h:308
@ CXD56_AUDIO_SIG_MIC1
Definition: audio.h:296
@ CXD56_AUDIO_SIG_MIX
Definition: audio.h:328
@ CXD56_AUDIO_DMA_PATH_MIC_TO_MEM
Definition: audio.h:269
@ CXD56_AUDIO_DMA_PATH_I2S0_TO_MEM
Definition: audio.h:273
@ CXD56_AUDIO_DMA_PATH_MEM_TO_BUSIF2
Definition: audio.h:285
@ CXD56_AUDIO_DMA_PATH_I2S1_TO_MEM
Definition: audio.h:277
@ CXD56_AUDIO_DMA_PATH_MEM_TO_BUSIF1
Definition: audio.h:281
@ CXD56_AUDIO_I2S_BYP_ENABLE
Definition: audio.h:226
@ CXD56_AUDIO_I2S_BYP_DISABLE
Definition: audio.h:222
@ CXD56_AUDIO_DMAC_I2S1_UP
Definition: audio.h:351
@ CXD56_AUDIO_DMAC_I2S1_DOWN
Definition: audio.h:355
@ CXD56_AUDIO_DMAC_I2S0_UP
Definition: audio.h:343
@ CXD56_AUDIO_DMAC_I2S0_DOWN
Definition: audio.h:347
@ CXD56_AUDIO_DMAC_MIC
Definition: audio.h:339
Definition: cxd56_audio_lower.h:36
bool cod_insel3
Definition: audio.h:476
bool au_dat_sel1
Definition: audio.h:464
bool src1in_sel
Definition: audio.h:480
bool cod_insel2
Definition: audio.h:472
bool src2in_sel
Definition: audio.h:484
bool au_dat_sel2
Definition: audio.h:468