Shadow Registers API#
This module contains support for Shadow Registers.
Module with the shadow registers control DAT support file#
The shadow registers control DAT support file.
- exception spsdk.shadowregs.shadowregs.IoVerificationError(desc=None)#
Bases:
SPSDKErrorThe error during write verification - exception for use with SPSDK.
Initialize the base SPSDK Exception.
- class spsdk.shadowregs.shadowregs.ShadowRegisters(family, revision='latest', debug_probe=None)#
Bases:
objectSPSDK support to control the shadow registers.
Initialization of Shadow register class.
- static antipolize_register(src, dst)#
Antipolize given registers.
- Parameters:
src (
RegsRegister) – Input register.dst (
RegsRegister) – The antipole destination register.
- Return type:
None
- static comalg_dcfg_cc_socu_crc8(val)#
Function that creates the crc for DCFG_CC_SOCU.
- Parameters:
val (
int) – Input DCFG_CC_SOCU Value.- Return type:
int- Returns:
Returns the value of DCFG_CC_SOCU with computed CRC8 field.
- comalg_dcfg_cc_socu_test_en(val)#
Function fill up the DCFG_CC_SOCU DEV_TEST_EN set to True to satisfy MCU needs.
- Parameters:
val (
int) – Input DCFG_CC_SOCU Value.- Return type:
int- Returns:
Returns the value of DCFG_CC_SOCU with optionally enabled test mode.
- compute_register(reg, method)#
Recalculate register value.
- Parameters:
reg (
RegsRegister) – Register to be recalculated.method (
str) – Method name to be use to recompute the register value.
- Raises:
SPSDKError – Raises when the computing routine is not found.
- Return type:
None
- static crc_update(data, crc=0, is_final=True)#
The function compute the CRC8 ITU method from given bytes.
- Parameters:
data (
bytes) – Input data to compute CRC.crc (
int) – The seed for CRC.is_final (
bool) – The flag the the function should return final result.
- Return type:
int- Returns:
The CRC result.
- create_fuse_blhost_script(reg_list)#
The function creates the BLHOST script to burn fuses.
- Parameters:
reg_list (
list[str]) – The list of register to be burned.- Raises:
SPSDKError – Exception in case of not existing register.
- Return type:
str- Returns:
Content of BLHOST script file.
- flush_func_handler()#
A function to determine and execute the flush-func handler.
- Parameters:
self – Input Value.
- Raises:
SPSDKError – Raises when the computing routine is not found.
- Return type:
None
- get_config(diff=False)#
The function creates the configuration.
- Parameters:
diff (
bool) – If set, only changed registers will be placed in configuration.- Return type:
dict[str,Any]
- get_register(reg_name)#
The function returns value of the requested register.
param reg: The register name. return: The value of requested register in bytes raises SPSDKDebugProbeError: The debug probe is not specified.
- Return type:
bytes
- static get_supported_families()#
Return list of supported families.
- Return type:
list[str]
- classmethod get_validation_schemas(family, revision='latest')#
Create the validation schema.
- Parameters:
family (
str) – Family description.revision (
str) – Chip revision specification, as default, latest is used.
- Raises:
SPSDKError – Family or revision is not supported.
- Return type:
list[dict[str,Any]]- Returns:
List of validation schemas.
- classmethod get_validation_schemas_family()#
Create the validation schema just for supported families.
- Return type:
list[dict[str,Any]]- Returns:
List of validation schemas for Shadow registers supported families.
- load_config(config)#
The function loads the configuration.
- Parameters:
config (
dict[str,Any]) – The configuration of shadow registers.- Return type:
None
- reload_registers()#
Reload all the values in managed registers.
- Return type:
None
- rw61x_update_scratch_reg()#
Function updates scratch register for RW61x, This enables the shadow register functionality.
- Parameters:
self – Input Value.
- Return type:
None
- set_all_registers(verify=True)#
Update all shadow registers in target using their local values.
- Parameters:
verify (
bool) – Verity write operation.- Return type:
None
- set_loaded_registers(verify=True)#
Update shadow registers in target using their local values.
- Parameters:
verify (
bool) – Verity write operation.- Return type:
None
- set_register(reg_name, data, verify=True, raw=True)#
The function sets the value of the specified register.
- Parameters:
reg_name (
str) – The register name.data (
Any) – The new data to be stored to shadow register.verify (
bool) – Verity write operation.raw (
bool) – Do not use any modification hooks.
- Raises:
SPSDKDebugProbeError – The debug probe is not specified.
SPSDKError – General error with write of Shadow register.
- Return type:
None
- spsdk.shadowregs.shadowregs.enable_debug(probe, family, ap_mem=0)#
Function that enables debug access ports on devices with debug mailbox.
- Parameters:
probe (
DebugProbe) – Initialized debug probe.family (
str) – Chip family name.ap_mem (
int) – Index of Debug access port for memory interface.
- Return type:
bool- Returns:
True if debug port is enabled, False otherwise
- Raises:
SPSDKError – Unlock method failed.