diff options
author | Tzung-Bi Shih <tzungbi@chromium.org> | 2019-02-27 13:04:24 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-19 07:59:05 +0000 |
commit | aa17252161c5cc526555c2f82ad238361f7d22a0 (patch) | |
tree | a09f6825289a1fb7fb3c971215557651dcc50460 /include/audio_codec.h | |
parent | 0beadf2ffd8b23e15d1e7c14de8719d0f45c9519 (diff) | |
download | chrome-ec-aa17252161c5cc526555c2f82ad238361f7d22a0.tar.gz |
audio_codec: add WoV abstract layer
Common logic for Wake-on-Voice.
- set hotword detection model
- get notifications from the chip
- read audio data from the chip
- use the audio data to detect hotword
- send host event to AP if hotword is detected
BRANCH=none
BUG=b:122027734, b:123268236
TEST=1. define CONFIG_AUDIO_CODEC in board.h
2. define CONFIG_AUDIO_CODEC_DMIC in board.h
3. define CONFIG_AUDIO_CODEC_DMIC_SOFTWARE_GAIN in board.h
4. define CONFIG_AUDIO_CODEC_DMIC_MAX_SOFTWARE_GAIN in board.h
5. define CONFIG_AUDIO_CODEC_WOV in board.h
6. make BOARD=kukui_scp -j
Change-Id: I26f7a8dbf9a6d57b1845fbb0666aa1d8285d9013
Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1490800
Diffstat (limited to 'include/audio_codec.h')
-rw-r--r-- | include/audio_codec.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/include/audio_codec.h b/include/audio_codec.h index af64deb16d..62009e6c73 100644 --- a/include/audio_codec.h +++ b/include/audio_codec.h @@ -176,4 +176,79 @@ int audio_codec_i2s_rx_set_daifmt(uint8_t daifmt); */ int audio_codec_i2s_rx_set_bclk(uint32_t bclk); + +/* + * WoV abstract layer + */ + +/* + * Enables WoV. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has enabled. + */ +int audio_codec_wov_enable(void); + +/* + * Disables WoV. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has not enabled. + */ +int audio_codec_wov_disable(void); + +/* + * Reads the WoV audio data from chip. + * + * @buf is the target pointer to put the data. + * @count is the maximum number of bytes to read. + * + * Returns: + * -1 if any errors. + * 0 if no data. + * >0 if success. The returned value denotes number of bytes read. + */ +int32_t audio_codec_wov_read(void *buf, uint32_t count); + +/* + * Enables notification if WoV audio data is available. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has enabled. + * EC_ERROR_ACCESS_DENIED if the notifiee has not set. + */ +int audio_codec_wov_enable_notifier(void); + +/* + * Disables WoV data notification. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has not enabled. + * EC_ERROR_ACCESS_DENIED if the notifiee has not set. + */ +int audio_codec_wov_disable_notifier(void); + +/* + * Audio buffer for 2 seconds S16_LE, 16kHz, mono. + */ +extern uintptr_t audio_codec_wov_audio_buf_addr; + +/* + * Language model buffer for speech-micro. At least 67KB. + */ +extern uintptr_t audio_codec_wov_lang_buf_addr; + +/* + * Task for running WoV. + */ +void audio_codec_wov_task(void *arg); + #endif |