Ejemplo n.º 1
0
/**
 * \brief Check whether the current partition has write access to a memory range
 *
 * This function assumes, that the current MPU configuration is set for the
 * partition to be checked.
 *
 * \param[in] p          The start address of the range to check
 * \param[in] s          The size of the range to check
 * \param[in] ns_caller  Whether the current partition is a non-secure one
 *
 * \return 1 if the partition has access to the memory range, 0 otherwise.
 */
static int32_t has_write_access_to_region(void *p, size_t s, int32_t ns_caller)
{
    uint32_t flags = CMSE_MPU_UNPRIV|CMSE_MPU_READWRITE;

    if (ns_caller) {
        flags |= CMSE_NONSECURE;
    }

    return has_access_to_region(p, s, flags);
}
Ejemplo n.º 2
0
int32_t tfm_core_has_read_access_to_region(const void *p, size_t s,
                                           uint32_t ns_caller)
{
    int flags = CMSE_MPU_UNPRIV|CMSE_MPU_READ;

    if (ns_caller) {
        flags |= CMSE_NONSECURE;
    }

    return has_access_to_region(p, s, flags);
}