Commit d426adcc authored by Ioannis Glaropoulos's avatar Ioannis Glaropoulos Committed by Carles Cufi
Browse files

arch: arm: refactor function to align with the adopted api



Refactor arm_cmse_mpu_region_get(.) function, so its signature,
documentation, and implementation align with the rest of functions
for obtaining MPU, SAU and IDAU region numbers via the TT instruction.

Signed-off-by: default avatarIoannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
parent f630559e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -7,15 +7,15 @@
#include <zephyr.h>
#include <cortex_m/cmse.h>

int arm_cmse_mpu_region_get(u32_t addr, u8_t *p_region)
int arm_cmse_mpu_region_get(u32_t addr)
{
	cmse_address_info_t addr_info =	cmse_TT((void *)addr);

	if (addr_info.flags.mpu_region_valid) {
		*p_region = addr_info.flags.mpu_region;
		return addr_info.flags.mpu_region;
	}

	return addr_info.flags.mpu_region_valid;
	return -EINVAL;
}

static int arm_cmse_addr_read_write_ok(u32_t addr, int force_npriv, int rw)
+5 −7
Original line number Diff line number Diff line
@@ -38,9 +38,8 @@ extern "C" {
/**
 * @brief Get the MPU region number of an address
 *
 * Get the MPU region that the address maps to. Return non-zero
 * to indicate that a valid MPU region was retrieved, and store the
 * MPU region information in the supplied location.
 * Return the non-negative MPU region that the address maps to,
 * or -EINVAL to indicate that an invalid MPU region was retrieved.
 *
 * Note:
 * Obtained region is valid only if:
@@ -49,11 +48,10 @@ extern "C" {
 * - the given address matches a single, enabled MPU region
 *
 * @param addr The address for which the MPU region is requested
 * @param p_region Output pointer to the location to store the MPU region
 *
 * @return non-zero if @ref region contains a valid MPU region, otherwise 0.
 * @return a valid MPU region number or -EINVAL
 */
int arm_cmse_mpu_region_get(u32_t addr, u8_t *p_region);
int arm_cmse_mpu_region_get(u32_t addr);

/**
 * @brief Read accessibility of an address