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:
spsdk.exceptions.SPSDKError
The error during write verification - exception for use with SPSDK.
Initialize the base SPSDK Exception.
-
class
spsdk.shadowregs.shadowregs.
ShadowRegisters
(debug_probe, config, device, revision='latest')¶ Bases:
object
SPSDK support to control the shadow registers.
Initialization of Shadow register class.
-
static
comalg_dcfg_cc_socu_crc8
(val)¶ Function that creates the crc for DCFG_CC_SOCU.
- Parameters
val (
bytes
) – Input DCFG_CC_SOCU Value.- Return type
bytes
- Returns
Returns the value of DCFG_CC_SOCU with computed CRC8 field.
-
static
comalg_dcfg_cc_socu_rsvd
(val)¶ Function fill up the DCFG_CC_SOCU RSVD filed by 0x80 to satisfy MCU needs.
- Parameters
val (
bytes
) – Input DCFG_CC_SOCU Value.- Return type
bytes
- Returns
Returns the value of DCFG_CC_SOCU with computed CRC8 field.
-
static
comalg_do_nothing
(val)¶ Function that do nothing.
- Parameters
val (
bytes
) – Input Value.- Return type
bytes
- Returns
Returns same value as it get.
-
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_yml_config
(file_name, raw=False)¶ The function creates the configuration YML file.
- Parameters
file_name (
str
) – The file_name (without extension) of stored configuration.raw (
bool
) – Raw output of configuration (including computed fields and anti-pole registers)
- Return type
None
-
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
-
load_yml_config
(file_name, raw=False)¶ The function loads the configuration from YML file.
- Parameters
file_name (
str
) – The file_name (without extension) of stored configuration.raw (
bool
) – Raw input of configuration (including computed fields and anti-pole registers)
- Raises
SPSDKError – When the configuration file not found.
- Return type
None
-
reg_antipolize_dst_handler
(val, context)¶ Keep same antipolized register value in computed register.
- Parameters
val (
bytes
) – Input register value.context (
Any
) – The method context.
- Return type
bytes
- Returns
Antipolized value.
-
reg_antipolize_src_handler
(val, context)¶ Antipolize given register value.
- Parameters
val (
bytes
) – Input register value.context (
Any
) – The method context.
- Return type
bytes
- Returns
Antipolized value.
-
reg_computed_fields_handler
(val, context)¶ Recalculate all fields for given register value.
- Parameters
val (
bytes
) – Input register value.context (
Any
) – The method context (fields).
- Return type
bytes
- Returns
recomputed value.
- Raises
SPSDKError – Raises when the computing routine is not found.
-
reload_register
(reg)¶ Reload the value in requested register.
- Parameters
reg (
RegsRegister
) – The register to reload from the HW.- Return type
None
-
reload_registers
()¶ Reload all the values in managed registers.
- Return type
None
-
set_register
(reg_name, data)¶ The function sets the value of the specified register.
param reg: The register name. param data: The new data to be stored to shadow register. raises SPSDKDebugProbeError: The debug probe is not specified.
- Return type
None
-
sets_all_registers
()¶ Update all shadow registers in target by local values.
- Return type
None
-
static
-
spsdk.shadowregs.shadowregs.
enable_debug
(probe, ap_mem=0)¶ Function that enables debug access ports on devices with debug mailbox.
- Parameters
probe (
DebugProbe
) – Initialized debug probe.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.