Skip to content

Commit 64ee333

Browse files
committed
emmc pd implementation
note that I put this together before seeing sigrokproject#24 and sigrokproject#93; I'm not sure how this compares to either of them.
1 parent 71f4514 commit 64ee333

File tree

3 files changed

+510
-0
lines changed

3 files changed

+510
-0
lines changed

decoders/emmc/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##
2+
## This file is part of the libsigrokdecode project.
3+
##
4+
## Copyright (C) 2015 Uwe Hermann <[email protected]>
5+
##
6+
## This program is free software; you can redistribute it and/or modify
7+
## it under the terms of the GNU General Public License as published by
8+
## the Free Software Foundation; either version 2 of the License, or
9+
## (at your option) any later version.
10+
##
11+
## This program is distributed in the hope that it will be useful,
12+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
## GNU General Public License for more details.
15+
##
16+
## You should have received a copy of the GNU General Public License
17+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
18+
##
19+
20+
'''
21+
eMMC low-level protocol decoder.
22+
'''
23+
24+
from .pd import Decoder

decoders/emmc/emmc_common.py

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
##
2+
## This file is part of the libsigrokdecode project.
3+
##
4+
## Copyright (C) 2012-2014 Uwe Hermann <[email protected]>
5+
##
6+
## This program is free software; you can redistribute it and/or modify
7+
## it under the terms of the GNU General Public License as published by
8+
## the Free Software Foundation; either version 2 of the License, or
9+
## (at your option) any later version.
10+
##
11+
## This program is distributed in the hope that it will be useful,
12+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
## GNU General Public License for more details.
15+
##
16+
## You should have received a copy of the GNU General Public License
17+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
18+
##
19+
20+
# Normal commands (CMD)
21+
# Unlisted items are 'Reserved' as per eMMC spec.
22+
cmd_names = {
23+
0: 'GO_IDLE_STATE',
24+
1: 'SEND_OP_COND',
25+
2: 'ALL_SEND_CID',
26+
3: 'SEND_RELATIVE_ADDR',
27+
4: 'SET_DSR',
28+
5: 'SLEEP_AWAKE',
29+
6: 'SWITCH',
30+
7: 'SELECT/DESELECT_CARD',
31+
8: 'SEND_EXT_CSD',
32+
9: 'SEND_CSD',
33+
10: 'SEND_CID',
34+
# 11: Obsolete
35+
12: 'STOP_TRANSMISSION',
36+
13: 'SEND_STATUS',
37+
14: 'BUSTEST_R',
38+
15: 'GO_INACTIVE_STATE',
39+
16: 'SET_BLOCKLEN',
40+
17: 'READ_SINGLE_BLOCK',
41+
18: 'READ_MULTIPLE_BLOCK',
42+
19: 'BUSTEST_W',
43+
# 20: Obsolete
44+
21: 'SEND_TUNING_BLOCK',
45+
# 22: Reserved
46+
23: 'SET_BLOCK_COUNT',
47+
24: 'WRITE_BLOCK',
48+
25: 'WRITE_MULTIPLE_BLOCK',
49+
26: 'PROGRAM_CID',
50+
27: 'PROGRAM_CSD',
51+
28: 'SET_WRITE_PROT',
52+
29: 'CLR_WRITE_PROT',
53+
30: 'SEND_WRITE_PROT',
54+
31: 'SEND_WRITE_PROT_TYPE',
55+
# 32-34: Reserved
56+
35: 'ERASE_GROUP_START',
57+
36: 'ERASE_GROUP_END',
58+
# 37: Reserved
59+
38: 'ERASE',
60+
39: 'FAST_IO',
61+
40: 'GO_IRQ_STATE',
62+
# 41: Reserved
63+
42: 'LOCK_UNLOCK',
64+
# 43: Reserved
65+
44: 'QUEUED_TASK_PARAMS',
66+
45: 'QUEUED_TASK_ADDRESS',
67+
46: 'EXECUTE_READ_TASK',
68+
47: 'EXECUTE_WRITE_TASK',
69+
48: 'CMDQ_TASK_MGMT',
70+
49: 'SET_TIME',
71+
# 50-52: Reserved
72+
53: 'PROTOCOL_RD',
73+
54: 'PROTOCOL_WR',
74+
55: 'APP_CMD',
75+
56: 'GEN_CMD',
76+
# 57-59: Reserved
77+
60: 'Reserved for manufacturer',
78+
61: 'Reserved for manufacturer',
79+
62: 'Reserved for manufacturer',
80+
63: 'Reserved for manufacturer',
81+
}
82+
83+
accepted_voltages = {
84+
0b0001: '2.7-3.6V',
85+
0b0010: 'reserved for low voltage range',
86+
0b0100: 'reserved',
87+
0b1000: 'reserved',
88+
# All other values: "not defined".
89+
}
90+
91+
card_status = {
92+
0: 'Reserved for manufacturer test mode',
93+
1: 'Reserved for manufacturer test mode',
94+
2: 'Reserved for application specific commands',
95+
3: 'Reserved for application specific commands',
96+
4: 'Reserved',
97+
5: 'APP_CMD',
98+
6: 'EXCEPTION_EVENT',
99+
7: 'SWITCH_ERROR',
100+
8: 'READY_FOR_DATA',
101+
9: 'CURRENT_STATE', # CURRENT_STATE is a 4-bit value (decimal: 0..15).
102+
10: 'CURRENT_STATE',
103+
11: 'CURRENT_STATE',
104+
12: 'CURRENT_STATE',
105+
13: 'ERASE_RESET',
106+
14: 'Reserved',
107+
15: 'WP_ERASE_SKIP',
108+
16: 'CID/CSD_OVERWRITE',
109+
17: 'Obsolete',
110+
18: 'Obsolete',
111+
19: 'ERROR',
112+
20: 'CC_ERROR',
113+
21: 'DEVICE_ECC_FAILED',
114+
22: 'ILLEGAL_COMMAND',
115+
23: 'COM_CRC_ERROR',
116+
24: 'LOCK_UNLOCK_FAILED',
117+
25: 'DEVICE_IS_LOCKED',
118+
26: 'WP_VIOLATION',
119+
27: 'ERASE_PARAM',
120+
28: 'ERASE_SEQ_ERROR',
121+
29: 'BLOCK_LEN_ERROR',
122+
30: 'ADDRESS_MISALIGN',
123+
31: 'ADDRESS_OUT_OF_RANGE',
124+
}

0 commit comments

Comments
 (0)