implement a message processing queue that will hopefully aleviate the pain in working with tinyframe. this should make it possible to almost entirely get rid of async jobs for simple replies
This commit is contained in:
@@ -29,4 +29,14 @@ struct sched_que_item {
|
||||
};
|
||||
};
|
||||
|
||||
// This que is used to stash frames received from TinyFrame for later evaluation on the application thread
|
||||
struct rx_que_item {
|
||||
uint32_t len;
|
||||
uint8_t data[64];
|
||||
};
|
||||
|
||||
#define LP_SCHED_CAPACITY 5
|
||||
#define HP_SCHED_CAPACITY 5
|
||||
#define RX_QUE_CAPACITY 8
|
||||
|
||||
#endif //GEX_SCHED_QUEUE_H
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ void TaskMain(void const * argument)
|
||||
// Periodically check stacks for overrun
|
||||
stackmon_check_canaries();
|
||||
// Periodically dump all stacks - for checking levels before critical (to reduce size if not needed)
|
||||
// if ((cnt%50)==0) stackmon_dump();
|
||||
if ((cnt%75)==0) stackmon_dump();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by MightyPork on 2017/12/22.
|
||||
//
|
||||
|
||||
#include <comm/messages.h>
|
||||
#include "platform.h"
|
||||
#include "task_msg.h"
|
||||
#include "sched_queue.h"
|
||||
|
||||
void TaskMessaging(const void * argument)
|
||||
{
|
||||
dbg("> Message queue task started!");
|
||||
|
||||
struct rx_que_item slot;
|
||||
while (1) {
|
||||
xQueueReceive(queRxDataHandle, &slot, osWaitForever);
|
||||
assert_param(slot.len>0 && slot.len<=64); // check the len is within bounds
|
||||
TF_Accept(comm, slot.data, slot.len);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Created by MightyPork on 2017/12/22.
|
||||
//
|
||||
|
||||
#ifndef GEX_F072_TASK_MSG_H
|
||||
#define GEX_F072_TASK_MSG_H
|
||||
|
||||
extern osMessageQId queRxDataHandle;
|
||||
extern osThreadId tskMsgHandle;
|
||||
void TaskMessaging(const void * argument);
|
||||
|
||||
#endif //GEX_F072_TASK_MSG_H
|
||||
Reference in New Issue
Block a user