Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MIDI: support new uart core, correctly this time

  • Loading branch information...
commit a50bd7b678742a94c6e214b32c64835493af368b 1 parent 533b374
@sbourdeauducq sbourdeauducq authored
Showing with 18 additions and 13 deletions.
  1. +18 −13 src/tests_midi.c
View
31 src/tests_midi.c
@@ -26,13 +26,13 @@ static int loopback(void)
{
unsigned int c = 0;
char e;
+ int timeout;
int result = TEST_STATUS_PASSED;
- printf("press 'e' exit MIDI test\n");
- irq_ack(IRQ_MIDI);
+ printf("Press 'e' to terminate the MIDI test\n");
while(1) {
- if (c == 256) {
- printf("0 ~ 255 sent out, press 'e' for exit\n");
+ if(c == 256) {
+ printf("Sending 0 ~ 255...\n");
c = 0;
}
CSR_MIDI_RXTX = c;
@@ -44,17 +44,22 @@ static int loopback(void)
}
CSR_MIDI_STAT = MIDI_STAT_TX_EVT;
-
- if(CSR_MIDI_STAT & MIDI_STAT_RX_EVT) {
- printf("Failed: RX receive problem\n");
- result = TEST_STATUS_FAILED;
+ timeout = 10000;
+ while(!(CSR_MIDI_STAT & MIDI_STAT_RX_EVT)) {
+ if(timeout-- == 0) {
+ printf("Test failed: RX timeout\n");
+ result = TEST_STATUS_FAILED;
+ break;
+ }
}
-
- if(CSR_MIDI_RXTX != c) {
- printf("Failed: TX: %d, but RX: %d\n", c, CSR_MIDI_RXTX);
- result = TEST_STATUS_FAILED;
+
+ if(timeout > 0) {
+ if(CSR_MIDI_RXTX != c) {
+ printf("Failed: TX: %d, but RX: %d\n", c, CSR_MIDI_RXTX);
+ result = TEST_STATUS_FAILED;
+ }
+ CSR_MIDI_STAT = MIDI_STAT_RX_EVT;
}
- CSR_MIDI_STAT = MIDI_STAT_RX_EVT;
c++;
}
Please sign in to comment.
Something went wrong with that request. Please try again.