diff --git a/src/hal/sstar/i6_aud.h b/src/hal/sstar/i6_aud.h index 5156aa0..837c027 100644 --- a/src/hal/sstar/i6_aud.h +++ b/src/hal/sstar/i6_aud.h @@ -43,7 +43,7 @@ typedef enum { } i6_aud_type; typedef struct { - int LeftJustOn; + int leftJustOn; i6_aud_clk clock; char syncRxClkOn; } i6_aud_i2s; diff --git a/src/hal/sstar/i6_hal.c b/src/hal/sstar/i6_hal.c index 03472f9..dee3b42 100644 --- a/src/hal/sstar/i6_hal.c +++ b/src/hal/sstar/i6_hal.c @@ -63,6 +63,44 @@ int i6_hal_init(void) return EXIT_SUCCESS; } +void i6_audio_deinit(void) +{ + i6_aud.fnDisableChannel(_i6_aud_dev, _i6_aud_chn); + + i6_aud.fnDisableDevice(_i6_aud_dev); +} + +int i6_audio_init(void) +{ + int ret; + + { + i6_aud_cnf config; + config.rate = 48000; + config.bit24On = 0; + config.intf = I6_AUD_INTF_I2S_SLAVE; + config.sound = I6_AUD_SND_MONO; + config.frmNum = 0; + config.packNumPerFrm = 0; + config.codecChnNum = 0; + config.chnNum = 0; + config.i2s.clock = I6_AUD_CLK_OFF; + config.i2s.leftJustOn = 0; + config.i2s.syncRxClkOn = 0; + if (ret = i6_aud.fnSetDeviceConfig(_i6_aud_dev, &config)) + return ret; + } + if (ret = i6_aud.fnEnableDevice(_i6_aud_dev)) + return ret; + + if (ret = i6_aud.fnEnableChannel(_i6_aud_dev, _i6_aud_chn)) + return ret; + if (ret = i6_aud.fnSetVolume(_i6_aud_dev, _i6_aud_chn, 0xF6)) + return ret; + + return EXIT_SUCCESS; +} + int i6_channel_bind(char index, char framerate, char jpeg) { int ret; diff --git a/src/hal/sstar/i6_hal.h b/src/hal/sstar/i6_hal.h index 44a140d..d4f8d76 100644 --- a/src/hal/sstar/i6_hal.h +++ b/src/hal/sstar/i6_hal.h @@ -17,6 +17,9 @@ extern int (*i6_venc_cb)(char, hal_vidstream*); void i6_hal_deinit(void); int i6_hal_init(void); +void i6_audio_deinit(void); +int i6_audio_init(void); + int i6_channel_bind(char index, char framerate, char jpeg); int i6_channel_create(char index, short width, short height, char mirror, char flip, char jpeg); void i6_channel_disable(char index); diff --git a/src/hal/sstar/i6c_aud.h b/src/hal/sstar/i6c_aud.h index bc7c00a..d9f7983 100644 --- a/src/hal/sstar/i6c_aud.h +++ b/src/hal/sstar/i6c_aud.h @@ -98,7 +98,7 @@ typedef enum { typedef struct { i6c_aud_intf intf; i6c_aud_bit bit; - int LeftJustOn; + int leftJustOn; // Accept industry standards from 8000 to 96000Hz int rate; i6c_aud_clk clock; diff --git a/src/hal/sstar/i6c_hal.c b/src/hal/sstar/i6c_hal.c index 10ad77c..862f415 100644 --- a/src/hal/sstar/i6c_hal.c +++ b/src/hal/sstar/i6c_hal.c @@ -90,7 +90,7 @@ int i6c_audio_init(void) i6c_aud_i2s config; config.intf = I6C_AUD_INTF_I2S_SLAVE; config.bit = I6C_AUD_BIT_32; - config.LeftJustOn = 0; + config.leftJustOn = 0; config.rate = 48000; config.clock = I6C_AUD_CLK_OFF; config.syncRxClkOn = 1; @@ -100,6 +100,7 @@ int i6c_audio_init(void) if (ret = i6c_aud.fnAttachToDevice(_i6c_aud_dev, &input, 1)) return ret; } + { char gain[1] = { 0xF6 }; if (ret = i6c_aud.fnSetGain(_i6c_aud_dev, _i6c_aud_chn, (char*)&gain, 1)) diff --git a/src/hal/sstar/i6f_aud.h b/src/hal/sstar/i6f_aud.h index 16089ce..00c9de8 100644 --- a/src/hal/sstar/i6f_aud.h +++ b/src/hal/sstar/i6f_aud.h @@ -50,7 +50,7 @@ typedef enum { } i6f_aud_type; typedef struct { - int LeftJustOn; + int leftJustOn; i6f_aud_clk clock; char syncRxClkOn; unsigned int tdmSlotNum; diff --git a/src/hal/sstar/i6f_hal.c b/src/hal/sstar/i6f_hal.c index 5ec0e5a..c52cae9 100644 --- a/src/hal/sstar/i6f_hal.c +++ b/src/hal/sstar/i6f_hal.c @@ -64,6 +64,47 @@ int i6f_hal_init(void) return EXIT_SUCCESS; } +void i6f_audio_deinit(void) +{ + i6f_aud.fnDisableChannel(_i6f_aud_dev, _i6f_aud_chn); + + i6f_aud.fnDisableDevice(_i6f_aud_dev); +} + + +int i6f_audio_init(void) +{ + int ret; + + { + i6f_aud_cnf config; + config.rate = 48000; + config.bit = I6F_AUD_BIT_16; + config.intf = I6F_AUD_INTF_I2S_SLAVE; + config.sound = I6F_AUD_SND_STEREO; + config.frmNum = 0; + config.packNumPerFrm = 0; + config.codecChnNum = 0; + config.chnNum = 0; + config.i2s.clock = I6F_AUD_CLK_OFF; + config.i2s.leftJustOn = 0; + config.i2s.syncRxClkOn = 1; + config.i2s.tdmSlotNum = 2; + config.i2s.bit = I6F_AUD_BIT_32; + if (ret = i6f_aud.fnSetDeviceConfig(_i6f_aud_dev, &config)) + return ret; + } + if (ret = i6f_aud.fnEnableDevice(_i6f_aud_dev)) + return ret; + + if (ret = i6f_aud.fnEnableChannel(_i6f_aud_dev, _i6f_aud_chn)) + return ret; + if (ret = i6f_aud.fnSetVolume(_i6f_aud_dev, _i6f_aud_chn, 0xF6)) + return ret; + + return EXIT_SUCCESS; +} + int i6f_channel_bind(char index, char framerate, char jpeg) { int ret; diff --git a/src/hal/sstar/i6f_hal.h b/src/hal/sstar/i6f_hal.h index f97664d..19b297c 100644 --- a/src/hal/sstar/i6f_hal.h +++ b/src/hal/sstar/i6f_hal.h @@ -15,6 +15,9 @@ extern int (*i6f_venc_cb)(char, hal_vidstream*); void i6f_hal_deinit(void); int i6f_hal_init(void); +void i6f_audio_deinit(void); +int i6f_audio_init(void); + int i6f_channel_bind(char index, char framerate, char jpeg); int i6f_channel_create(char index, short width, short height, char mirror, char flip, char jpeg); void i6f_channel_disable(char index);