Struct cortex_m::cmse::TestTarget
source · pub struct TestTarget { /* private fields */ }
Expand description
Abstraction of TT instructions and helper functions to determine the security and privilege attribute of a target address, accessed in different ways.
Implementations§
source§impl TestTarget
impl TestTarget
sourcepub fn check(addr: *mut u32, access_type: AccessType) -> Self
pub fn check(addr: *mut u32, access_type: AccessType) -> Self
Creates a Test Target Response Payload by testing addr using access_type.
sourcepub fn check_range(
addr: *mut u32,
size: usize,
access_type: AccessType
) -> Option<Self>
pub fn check_range(
addr: *mut u32,
size: usize,
access_type: AccessType
) -> Option<Self>
Creates a Test Target Response Payload by testing the zone from addr to addr + size - 1 using access_type. Returns None if:
- the address zone overlaps SAU, IDAU or MPU region boundaries
- size is 0
- addr + size - 1 overflows
sourcepub fn access_type(self) -> AccessType
pub fn access_type(self) -> AccessType
Access type that was used for this test target.
sourcepub fn readable(self) -> bool
pub fn readable(self) -> bool
Read accessibility of the target address. Only returns the MPU settings without checking the Security state of the target. For Unprivileged and NonSecureUnprivileged access types, returns the permissions for unprivileged access, regardless of whether the current mode is privileged or unprivileged. Returns false if the TT instruction was executed from an unprivileged mode and the NonSecure access type was not specified. Returns false if the address matches multiple MPU regions.
sourcepub fn read_and_writable(self) -> bool
pub fn read_and_writable(self) -> bool
Read and write accessibility of the target address. Only returns the MPU settings without checking the Security state of the target. For Unprivileged and NonSecureUnprivileged access types, returns the permissions for unprivileged access, regardless of whether the current mode is privileged or unprivileged. Returns false if the TT instruction was executed from an unprivileged mode and the NonSecure access type was not specified. Returns false if the address matches multiple MPU regions.
sourcepub fn mpu_region(self) -> Option<u8>
pub fn mpu_region(self) -> Option<u8>
Indicate the MPU region number containing the target address. Returns None if the value is not valid:
- the MPU is not implemented or MPU_CTRL.ENABLE is set to zero
- the register argument specified by the MREGION field does not match any enabled MPU regions
- the address matched multiple MPU regions
- the address specified by the SREGION field is exempt from the secure memory attribution
- the TT instruction was executed from an unprivileged mode and the A flag was not specified.
sourcepub fn secure(self) -> bool
pub fn secure(self) -> bool
Indicates the Security attribute of the target address. Independent of AccessType. Always zero when the test target is done in the Non-Secure state.
sourcepub fn ns_readable(self) -> bool
pub fn ns_readable(self) -> bool
Non-Secure Read accessibility of the target address. Same as readable() && !secure()
sourcepub fn ns_read_and_writable(self) -> bool
pub fn ns_read_and_writable(self) -> bool
Non-Secure Read and Write accessibility of the target address. Same as read_and_writable() && !secure()
sourcepub fn idau_region(self) -> Option<u8>
pub fn idau_region(self) -> Option<u8>
Indicate the IDAU region number containing the target address. Independent of AccessType. Returns None if the value is not valid:
- the IDAU cannot provide a region number
- the address is exempt from security attribution
- the test target is done from Non-Secure state
sourcepub fn sau_region(self) -> Option<u8>
pub fn sau_region(self) -> Option<u8>
Indicate the SAU region number containing the target address. Independent of AccessType. Returns None if the value is not valid:
- SAU_CTRL.ENABLE is set to zero
- the register argument specified in the SREGION field does not match any enabled SAU regions
- the address specified matches multiple enabled SAU regions
- the address specified by the SREGION field is exempt from the secure memory attribution
- the TT instruction was executed from the Non-secure state or the Security Extension is not implemented
Trait Implementations§
source§impl Clone for TestTarget
impl Clone for TestTarget
source§fn clone(&self) -> TestTarget
fn clone(&self) -> TestTarget
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TestTarget
impl Debug for TestTarget
source§impl PartialEq<TestTarget> for TestTarget
impl PartialEq<TestTarget> for TestTarget
source§fn eq(&self, other: &TestTarget) -> bool
fn eq(&self, other: &TestTarget) -> bool
self
and other
values to be equal, and is used
by ==
.