Coverage for tropicsquare / config / constants.py: 100%
56 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 21:24 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 21:24 +0000
1"""Internal bit positions and masks for config fields
3These constants are used internally by config classes to access
4individual configuration bits. Not intended for public API use.
5"""
7# StartUp config (CFG_START_UP @ 0x00)
8# Bit positions from tropic01_bootloader_co.h
9STARTUP_MBIST_DIS_BIT = 1
10STARTUP_RNGTEST_DIS_BIT = 2
11STARTUP_MAINTENANCE_ENA_BIT = 3
13# Sensors config (CFG_SENSORS @ 0x08)
14# Bit positions from tropic01_bootloader_co.h
15SENSORS_PTRNG0_TEST_DIS_BIT = 0
16SENSORS_PTRNG1_TEST_DIS_BIT = 1
17SENSORS_OSCMON_DIS_BIT = 2
18SENSORS_SHIELD_DIS_BIT = 3
19SENSORS_VMON_DIS_BIT = 4
20SENSORS_GLITCH_DIS_BIT = 5
21SENSORS_TEMP_DIS_BIT = 6
22SENSORS_LASER_DIS_BIT = 7
23SENSORS_EMP_DIS_BIT = 8
24SENSORS_CPU_ALERT_DIS_BIT = 9
25SENSORS_BF_PIN_VER_DIS_BIT = 10
26SENSORS_BF_SCB_DIS_BIT = 11
27SENSORS_BF_CPB_DIS_BIT = 12
28SENSORS_BF_ECC_DIS_BIT = 13
29SENSORS_BF_RAM_DIS_BIT = 14
30SENSORS_BF_EKDB_DIS_BIT = 15
31SENSORS_BF_IMEM_DIS_BIT = 16
32SENSORS_BF_PLATFORM_DIS_BIT = 17
34# Debug config (CFG_DEBUG @ 0x10)
35# Bit positions from tropic01_bootloader_co.h
36DEBUG_FW_LOG_EN_BIT = 0
38# GPO config (CFG_GPO @ 0x14)
39# Bit positions from tropic01_application_co.h
40GPO_FUNC_MASK = 0x07 # bits 2-0
41GPO_FUNC_POS = 0
43# Sleep Mode config (CFG_SLEEP_MODE @ 0x18)
44# Bit positions from tropic01_application_co.h
45SLEEP_MODE_EN_BIT = 0
47# UAP (User Access Policy) permission bits
48# Each 8-bit field has permission bits for Pairing Key slots 0-3
49UAP_PKEY_SLOT_0_BIT = 0
50UAP_PKEY_SLOT_1_BIT = 1
51UAP_PKEY_SLOT_2_BIT = 2
52UAP_PKEY_SLOT_3_BIT = 3
54# UAP Pairing Key (shared by WRITE @ 0x20, READ @ 0x24, INVALIDATE @ 0x28)
55UAP_PKEY_SLOT_0_POS = 0
56UAP_PKEY_SLOT_1_POS = 8
57UAP_PKEY_SLOT_2_POS = 16
58UAP_PKEY_SLOT_3_POS = 24
60# UAP MAC and Destroy (CFG_UAP_MAC_AND_DESTROY @ 0x160)
61# 4 slots, each 8 bits controlling access to different ranges of MAC-and-Destroy partition
62# - slot_0: Access privileges for MAC-and-Destroy slots 0-31
63# - slot_1: Access privileges for MAC-and-Destroy slots 32-63
64# - slot_2: Access privileges for MAC-and-Destroy slots 64-95
65# - slot_3: Access privileges for MAC-and-Destroy slots 96-127
66UAP_MACANDD_0_31_POS = 0
67UAP_MACANDD_32_63_POS = 8
68UAP_MACANDD_64_95_POS = 16
69UAP_MACANDD_96_127_POS = 24
71# UAP Monotonic Counter (shared by INIT @ 0x150, GET @ 0x154, UPDATE @ 0x158)
72# 4 slots, each 8 bits controlling access to different monotonic counters
73UAP_MCOUNTER_0_3_POS = 0
74UAP_MCOUNTER_4_7_POS = 8
75UAP_MCOUNTER_8_11_POS = 16
76UAP_MCOUNTER_12_15_POS = 24
78# UAP ECC Key operations (shared by GENERATE @ 0x130, STORE @ 0x134, READ @ 0x138,
79# ERASE @ 0x13C, ECDSA @ 0x140, EDDSA @ 0x144)
80# 4 slots, each 8 bits controlling access to different ECC Key slots
81UAP_ECCKEY_SLOT_0_7_POS = 0
82UAP_ECCKEY_SLOT_8_15_POS = 8
83UAP_ECCKEY_SLOT_16_23_POS = 16
84UAP_ECCKEY_SLOT_24_31_POS = 24
86# UAP R-MEM User Data operations (shared by WRITE @ 0x110, READ @ 0x114, ERASE @ 0x118)
87# 4 slots, each 8 bits controlling access to different User Data slot ranges
88UAP_UDATA_SLOT_0_127_POS = 0
89UAP_UDATA_SLOT_128_255_POS = 8
90UAP_UDATA_SLOT_256_383_POS = 16
91UAP_UDATA_SLOT_384_511_POS = 24
93# UAP R-CONFIG Write/Erase (CFG_UAP_R_CONFIG_WRITE_ERASE @ 0x30)
94# Single 8-bit field
95UAP_R_CONFIG_WRITE_ERASE_POS = 0
97# UAP R-CONFIG Read (CFG_UAP_R_CONFIG_READ @ 0x34)
98# Two 8-bit fields: CFG and FUNC
99UAP_R_CONFIG_READ_CFG_POS = 0
100UAP_R_CONFIG_READ_FUNC_POS = 8
102# UAP I-CONFIG Write (CFG_UAP_I_CONFIG_WRITE @ 0x40)
103# Two 8-bit fields: CFG and FUNC
104UAP_I_CONFIG_WRITE_CFG_POS = 0
105UAP_I_CONFIG_WRITE_FUNC_POS = 8
107# UAP I-CONFIG Read (CFG_UAP_I_CONFIG_READ @ 0x44)
108# Two 8-bit fields: CFG and FUNC
109UAP_I_CONFIG_READ_CFG_POS = 0
110UAP_I_CONFIG_READ_FUNC_POS = 8