|
36 | 36 | # }, |
37 | 37 | dwc2_info = {key: {field: value for field, value in zip(dwc2_reg_list, values)} for key, values in dwc2_reg_value.items()} |
38 | 38 |
|
| 39 | + |
39 | 40 | class GHWCFG2(ctypes.LittleEndianStructure): |
40 | 41 | _fields_ = [ |
41 | 42 | ("op_mode", ctypes.c_uint32, 3), |
@@ -130,13 +131,20 @@ def render_md(): |
130 | 131 | # Create an empty list to hold the dictionaries |
131 | 132 | dwc2_info_list = [] |
132 | 133 |
|
133 | | - #Iterate over the dwc2_info dictionary and extract fields |
| 134 | + # Iterate over the dwc2_info dictionary and extract fields |
134 | 135 | for device, reg_values in dwc2_info.items(): |
135 | 136 | entry_dict = {"Device": device} |
136 | 137 | for r_name, r_value in reg_values.items(): |
137 | 138 | entry_dict[r_name] = f"0x{r_value:08X}" |
138 | | - # Print bit-field values |
139 | | - if r_name.upper() in globals(): |
| 139 | + |
| 140 | + if r_name == 'gsnpsid': |
| 141 | + # Get dwc2 specs version |
| 142 | + major = ((r_value >> 8) >> 4) & 0x0F |
| 143 | + minor = (r_value >> 4) & 0xFF |
| 144 | + patch = chr((r_value & 0x0F) + ord('a') - 0xA) |
| 145 | + entry_dict[f' - specs version'] = f"{major:X}.{minor:02X}{patch}" |
| 146 | + elif r_name.upper() in globals(): |
| 147 | + # Get bit-field values which exist as ctypes structures |
140 | 148 | class_name = globals()[r_name.upper()] |
141 | 149 | ghwcfg = class_name.from_buffer_copy(r_value.to_bytes(4, byteorder='little')) |
142 | 150 | for field_name, field_type, _ in class_name._fields_: |
|
0 commit comments