mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-29 03:31:26 -04:00
Generalize FIFO to specify FIFO size as 2^K.
Configure baseband queue to be larger (4K) than application queue (2K).
This commit is contained in:
parent
4126f1ab1f
commit
52e8093618
3 changed files with 32 additions and 38 deletions
|
@ -20,33 +20,3 @@
|
|||
*/
|
||||
|
||||
#include "message_queue.hpp"
|
||||
|
||||
#include "ch.h"
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
|
||||
using namespace lpc43xx;
|
||||
|
||||
bool MessageQueue::push(const void* const buf, const size_t len) {
|
||||
const auto result = fifo.in_r(buf, len);
|
||||
const bool success = (result == len);
|
||||
if( success ) {
|
||||
signal();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
size_t MessageQueue::pop(void* const buf, const size_t len) {
|
||||
return fifo.out_r(buf, len);
|
||||
}
|
||||
|
||||
#if defined(LPC43XX_M0)
|
||||
void MessageQueue::signal() {
|
||||
creg::m0apptxevent::assert();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LPC43XX_M4)
|
||||
void MessageQueue::signal() {
|
||||
creg::m4txevent::assert();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue