Skip to content

Commit

Permalink
(Continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Jun 10, 2024
1 parent 3ab6fd8 commit 9a9125a
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 3 deletions.
30 changes: 29 additions & 1 deletion src/hal/sstar/i6_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int i6_audio_init(void)
config.chnNum = 1;
config.i2s.clock = I6_AUD_CLK_OFF;
config.i2s.leftJustOn = 0;
config.i2s.syncRxClkOn = 0;
config.i2s.syncRxClkOn = 1;
if (ret = i6_aud.fnSetDeviceConfig(_i6_aud_dev, &config))
return ret;
}
Expand All @@ -102,6 +102,34 @@ int i6_audio_init(void)
return EXIT_SUCCESS;
}

void *i6_audio_thread(void)
{
int ret;

i6_aud_frm frame, echoFrame;

while (keepRunning) {
if ((ret = i6_aud.fnGetFrame(_i6_aud_dev, _i6_aud_chn,
&frame, &echoFrame, 100)) & 0xFF == 0xD) {
fprintf(stderr, "[i6_aud] Getting the frame failed"
" with %#x!\n", ret);
break;
} else continue;

if (i6_aud_cb) {
hal_audframe outFrame;
(i6_aud_cb)(&outFrame);
}

if (ret = i6_aud.fnFreeFrame(_i6_aud_dev, _i6_aud_chn,
&frame, &echoFrame)) {
fprintf(stderr, "[i6_aud] Releasing the frame failed"
" with %#x!\n", ret);
}
}
fprintf(stderr, "[i6_aud] Shutting down encoding thread...\n");
}

int i6_channel_bind(char index, char framerate, char jpeg)
{
int ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern int (*i6_venc_cb)(char, hal_vidstream*);

void i6_hal_deinit(void);
int i6_hal_init(void);
void *i6_audio_thread(void);

void i6_audio_deinit(void);
int i6_audio_init(void);
Expand Down
32 changes: 30 additions & 2 deletions src/hal/sstar/i6c_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ int i6c_audio_init(void)
config.sound = I6C_AUD_SND_MONO;
config.rate = 48000;
config.periodSize = 0x600;
config.interleavedOn = 1;
config.interleavedOn = 0;
if (ret = i6c_aud.fnEnableDevice(_i6c_aud_dev, &config))
return ret;
}
{
i6c_aud_input input = I6C_AUD_INPUT_I2S_A_01;
i6c_aud_i2s config;
config.intf = I6C_AUD_INTF_I2S_SLAVE;
config.bit = I6C_AUD_BIT_32;
config.bit = I6C_AUD_BIT_16;
config.leftJustOn = 0;
config.rate = 48000;
config.clock = I6C_AUD_CLK_OFF;
Expand All @@ -113,6 +113,34 @@ int i6c_audio_init(void)
return EXIT_SUCCESS;
}

void *i6c_audio_thread(void)
{
int ret;

i6c_aud_frm frame, echoFrame;

while (keepRunning) {
if ((ret = i6c_aud.fnGetFrame(_i6c_aud_dev, _i6c_aud_chn,
&frame, &echoFrame, 100)) & 0xFF == 0xD) {
fprintf(stderr, "[i6c_aud] Getting the frame failed"
" with %#x!\n", ret);
break;
} else continue;

if (i6c_aud_cb) {
hal_audframe outFrame;
(i6c_aud_cb)(&outFrame);
}

if (ret = i6c_aud.fnFreeFrame(_i6c_aud_dev, _i6c_aud_chn,
&frame, &echoFrame)) {
fprintf(stderr, "[i6c_aud] Releasing the frame failed"
" with %#x!\n", ret);
}
}
fprintf(stderr, "[i6c_aud] Shutting down encoding thread...\n");
}

int i6c_channel_bind(char index, char framerate, char jpeg)
{
int ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6c_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ int i6c_hal_init(void);

void i6c_audio_deinit(void);
int i6c_audio_init(void);
void *i6c_audio_thread(void);

int i6c_channel_bind(char index, char framerate, char jpeg);
int i6c_channel_create(char index, short width, short height, char mirror, char flip, char jpeg);
Expand Down
28 changes: 28 additions & 0 deletions src/hal/sstar/i6f_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,34 @@ int i6f_audio_init(void)
return EXIT_SUCCESS;
}

void *i6f_audio_thread(void)
{
int ret;

i6f_aud_frm frame, echoFrame;

while (keepRunning) {
if ((ret = i6f_aud.fnGetFrame(_i6f_aud_dev, _i6f_aud_chn,
&frame, &echoFrame, 100)) & 0xFF == 0xD) {
fprintf(stderr, "[i6f_aud] Getting the frame failed"
" with %#x!\n", ret);
break;
} else continue;

if (i6f_aud_cb) {
hal_audframe outFrame;
(i6f_aud_cb)(&outFrame);
}

if (ret = i6f_aud.fnFreeFrame(_i6f_aud_dev, _i6f_aud_chn,
&frame, &echoFrame)) {
fprintf(stderr, "[i6f_aud] Releasing the frame failed"
" with %#x!\n", ret);
}
}
fprintf(stderr, "[i6f_aud] Shutting down encoding thread...\n");
}

int i6f_channel_bind(char index, char framerate, char jpeg)
{
int ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6f_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ int i6f_hal_init(void);

void i6f_audio_deinit(void);
int i6f_audio_init(void);
void *i6f_audio_thread(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);
Expand Down

0 comments on commit 9a9125a

Please sign in to comment.