Minor tidy

This commit is contained in:
Ed
2024-04-26 16:12:07 +01:00
parent 19a18c2db5
commit 8627ef9744
4 changed files with 13 additions and 12 deletions

View File

@@ -1,8 +1,11 @@
// Copyright 2011-2021 XMOS LIMITED.
// Copyright 2011-2024 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef MIDIOUTPARSE_XH
#define MIDIOUTPARSE_XH
#warning MAYBE A SYSEX START AND FINISH IS SAFEST FOR NULL?
#define MIDI_OUT_NULL_MESSAGE 0x00000000 // midi_out_parse will return a size of 0 for this invalid message/event
{unsigned, unsigned, unsigned, unsigned} midi_out_parse(unsigned event);
#endif

View File

@@ -3,6 +3,8 @@
#ifndef QUEUE_H_
#define QUEUE_H_
#include "midioutparse.h"
#define assert(x) asm("ecallf %0"::"r"(x));
#ifndef MIDI_ENABLE_ASSERTS
@@ -48,10 +50,11 @@ inline void queue_push_word(queue_t &q, unsigned array[], unsigned data)
assert(0);
} else {
// Drop message
return;
}
} else {
array[q.wrptr++ & q.mask] = data;
}
array[q.wrptr++ & q.mask] = data;
}
inline unsigned queue_pop_word(queue_t &q, unsigned array[]) {
@@ -59,11 +62,11 @@ inline unsigned queue_pop_word(queue_t &q, unsigned array[]) {
if(MIDI_ENABLE_ASSERTS){
assert(0);
} else {
return 0x00000000; // midi_out_parse will return a size of 0 for this message/event
return MIDI_OUT_NULL_MESSAGE;
}
} else {
return array[q.rdptr++ & q.mask];
}
return array[q.rdptr++ & q.mask];
}

View File

@@ -1,4 +1,4 @@
// Copyright 2013-2021 XMOS LIMITED.
// Copyright 2013-2024 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include "queue.h"

View File

@@ -27,11 +27,6 @@ def test_tx(capfd, config, build_midi):
[0x90, 60, 81], # Note on
[0x80, 60, 81]] # Note off
# midi_commands = [
# [0x90, 60, 81], # Note on
# [0x80, 60, 81]] # Note off
# midi_command_expected = midi_commands[1:] # should skip invalid first message
# Make a 1D list from the 2D list
midi_command_expected = [[item for row in midi_commands for item in row]]