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/ec_commands.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/ec_commands.h')
-rw-r--r-- | include/ec_commands.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index e553ecdfa9..30783bc1bb 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -641,6 +641,9 @@ enum host_event_code { /* Keyboard recovery combo with hardware reinitialization */ EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30, + /* WoV */ + EC_HOST_EVENT_WOV = 31, + /* * The high bit of the event mask is not used as a host event code. If * it reads back as set, then the entire event mask should be @@ -4670,10 +4673,14 @@ enum ec_codec_subcmd { }; enum ec_codec_cap { + EC_CODEC_CAP_WOV_AUDIO_SHM = 0, + EC_CODEC_CAP_WOV_LANG_SHM = 1, EC_CODEC_CAP_LAST = 32, }; enum ec_codec_shm_id { + EC_CODEC_SHM_ID_WOV_AUDIO = 0x0, + EC_CODEC_SHM_ID_WOV_LANG = 0x1, EC_CODEC_SHM_ID_LAST, }; @@ -4835,6 +4842,68 @@ struct __ec_align4 ec_param_ec_codec_i2s_rx { }; /*****************************************************************************/ +/* Commands for WoV on audio codec. */ + +#define EC_CMD_EC_CODEC_WOV 0x00BF + +enum ec_codec_wov_subcmd { + EC_CODEC_WOV_SET_LANG = 0x0, + EC_CODEC_WOV_SET_LANG_SHM = 0x1, + EC_CODEC_WOV_GET_LANG = 0x2, + EC_CODEC_WOV_ENABLE = 0x3, + EC_CODEC_WOV_DISABLE = 0x4, + EC_CODEC_WOV_READ_AUDIO = 0x5, + EC_CODEC_WOV_READ_AUDIO_SHM = 0x6, + EC_CODEC_WOV_SUBCMD_COUNT, +}; + +/* + * @hash is SHA256 of the whole language model. + * @total_len indicates the length of whole language model. + * @offset is the cursor from the beginning of the model. + * @buf is the packet buffer. + * @len denotes how many bytes in the buf. + */ +struct __ec_align4 ec_param_ec_codec_wov_set_lang { + uint8_t hash[32]; + uint32_t total_len; + uint32_t offset; + uint8_t buf[128]; + uint32_t len; +}; + +struct __ec_align4 ec_param_ec_codec_wov_set_lang_shm { + uint8_t hash[32]; + uint32_t total_len; +}; + +struct __ec_align4 ec_param_ec_codec_wov { + uint8_t cmd; /* enum ec_codec_wov_subcmd */ + uint8_t reserved[3]; + + union { + struct ec_param_ec_codec_wov_set_lang + set_lang_param; + struct ec_param_ec_codec_wov_set_lang_shm + set_lang_shm_param; + }; +}; + +struct __ec_align4 ec_response_ec_codec_wov_get_lang { + uint8_t hash[32]; +}; + +struct __ec_align4 ec_response_ec_codec_wov_read_audio { + uint8_t buf[128]; + uint32_t len; +}; + +struct __ec_align4 ec_response_ec_codec_wov_read_audio_shm { + uint32_t offset; + uint32_t len; +}; + +/*****************************************************************************/ /* System commands */ /* |