Intel® Quark™ Microcontroller Software Interface  1.4.0
Intel® Quark™ Microcontroller BSP
FPR

Flash Protection Region control. More...

Data Structures

struct  qm_fpr_config_t
 Flash Protection Region configuration structure. More...
 

Enumerations

enum  qm_fpr_en_t { QM_FPR_DISABLE, QM_FPR_ENABLE, QM_FPR_LOCK_DISABLE, QM_FPR_LOCK_ENABLE }
 FPR enable type. More...
 
enum  qm_fpr_viol_mode_t { FPR_VIOL_MODE_INTERRUPT = 0, FPR_VIOL_MODE_RESET, FPR_VIOL_MODE_PROBE }
 FPR violation mode type. More...
 
enum  qm_flash_region_type_t { QM_MAIN_FLASH_SYSTEM = 0, QM_MAIN_FLASH_DATA, QM_MAIN_FLASH_NUM }
 FPR region type. More...
 
enum  qm_fpr_read_allow_t { QM_FPR_HOST_PROCESSOR, QM_FPR_SENSOR_SUBSYSTEM, QM_FPR_DMA = BIT(2), QM_FPR_OTHER_AGENTS }
 FPR read allow type. More...
 

Functions

int qm_fpr_set_config (const qm_flash_t flash, const qm_fpr_id_t id, const qm_fpr_config_t *const cfg, const qm_flash_region_type_t region)
 Configure a Flash controller's Flash Protection Region. More...
 
int qm_fpr_set_violation_policy (const qm_fpr_viol_mode_t mode, const qm_flash_t flash, qm_fpr_callback_t fpr_cb, void *data)
 Configure FPR violation behaviour. More...
 
int qm_fpr_save_context (const qm_flash_t flash, qm_fpr_context_t *const ctx)
 Save FPR context. More...
 
int qm_fpr_restore_context (const qm_flash_t flash, const qm_fpr_context_t *const ctx)
 Restore FPR context. More...
 

Detailed Description

Flash Protection Region control.

Enumeration Type Documentation

FPR region type.

Enumerator
QM_MAIN_FLASH_SYSTEM 

System flash region.

QM_MAIN_FLASH_DATA 

Data flash region.

QM_MAIN_FLASH_NUM 

Number of flash regions.

Definition at line 41 of file qm_fpr.h.

FPR enable type.

Enumerator
QM_FPR_DISABLE 

Disable FPR.

QM_FPR_ENABLE 

Enable FPR.

QM_FPR_LOCK_DISABLE 

Disable FPR lock.

QM_FPR_LOCK_ENABLE 

Enable FPR lock.

Definition at line 22 of file qm_fpr.h.

FPR read allow type.

Enumerator
QM_FPR_HOST_PROCESSOR 

Allow host processor to access flash region.

QM_FPR_SENSOR_SUBSYSTEM 

Allow sensor subsystem to access flash region.

QM_FPR_DMA 

Allow DMA to access flash region.

QM_FPR_OTHER_AGENTS 

Allow other agents to access flash region.

Definition at line 52 of file qm_fpr.h.

FPR violation mode type.

Enumerator
FPR_VIOL_MODE_INTERRUPT 

Generate interrupt on violation.

FPR_VIOL_MODE_RESET 

Reset SoC on violation.

FPR_VIOL_MODE_PROBE 

Enter probe mode on violation.

Definition at line 32 of file qm_fpr.h.

Function Documentation

int qm_fpr_restore_context ( const qm_flash_t  flash,
const qm_fpr_context_t *const  ctx 
)

Restore FPR context.

Restore the configuration of the specified FPR peripheral after exiting sleep. The Flash peripheral linked to the FPR restored needs to be restored as well by calling qm_flash_restore_context().

FPR configuration is lost after sleep and can therefore be modified even if this configuration was locked before sleep. To support persistent configuration, the configuration must be restored when resuming as part of the bootloader.

Parameters
[in]flashFlash index.
[in]ctxFPR context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 197 of file qm_fpr.c.

References qm_flash_reg_t::fpr_rd_cfg, and qm_fpr_context_t::fpr_rd_cfg.

int qm_fpr_save_context ( const qm_flash_t  flash,
qm_fpr_context_t *const  ctx 
)

Save FPR context.

Save the configuration of the specified FPR peripheral before entering sleep. The Flash peripheral linked to the FPR saved needs to be saved as well by calling qm_flash_save_context().

FPR configuration is lost after sleep and can therefore be modified even if this configuration was locked before sleep. To support persistent configuration, the configuration must be restored when resuming as part of the bootloader.

Parameters
[in]flashFlash index.
[out]ctxFPR context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 182 of file qm_fpr.c.

References qm_flash_reg_t::fpr_rd_cfg, and qm_fpr_context_t::fpr_rd_cfg.

int qm_fpr_set_config ( const qm_flash_t  flash,
const qm_fpr_id_t  id,
const qm_fpr_config_t *const  cfg,
const qm_flash_region_type_t  region 
)

Configure a Flash controller's Flash Protection Region.

Parameters
[in]flashWhich Flash controller to configure.
[in]idFPR identifier.
[in]cfgFPR configuration.
[in]regionThe region of Flash to be configured.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 34 of file qm_fpr.c.

References qm_fpr_config_t::allow_agents, qm_fpr_config_t::en_mask, qm_flash_reg_t::fpr_rd_cfg, qm_fpr_config_t::low_bound, QM_MAIN_FLASH_DATA, QM_MAIN_FLASH_NUM, QM_MAIN_FLASH_SYSTEM, and qm_fpr_config_t::up_bound.

int qm_fpr_set_violation_policy ( const qm_fpr_viol_mode_t  mode,
const qm_flash_t  flash,
qm_fpr_callback_t  fpr_cb,
void *  data 
)

Configure FPR violation behaviour.

Parameters
[in]mode(generate interrupt, warm reset, enter probe mode).
[in]flashcontroller.
[in]fpr_cbfor interrupt mode (only).
[in]datauser callback data for interrupt mode (only).
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 70 of file qm_fpr.c.

References FPR_VIOL_MODE_INTERRUPT, and FPR_VIOL_MODE_PROBE.