pub enum TbfHeader {
TbfHeaderV2(TbfHeaderV2),
Padding(TbfHeaderV2Base),
}
Expand description
Type that represents the fields of the Tock Binary Format header.
This specifies the locations of the different code and memory sections in the tock binary, as well as other information about the application. The kernel can also use this header to keep persistent state about the application.
Variants§
TbfHeaderV2(TbfHeaderV2)
Padding(TbfHeaderV2Base)
Implementations§
Source§impl TbfHeader
impl TbfHeader
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Return whether the application is enabled or not. Disabled applications are not started by the kernel.
Sourcepub fn get_minimum_app_ram_size(&self) -> u32
pub fn get_minimum_app_ram_size(&self) -> u32
Add up all of the relevant fields in header version 1, or just used the app provided value in version 2 to get the total amount of RAM that is needed for this app.
Sourcepub fn get_protected_size(&self) -> u32
pub fn get_protected_size(&self) -> u32
Get the number of bytes from the start of the app’s region in flash that is for kernel use only. The app cannot write this region.
Sourcepub fn get_app_start_offset(&self) -> u32
pub fn get_app_start_offset(&self) -> u32
Get the start offset of the application binary from the beginning of the process binary (start of the TBF header). Only valid if this is an app.
Sourcepub fn get_init_function_offset(&self) -> u32
pub fn get_init_function_offset(&self) -> u32
Get the offset from the beginning of the app’s flash region where the app should start executing.
Sourcepub fn get_package_name(&self) -> Option<&'static str>
pub fn get_package_name(&self) -> Option<&'static str>
Get the name of the app.
Sourcepub fn number_writeable_flash_regions(&self) -> usize
pub fn number_writeable_flash_regions(&self) -> usize
Get the number of flash regions this app has specified in its header.
Sourcepub fn get_writeable_flash_region(&self, index: usize) -> (usize, usize)
pub fn get_writeable_flash_region(&self, index: usize) -> (usize, usize)
Get the offset and size of a given flash region.
Sourcepub fn get_fixed_address_ram(&self) -> Option<u32>
pub fn get_fixed_address_ram(&self) -> Option<u32>
Get the address in RAM this process was specifically compiled for. If
the process is position independent, return None
.
Sourcepub fn get_fixed_address_flash(&self) -> Option<u32>
pub fn get_fixed_address_flash(&self) -> Option<u32>
Get the address in flash this process was specifically compiled for. If
the process is position independent, return None
.
Sourcepub fn get_command_permissions(
&self,
driver_num: usize,
offset: usize,
) -> CommandPermissions
pub fn get_command_permissions( &self, driver_num: usize, offset: usize, ) -> CommandPermissions
Get the permissions for a specified driver and offset.
driver_num
: The driver to lookup.offset
: The offset for the driver to find. An offset value of 1 will find a header with offset 1, so theallowed_commands
will cover command numbers 64 to 127.
If permissions are found for the driver number, this function will
return CommandPermissions::Mask
. If there are permissions in the
header but not for this driver the function will return
CommandPermissions::NoPermsThisDriver
. If the process does not have
any permissions specified, return CommandPermissions::NoPermsAtAll
.
Sourcepub fn get_storage_write_id(&self) -> Option<NonZeroU32>
pub fn get_storage_write_id(&self) -> Option<NonZeroU32>
Get the process write_id
.
Returns None
if a write_id
is not included. This indicates the TBF
does not have the ability to store new items.
Sourcepub fn get_storage_read_ids(&self) -> Option<(usize, [u32; 8])>
pub fn get_storage_read_ids(&self) -> Option<(usize, [u32; 8])>
Get the number of valid read_ids
and the read_ids
.
Returns None
if a read_ids
is not included.
Sourcepub fn get_storage_modify_ids(&self) -> Option<(usize, [u32; 8])>
pub fn get_storage_modify_ids(&self) -> Option<(usize, [u32; 8])>
Get the number of valid access_ids
and the access_ids
.
Returns None
if a access_ids
is not included.
Sourcepub fn get_kernel_version(&self) -> Option<(u16, u16)>
pub fn get_kernel_version(&self) -> Option<(u16, u16)>
Get the minimum compatible kernel version this process requires.
Returns None
if the kernel compatibility header is not included.
Sourcepub fn get_binary_end(&self) -> u32
pub fn get_binary_end(&self) -> u32
Return the offset where the binary ends in the TBF or 0 if there is no binary. If there is a Main header the end offset is the size of the TBF, while if there is a Program header it can be smaller.
Sourcepub fn get_binary_version(&self) -> u32
pub fn get_binary_version(&self) -> u32
Return the version number of the Userspace Binary in this TBF Object, or 0 if there is no binary or no version number.
Sourcepub fn get_fixed_short_id(&self) -> Option<NonZeroU32>
pub fn get_fixed_short_id(&self) -> Option<NonZeroU32>
Return the fixed ShortId of the application if it was specified in the TBF header.