1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include "application.h"
23 #include "hals/common.h"
24 
25 #define AVB_CARRIER_LOCK_NAME_MAX_SIZE 256
26 
27 typedef uint8_t nos2_avb_carrier_lock_name_t[AVB_CARRIER_LOCK_NAME_MAX_SIZE];
28 
29 /****************************************************************************/
30 /* The command is sent separately from any data */
31 
32 enum nos2_avb_cmd {
33   NOS2_AVB_CMD_GET_STATE,
34   NOS2_AVB_CMD_LOAD,
35   NOS2_AVB_CMD_STORE,
36   NOS2_AVB_CMD_GET_LOCK,
37   NOS2_AVB_CMD_CARRIER_LOCK,
38   NOS2_AVB_CMD_CARRIER_UNLOCK,
39   NOS2_AVB_CMD_SET_DEVICE_LOCK,
40   NOS2_AVB_CMD_SET_BOOT_LOCK,
41   NOS2_AVB_CMD_SET_OWNER_LOCK,
42   NOS2_AVB_CMD_SET_PRODUCTION,
43   NOS2_AVB_CMD_CARRIER_LOCK_TEST,
44   NOS2_AVB_CMD_RESET,
45   NOS2_AVB_CMD_BOOT_LOADER_DONE,
46   NOS2_AVB_CMD_GET_OWNER_KEY,
47   NOS2_AVB_CMD_GET_RESET_CHALLENGE,
48   NOS2_AVB_CMD_PRODUCTION_RESET_TEST,
49   NOS2_AVB_CMD_GET_CARRIER_LOCK_NAME,
50 
51   NOS2_AVB_NUM_CMDS
52 };
53 
54 /****************************************************************************/
55 /* Request/Response data. Both are optional and depend on the command. */
56 
57 /**   NOS2_AVB_CMD_GET_CARRIER_LOCK_NAME */
58 struct nos2_avb_get_carrier_lock_name_request {
59   struct nos2_cmd_hal hal;
60 };
61 
62 struct nos2_avb_get_carrier_lock_name_response {
63   struct nos2_cmd_hal hal;
64 
65   nos2_avb_carrier_lock_name_t name;
66 };
67 
68 /****************************************************************************/
69 #ifdef __cplusplus
70 }
71 #endif
72