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.