Split NVRAM HAL header to break out types and constants.
This allows inclusion of the new nvram_defs.h header to pull in NVRAM types and constants without pulling in hardware.h, which is difficult in low-level environments such as Trusty (and the full NVRAM HAL header isn't useful in that environment anyways). Change-Id: I023104ec666832d4e01ae8841a4d6407a5b04643
This commit is contained in:
parent
5cfc02e4b1
commit
d2d0b67259
2 changed files with 62 additions and 23 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/nvram_defs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -32,29 +33,6 @@ __BEGIN_DECLS
|
|||
#define NVRAM_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
|
||||
#define NVRAM_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
|
||||
|
||||
/* Values returned by nvram_device methods. */
|
||||
typedef uint32_t nvram_result_t;
|
||||
|
||||
const nvram_result_t NV_RESULT_SUCCESS = 0;
|
||||
const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
|
||||
const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
|
||||
const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
|
||||
const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
|
||||
const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
|
||||
const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
|
||||
|
||||
/* Values describing available access controls. */
|
||||
typedef uint32_t nvram_control_t;
|
||||
|
||||
const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
|
||||
const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
|
||||
const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
|
||||
const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
|
||||
const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
|
||||
const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
|
||||
|
||||
const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
|
||||
|
||||
struct nvram_module {
|
||||
/**
|
||||
* Common methods of the nvram_module. This *must* be the first member of
|
||||
|
|
61
include/hardware/nvram_defs.h
Normal file
61
include/hardware/nvram_defs.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains data type definitions and constants that are useful to
|
||||
* code interacting with and implementing the NVRAM HAL, even though it doesn't
|
||||
* use the actual NVRAM HAL module interface. Keeping this in a separate file
|
||||
* simplifies inclusion in low-level code which can't easily include the heavier
|
||||
* hardware.h due to lacking standard headers.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_NVRAM_DEFS_H
|
||||
#define ANDROID_HARDWARE_NVRAM_DEFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/* Values returned by nvram_device methods. */
|
||||
typedef uint32_t nvram_result_t;
|
||||
|
||||
const nvram_result_t NV_RESULT_SUCCESS = 0;
|
||||
const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
|
||||
const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
|
||||
const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
|
||||
const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
|
||||
const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
|
||||
const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
|
||||
|
||||
/* Values describing available access controls. */
|
||||
typedef uint32_t nvram_control_t;
|
||||
|
||||
const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
|
||||
const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
|
||||
const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
|
||||
const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
|
||||
const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
|
||||
const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
|
||||
|
||||
const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // ANDROID_HARDWARE_NVRAM_DEFS_H
|
Loading…
Reference in a new issue