use bulk typedefs in functions, add monitoring of msg queue usage to stackmon

sipo
Ondřej Hruška 6 years ago
parent 45910e7f04
commit ad2e19d4fe
  1. 4
      comm/msg_bulkread.c
  2. 2
      comm/msg_bulkread.h
  3. 4
      comm/msg_bulkwrite.c
  4. 2
      comm/msg_bulkwrite.h
  5. 6
      freertos.c
  6. 2
      tasks/sched_queue.h
  7. 10
      tasks/task_msg.c
  8. 1
      tasks/task_sched.h
  9. 6
      units/test/unit_test.c
  10. 4
      utils/stacksmon.c

@ -18,7 +18,7 @@ static uint8_t bulkread_buffer[BULKREAD_MAX_CHUNK];
*/
static TF_Result bulkread_lst(TinyFrame *tf, TF_Msg *msg)
{
struct bulk_read *bulk = msg->userdata;
BulkRead *bulk = msg->userdata;
// this is a final call before timeout, to clean up
if (msg->data == NULL) {
@ -69,7 +69,7 @@ close:
}
/** Start the bulk read flow */
void bulkread_start(TinyFrame *tf, struct bulk_read *bulk)
void bulkread_start(TinyFrame *tf, BulkRead *bulk)
{
assert_param(bulk);
assert_param(bulk->len);

@ -39,7 +39,7 @@ struct bulk_read {
* @param tf - tinyframe instance
* @param bulk - bulk read config structure (malloc'd or static)
*/
void bulkread_start(TinyFrame *tf, struct bulk_read *bulk);
void bulkread_start(TinyFrame *tf, BulkRead *bulk);
#endif //GEX_F072_MSG_BULKREAD_H

@ -15,7 +15,7 @@
*/
static TF_Result bulkwrite_lst(TinyFrame *tf, TF_Msg *msg)
{
struct bulk_write *bulk = msg->userdata;
BulkWrite *bulk = msg->userdata;
// this is a final call before timeout, to clean up
if (msg->data == NULL) {
@ -60,7 +60,7 @@ close:
}
/** Start the bulk write flow */
void bulkwrite_start(TinyFrame *tf, struct bulk_write *bulk)
void bulkwrite_start(TinyFrame *tf, BulkWrite *bulk)
{
assert_param(bulk);
assert_param(bulk->len);

@ -35,7 +35,7 @@ struct bulk_write {
* @param tf - tinyframe instance
* @param bulk - bulk write config structure (malloc'd or static)
*/
void bulkwrite_start(TinyFrame *tf, struct bulk_write *bulk);
void bulkwrite_start(TinyFrame *tf, BulkWrite *bulk);
#endif //GEX_F072_MSG_BULKWRITE_H

@ -58,9 +58,9 @@
/* Variables -----------------------------------------------------------------*/
#define STACK_MAIN 160
#define STACK_MSG 230
#define STACK_JOBRUNNER 150
#define STACK_MAIN 150
#define STACK_MSG 150
#define STACK_JOBRUNNER 128
osThreadId tskMainHandle;
uint32_t mainTaskBuffer[ STACK_MAIN ];

@ -36,6 +36,6 @@ struct rx_que_item {
};
#define HP_SCHED_CAPACITY 5
#define RX_QUE_CAPACITY 16
#define RX_QUE_CAPACITY 10
#endif //GEX_SCHED_QUEUE_H

@ -4,9 +4,9 @@
#include "platform.h"
#include "comm/messages.h"
#include "utils/hexdump.h"
#include "task_msg.h"
#include "sched_queue.h"
volatile uint32_t msgQueHighWaterMark = 0;
/**
* Process data received from TinyFrame.
@ -27,5 +27,11 @@ void TaskMessaging(const void * argument)
assert_param(slot.len>0 && slot.len<=64); // check the len is within bounds
TF_Accept(comm, slot.data, slot.len);
#if USE_STACK_MONITOR
uint32_t count;
count = (uint32_t) uxQueueMessagesWaiting(queRxDataHandle); // this seems to return N+1, hence we don't add the +1 for the one just removed.
msgQueHighWaterMark = MAX(msgQueHighWaterMark, count);
#endif
}
}

@ -10,6 +10,7 @@
#if USE_STACK_MONITOR
extern volatile uint32_t jobQueHighWaterMark;
extern volatile uint32_t msgQueHighWaterMark;
#endif
extern osThreadId tskJobRunnerHandle;

@ -141,7 +141,7 @@ static bool Tst_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Paylo
break;
case CMD_BULKREAD:;
struct bulk_read *br = malloc(sizeof(struct bulk_read));
BulkRead *br = malloc(sizeof(struct bulk_read));
assert_param(br);
br->len = (uint32_t) strlen(longtext);
@ -152,10 +152,10 @@ static bool Tst_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Paylo
break;
case CMD_BULKWRITE:;
struct bulk_write *bw = malloc(sizeof(struct bulk_write));
BulkWrite *bw = malloc(sizeof(struct bulk_write));
assert_param(bw);
bw->len = 1024;
bw->len = 10240;
bw->frame_id = frame_id;
bw->write = bw_dump;

@ -68,6 +68,10 @@ void stackmon_dump(void)
PRINTF(" Used slots: \033[33m%"PRIu32"\033[m\r\n",
jobQueHighWaterMark);
PUTS("\033[36m>> MSG QUEUE\033[m\r\n");
PRINTF(" Used slots: \033[33m%"PRIu32"\033[m\r\n",
msgQueHighWaterMark);
PRINTF("\033[1m---------------------------\033[m\r\n\r\n");
}

Loading…
Cancel
Save