Skip to content

Commit

Permalink
(Continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed May 21, 2024
1 parent a1aa8e7 commit 2b044ec
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/hal/sstar/i6_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef enum {
} i6_aud_type;

typedef struct {
int LeftJustOn;
int leftJustOn;
i6_aud_clk clock;
char syncRxClkOn;
} i6_aud_i2s;
Expand Down
38 changes: 38 additions & 0 deletions src/hal/sstar/i6_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/hal/sstar/i6_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hal/sstar/i6c_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/hal/sstar/i6c_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/hal/sstar/i6f_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef enum {
} i6f_aud_type;

typedef struct {
int LeftJustOn;
int leftJustOn;
i6f_aud_clk clock;
char syncRxClkOn;
unsigned int tdmSlotNum;
Expand Down
41 changes: 41 additions & 0 deletions src/hal/sstar/i6f_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/hal/sstar/i6f_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2b044ec

Please sign in to comment.