File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ static void flash_execute_command(void) {
135
135
case 0x05 : // Read Status Register-1
136
136
case 0x35 : // Read Status Register-2
137
137
case 0x15 : // Read Status Register-3
138
- flash .commandStatus [0 ] |= 1 << 2 ;
138
+ flash .commandStatus [0 ] |= 2 << 1 ;
139
139
break ;
140
140
case 0x32 : // Quad Input Page Program
141
141
flash .commandStatus [0 ] |= 1 << 1 ;
@@ -154,6 +154,11 @@ static void flash_execute_command(void) {
154
154
break ;
155
155
}
156
156
if (!flash .commandLength && flash .commandStatus [0 ] & 3 << 1 ) {
157
+ /* Zero-length reads or writes finish without any byte transfers */
158
+ flash .commandStatus [0 ] &= ~(3 << 1 );
159
+ flash_finish_command ();
160
+ } else if (flash .commandStatus [0 ] & 2 << 1 ) {
161
+ /* Reads are considered finished before the byte transfers */
157
162
flash_finish_command ();
158
163
}
159
164
}
@@ -193,8 +198,11 @@ static void flash_write_command(uint8_t byte) {
193
198
}
194
199
static void flash_command_byte_transferred (void ) {
195
200
if (!-- flash .commandLength ) {
201
+ bool write = flash .commandStatus [0 ] & 1 << 1 ;
196
202
flash .commandStatus [0 ] &= ~(3 << 1 );
197
- flash_finish_command ();
203
+ if (write ) {
204
+ flash_finish_command ();
205
+ }
198
206
}
199
207
}
200
208
You can’t perform that action at this time.
0 commit comments