Keun Soo Yim | 5a9af06 | 2016-08-11 20:29:23 -0700 | [diff] [blame] | 1 | // Copyright 2016 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | syntax = "proto2"; |
| 16 | |
| 17 | package android.vts; |
| 18 | |
Keun Soo Yim | 59fb349 | 2016-08-26 18:36:29 -0700 | [diff] [blame^] | 19 | |
| 20 | // Class of a target component. |
| 21 | enum ComponentClass { |
| 22 | UNKNOWN_CLASS = 0; |
| 23 | // For a HAL shared library. |
| 24 | HAL_CONVENTIONAL = 1; |
| 25 | // For a submodule of a shared library HAL . |
| 26 | HAL_CONVENTIONAL_SUBMODULE = 2; |
| 27 | // For a legacy HAL. |
| 28 | HAL_LEGACY = 3; |
| 29 | // For a HAL which uses HIDL (HAL Interface Definition Language). |
| 30 | HAL_HIDL = 4; |
| 31 | // For a HAL which uses HIDL (HAL Interface Definition Language). |
| 32 | HAL_HIDL_WRAPPED_CONVENTIONAL = 5; |
| 33 | |
| 34 | // For a shared library which is not a HAL (e.g., standard library). |
| 35 | LIB_SHARED = 11; |
| 36 | |
| 37 | // For an OS kernel. |
| 38 | KERNEL = 21; |
| 39 | // For an OS kernel module. |
| 40 | KERNEL_MODULE = 22; |
| 41 | } |
| 42 | |
| 43 | |
| 44 | // Type of a target component. |
| 45 | enum ComponentType { |
| 46 | UNKNOWN_TYPE = 0; |
| 47 | // For an audio submodule. |
| 48 | AUDIO = 1; |
| 49 | // For a camera submodule. |
| 50 | CAMERA = 2; |
| 51 | // For a GPS submodule. |
| 52 | GPS = 3; |
| 53 | // For a Lights sensor submodule. |
| 54 | LIGHT = 4; |
| 55 | // For a WiFi submodule. |
| 56 | WIFI = 5; |
| 57 | // For a mobile networking submodule. |
| 58 | MOBILE = 6; |
| 59 | // For a WiFi submodule. |
| 60 | BLUETOOTH = 7; |
| 61 | // For a NFC submodule |
| 62 | NFC = 8; |
| 63 | // For a power HAL. |
| 64 | POWER = 9; |
| 65 | // For a mem track HAL. |
| 66 | MEMTRACK = 10; |
| 67 | // For a biometrics fingerprint HAL. |
| 68 | BFP = 11; |
| 69 | |
| 70 | // for bionic's libm |
| 71 | BIONIC_LIBM = 1001; |
| 72 | |
| 73 | // for bionic's libc |
| 74 | BIONIC_LIBC = 1002; |
| 75 | |
| 76 | // for VNDK's libcutils |
| 77 | VNDK_LIBCUTILS = 1101; |
| 78 | |
| 79 | // for OS kernel's system call. |
| 80 | SYSCALL = 2001; |
| 81 | } |
| 82 | |
| 83 | |
| 84 | // Type of a variable. |
| 85 | enum VariableType { |
| 86 | UNKNOWN_VARIABLE_TYPE = 0; |
| 87 | TYPE_PREDEFINED = 1; |
| 88 | TYPE_SCALAR = 2; |
| 89 | TYPE_STRING = 3; |
| 90 | TYPE_ENUM = 4; |
| 91 | TYPE_ARRAY = 5; |
| 92 | TYPE_VECTOR = 6; |
| 93 | TYPE_STRUCT = 7; |
| 94 | // for conventional HALs, to keep a data structure with one or multiple |
| 95 | // callback functions. |
| 96 | TYPE_FUNCTION_POINTER = 8; |
| 97 | TYPE_VOID = 9; |
| 98 | TYPE_HIDL_CALLBACK = 10; |
| 99 | TYPE_SUBMODULE = 11; |
| 100 | } |
| 101 | |
| 102 | |
| 103 | // Type of a target processor architecture. |
| 104 | enum TargetArch { |
| 105 | UNKNOWN_TARGET_ARCH = 0; |
| 106 | TARGET_ARCH_ARM = 1; |
| 107 | TARGET_ARCH_ARM64 = 2; |
| 108 | } |
| 109 | |
| 110 | |
| 111 | // To specify a call flow event. |
| 112 | message CallFlowSpecificationMessage { |
| 113 | // true if for a function call event. |
| 114 | optional bool entry = 1 [default = false]; |
| 115 | // true if for an exit event from a function. |
| 116 | optional bool exit = 2 [default = false]; |
| 117 | // a list of functions that can be called right after this event. |
| 118 | repeated bytes next = 11; |
| 119 | // a list of functions that can be called right before this event. |
| 120 | repeated bytes prev = 12; |
| 121 | } |
| 122 | |
| 123 | |
| 124 | // To specify the measured native code coverage raw data. |
| 125 | message NativeCodeCoverageRawDataMessage { |
| 126 | // gcno file path. |
| 127 | optional bytes file_path = 1; |
| 128 | |
| 129 | // content of a gcda file. |
| 130 | optional bytes gcda = 11; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | // To specify a function. |
| 135 | message FunctionSpecificationMessage { |
| 136 | // the function name. |
| 137 | optional bytes name = 1; |
| 138 | |
| 139 | // the submodule name. |
| 140 | optional bytes submodule_name = 2; |
| 141 | |
| 142 | // data type of the return value (for legacy HALs and shared libraries). |
| 143 | optional VariableSpecificationMessage return_type = 11; |
| 144 | |
| 145 | // data type of the return value (for HIDL HALs). |
| 146 | repeated VariableSpecificationMessage return_type_hidl = 12; |
| 147 | |
| 148 | // used to pass the spec of a found HAL_CONVENTIONAL_SUBMODULE to the host. |
| 149 | optional ComponentSpecificationMessage return_type_submodule_spec = 13; |
| 150 | |
| 151 | // a list of arguments. |
| 152 | repeated VariableSpecificationMessage arg = 21; |
| 153 | |
| 154 | // a specification of the call flows of the function. |
| 155 | repeated CallFlowSpecificationMessage callflow = 31; |
| 156 | |
| 157 | // whether it is a callback. |
| 158 | optional bool is_callback = 41; |
| 159 | |
| 160 | // when it is a callback. |
| 161 | optional FunctionPointerSpecificationMessage function_pointer = 42; |
| 162 | |
| 163 | // profiling data. |
| 164 | repeated float profiling_data = 101; |
| 165 | |
| 166 | // measured processed coverage data. |
| 167 | repeated uint32 processed_coverage_data = 201; |
| 168 | |
| 169 | // measured raw coverage data. |
| 170 | repeated NativeCodeCoverageRawDataMessage raw_coverage_data = 202; |
| 171 | |
| 172 | // not a user-provided variable. used by the frameworks to tell the sub |
| 173 | // struct hierarchy. |
| 174 | optional bytes parent_path = 301; |
| 175 | |
| 176 | // to specify a syscall number. |
| 177 | optional uint32 syscall_number = 401; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | // To keep the value of a scalar variable. |
| 182 | message ScalarDataValueMessage { |
| 183 | optional int32 bool_t = 1; |
| 184 | |
| 185 | optional int32 int8_t = 11; |
| 186 | optional uint32 uint8_t = 12; |
| 187 | |
| 188 | optional int32 char = 13; |
| 189 | optional uint32 uchar = 14; |
| 190 | |
| 191 | optional int32 int16_t = 21; |
| 192 | optional uint32 uint16_t = 22; |
| 193 | |
| 194 | optional int32 int32_t = 31; |
| 195 | optional uint32 uint32_t = 32; |
| 196 | |
| 197 | optional int64 int64_t = 41; |
| 198 | optional uint64 uint64_t = 42; |
| 199 | |
| 200 | optional float float_t = 101; |
| 201 | optional double double_t = 102; |
| 202 | |
| 203 | optional uint32 pointer = 201; |
| 204 | optional uint32 opaque = 202; |
| 205 | optional uint32 void_pointer = 211; |
| 206 | optional uint32 char_pointer = 212; |
| 207 | optional uint32 uchar_pointer = 213; |
| 208 | optional uint32 pointer_pointer = 251; |
| 209 | |
| 210 | // for scalar attributes in a union data structure, |
| 211 | // to specify the number of used bits. |
| 212 | optional uint32 bits = 1001; |
| 213 | } |
| 214 | |
| 215 | |
| 216 | // To keep the value of a vector variable. |
| 217 | message VectorDataValueMessage { |
| 218 | optional VariableType type = 1; |
| 219 | |
| 220 | // mainly for an array, and also can be used at runtime if this's for a vector. |
| 221 | optional uint32 size = 2; |
| 222 | |
| 223 | // when it's for a scalar vector. |
| 224 | optional bytes scalar_type = 11; |
| 225 | repeated ScalarDataValueMessage value = 12; |
| 226 | |
| 227 | // when it's for a struct vector. |
| 228 | optional bytes struct_type = 21; |
| 229 | repeated VariableSpecificationMessage struct_value = 22; |
| 230 | } |
| 231 | |
| 232 | |
| 233 | // To keep the specification and value of a function pointer. |
| 234 | message FunctionPointerSpecificationMessage { |
| 235 | // used for a function pointer to keep its function name. |
| 236 | optional bytes function_name = 1; |
| 237 | |
| 238 | // actual pointer value. |
| 239 | optional uint32 address = 11; |
| 240 | // ID used for VTS RMI (remote method invocation). |
| 241 | optional bytes id = 21; |
| 242 | |
| 243 | // argument(s) |
| 244 | repeated VariableSpecificationMessage arg = 101; |
| 245 | |
| 246 | // data type of the return value (for legacy HALs and shared libraries). |
| 247 | optional VariableSpecificationMessage return_type = 111; |
| 248 | } |
| 249 | |
| 250 | |
| 251 | // To keep the value of a string variable. |
| 252 | message StringDataValueMessage { |
| 253 | // for actual contents. |
| 254 | optional bytes message = 1; |
| 255 | |
| 256 | // for length in bytes, and usually not required. |
| 257 | optional uint32 length = 11; |
| 258 | } |
| 259 | |
| 260 | |
| 261 | // To keep the value of an enum type variable. |
| 262 | message EnumDataValueMessage { |
| 263 | // for the enumerator names. |
| 264 | repeated bytes enumerator = 1; |
| 265 | |
| 266 | // for the corresponding values. |
| 267 | repeated uint32 value = 2; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | // To specify a function argument or an attribute in general. |
| 272 | message VariableSpecificationMessage { |
| 273 | // the variable name. empty if for a type definition. |
| 274 | optional bytes name = 1; |
| 275 | |
| 276 | // the variable type which is one of: |
| 277 | // TYPE_SCALAR, TYPE_STRING, TYPE_ENUM, TYPE_ARRAY, |
| 278 | // TYPE_VECTOR, TYPE_STRUCT, TYPE_UNION |
| 279 | // |
| 280 | // not yet supported: |
| 281 | // "template", "typedef", "handle", "binder", "parcelable". |
| 282 | optional VariableType type = 2; |
| 283 | |
| 284 | // the number of used bits (only for variables of a TYPE_UNION variable). |
| 285 | optional int32 used_bits = 11; |
| 286 | |
| 287 | // the actual value(s) for an scalar data type. |
| 288 | // repeated values for a vector. |
| 289 | optional ScalarDataValueMessage scalar_value = 101; |
| 290 | optional bytes scalar_type = 102; |
| 291 | |
| 292 | optional StringDataValueMessage string_value = 111; |
| 293 | |
| 294 | optional EnumDataValueMessage enum_value = 121; |
| 295 | |
| 296 | // for both TYPE_ARRAY (using size field) and TYPE_VECTOR. |
| 297 | repeated VectorDataValueMessage vector_value = 131; |
| 298 | |
| 299 | // for sub variables when this's a struct type. |
| 300 | repeated VariableSpecificationMessage struct_value = 141; |
| 301 | // the type name of this struct. |
| 302 | optional bytes struct_type = 142; |
| 303 | |
| 304 | // for sub variables when this's a union type. |
| 305 | repeated VariableSpecificationMessage union_value = 151; |
| 306 | |
| 307 | // for non HIDL HAL, to use a custom type defined in C/C++. |
| 308 | optional bytes predefined_type = 201; |
| 309 | |
| 310 | // for non HIDL HAL, to set function pointer(s). |
| 311 | repeated FunctionPointerSpecificationMessage function_pointer = 221; |
| 312 | |
| 313 | // for HIDL HAL, to use a HIDL callback instance. |
| 314 | optional bytes hidl_callback_type = 231; |
| 315 | |
| 316 | // true if the argument is an input (valid only for the top-level message). |
| 317 | optional bool is_input = 301 [default = true]; |
| 318 | // true if the argument is an output. |
| 319 | optional bool is_output = 302 [default = false]; |
| 320 | // true if the argument is a constant variable. |
| 321 | optional bool is_const = 303 [default = false]; |
| 322 | // true if the argument is a struct with one or multiple function pointers. |
| 323 | optional bool is_callback = 304 [default = false]; |
| 324 | } |
| 325 | |
| 326 | |
| 327 | // To specify a sub-structure. |
| 328 | message StructSpecificationMessage { |
| 329 | // the sub-structure's variable name in its parent data structure. |
| 330 | optional bytes name = 1; |
| 331 | |
| 332 | // whether itself a pointer varaible in its parent data structure. |
| 333 | optional bool is_pointer = 2 [default = false]; |
| 334 | |
| 335 | // a list of functions contained in the struct. |
| 336 | repeated FunctionSpecificationMessage api = 1001; |
| 337 | |
| 338 | // a list of structures contained in the component. |
| 339 | repeated StructSpecificationMessage sub_struct = 2001; |
| 340 | |
| 341 | // The definitions of custom-defined aggregate types. |
| 342 | repeated VariableSpecificationMessage attribute = 3001; |
| 343 | } |
| 344 | |
| 345 | |
| 346 | // To specify an interface of a component |
| 347 | message InterfaceSpecificationMessage { |
| 348 | // a list of functions exposed by the component. |
| 349 | repeated FunctionSpecificationMessage api = 2001; |
| 350 | |
| 351 | // The definitions of custom-defined aggregate types. |
| 352 | repeated VariableSpecificationMessage attribute = 3001; |
| 353 | |
| 354 | // a list of structures contained in the component. |
| 355 | repeated StructSpecificationMessage sub_struct = 4001; |
| 356 | } |
Keun Soo Yim | 5a9af06 | 2016-08-11 20:29:23 -0700 | [diff] [blame] | 357 | |
| 358 | |
| 359 | // To specify a module (which is logically equivalent to a .hal file in case |
| 360 | // of a HIDL HAL). |
| 361 | message ComponentSpecificationMessage { |
| 362 | // Class, type, and version of a target component. |
| 363 | optional ComponentClass component_class = 1; |
| 364 | optional ComponentType component_type = 2; |
| 365 | optional float component_type_version = 3 [default = 1.0]; |
| 366 | |
| 367 | // The name of a target component (used for HIDL HALs). |
| 368 | optional bytes component_name = 4; |
| 369 | |
Keun Soo Yim | 59fb349 | 2016-08-26 18:36:29 -0700 | [diff] [blame^] | 370 | // for the target processor architecture. |
| 371 | optional TargetArch target_arch = 5; |
| 372 | |
Keun Soo Yim | 5a9af06 | 2016-08-11 20:29:23 -0700 | [diff] [blame] | 373 | // The package path of a target component (e.g., android.hardware.name). |
| 374 | // name implies the component_type field. |
| 375 | optional bytes package = 11; |
| 376 | |
| 377 | // The modules to import (e.g., package_path.component_name). |
| 378 | repeated bytes import = 12; |
| 379 | |
| 380 | // The name of original C/C++ data structure |
| 381 | // (used for conventional and legacy HALs). |
| 382 | optional bytes original_data_structure_name = 1001; |
| 383 | |
| 384 | // a list of headers that need to be imported in order to use the component. |
| 385 | repeated bytes header = 1002; |
| 386 | |
| 387 | // For a .hal file which actually defines an interface. |
| 388 | optional InterfaceSpecificationMessage interface = 2001; |
| 389 | |
| 390 | // For a .hal file which does not defines an interface (e.g., types.hal). |
Keun Soo Yim | 391057e | 2016-08-12 13:42:40 -0700 | [diff] [blame] | 391 | repeated VariableSpecificationMessage attribute = 2101; |
Keun Soo Yim | 5a9af06 | 2016-08-11 20:29:23 -0700 | [diff] [blame] | 392 | } |