Skip to content

Commit db82a5d

Browse files
FozzTexxtschak909
authored andcommitted
Add comments about ack is used as write protect.
1 parent 5f72cc9 commit db82a5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/bus/iwm/iwm_ll.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,12 @@ void IRAM_ATTR iwm_diskii_ll::diskii_write_handler()
919919

920920
void iwm_diskii_ll::start(uint8_t drive, bool write_protect)
921921
{
922-
if (write_protect)
922+
if (write_protect) {
923+
// Signal that disk is write protected
923924
smartport.iwm_ack_set();
925+
}
924926
else {
927+
// Signal that disk can be written to
925928
smartport.iwm_ack_clr();
926929

927930
d2w_buflen = cspi_alloc_continuous(IWM_NUMBYTES_FOR_BITS(TRACK_LEN * 8, d2w_buffer),
@@ -949,8 +952,9 @@ void iwm_diskii_ll::stop()
949952
d2w_started = false;
950953
heap_caps_free(d2w_desc);
951954
heap_caps_free(d2w_buffer);
955+
// Let SmartPort use write protect as ACK line again
956+
smartport.iwm_ack_set();
952957
}
953-
smartport.iwm_ack_set();
954958
gpio_isr_handler_remove(SP_WREQ);
955959
fnLedManager.set(LED_BUS, false);
956960
Debug_printf("\nstop diskII");

0 commit comments

Comments
 (0)