Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_audac.h
Go to the documentation of this file.
1 #ifndef _BFLB_AUDAC_H
2 #define _BFLB_AUDAC_H
3 
4 #include "bflb_core.h"
5 
18 #define AUDAC_SAMPLING_RATE_8K 0
19 #define AUDAC_SAMPLING_RATE_16K 1
20 #define AUDAC_SAMPLING_RATE_22P05K 5
21 #define AUDAC_SAMPLING_RATE_24K 3
22 #define AUDAC_SAMPLING_RATE_32K 2
23 #define AUDAC_SAMPLING_RATE_44P1K 6
24 #define AUDAC_SAMPLING_RATE_48K 4
25 
33 #define AUDAC_OUTPUT_MODE_PWM 0
34 #define AUDAC_OUTPUT_MODE_GPDAC_CH_A 1
35 #define AUDAC_OUTPUT_MODE_GPDAC_CH_B 2
36 #define AUDAC_OUTPUT_MODE_GPDAC_CH_A_B 3
37 
45 #define AUDAC_SOURCE_CHANNEL_SINGLE 0x01
46 #define AUDAC_SOURCE_CHANNEL_DUAL 0x03
47 
56 #define AUDAC_MIXER_MODE_ONLY_L 0
57 #define AUDAC_MIXER_MODE_ONLY_R 1
58 #define AUDAC_MIXER_MODE_SUM 2
59 #define AUDAC_MIXER_MODE_AVERAGE 3
60 
68 #define AUDAC_DATA_FORMAT_16BIT 3
69 #define AUDAC_DATA_FORMAT_20BIT 2
70 #define AUDAC_DATA_FORMAT_24BIT 1
71 #define AUDAC_DATA_FORMAT_32BIT 0
72 
80 #define AUDAC_RAMP_RATE_FS_2 0
81 #define AUDAC_RAMP_RATE_FS_4 1
82 #define AUDAC_RAMP_RATE_FS_8 2
83 #define AUDAC_RAMP_RATE_FS_16 3
84 #define AUDAC_RAMP_RATE_FS_32 4
85 #define AUDAC_RAMP_RATE_FS_64 5
86 #define AUDAC_RAMP_RATE_FS_128 6
87 #define AUDAC_RAMP_RATE_FS_256 7
88 #define AUDAC_RAMP_RATE_FS_512 8
89 #define AUDAC_RAMP_RATE_FS_1024 9
90 #define AUDAC_RAMP_RATE_FS_2048 10
91 
99 #define AUDAC_VOLUME_UPDATE_MODE_FORCE 0
100 #define AUDAC_VOLUME_UPDATE_MODE_RAMP 1
101 #define AUDAC_VOLUME_UPDATE_MODE_RAMP_ZERO_CROSSING 2
102 
110 #define AUDAC_INTSTS_VOLUME_RAMP (1 << 0)
111 #define AUDAC_INTSTS_FIFO_OVER (1 << 1)
112 #define AUDAC_INTSTS_FIFO_UNDER (1 << 2)
113 #define AUDAC_INTSTS_FIFO_AVAILABLE (1 << 3)
114 
118 #define AUDAC_CMD_PLAY_START (0x01)
119 #define AUDAC_CMD_PLAY_STOP (0x02)
120 #define AUDAC_CMD_SET_MUTE (0x03)
121 #define AUDAC_CMD_SET_VOLUME_VAL (0x04)
122 #define AUDAC_CMD_CLEAR_TX_FIFO (0x05)
123 #define AUDAC_CMD_GET_TX_FIFO_CNT (0x06)
124 
141  uint8_t sampling_rate;
142  uint8_t output_mode;
144  uint8_t mixer_mode;
145  uint8_t data_format;
146  uint8_t fifo_threshold;
147 };
148 
166 };
167 
168 #ifdef __cplusplus
169 extern "C" {
170 #endif
171 
172 int bflb_audac_init(struct bflb_device_s *dev, const struct bflb_audac_init_config_s *config);
173 
174 int bflb_audac_volume_init(struct bflb_device_s *dev, const struct bflb_audac_volume_config_s *vol_cfg);
175 
176 int bflb_audac_link_rxdma(struct bflb_device_s *dev, bool enable);
177 
178 int bflb_audac_int_mask(struct bflb_device_s *dev, uint32_t mask);
179 
180 int bflb_audac_get_intstatus(struct bflb_device_s *dev);
181 
182 int bflb_audac_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
183 
184 int bflb_audac_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
198 #endif
AUDAC initialization configuration structure.
Definition: bflb_audac.h:140
int bflb_audac_link_rxdma(struct bflb_device_s *dev, bool enable)
int bflb_audac_init(struct bflb_device_s *dev, const struct bflb_audac_init_config_s *config)
AUDAC volume configuration structure.
Definition: bflb_audac.h:159
int bflb_audac_volume_init(struct bflb_device_s *dev, const struct bflb_audac_volume_config_s *vol_cfg)
int bflb_audac_get_intstatus(struct bflb_device_s *dev)
int bflb_audac_int_clear(struct bflb_device_s *dev, uint32_t int_clear)
int bflb_audac_feature_control(struct bflb_device_s *dev, int cmd, size_t arg)
int bflb_audac_int_mask(struct bflb_device_s *dev, uint32_t mask)