Skip to content

Commit 025ffa2

Browse files
committed
add spec version to dwc2 info
1 parent efcc2b6 commit 025ffa2

File tree

3 files changed

+12
-780
lines changed

3 files changed

+12
-780
lines changed

src/portable/synopsys/dwc2/dwc2_info.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
|:----------------------------|:----------------|:--------------------|:-----------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:----------------------|:-----------|
33
| guid | 0x2708A000 | 0x00000000 | 0x00000000 | 0x00001200 | 0x00001100 | 0x00001200 | 0x00002000 | 0x00001200 | 0x00001100 | 0x00003000 | 0x00003100 | 0x00002000 | 0x00002300 | 0x00002000 | 0x00005000 | 0x00001000 | 0x00AEC000 |
44
| gsnpsid | 0x4F54280A | 0x4F54330A | 0x4F54400A | 0x4F54281A | 0x4F54281A | 0x4F54281A | 0x4F54320A | 0x4F54281A | 0x4F54281A | 0x4F54330A | 0x4F54330A | 0x4F54320A | 0x4F54330A | 0x4F54310A | 0x4F54411A | 0x00000000 | 0x4F54292A |
5+
| - specs version | 2.80a | 3.30a | 4.00a | 2.81a | 2.81a | 2.81a | 3.20a | 2.81a | 2.81a | 3.30a | 3.30a | 3.20a | 3.30a | 3.10a | 4.11a | 0.00W | 2.92a |
56
| ghwcfg1 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 | 0x00000000 |
67
| ghwcfg2 | 0x228DDD50 | 0x228F5910 | 0x224DD930 | 0x229DCD20 | 0x229ED590 | 0x229DCD20 | 0x229ED520 | 0x229DCD20 | 0x229ED590 | 0x229ED520 | 0x229FE1D0 | 0x229ED520 | 0x229FE190 | 0x229ED520 | 0x228FE052 | 0x00000000 | 0x228F5930 |
78
| - op_mode | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 |

src/portable/synopsys/dwc2/dwc2_info.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
# },
3737
dwc2_info = {key: {field: value for field, value in zip(dwc2_reg_list, values)} for key, values in dwc2_reg_value.items()}
3838

39+
3940
class GHWCFG2(ctypes.LittleEndianStructure):
4041
_fields_ = [
4142
("op_mode", ctypes.c_uint32, 3),
@@ -130,13 +131,20 @@ def render_md():
130131
# Create an empty list to hold the dictionaries
131132
dwc2_info_list = []
132133

133-
#Iterate over the dwc2_info dictionary and extract fields
134+
# Iterate over the dwc2_info dictionary and extract fields
134135
for device, reg_values in dwc2_info.items():
135136
entry_dict = {"Device": device}
136137
for r_name, r_value in reg_values.items():
137138
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
140148
class_name = globals()[r_name.upper()]
141149
ghwcfg = class_name.from_buffer_copy(r_value.to_bytes(4, byteorder='little'))
142150
for field_name, field_type, _ in class_name._fields_:

0 commit comments

Comments
 (0)