forked from autosportlabs/RaceCapture-Pro_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseCommands.c
79 lines (72 loc) · 2.07 KB
/
baseCommands.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* baseCommands.c
*
* Created on: Jul 23, 2011
* Author: brent
*/
#include "baseCommands.h"
#include "FreeRTOS.h"
#include "task.h"
#include "mem_mang.h"
#include "luaScript.h"
#include "lua.h"
#include "luaTask.h"
#include "memory.h"
#include "loggerConfig.h"
//Stuff to provide memory statistics
extern unsigned int _CONFIG_HEAP_SIZE;
extern unsigned portCHAR _heap_address[];
void ShowStats(Serial *serial, unsigned int argc, char **argv){
serial->put_s("== Memory Info ==\r\n");
unsigned long heap = (unsigned long)_heap_address;
unsigned long lastPointer = getLastPointer();
serial->put_s("Heap address :");
put_uint(serial, heap);
put_crlf(serial);
serial->put_s("Last pointer address :");
put_uint(serial, lastPointer);
put_crlf(serial);
serial->put_s("Heap size :");
put_uint(serial, (unsigned int)&_CONFIG_HEAP_SIZE);
put_crlf(serial);
serial->put_s("Estimated Usage :");
put_uint(serial, lastPointer - heap);
put_crlf(serial);
serial->put_s("== Lua Info ==\r\n");
lua_State *L = getLua();
lua_gc(L,LUA_GCCOLLECT,0);
serial->put_s("Lua Top :");
put_int(serial, lua_gettop(L));
put_crlf(serial);
serial->put_s("Lua GC Count :");
put_int(serial, lua_gc(L,LUA_GCCOUNT,0));
put_crlf(serial);
serial->put_s("== Misc ==\r\n");
serial->put_s("sizeof LoggerConfig :");
put_int(serial, sizeof(LoggerConfig));
put_crlf(serial);
serial->put_s("sizeof SampleRecord :");
put_int(serial, sizeof(SampleRecord));
put_crlf(serial);
}
void ShowTaskInfo(Serial *serial, unsigned int argc, char **argv){
serial->put_s("Task Info");
put_crlf(serial);
serial->put_s("Status\tPri\tStack\tTask#\tName");
put_crlf(serial);
char *taskList = (char *)portMalloc(1024);
if (NULL != taskList){
vTaskList(taskList);
serial->put_s(taskList);
portFree(taskList);
}
else{
serial->put_s("Out of Memory!");
}
put_crlf(serial);
}
void GetVersion(Serial *serial, unsigned int argc, char **argv){
put_nameString(serial, "major", MAJOR_REV);
put_nameString(serial, "minor", MINOR_REV);
put_nameString(serial, "bugfix", BUGFIX_REV);
}