Skip to content
Permalink
Browse files

samples: intel_s1000: tuning commands in audio app

Add processing of sample tuning commands in the audio
sample app.
Add audio processing stubs.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
  • Loading branch information...
sathishkuttan authored and nashif committed Jun 28, 2019
1 parent 47e2e62 commit c3bf362c28f6c5b83a216f8db43c3a16dc14cc25
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#define LOG_LEVEL LOG_LEVEL_ERR
#define LOG_LEVEL LOG_LEVEL_INF
#include <logging/log.h>
LOG_MODULE_REGISTER(audio_core);

@@ -23,6 +23,13 @@ LOG_MODULE_REGISTER(audio_core);
static s32_t mic_input[AUDIO_ACTIVE_CHANNELS][AUDIO_SAMPLES_PER_FRAME];
static s32_t host_input[AUDIO_ACTIVE_CHANNELS][AUDIO_SAMPLES_PER_FRAME];

static bool tuning_reply_ready;
static u32_t *tuning_command_buffer;
static u32_t tuning_cmd_buf_size_in_words;

#define CMD_START_AUDIO 1
#define CMD_STOP_AUDIO 2

int audio_core_initialize(void)
{
return 0;
@@ -108,3 +115,57 @@ int audio_core_notify_frame_tick(void)
{
return 0;
}

int audio_core_tuning_interface_init(u32_t *command_buffer, u32_t size_in_words)
{
tuning_command_buffer = command_buffer;
tuning_cmd_buf_size_in_words = size_in_words;
return 0;
}

int audio_core_notify_tuning_cmd(void)
{
u32_t first_word = *((u32_t *)tuning_command_buffer);
u32_t command = (first_word << 16) >> 16;

switch (command) {
case CMD_START_AUDIO:
audio_driver_start();
break;

case CMD_STOP_AUDIO:
audio_driver_stop();
break;

default:
LOG_INF("Unknown command %d", command);
}

tuning_reply_ready = true;
return 0;
}

bool audio_core_is_tuning_reply_ready(void)
{
if (tuning_reply_ready == true) {
tuning_reply_ready = false;
return true;
}

return false;
}

int audio_core_process_background_tasks(void)
{
return 0;
}

int audio_core_process_small_blocks(void)
{
return 0;
}

int audio_core_process_large_blocks(void)
{
return 0;
}
@@ -8,10 +8,18 @@
#define AUDIO_CORE__H

/* scheduling priority used by each thread */
#define TUN_DRV_IO_THREAD_PRIORITY -3
#define AUDIO_DRIVER_THREAD_PRIORITY 2
#define AUDIO_SM_BLOCK_PROC_THREAD_PRIORITY 3
#define AUDIO_LG_BLOCK_PROC_THREAD_PRIORITY 4
#define FRAMEWORK_BG_THREAD_PRIORITY 99

/* size of stack area used by each thread */
#define AUDIO_DRIVER_THREAD_STACKSIZE 2048
#define TUN_DRV_IO_THREAD_STACK_SIZE 1024
#define FRAMEWORK_BG_THREAD_STACK_SIZE 1024
#define AUDIO_SM_BLOCK_PROC_THREAD_STACK_SIZE 1024
#define AUDIO_LG_BLOCK_PROC_THREAD_STACK_SIZE 1024

/* input audio channels */
#define AUDIO_MIC_INPUT_CHANNEL_COUNT 8
@@ -37,4 +45,21 @@ int audio_core_process_speaker_sink(s32_t *buffer, int channels);
int audio_core_process_host_sink(s32_t *buffer, int channels);
int audio_core_notify_frame_tick(void);

/* tuning interface prototypes */
int audio_core_tuning_interface_init(u32_t *command_buffer,
u32_t size_in_words);
int audio_core_notify_tuning_cmd(void);
bool audio_core_is_tuning_reply_ready(void);

/* audio driver prototypes */
int audio_driver_start(void);
int audio_driver_stop(void);

/* tick for processing background tasks, called from the background thread */
int audio_core_process_background_tasks(void);

/* tick for processing small audio blocks */
int audio_core_process_small_blocks(void);
int audio_core_process_large_blocks(void);

#endif /* AUDIO_CORE__H */

0 comments on commit c3bf362

Please sign in to comment.
You can’t perform that action at this time.