1 /*
2  * Copyright (C) 2016 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 
17 /*
18  * This file contains data type definitions and constants that are useful to
19  * code interacting with and implementing the NVRAM HAL, even though it doesn't
20  * use the actual NVRAM HAL module interface. Keeping this in a separate file
21  * simplifies inclusion in low-level code which can't easily include the heavier
22  * hardware.h due to lacking standard headers.
23  */
24 
25 #ifndef ANDROID_HARDWARE_NVRAM_DEFS_H
26 #define ANDROID_HARDWARE_NVRAM_DEFS_H
27 
28 #include <stdint.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif  // __cplusplus
33 
34 /* Values returned by nvram_device methods. */
35 typedef uint32_t nvram_result_t;
36 
37 const nvram_result_t NV_RESULT_SUCCESS = 0;
38 const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
39 const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
40 const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
41 const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
42 const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
43 const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
44 
45 /* Values describing available access controls. */
46 typedef uint32_t nvram_control_t;
47 
48 const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
49 const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
50 const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
51 const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
52 const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
53 const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
54 
55 const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
56 
57 #ifdef __cplusplus
58 }  // extern "C"
59 #endif  // __cplusplus
60 
61 #endif  // ANDROID_HARDWARE_NVRAM_DEFS_H
62