Merge pull request #2831 from opentx/bsongis/arm_tasks_refactoring
Bsongis/arm tasks refactoring
This commit is contained in:
+42
-4
@@ -37,12 +37,11 @@
|
|||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define CLI_STACK_SIZE 500
|
|
||||||
#define CLI_COMMAND_MAX_ARGS 8
|
#define CLI_COMMAND_MAX_ARGS 8
|
||||||
#define CLI_COMMAND_MAX_LEN 256
|
#define CLI_COMMAND_MAX_LEN 256
|
||||||
|
|
||||||
OS_TID cliTaskId;
|
OS_TID cliTaskId;
|
||||||
OS_STK cliStack[CLI_STACK_SIZE];
|
TaskStack<CLI_STACK_SIZE> cliStack;
|
||||||
Fifo<256> cliRxFifo;
|
Fifo<256> cliRxFifo;
|
||||||
uint8_t cliTracesEnabled = false;
|
uint8_t cliTracesEnabled = false;
|
||||||
|
|
||||||
@@ -151,6 +150,44 @@ int cliTrace(const char ** argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cliStackInfo(const char ** argv)
|
||||||
|
{
|
||||||
|
int tid = 0;
|
||||||
|
if (toInt(argv, 1, &tid) > 0) {
|
||||||
|
int available = 0;
|
||||||
|
int total = 0;
|
||||||
|
switch(tid) {
|
||||||
|
case MENU_TASK_INDEX:
|
||||||
|
total = menusStack.size();
|
||||||
|
available = menusStack.available();
|
||||||
|
break;
|
||||||
|
case MIXER_TASK_INDEX:
|
||||||
|
total = mixerStack.size();
|
||||||
|
available = mixerStack.available();
|
||||||
|
break;
|
||||||
|
case AUDIO_TASK_INDEX:
|
||||||
|
total = audioStack.size();
|
||||||
|
available = audioStack.available();
|
||||||
|
break;
|
||||||
|
case CLI_TASK_INDEX:
|
||||||
|
total = cliStack.size();
|
||||||
|
available = cliStack.available();
|
||||||
|
break;
|
||||||
|
case MAIN_TASK_INDEX:
|
||||||
|
total = stackAvailable();
|
||||||
|
available = stackSize();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
serialPrint("%d available (%d total)", available, total);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int cliVolume(const char ** argv)
|
int cliVolume(const char ** argv)
|
||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@@ -214,6 +251,7 @@ const CliCommand cliCommands[] = {
|
|||||||
{ "ls", cliLs, "<directory>" },
|
{ "ls", cliLs, "<directory>" },
|
||||||
{ "play", cliPlay, "<filename>" },
|
{ "play", cliPlay, "<filename>" },
|
||||||
{ "print", cliDisplay, "<address> [<size>] | <what>" },
|
{ "print", cliDisplay, "<address> [<size>] | <what>" },
|
||||||
|
{ "stackinfo", cliStackInfo, "<tid>" },
|
||||||
{ "trace", cliTrace, "on | off" },
|
{ "trace", cliTrace, "on | off" },
|
||||||
{ "volume", cliVolume, "<level>" },
|
{ "volume", cliVolume, "<level>" },
|
||||||
{ "help", cliHelp, "[<command>]" },
|
{ "help", cliHelp, "[<command>]" },
|
||||||
@@ -279,7 +317,7 @@ void cliTask(void * pdata)
|
|||||||
uint8_t c;
|
uint8_t c;
|
||||||
|
|
||||||
while (!cliRxFifo.pop(c)) {
|
while (!cliRxFifo.pop(c)) {
|
||||||
CoTickDelay(5); // 10ms
|
CoTickDelay(10); // 20ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == 12) {
|
if (c == 12) {
|
||||||
@@ -311,5 +349,5 @@ void cliTask(void * pdata)
|
|||||||
|
|
||||||
void cliStart()
|
void cliStart()
|
||||||
{
|
{
|
||||||
cliTaskId = CoCreateTaskEx(cliTask, NULL, 10, &cliStack[CLI_STACK_SIZE-1], CLI_STACK_SIZE, 1, false);
|
cliTaskId = CoCreateTaskEx(cliTask, NULL, 10, &cliStack.stack[CLI_STACK_SIZE-1], CLI_STACK_SIZE, 1, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ extern uint8_t cliTracesEnabled;
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "fifo.h"
|
#include "fifo.h"
|
||||||
extern Fifo<256> cliRxFifo;
|
extern Fifo<256> cliRxFifo;
|
||||||
|
#include "tasks_arm.h"
|
||||||
|
#define CLI_STACK_SIZE 1000
|
||||||
|
extern TaskStack<CLI_STACK_SIZE> cliStack;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cliStart();
|
void cliStart();
|
||||||
|
|||||||
@@ -40,7 +40,9 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "dump.h"
|
#include "dump.h"
|
||||||
|
#if defined(CLI)
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -196,11 +196,11 @@ void menuStatisticsDebug(uint8_t event)
|
|||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, stack_free(0), UNSIGN|LEFT|TINSIZE);
|
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(1), UNSIGN|LEFT|TINSIZE);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(2), UNSIGN|LEFT|TINSIZE);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
@@ -213,7 +213,7 @@ void menuStatisticsDebug(uint8_t event)
|
|||||||
lcd_putsLeft(4*FH, STR_TMIXMAXMS);
|
lcd_putsLeft(4*FH, STR_TMIXMAXMS);
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
|
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
|
||||||
lcd_putsLeft(5*FH, STR_FREESTACKMINB);
|
lcd_putsLeft(5*FH, STR_FREESTACKMINB);
|
||||||
lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ;
|
lcd_outdezAtt(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_puts(4*FW, 7*FH+1, STR_MENUTORESET);
|
lcd_puts(4*FW, 7*FH+1, STR_MENUTORESET);
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void menuStatisticsDebug(uint8_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT);
|
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT);
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
|
||||||
|
|
||||||
#if defined(LUA)
|
#if defined(LUA)
|
||||||
@@ -189,13 +189,13 @@ void menuStatisticsDebug(uint8_t event)
|
|||||||
|
|
||||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE);
|
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT);
|
||||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE);
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT);
|
||||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE);
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT);
|
||||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE);
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(255), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stackAvailable(), UNSIGN|LEFT);
|
||||||
|
|
||||||
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
||||||
lcd_status_line();
|
lcd_status_line();
|
||||||
|
|||||||
@@ -2348,7 +2348,7 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
|
|||||||
#if !defined(CPUARM) && !defined(SIMU)
|
#if !defined(CPUARM) && !defined(SIMU)
|
||||||
extern unsigned char __bss_end ;
|
extern unsigned char __bss_end ;
|
||||||
#define STACKPTR _SFR_IO16(0x3D)
|
#define STACKPTR _SFR_IO16(0x3D)
|
||||||
void stack_paint()
|
void stackPaint()
|
||||||
{
|
{
|
||||||
// Init Stack while interrupts are disabled
|
// Init Stack while interrupts are disabled
|
||||||
unsigned char *p ;
|
unsigned char *p ;
|
||||||
@@ -2362,7 +2362,7 @@ void stack_paint()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t stack_free()
|
uint16_t stackAvailable()
|
||||||
{
|
{
|
||||||
unsigned char *p ;
|
unsigned char *p ;
|
||||||
|
|
||||||
@@ -2492,7 +2492,7 @@ int main(void)
|
|||||||
lcdInit();
|
lcdInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stack_paint();
|
stackPaint();
|
||||||
|
|
||||||
#if defined(GUI)
|
#if defined(GUI)
|
||||||
g_menuStack[0] = menuMainView;
|
g_menuStack[0] = menuMainView;
|
||||||
|
|||||||
+5
-13
@@ -717,14 +717,14 @@ extern uint8_t flightModeTransitionLast;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
inline int getAvailableMemory() { return 1000; }
|
inline int availableMemory() { return 1000; }
|
||||||
#elif defined(CPUARM) && !defined(SIMU)
|
#elif defined(CPUARM) && !defined(SIMU)
|
||||||
extern unsigned char *heap;
|
extern unsigned char *heap;
|
||||||
extern int _end;
|
extern int _end;
|
||||||
extern int _estack;
|
extern int _estack;
|
||||||
extern int _main_stack_start;
|
extern int _main_stack_start;
|
||||||
extern int _heap_end;
|
extern int _heap_end;
|
||||||
#define getAvailableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||||
@@ -942,11 +942,8 @@ extern uint16_t lastMixerDuration;
|
|||||||
uint16_t getTmr16KHz();
|
uint16_t getTmr16KHz();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
uint32_t stack_free(uint32_t tid);
|
uint16_t stackAvailable();
|
||||||
void stack_paint();
|
|
||||||
#else
|
|
||||||
uint16_t stack_free();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SPLASH)
|
#if defined(SPLASH)
|
||||||
@@ -1050,12 +1047,7 @@ template<class t> void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
|||||||
uint16_t isqrt32(uint32_t n);
|
uint16_t isqrt32(uint32_t n);
|
||||||
|
|
||||||
#if defined(CPUARM) && !defined(BOOT)
|
#if defined(CPUARM) && !defined(BOOT)
|
||||||
#if !defined(SIMU)
|
#include "tasks_arm.h"
|
||||||
extern "C" {
|
|
||||||
#include <CoOS.h>
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern OS_MutexID mixerMutex;
|
extern OS_MutexID mixerMutex;
|
||||||
inline void pauseMixerCalculations()
|
inline void pauseMixerCalculations()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ void *main_thread(void *)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
stack_paint();
|
stackPaint();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s_current_protocol[0] = 255;
|
s_current_protocol[0] = 255;
|
||||||
@@ -657,12 +657,10 @@ void eepromWriteBlock(uint8_t * pointer_ram, uint32_t pointer_eeprom, uint32_t s
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
uint16_t stackAvailable()
|
||||||
uint16_t stack_free()
|
|
||||||
{
|
{
|
||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void EeFsDump(){
|
static void EeFsDump(){
|
||||||
|
|||||||
+67
-55
@@ -36,10 +36,10 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#define MENUS_STACK_SIZE 2000
|
#define MENUS_STACK_SIZE 2000
|
||||||
#define MIXER_STACK_SIZE 500
|
#define MIXER_STACK_SIZE 500
|
||||||
#define AUDIO_STACK_SIZE 500
|
#define AUDIO_STACK_SIZE 500
|
||||||
#define BT_STACK_SIZE 500
|
#define BLUETOOTH_STACK_SIZE 500
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define _ALIGNED(x) __declspec(align(x))
|
#define _ALIGNED(x) __declspec(align(x))
|
||||||
@@ -48,73 +48,85 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
OS_TID menusTaskId;
|
OS_TID menusTaskId;
|
||||||
// stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||||
OS_STK _ALIGNED(8) menusStack[MENUS_STACK_SIZE];
|
TaskStack<MENUS_STACK_SIZE> _ALIGNED(8) menusStack;
|
||||||
|
|
||||||
OS_TID mixerTaskId;
|
OS_TID mixerTaskId;
|
||||||
OS_STK mixerStack[MIXER_STACK_SIZE];
|
TaskStack<MENUS_STACK_SIZE> mixerStack;
|
||||||
|
|
||||||
OS_TID audioTaskId;
|
OS_TID audioTaskId;
|
||||||
OS_STK audioStack[AUDIO_STACK_SIZE];
|
TaskStack<AUDIO_STACK_SIZE> audioStack;
|
||||||
|
|
||||||
#if defined(BLUETOOTH)
|
#if defined(BLUETOOTH)
|
||||||
OS_TID btTaskId;
|
OS_TID btTaskId;
|
||||||
OS_STK btStack[BT_STACK_SIZE];
|
TaskStack<BLUETOOTH_STACK_SIZE> bluetoothStack;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OS_MutexID audioMutex;
|
OS_MutexID audioMutex;
|
||||||
OS_MutexID mixerMutex;
|
OS_MutexID mixerMutex;
|
||||||
|
|
||||||
void stack_paint()
|
enum TaskIndex {
|
||||||
|
MENU_TASK_INDEX,
|
||||||
|
MIXER_TASK_INDEX,
|
||||||
|
AUDIO_TASK_INDEX,
|
||||||
|
CLI_TASK_INDEX,
|
||||||
|
BLUETOOTH_TASK_INDEX,
|
||||||
|
TASK_INDEX_COUNT,
|
||||||
|
MAIN_TASK_INDEX = 255
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int SIZE>
|
||||||
|
void TaskStack<SIZE>::paint()
|
||||||
{
|
{
|
||||||
for (uint32_t i=0; i<MENUS_STACK_SIZE; i++)
|
for (uint32_t i=0; i<SIZE; i++) {
|
||||||
menusStack[i] = 0x55555555;
|
stack[i] = 0x55555555;
|
||||||
for (uint32_t i=0; i<MIXER_STACK_SIZE; i++)
|
}
|
||||||
mixerStack[i] = 0x55555555;
|
|
||||||
for (uint32_t i=0; i<AUDIO_STACK_SIZE; i++)
|
|
||||||
audioStack[i] = 0x55555555;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t stack_free(uint32_t tid)
|
template<int SIZE>
|
||||||
|
uint16_t TaskStack<SIZE>::size()
|
||||||
{
|
{
|
||||||
OS_STK *stack;
|
return SIZE*4;
|
||||||
uint32_t size;
|
}
|
||||||
|
|
||||||
switch(tid) {
|
uint16_t getStackAvailable(void * address, uint16_t size)
|
||||||
case 0:
|
{
|
||||||
stack = menusStack;
|
uint32_t * array = (uint32_t *)address;
|
||||||
size = MENUS_STACK_SIZE;
|
uint16_t i = 0;
|
||||||
break;
|
while (i < size && array[i] == 0x55555555) {
|
||||||
case 1:
|
i++;
|
||||||
stack = mixerStack;
|
|
||||||
size = MIXER_STACK_SIZE;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
stack = audioStack;
|
|
||||||
size = AUDIO_STACK_SIZE;
|
|
||||||
break;
|
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
case 255:
|
|
||||||
#if defined(SIMU)
|
|
||||||
return 1024;
|
|
||||||
#else
|
|
||||||
// main stack
|
|
||||||
stack = (OS_STK *)&_main_stack_start;
|
|
||||||
size = ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t i=0;
|
|
||||||
for (; i<size; i++)
|
|
||||||
if (stack[i] != 0x55555555)
|
|
||||||
break;
|
|
||||||
return i*4;
|
return i*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int SIZE>
|
||||||
|
uint16_t TaskStack<SIZE>::available()
|
||||||
|
{
|
||||||
|
return getStackAvailable(stack, SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stackPaint()
|
||||||
|
{
|
||||||
|
menusStack.paint();
|
||||||
|
mixerStack.paint();
|
||||||
|
audioStack.paint();
|
||||||
|
#if defined(CLI)
|
||||||
|
cliStack.paint();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CPUSTM32) && !defined(SIMU)
|
||||||
|
uint16_t stackSize()
|
||||||
|
{
|
||||||
|
return ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t stackAvailable()
|
||||||
|
{
|
||||||
|
return getStackAvailable(&_main_stack_start, stackSize());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
|
|
||||||
void mixerTask(void * pdata)
|
void mixerTask(void * pdata)
|
||||||
@@ -176,7 +188,7 @@ void menusTask(void * pdata)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(REV9E)
|
#if defined(PCBTARANIS) && defined(REV9E)
|
||||||
topLcdOff();
|
topLcdOff();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -204,12 +216,12 @@ void tasksStart()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BLUETOOTH)
|
#if defined(BLUETOOTH)
|
||||||
btTaskId = CoCreateTask(btTask, NULL, 15, &btStack[BT_STACK_SIZE-1], BT_STACK_SIZE);
|
btTaskId = CoCreateTask(btTask, NULL, 15, &bluetoothStack.stack[BLUETOOTH_STACK_SIZE-1], BLUETOOTH_STACK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
|
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack.stack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
|
||||||
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
|
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack.stack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
|
||||||
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
|
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack.stack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
|
||||||
|
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
audioMutex = CoCreateMutex();
|
audioMutex = CoCreateMutex();
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Authors (alphabetical order)
|
||||||
|
* - Andre Bernet <bernet.andre@gmail.com>
|
||||||
|
* - Andreas Weitl
|
||||||
|
* - Bertrand Songis <bsongis@gmail.com>
|
||||||
|
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||||
|
* - Cameron Weeks <th9xer@gmail.com>
|
||||||
|
* - Erez Raviv
|
||||||
|
* - Gabriel Birkus
|
||||||
|
* - Jean-Pierre Parisy
|
||||||
|
* - Karl Szmutny
|
||||||
|
* - Michael Blandford
|
||||||
|
* - Michal Hlavinka
|
||||||
|
* - Pat Mackenzie
|
||||||
|
* - Philip Moss
|
||||||
|
* - Rob Thomson
|
||||||
|
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||||
|
* - Thomas Husterer
|
||||||
|
*
|
||||||
|
* opentx is based on code named
|
||||||
|
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||||
|
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||||
|
* and the original (and ongoing) project by
|
||||||
|
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TASKS_ARM_H_
|
||||||
|
#define _TASKS_ARM_H_
|
||||||
|
|
||||||
|
#if !defined(SIMU)
|
||||||
|
extern "C" {
|
||||||
|
#include <CoOS.h>
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<int SIZE>
|
||||||
|
class TaskStack
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TaskStack() { }
|
||||||
|
void paint();
|
||||||
|
uint16_t size();
|
||||||
|
uint16_t available();
|
||||||
|
OS_STK stack[SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
void stackPaint();
|
||||||
|
uint16_t stackSize();
|
||||||
|
uint16_t stackAvailable();
|
||||||
|
|
||||||
|
#endif // _TASKS_ARM_H_
|
||||||
Reference in New Issue
Block a user