blob: 0256a3cf235c590bc2cb45fd8817f9503a566dfd [file] [log] [blame]
Mattias Nisslerd2d0b672016-02-04 10:00:28 +01001/*
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
31extern "C" {
32#endif // __cplusplus
33
34/* Values returned by nvram_device methods. */
35typedef uint32_t nvram_result_t;
36
37const nvram_result_t NV_RESULT_SUCCESS = 0;
38const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
39const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
40const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
41const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
42const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
43const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
44
45/* Values describing available access controls. */
46typedef uint32_t nvram_control_t;
47
48const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
49const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
50const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
51const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
52const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
53const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
54
55const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
56
57#ifdef __cplusplus
58} // extern "C"
59#endif // __cplusplus
60
61#endif // ANDROID_HARDWARE_NVRAM_DEFS_H