Fix TX test

This commit is contained in:
Ed
2024-04-29 12:15:17 +01:00
parent d429068bcf
commit 28a530685f
4 changed files with 15 additions and 9 deletions

View File

@@ -134,7 +134,9 @@ void test(chanend c_midi){
} else {
unsigned midi_data[3] = {0};
unsigned byte_count = 0;
// Even though this is an Rx from MIDI we use midi_out_parse so we can decode the packet
{midi_data[0], midi_data[1], midi_data[2], byte_count} = midi_out_parse(byterev(rx_packet));
dprintf("Got packet from MIDI: 0x%8x\n", rx_packet);
// Note this needs to always print for capfd in pytest to pick it up
printf("dut_midi_rx: %u %u %u\n", midi_data[0], midi_data[1], midi_data[2]);
rx_cmd_count++;
@@ -144,9 +146,10 @@ void test(chanend c_midi){
case tx_cmd_count < num_to_tx => tmr when timerafter(t_tx) :> int _:
unsigned midi[] = {commands[tx_cmd_count][0], commands[tx_cmd_count][1], commands[tx_cmd_count][2]};
// Even though this is a Tx to MIDI we use midi_in_parse_helper to form the packet from bytes
unsigned tx_packet = midi_in_parse_helper(midi, m_state);
outuint(c_midi, byterev(tx_packet));
dprintf("Sent packet to midi: %u %u %u\n", commands[tx_cmd_count][0], commands[tx_cmd_count][1], commands[tx_cmd_count][2]);
dprintf("Sent packet to midi: %u %u %u (0x%8x)\n", commands[tx_cmd_count][0], commands[tx_cmd_count][1], commands[tx_cmd_count][2], tx_packet);
t_tx += tx_interval;
tx_end += max_tx_time;
break;