nvram_device 结构参考

nvram_device 结构参考

#include < nvram.h >

数据字段

结构hw_device_t常见的
nvram_result_t (* get_total_size_in_bytes )(const struct nvram_device *device, uint64_t *total_size)
nvram_result_t (* get_available_size_in_bytes )(const struct nvram_device *device, uint64_t *available_size)
nvram_result_t (* get_max_space_size_in_bytes )(const struct nvram_device *device, uint64_t *max_space_size)
nvram_result_t (* get_max_spaces )(const struct nvram_device *device, uint32_t *num_spaces)
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)
nvram_result_t (* get_space_size )(const struct nvram_device *device, uint32_t index, uint64_t *size)
nvram_result_t (* get_space_controls )(const struct nvram_device *device, uint32_t index, uint32_t max_list_size, nvram_control_t *control_list, uint32_t *list_size)
nvram_result_t (* is_space_locked )(const struct nvram_device *device, uint32_t index, int *write_lock_enabled, int *read_lock_enabled)
nvram_result_t (* create_space )(const struct nvram_device *device, uint32_t index, uint64_t size_in_bytes, const nvram_control_t *control_list, uint32_t list_size, const uint8_t *authorization_value, uint32_t authorization_value_size)
nvram_result_t (* delete_space )(const struct nvram_device *device, uint32_t index, const uint8_t *authorization_value, uint32_t authorization_value_size)
nvram_result_t (* disable_create )(const struct nvram_device *device)
nvram_result_t (* write_space )(const struct nvram_device *device, uint32_t index, const uint8_t *buffer, uint64_t buffer_size, const uint8_t *authorization_value, uint32_t authorization_value_size)
nvram_result_t (* read_space )(const struct nvram_device *device, uint32_t index, uint64_t num_bytes_to_read, const uint8_t *authorization_value, uint32_t authorization_value_size, uint8_t *buffer, uint64_t *bytes_read)
nvram_result_t (* enable_write_lock )(const struct nvram_device *device, uint32_t index, const uint8_t *authorization_value, uint32_t authorization_value_size)
nvram_result_t (* enable_read_lock )(const struct nvram_device *device, uint32_t index, const uint8_t *authorization_value, uint32_t authorization_value_size)

详细说明

在文件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 index, uint64_t size_in_bytes, const nvram_control_t *control_list, uint32_t list_size, const uint8_t *authorization_value, uint32_t authorization_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 *device, uint32_t index, const uint8_t *authorization_value, uint32_t authorization_value_size)

删除一个空格。

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 index, const uint8_t *authorization_value, uint32_t authorization_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 *device, uint32_t index, const uint8_t *authorization_value, uint32_t authorization_value_size)

根据其策略为给定空间启用写锁定。如果空间没有设置 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.h的第76行定义。

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.h的第87行定义。

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.h的第99行定义。

nvram_result_t (* get_space_controls)(const struct nvram_device *device, uint32_t index, 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 *device, uint32_t index, uint64_t *size)

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

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.h的第65行定义。

nvram_result_t (* is_space_locked)(const struct nvram_device *device, uint32_t index, 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 index, uint64_t num_bytes_to_read, const uint8_t *authorization_value, uint32_t authorization_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 *device, uint32_t index, const uint8_t *buffer, uint64_t buffer_size, const uint8_t *authorization_value, uint32_t authorization_value_size)

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

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

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


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