Skip to content

Commit cc1c3bd

Browse files
committed
Add GD32 crc component
1 parent e359dfa commit cc1c3bd

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

qiling/hw/math/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
#
55

6-
from .stm32f4xx_crc import STM32F4xxCrc
6+
from .stm32f4xx_crc import STM32F4xxCrc
7+
from .gd32vf1xx_crc import GD32VF1xxCrc

qiling/hw/math/gd32vf1xx_crc.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import ctypes
2+
3+
from qiling.hw.peripheral import QlPeripheral
4+
5+
6+
class GD32VF1xxCrc(QlPeripheral):
7+
class Type(ctypes.Structure):
8+
""" cyclic redundancy check calculation unit
9+
"""
10+
11+
_fields_ = [
12+
("DATA" , ctypes.c_uint32), # Address offset: 0x0, Data register
13+
("FDATA", ctypes.c_uint32), # Address offset: 0x04, Free data register
14+
("CTL" , ctypes.c_uint32), # Address offset: 0x08, Control register
15+
]
16+
17+
def __init__(self, ql, label):
18+
super().__init__(ql, label)
19+
20+
self.crc = self.struct(
21+
DATA = 0xffffffff,
22+
FDATA = 0x00000000,
23+
CTL = 0x00000000,
24+
)
25+

0 commit comments

Comments
 (0)