blob: b6d047dbc219015a6696c8356365f1a208ad0479 [file] [log] [blame]
Quinn Male2e883752019-03-22 11:28:54 -07001/* opaque_header.h
2 *
3 * This file contains the structures needed for the updated
4 * recognition config and recognition event opaque data. These
5 * structures will also be used by the client applications for
6 * SVA.
7 *
8 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of The Linux Foundation nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
27 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef ST_OPAQUE_H
37#define ST_OPAQUE_H
38
39#include "st_second_stage.h"
40
41#define ST_MAX_SOUND_MODELS 10
42#define ST_MAX_KEYWORDS 10
43#define ST_MAX_USERS 10
44
45typedef enum st_param_key st_param_key_t;
46
47enum st_param_key {
48 ST_PARAM_KEY_CONFIDENCE_LEVELS,
49 ST_PARAM_KEY_HISTORY_BUFFER_CONFIG,
50 ST_PARAM_KEY_KEYWORD_INDICES,
51 ST_PARAM_KEY_TIMESTAMP,
52 ST_PARAM_KEY_DETECTION_PERF_MODE,
53};
54
55struct st_param_header
56{
57 st_param_key_t key_id;
58 uint32_t payload_size;
59}__packed;
60
61struct st_user_levels
62{
63 uint32_t user_id;
64 uint8_t level;
65}__packed;
66
67struct st_keyword_levels
68{
69 uint8_t kw_level;
70 uint32_t num_user_levels;
71 struct st_user_levels user_levels[ST_MAX_USERS];
72}__packed;
73
74struct st_sound_model_conf_levels
75{
76 listen_model_indicator_enum sm_id;
77 uint32_t num_kw_levels;
78 struct st_keyword_levels kw_levels[ST_MAX_KEYWORDS];
79}__packed;
80
81struct st_confidence_levels_info
82{
83 uint32_t version; /* value: 0x1 */
84 uint32_t num_sound_models;
85 struct st_sound_model_conf_levels conf_levels[ST_MAX_SOUND_MODELS];
86}__packed;
87
88struct st_user_levels_v2
89{
90 uint32_t user_id;
91 int32_t level;
92}__packed;
93
94struct st_keyword_levels_v2
95{
96 int32_t kw_level;
97 uint32_t num_user_levels;
98 struct st_user_levels_v2 user_levels[ST_MAX_USERS];
99}__packed;
100
101struct st_sound_model_conf_levels_v2
102{
103 listen_model_indicator_enum sm_id;
104 uint32_t num_kw_levels;
105 struct st_keyword_levels_v2 kw_levels[ST_MAX_KEYWORDS];
106}__packed;
107
108struct st_confidence_levels_info_v2
109{
110 uint32_t version; /* value: 0x02 */
111 uint32_t num_sound_models;
112 struct st_sound_model_conf_levels_v2 conf_levels[ST_MAX_SOUND_MODELS];
113}__packed;
114
115struct st_hist_buffer_info
116{
117 uint32_t version; /* value: 0x02 */
118 uint32_t hist_buffer_duration_msec;
119 uint32_t pre_roll_duration_msec;
120}__packed;
121
122struct st_keyword_indices_info
123{
124 uint32_t version; /* value: 0x01 */
125 uint32_t start_index; /* in bytes */
126 uint32_t end_index; /* in bytes */
127}__packed;
128
129struct st_timestamp_info
130{
131 uint32_t version; /* value: 0x01 */
132 uint64_t first_stage_det_event_time; /* in nanoseconds */
133 uint64_t second_stage_det_event_time; /* in nanoseconds */
134}__packed;
135
136struct st_det_perf_mode_info
137{
138 uint32_t version; /* value: 0x01 */
139 uint8_t mode; /* 0 -Low Power, 1 -High performance */
140}__packed;
141#endif /* ST_OPAQUE_H */