Created
July 29, 2022 04:40
-
-
Save ohsix/3b5b66c7401a9449ad8c8774a7124cad to your computer and use it in GitHub Desktop.
realtek fw decoder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only checked w/ rtl8168e-3.fw | |
# there are firmware with and without a magic number | |
# this also doesn't check the validity of the check byte | |
meta: | |
id: rtl_fw | |
file-extension: fw | |
endian: le | |
instances: | |
header: | |
type: fw_header | |
opcodes: | |
pos: header.fw_start | |
type: opcode | |
repeat: eos | |
types: | |
opcode: | |
seq: | |
- id: insn | |
type: u4 | |
instances: | |
action: | |
value: insn >> 28 | |
enum: fw_opcode | |
val: | |
value: insn & 0x0000ffff | |
regno: | |
value: (insn & 0x0fff0000) >> 16 | |
fw_header: | |
seq: | |
- id: magic | |
size: 4 | |
- id: version | |
size: constants::rtl_ver_size.to_i | |
- id: fw_start | |
type: u4 | |
- id: fw_len | |
type: u4 | |
- id: check_byte | |
type: u1 | |
fw_phy_action: | |
seq: | |
- id: code | |
type: u4 | |
- id: size | |
type: u4 | |
enums: | |
constants: | |
32: | |
id: rtl_ver_size | |
fw_opcode: | |
0x0: | |
id: read | |
-orig-id: PHY_READ | |
0x1: | |
id: data_or | |
-orig-id: PHY_DATA_OR | |
0x2: | |
id: data_and | |
-orig-id: PHY_DATA_AND | |
0x3: | |
id: bjmpn | |
-orig-id: PHY_BJMPN | |
0x4: | |
id: mdio_chg | |
-orig-id: PHY_MDIO_CHG | |
0x7: | |
id: clear_readcount | |
-orig-id: PHY_CLEAR_READCOUNT | |
0x8: | |
id: write | |
-orig-id: PHY_WRITE | |
0x9: | |
id: readcount_eq_skip | |
-orig-id: PHY_READCOUNT_EQ_SKIP | |
0xa: | |
id: comp_eq_skipn | |
-orig-id: PHY_COMP_EQ_SKIPN | |
0xb: | |
id: comp_neq_skipn | |
-orig-id: PHY_COMP_NEQ_SKIPN | |
0xc: | |
id: write_previous | |
-orig-id: PHY_WRITE_PREVIOUS | |
0xd: | |
id: skipn | |
-orig-id: PHY_SKIPN | |
0xe: | |
id: delay_ms | |
-orig-id: PHY_DELAY_MS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment