# HG changeset patch # User Michael Pavone # Date 1647809731 25200 # Node ID 11a3d5b00a661f51a19aab21e755da0a848747bb # Parent b6338e18787eb090b71af21114a1fb39a9904084 Fix DRS and DTS bits of CDD status diff -r b6338e18787e -r 11a3d5b00a66 cdd_mcu.c --- a/cdd_mcu.c Sat Mar 19 15:50:45 2022 -0700 +++ b/cdd_mcu.c Sun Mar 20 13:55:31 2022 -0700 @@ -569,7 +569,6 @@ update_status(context, gate_array); next_nibble = context->cycle + PROCESSING_DELAY; context->current_status_nibble = 0; - gate_array[GAO_CDD_STATUS] |= BIT_DRS; if (context->next_subcode_int_cycle != CYCLE_NEVER) { context->subcode_int_pending = 1; } @@ -585,17 +584,18 @@ if (context->cycle >= next_nibble) { if (context->current_status_nibble == sizeof(cdd_status)) { context->current_status_nibble = -1; - gate_array[GAO_CDD_STATUS] &= ~BIT_DRS; + gate_array[GAO_CDD_CTRL] &= ~BIT_DRS; if (context->cmd_recv_pending) { context->cmd_recv_pending = 0; context->current_cmd_nibble = 0; - gate_array[GAO_CDD_STATUS] |= BIT_DTS; + gate_array[GAO_CDD_CTRL] |= BIT_DTS; next_cmd_nibble = context->cycle + NIBBLE_CLOCKS; } else { context->cmd_recv_wait = 1; } next_nibble = CYCLE_NEVER; } else { + gate_array[GAO_CDD_CTRL] |= BIT_DRS; uint8_t value = ((uint8_t *)&context->status_buffer)[context->current_status_nibble]; int ga_index = GAO_CDD_STATUS + (context->current_status_nibble >> 1); if (context->current_status_nibble & 1) { @@ -615,7 +615,7 @@ if (context->current_cmd_nibble == sizeof(cdd_cmd)) { next_cmd_nibble = CYCLE_NEVER; context->current_cmd_nibble = -1; - gate_array[GAO_CDD_STATUS] &= ~BIT_DTS; + gate_array[GAO_CDD_CTRL] &= ~BIT_DTS; run_command(context); } else { int ga_index = GAO_CDD_CMD + (context->current_cmd_nibble >> 1); @@ -679,9 +679,12 @@ void cdd_mcu_start_cmd_recv(cdd_mcu *context, uint16_t *gate_array) { + if (gate_array[GAO_CDD_CTRL] & BIT_DTS) { + return; + } if (context->cmd_recv_wait) { context->current_cmd_nibble = 0; - gate_array[GAO_CDD_STATUS] |= BIT_DTS; + gate_array[GAO_CDD_CTRL] |= BIT_DTS; context->last_nibble_cycle = context->cycle; context->cmd_recv_wait = 0; } else {