nvram_device 结构参考

nvram_device 结构参考

#include < nvram.h >

数据字段

结构体hw_device_t常见的
nvram_结果_t (* get_total_size_in_bytes )(const struct nvram_device *设备,uint64_t *total_size)
nvram_结果_t (* get_available_size_in_bytes )(const struct nvram_device *设备,uint64_t *available_size)
nvram_结果_t (* get_max_space_size_in_bytes )(const struct nvram_device *设备,uint64_t *max_space_size)
nvram_结果_t (* get_max_spaces )(const struct nvram_device *device, uint32_t *num_spaces)
nvram_结果_t (* get_space_list )(const struct nvram_device *设备,uint32_t max_list_size,uint32_t *space_index_list,uint32_t *list_size)
nvram_结果_t (* get_space_size )(const struct nvram_device *设备,uint32_t索引,uint64_t *大小)
nvram_结果_t (* get_space_controls )(const struct nvram_device *设备,uint32_t索引,uint32_t max_list_size, nvram_control_t *control_list,uint32_t *list_size)
nvram_结果_t (* is_space_locked )(const struct nvram_device *device, uint32_t 索引, int *write_lock_enabled, int *read_lock_enabled)
nvram_结果_t (* create_space )(const struct nvram_device *设备,uint32_t索引,uint64_t size_in_bytes,const nvram_control_t *control_list,uint32_t list_size,const uint8_t *authorization_value,uint32_tauthorization_value_size)
nvram_结果_t (* delete_space )(const struct nvram_device *设备,uint32_t索引,const uint8_t *授权值,uint32_t授权值_大小)
nvram_结果_t (* disable_create )(const struct nvram_device *设备)
nvram_结果_t (* write_space )(const struct nvram_device *设备,uint32_t索引,const uint8_t *缓冲区,uint64_t buffer_size,const uint8_t *授权值,uint32_t授权值_大小)
nvram_结果_t (* read_space )(const struct nvram_device *设备,uint32_t索引,uint64_t num_bytes_to_read,const uint8_t *授权值,uint32_t授权值_大小,uint8_t *缓冲区,uint64_t *bytes_read)
nvram_结果_t (*启用_写_锁)(const struct nvram_device *设备,uint32_t索引,const uint8_t *授权值,uint32_t授权值_大小)
nvram_结果_t (*启用_读_锁)(const struct nvram_device *设备,uint32_t索引,const uint8_t *授权值,uint32_t授权值_大小)

详细说明

定义位于文件nvram.h的第48行。

现场文档

结构体hw_device_t公共

nvram_device的常用方法。这必须nvram_device的第一个成员,因为该结构的用户将在已知hw_device_t引用nvram_device 的上下文中将hw_device_t强制转换为nvram_device指针。

定义位于文件nvram.h的第55行。

nvram_result_t (* create_space)(const struct nvram_device *device, uint32_t 索引, uint64_t size_in_bytes, const nvram_control_t *control_list, uint32_t list_size, const uint8_t *authorization_value, uint32_tauthorization_value_size)

使用给定的索引、大小、控件和授权值创建新空间。

device - nvram_device实例。 index - 新空间的索引。索引可以是任何 32 位值,但不得已分配给现有空间。 size_in_bytes - 为空间分配的字节数。 control_list - 对空间强制执行的控制数组。 list_size - |control_list| 中的项目数。授权值 - 如果 |control_list|包含 NV_CONTROL_READ_AUTHORIZATION 和/或 NV_CONTROL_WRITE_AUTHORIZATION,则此参数提供这些策略的授权值(如果设置了两个控件,则此值适用于两者)。否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。

定义位于文件nvram.h的第187行。

nvram_result_t (*delete_space)(const struct nvram_device *设备,uint32_t索引,const uint8_t *授权值,uint32_t授权值_大小)

删除一个空格。

device - nvram_device实例。 index - 空间索引。 authorization_value - 如果空间具有 NV_CONTROL_WRITE_AUTHORIZATION 策略,则此参数提供授权值。否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。

定义位于文件nvram.h的第207行。

nvram_result_t (*disable_create)(const struct nvram_device *device)

禁止进一步创建空间,直到下一次完全设备重置(如恢​​复出厂设置,而不是重新启动)。对 NV_CreateSpace 的后续调用应返回 NV_RESULT_OPERATION_DISABLED。

device - nvram_device实例。

定义位于文件nvram.h的第219行。

nvram_result_t (*enable_read_lock)(const struct nvram_device *device, uint32_t 索引, const uint8_t *authorization_value, uint32_tauthorization_value_size)

根据给定空间的策略启用读锁。如果空间未设置 NV_CONTROL_BOOT_READ_LOCK,则此函数无效并可能返回错误。

device - nvram_device实例。 index - 空间索引。 authorization_value - 如果空间具有 NV_CONTROL_READ_AUTHORIZATION 策略,则此参数提供授权值。 (请注意,不需要写访问即可锁定读。读锁始终是易失性的。)否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。

定义位于文件nvram.h的第317行。

nvram_result_t (*enable_write_lock)(const struct nvram_device *设备,uint32_t索引,const uint8_t *授权值,uint32_t授权值_大小)

根据给定空间的策略启用写锁。如果空间没有设置 NV_CONTROL_PERSISTENT_WRITE_LOCK 或 NV_CONTROL_BOOT_WRITE_LOCK,则此函数无效并可能返回错误。

device - nvram_device实例。 index - 空间索引。 authorization_value - 如果空间具有 NV_CONTROL_WRITE_AUTHORIZATION 策略,则此参数提供授权值。否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。

定义位于文件nvram.h的第294行。

nvram_result_t (* get_available_size_in_bytes)(const struct nvram_device *device, uint64_t *available_size)

输出 NVRAM 中可用的未分配字节数。如果实现不知道可用大小,它可以提供估计或总大小。

device - nvram_device实例。 available_size - 接收输出。不能为 NULL。

定义位于文件nvram.h76行。

nvram_result_t (* get_max_space_size_in_bytes)(const struct nvram_device *device, uint64_t *max_space_size)

输出可为单个空间分配的最大字节数。这将始终至少为 32。如果实现不限制最大大小,它可能会提供总大小。

device - nvram_device实例。 max_space_size - 接收输出。不能为 NULL。

定义位于文件nvram.h87行。

nvram_result_t (* get_max_spaces)(const struct nvram_device *device, uint32_t *num_spaces)

输出可分配的最大空间总数。这将始终至少为 8。如果支持任意数量的空间(仅限于可用的 NVRAM 字节),则输出 NV_UNLIMITED_SPACES。

device - nvram_device实例。 num_spaces - 接收输出。不能为 NULL。

定义位于文件nvram.h99行。

nvram_result_t (* get_space_controls)(const struct nvram_device *device, uint32_t 索引, uint32_t max_list_size, nvram_control_t *control_list, uint32_t *list_size)

输出与给定空间关联的控件列表。

device - nvram_device实例。 index - 空间索引。 max_list_size - |control_list| 中的项目数大批。 control_list - 接收最多给定 |max_list_size| 的控件列表。如果 |max_list_size| 则可能为 NULL为 0。 list_size - 接收 |control_list| 中填充的项目数,或如果 |control_list| 则可用的项目数。一片空白。

定义位于文件nvram.h的第144行。

nvram_result_t (* get_space_list)(const struct nvram_device *device, uint32_t max_list_size, uint32_t *space_index_list, uint32_t *list_size)

输出已创建的空间索引的列表。如果 |max_list_size|为 0,仅 |list_size|已有人居住。

device - nvram_device实例。 max_list_size - |space_index_list| 中的项目数大批。 space_index_list - 接收已创建空间的列表,最多可达给定的 |max_list_size|。如果 |max_list_size| 则可能为 NULL为 0。 list_size - 接收 |space_index_list| 中填充的项目数,或如果 |space_index_list| 则可用的项目数。一片空白。

定义位于文件nvram.h的第116行。

nvram_result_t (* get_space_size)(const struct nvram_device *设备, uint32_t 索引, uint64_t *大小)

输出给定空间的大小(以字节为单位)。

device - nvram_device实例。 index - 空间索引。 size - 接收输出。不能为 NULL。

定义位于文件nvram.h的第128行。

nvram_result_t (* get_total_size_in_bytes)(const struct nvram_device *device, uint64_t *total_size)

输出 NVRAM 中可用的字节总数。这将始终至少为 2048。如果实现不知道总大小,它可能会提供估计值或 2048。

device - nvram_device实例。 Total_size - 接收输出。不能为 NULL。

定义位于文件nvram.h65行。

nvram_result_t (* is_space_locked)(const struct nvram_device *device, uint32_t 索引, int *write_lock_enabled, int *read_lock_enabled)

输出是否为给定空间启用了锁。启用锁后,操作将被禁用,任何执行该操作的尝试都将导致 NV_RESULT_OPERATION_DISABLED。

device - nvram_device实例。 index - 空间索引。 write_lock_enabled - 如果当前禁用写操作,则将设置为非零。 read_lock_enabled - 如果当前禁用读取操作,则将设置为非零。

定义位于文件nvram.h的第161行。

nvram_result_t (* read_space)(const struct nvram_device *device, uint32_t 索引, uint64_t num_bytes_to_read, const uint8_t *authorization_value, uint32_tauthorization_value_size, uint8_t *buffer, uint64_t *bytes_read)

读取空间的内容。如果该空间从未被写入,则读取的所有字节将为 0x00。

device - nvram_device实例。 index - 空间索引。 num_bytes_to_read - 要读取的字节数; |缓冲区|必须足够大才能容纳这么多字节。如果这大于空间的大小,则读取整个空间。如果这小于空间的大小,则读取空间中的第一个字节。 authorization_value - 如果空间具有 NV_CONTROL_READ_AUTHORIZATION 策略,则此参数提供授权值。否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。 buffer - 接收从空间读取的数据。必须至少为 |num_bytes_to_read|字节大小。 bytes_read - 读取的字节数。如果返回 NV_RESULT_SUCCESS,则该值将被设置为 |num_bytes_to_read| 中较小的一个。或空间的大小。

定义位于文件nvram.h的第272行。

nvram_result_t (* write_space)(const struct nvram_device *设备,uint32_t索引,const uint8_t *缓冲区,uint64_t buffer_size,const uint8_t *授权值,uint32_t授权值_大小)

写入空间的内容。如果空间配置为 NV_CONTROL_WRITE_EXTEND,则输入数据将用于扩展当前数据。

device - nvram_device实例。 index - 空间索引。 buffer - 要写入的数据。 buffer_size - |buffer| 中的字节数。如果小于空间大小,则剩余字节将设置为 0x00。如果这大于空间大小,则返回 NV_RESULT_INVALID_PARAMETER。 authorization_value - 如果空间具有 NV_CONTROL_WRITE_AUTHORIZATION 策略,则此参数提供授权值。否则,该值将被忽略并且可能为 NULL。 authorization_value_size - |authorization_value| 中的字节数。

定义位于文件nvram.h的第241行。


该结构的文档是从以下文件生成的: