1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 09:45:21 +03:00

Follow ups

This commit is contained in:
3djc 2021-07-26 08:50:00 +02:00
parent 060b18dbd7
commit f436f4bbe4
9 changed files with 34 additions and 30 deletions

View file

@ -528,7 +528,7 @@ if(NOT MSVC)
endif()
endif()
add_definitions(-DRTOS_COOS)
add_definitions(-DFREE_RTOS)
add_executable(firmware ${SRC} ${FIRMWARE_HEADERS})
link_libraries(firmware -lstdc++)

View file

@ -20,7 +20,7 @@
#include <limits.h>
#include "opentx.h"
#include "timers.h"
#include "../timers.h"
#if (defined(PCBX9E) || defined(PCBX9DP)) && defined(LCD_DUAL_BUFFER)
display_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA;

View file

@ -22,7 +22,7 @@
#include <stdio.h>
#include "opentx.h"
#include "lua_api.h"
#include "timers.h"
#include "../timers.h"
/*luadoc
@function model.getInfo()

View file

@ -2090,10 +2090,12 @@ int main()
initialise_monitor_handles();
#endif
#if defined(STM32)
#if !defined(SIMU)
/* Ensure all priority bits are assigned as preemption priority bits. */
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
#endif
#if defined(STM32)
TRACE("reusableBuffer: modelSel=%d, moduleSetup=%d, calib=%d, sdManager=%d, hardwareAndSettings=%d, spectrumAnalyser=%d, usb=%d",
sizeof(reusableBuffer.modelsel),
sizeof(reusableBuffer.moduleSetup),

View file

@ -22,13 +22,14 @@
#define _RTOS_H_
#include "definitions.h"
#include "board.h"
#ifdef __cplusplus
extern "C++" {
#endif
#if defined(SIMU)
#include <pthread.h>
#include <pthread.h>
#include <semaphore.h>
#define SIMU_SLEEP_OR_EXIT_MS(x) simuSleep(x)
@ -98,9 +99,9 @@ extern "C++" {
};
#define RTOS_DEFINE_STACK(name, size) FakeTaskStack<size> name
#define TASK_FUNCTION(task) void task(void *)
#define TASK_FUNCTION(task) void* task(void *)
inline void RTOS_CREATE_TASK(pthread_t &taskId, void * task(void *), const char * name)
inline void RTOS_CREATE_TASK(pthread_t &taskId, void * (*task)(void *), const char * name)
{
pthread_create(&taskId, nullptr, task, nullptr);
#ifdef __linux__
@ -109,7 +110,7 @@ extern "C++" {
}
template<int SIZE>
inline void RTOS_CREATE_TASK(pthread_t &taskId, void * task(void *), const char * name, FakeTaskStack<SIZE> &, unsigned size = 0, unsigned priority = 0)
inline void RTOS_CREATE_TASK(pthread_t &taskId, void * (*task)(void *), const char * name, FakeTaskStack<SIZE> &, unsigned size = 0, unsigned priority = 0)
{
UNUSED(size);
UNUSED(priority);
@ -135,7 +136,7 @@ template<int SIZE>
return (uint32_t)(simuTimerMicros() / 1000);
}
#elif defined(RTOS_COOS)
#elif defined(FREE_RTOS)
#ifdef __cplusplus
extern "C" {
#endif
@ -158,10 +159,8 @@ template<int SIZE>
StaticSemaphore_t mutex_struct;
} RTOS_MUTEX_HANDLE;
typedef RTOS_MUTEX_HANDLE RTOS_FLAG_HANDLE;
static inline void RTOS_START()
{
vTaskStartScheduler();
@ -197,8 +196,6 @@ template<int SIZE>
#define RTOS_CREATE_TASK(h,task,name,stackStruct,stackSize,prio) \
_RTOS_CREATE_TASK(&h,task,name,stackStruct.stack,stackSize,prio)
static inline void _RTOS_CREATE_MUTEX(RTOS_MUTEX_HANDLE* h)
{
h->rtos_handle = xSemaphoreCreateBinaryStatic(&h->mutex_struct);
@ -310,23 +307,24 @@ template<int SIZE>
return (RTOS_GET_TIME() * RTOS_MS_PER_TICK);
}
#define RTOS_DEFINE_STACK(name, size) TaskStack<size> __ALIGNED(8) name // stack must be aligned to 8 bytes otherwise printf for %f does not work!
// stack must be aligned to 8 bytes otherwise printf for %f does not work!
#define RTOS_DEFINE_STACK(name, size) TaskStack<size> __ALIGNED(8) name
#define TASK_FUNCTION(task) void task(void *)
#define TASK_RETURN() return
#define TASK_RETURN() vTaskDelete(nullptr)
#else // no RTOS
static inline void RTOS_START()
{
}
static inline void RTOS_START()
{
}
static inline void RTOS_WAIT_MS(unsigned x)
{
}
static inline void RTOS_WAIT_MS(unsigned x)
{
}
static inline void RTOS_WAIT_TICKS(unsigned x)
{
}
static inline void RTOS_WAIT_TICKS(unsigned x)
{
}
#endif // RTOS type
#ifdef __cplusplus

View file

@ -22,7 +22,7 @@
#include <inttypes.h>
#include <string.h>
#include "opentx.h"
#include "timers.h"
#include "../timers.h"
void eeLoadModel(uint8_t index)
{

View file

@ -21,7 +21,7 @@
#include <inttypes.h>
#include <string.h>
#include "opentx.h"
#include "timers.h"
#include "../timers.h"
#include "conversions/conversions.h"
uint8_t s_write_err = 0; // error reasons

View file

@ -22,15 +22,12 @@
#include "mixer_scheduler.h"
RTOS_TASK_HANDLE menusTaskId;
StaticTask_t menusTaskStruct;
RTOS_DEFINE_STACK(menusStack, MENUS_STACK_SIZE);
RTOS_TASK_HANDLE mixerTaskId;
StaticTask_t mixerTaskStruct;
RTOS_DEFINE_STACK(mixerStack, MIXER_STACK_SIZE);
RTOS_TASK_HANDLE audioTaskId;
StaticTask_t audioTaskStruct;
RTOS_DEFINE_STACK(audioStack, AUDIO_STACK_SIZE);
RTOS_MUTEX_HANDLE audioMutex;

View file

@ -33,10 +33,17 @@
#define AUDIO_STACK_SIZE 400
#define CLI_STACK_SIZE 1000 // only consumed with CLI build option
#if defined(FREE_RTOS)
#define MIXER_TASK_PRIO (tskIDLE_PRIORITY + 4)
#define AUDIO_TASK_PRIO (tskIDLE_PRIORITY + 2)
#define MENUS_TASK_PRIO (tskIDLE_PRIORITY + 1)
#define CLI_TASK_PRIO (tskIDLE_PRIORITY + 1)
#else
#define MIXER_TASK_PRIO (4)
#define AUDIO_TASK_PRIO (2)
#define MENUS_TASK_PRIO (1)
#define CLI_TASK_PRIO (1)
#endif
extern RTOS_TASK_HANDLE menusTaskId;
extern RTOS_DEFINE_STACK(menusStack, MENUS_STACK_SIZE);