From 5fdaccc1fa3d94dd39bc17b1f0ab55a27dce2551 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 24 Feb 2013 18:33:29 +0100 Subject: [PATCH] sim_posix: unified inc files with the rest of PiOS .h, some dir moves/cleanup, fixed some compilation issues. --- flight/PiOS.posix/Boards/pios_board.h | 10 - flight/PiOS.posix/inc/FreeRTOSConfig.h | 107 --------- flight/PiOS/Boards/pios_board.h | 2 + .../{PiOS.posix => PiOS}/Boards/sim_posix.h | 0 flight/PiOS/inc/pios_debug.h | 4 + flight/PiOS/inc/pios_initcall.h | 21 ++ flight/{PiOS.posix => PiOS}/inc/pios_posix.h | 0 flight/PiOS/inc/pios_sdcard.h | 9 +- flight/{PiOS.posix => PiOS}/inc/pios_udp.h | 0 .../{PiOS.posix => PiOS}/inc/pios_udp_priv.h | 0 flight/PiOS/pios.h | 6 +- .../pios.h => PiOS/pios_sim_posix.h} | 12 +- .../Libraries/FreeRTOS/Source/croutine.c | 0 .../FreeRTOS/Source/include/FreeRTOS.h | 0 .../FreeRTOS/Source/include/StackMacros.h | 0 .../FreeRTOS/Source/include/croutine.h | 0 .../Libraries/FreeRTOS/Source/include/list.h | 0 .../FreeRTOS/Source/include/mpu_wrappers.h | 0 .../FreeRTOS/Source/include/portable.h | 0 .../FreeRTOS/Source/include/projdefs.h | 0 .../Libraries/FreeRTOS/Source/include/queue.h | 0 .../FreeRTOS/Source/include/semphr.h | 0 .../Libraries/FreeRTOS/Source/include/task.h | 0 .../posix/Libraries/FreeRTOS/Source/list.c | 0 .../FreeRTOS/Source/portable/GCC/Posix/port.c | 0 .../GCC/Posix/port.c.documentation.txt | 0 .../Source/portable/GCC/Posix/portmacro.h | 0 .../FreeRTOS/Source/portable/MemMang/heap_3.c | 0 .../FreeRTOS/Source/portable/readme.txt | 0 .../posix/Libraries/FreeRTOS/Source/queue.c | 0 .../Libraries/FreeRTOS/Source/readme.txt | 0 .../posix/Libraries/FreeRTOS/Source/tasks.c | 0 .../posix/Libraries/FreeRTOS/library.mk | 0 flight/{PiOS.posix => PiOS}/posix/library.mk | 0 .../posix/pios_bl_helper.c | 0 .../posix/pios_board_info.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_com.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_crc.c | 0 .../{PiOS.posix => PiOS}/posix/pios_debug.c | 0 .../{PiOS.posix => PiOS}/posix/pios_delay.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_iap.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_irq.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_led.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_rcvr.c | 0 .../{PiOS.posix => PiOS}/posix/pios_sdcard.c | 2 +- .../{PiOS.posix => PiOS}/posix/pios_servo.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_sys.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_udp.c | 0 flight/{PiOS.posix => PiOS}/posix/pios_wdg.c | 3 +- .../SimPosix/System/inc/FreeRTOSConfig.h | 210 +++++++++--------- .../SimPosix/System/inc/FreeRTOSConfig_bk.h | 103 +++++++++ 51 files changed, 255 insertions(+), 234 deletions(-) delete mode 100644 flight/PiOS.posix/Boards/pios_board.h delete mode 100644 flight/PiOS.posix/inc/FreeRTOSConfig.h rename flight/{PiOS.posix => PiOS}/Boards/sim_posix.h (100%) rename flight/{PiOS.posix => PiOS}/inc/pios_posix.h (100%) rename flight/{PiOS.posix => PiOS}/inc/pios_udp.h (100%) rename flight/{PiOS.posix => PiOS}/inc/pios_udp_priv.h (100%) rename flight/{PiOS.posix/pios.h => PiOS/pios_sim_posix.h} (92%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/croutine.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/StackMacros.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/croutine.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/list.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/portable.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/projdefs.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/queue.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/semphr.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/include/task.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/list.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c.documentation.txt (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/portable/readme.txt (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/queue.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/readme.txt (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/Source/tasks.c (100%) rename flight/{PiOS.posix => PiOS}/posix/Libraries/FreeRTOS/library.mk (100%) rename flight/{PiOS.posix => PiOS}/posix/library.mk (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_bl_helper.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_board_info.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_com.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_crc.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_debug.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_delay.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_iap.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_irq.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_led.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_rcvr.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_sdcard.c (95%) rename flight/{PiOS.posix => PiOS}/posix/pios_servo.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_sys.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_udp.c (100%) rename flight/{PiOS.posix => PiOS}/posix/pios_wdg.c (96%) create mode 100644 flight/targets/SimPosix/System/inc/FreeRTOSConfig_bk.h diff --git a/flight/PiOS.posix/Boards/pios_board.h b/flight/PiOS.posix/Boards/pios_board.h deleted file mode 100644 index 9917a1d23..000000000 --- a/flight/PiOS.posix/Boards/pios_board.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef PIOS_BOARD_H_ -#define PIOS_BOARD_H_ - -#ifdef USE_SIM_POSIX -#include "sim_posix.h" -#else -#error Board definition has not been provided. -#endif - -#endif /* PIOS_BOARD_H_ */ diff --git a/flight/PiOS.posix/inc/FreeRTOSConfig.h b/flight/PiOS.posix/inc/FreeRTOSConfig.h deleted file mode 100644 index f6602c721..000000000 --- a/flight/PiOS.posix/inc/FreeRTOSConfig.h +++ /dev/null @@ -1,107 +0,0 @@ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -/* Notes: We use 5 task priorities */ - - -#ifdef __APPLE__ - #define COND_SIGNALING - #define CHECK_TASK_RESUMES - #define RUNNING_THREAD_MUTEX -// #define TICK_SIGNAL -// #define TICK_SIGWAIT - #define IDLE_SLEEPS - - #define configUSE_PREEMPTION 1 - #define configIDLE_SHOULD_YIELD 0 -#endif -#ifdef __CYGWIN__ - #define COND_SIGNALING - #define CHECK_TASK_RESUMES -// #define RUNNING_THREAD_MUTEX -// #define TICK_SIGNAL - #define TICK_SIGWAIT - #define IDLE_SLEEPS - - #define configUSE_PREEMPTION 0 - #define configIDLE_SHOULD_YIELD 1 -#endif -#ifdef __linux__ - #define COND_SIGNALING - #define CHECK_TASK_RESUMES - #define RUNNING_THREAD_MUTEX -// #define TICK_SIGNAL -// #define TICK_SIGWAIT - #define IDLE_SLEEPS - - #define configUSE_PREEMPTION 1 - #define configIDLE_SHOULD_YIELD 0 -#endif - - -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 0 -#define configCPU_CLOCK_HZ ( ( unsigned long ) 72000000 ) -#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) -#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) ) -#define configMAX_TASK_NAME_LEN ( 16 ) -#define configUSE_TRACE_FACILITY 0 -#define configUSE_16_BIT_TICKS 0 -#define configUSE_MUTEXES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_COUNTING_SEMAPHORES 0 -#define configUSE_ALTERNATIVE_API 0 -#define configCHECK_FOR_STACK_OVERFLOW 2 -#define configQUEUE_REGISTRY_SIZE 10 - - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) - -/* Set the following definitions to 1 to include the API function, or zero -to exclude the API function. */ - -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 0 - - - - -/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255 -(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */ -#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */ - - -/* This is the value being used as per the ST library which permits 16 -priority values, 0 to 15. This must correspond to the -configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest -NVIC value of 255. */ -#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 - -#endif /* FREERTOS_CONFIG_H */ - diff --git a/flight/PiOS/Boards/pios_board.h b/flight/PiOS/Boards/pios_board.h index 120c7d64a..aced5f898 100644 --- a/flight/PiOS/Boards/pios_board.h +++ b/flight/PiOS/Boards/pios_board.h @@ -17,6 +17,8 @@ #include "STM32F4xx_OSD.h" #elif USE_STM32F4xx_RM #include "STM32F4xx_RevoMini.h" +#elif USE_SIM_POSIX +#include "sim_posix.h" #else #error Board definition has not been provided. #endif diff --git a/flight/PiOS.posix/Boards/sim_posix.h b/flight/PiOS/Boards/sim_posix.h similarity index 100% rename from flight/PiOS.posix/Boards/sim_posix.h rename to flight/PiOS/Boards/sim_posix.h diff --git a/flight/PiOS/inc/pios_debug.h b/flight/PiOS/inc/pios_debug.h index 4dc5f5b3e..aa3eb3332 100644 --- a/flight/PiOS/inc/pios_debug.h +++ b/flight/PiOS/inc/pios_debug.h @@ -33,9 +33,13 @@ extern const char *PIOS_DEBUG_AssertMsg; +#ifdef USE_SIM_POSIX +void PIOS_DEBUG_Init(void); +#else #include void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_channels); +#endif void PIOS_DEBUG_PinHigh(uint8_t pin); void PIOS_DEBUG_PinLow(uint8_t pin); void PIOS_DEBUG_PinValue8Bit(uint8_t value); diff --git a/flight/PiOS/inc/pios_initcall.h b/flight/PiOS/inc/pios_initcall.h index e242989c0..1f1dea393 100644 --- a/flight/PiOS/inc/pios_initcall.h +++ b/flight/PiOS/inc/pios_initcall.h @@ -51,6 +51,26 @@ typedef struct { /* Init module section */ extern initmodule_t __module_initcall_start[], __module_initcall_end[]; +#ifdef USE_SIM_POSIX + +extern void InitModules(); +extern void StartModules(); + +#define MODULE_INITCALL(ifn, sfn) + +#define MODULE_TASKCREATE_ALL { \ + /* Start all module threads */ \ + StartModules(); \ + } + +#define MODULE_INITIALISE_ALL { \ + /* Initialize modules */ \ + InitModules(); \ + /* Initialize the system thread */ \ + SystemModInitialize();} + +#else + /* initcalls are now grouped by functionality into separate * subsections. Ordering inside the subsections is determined * by link order. @@ -77,6 +97,7 @@ extern initmodule_t __module_initcall_start[], __module_initcall_end[]; if (fn->fn_tinit) \ (fn->fn_tinit)(); } +#endif /* USE_SIM_POSIX */ #endif /* PIOS_INITCALL_H */ /** diff --git a/flight/PiOS.posix/inc/pios_posix.h b/flight/PiOS/inc/pios_posix.h similarity index 100% rename from flight/PiOS.posix/inc/pios_posix.h rename to flight/PiOS/inc/pios_posix.h diff --git a/flight/PiOS/inc/pios_sdcard.h b/flight/PiOS/inc/pios_sdcard.h index f839b99a5..8cbe3fd9f 100644 --- a/flight/PiOS/inc/pios_sdcard.h +++ b/flight/PiOS/inc/pios_sdcard.h @@ -80,17 +80,17 @@ typedef struct { uint16_t OEM_AppliID; /* OEM/Application ID */ char ProdName[6]; /* Product Name */ uint8_t ProdRev; /* Product Revision */ - u32 ProdSN; /* Product Serial Number */ + uint32_t ProdSN; /* Product Serial Number */ uint8_t Reserved1; /* Reserved1 */ uint16_t ManufactDate; /* Manufacturing Date */ uint8_t msd_CRC; /* CRC */ uint8_t Reserved2; /* always 1 */ } SDCARDCidTypeDef; - +#ifndef USE_SIM_POSIX /* Global Variables */ extern VOLINFO PIOS_SDCARD_VolInfo; extern uint8_t PIOS_SDCARD_Sector[SECTOR_SIZE]; - +#endif /* Prototypes */ extern int32_t PIOS_SDCARD_Init(uint32_t spi_id); extern int32_t PIOS_SDCARD_PowerOn(void); @@ -106,9 +106,10 @@ extern int32_t PIOS_SDCARD_StartupLog(void); extern int32_t PIOS_SDCARD_IsMounted(); extern int32_t PIOS_SDCARD_MountFS(uint32_t StartupLog); extern int32_t PIOS_SDCARD_GetFree(void); - +#ifndef USE_SIM_POSIX extern int32_t PIOS_SDCARD_ReadBuffer(PFILEINFO fileinfo, uint8_t * buffer, uint32_t len); extern int32_t PIOS_SDCARD_ReadLine(PFILEINFO fileinfo, uint8_t * buffer, uint32_t max_len); +#endif extern int32_t PIOS_SDCARD_FileCopy(char *Source, char *Destination); extern int32_t PIOS_SDCARD_FileDelete(char *Filename); diff --git a/flight/PiOS.posix/inc/pios_udp.h b/flight/PiOS/inc/pios_udp.h similarity index 100% rename from flight/PiOS.posix/inc/pios_udp.h rename to flight/PiOS/inc/pios_udp.h diff --git a/flight/PiOS.posix/inc/pios_udp_priv.h b/flight/PiOS/inc/pios_udp_priv.h similarity index 100% rename from flight/PiOS.posix/inc/pios_udp_priv.h rename to flight/PiOS/inc/pios_udp_priv.h diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 66de54a3e..2ce7e80ec 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -27,7 +27,9 @@ #ifndef PIOS_H #define PIOS_H - +#ifdef USE_SIM_POSIX +#include +#else /* PIOS Feature Selection */ #include "pios_config.h" @@ -169,5 +171,5 @@ #include #define NELEMENTS(x) (sizeof(x) / sizeof(*(x))) - +#endif /* USE_SIMPOSIX */ #endif /* PIOS_H */ diff --git a/flight/PiOS.posix/pios.h b/flight/PiOS/pios_sim_posix.h similarity index 92% rename from flight/PiOS.posix/pios.h rename to flight/PiOS/pios_sim_posix.h index 28e896835..b51837f3e 100644 --- a/flight/PiOS.posix/pios.h +++ b/flight/PiOS/pios_sim_posix.h @@ -25,11 +25,11 @@ */ -#ifndef PIOS_H -#define PIOS_H +#ifndef PIOS_SIM_POSIX_H +#define PIOS_SIM_POSIX_H /* PIOS Feature Selection */ -#include "pios_config.h" +#include "pios_config.h" #include #if defined(PIOS_INCLUDE_FREERTOS) @@ -49,10 +49,10 @@ #include /* Generic initcall infrastructure */ -#include "pios_initcall.h" +#include /* PIOS Board Specific Device Configuration */ -#include "pios_board.h" +#include "pios_board.h" /* PIOS Hardware Includes (posix) */ #include @@ -77,4 +77,4 @@ #define NELEMENTS(x) (sizeof(x) / sizeof(*(x))) -#endif /* PIOS_H */ +#endif /* PIOS_POSIX_H */ diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/croutine.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/croutine.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/croutine.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/croutine.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/StackMacros.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/StackMacros.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/StackMacros.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/StackMacros.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/croutine.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/croutine.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/croutine.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/croutine.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/list.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/list.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/list.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/list.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/portable.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/portable.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/portable.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/portable.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/projdefs.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/projdefs.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/projdefs.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/projdefs.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/queue.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/queue.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/queue.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/queue.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/semphr.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/semphr.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/semphr.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/semphr.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/task.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/include/task.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/include/task.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/include/task.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/list.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/list.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/list.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/list.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c.documentation.txt b/flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c.documentation.txt similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c.documentation.txt rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c.documentation.txt diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h b/flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/readme.txt b/flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/readme.txt similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/readme.txt rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/portable/readme.txt diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/queue.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/queue.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/queue.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/queue.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/readme.txt b/flight/PiOS/posix/Libraries/FreeRTOS/Source/readme.txt similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/readme.txt rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/readme.txt diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/tasks.c b/flight/PiOS/posix/Libraries/FreeRTOS/Source/tasks.c similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/tasks.c rename to flight/PiOS/posix/Libraries/FreeRTOS/Source/tasks.c diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/library.mk b/flight/PiOS/posix/Libraries/FreeRTOS/library.mk similarity index 100% rename from flight/PiOS.posix/posix/Libraries/FreeRTOS/library.mk rename to flight/PiOS/posix/Libraries/FreeRTOS/library.mk diff --git a/flight/PiOS.posix/posix/library.mk b/flight/PiOS/posix/library.mk similarity index 100% rename from flight/PiOS.posix/posix/library.mk rename to flight/PiOS/posix/library.mk diff --git a/flight/PiOS.posix/posix/pios_bl_helper.c b/flight/PiOS/posix/pios_bl_helper.c similarity index 100% rename from flight/PiOS.posix/posix/pios_bl_helper.c rename to flight/PiOS/posix/pios_bl_helper.c diff --git a/flight/PiOS.posix/posix/pios_board_info.c b/flight/PiOS/posix/pios_board_info.c similarity index 100% rename from flight/PiOS.posix/posix/pios_board_info.c rename to flight/PiOS/posix/pios_board_info.c diff --git a/flight/PiOS.posix/posix/pios_com.c b/flight/PiOS/posix/pios_com.c similarity index 100% rename from flight/PiOS.posix/posix/pios_com.c rename to flight/PiOS/posix/pios_com.c diff --git a/flight/PiOS.posix/posix/pios_crc.c b/flight/PiOS/posix/pios_crc.c similarity index 100% rename from flight/PiOS.posix/posix/pios_crc.c rename to flight/PiOS/posix/pios_crc.c diff --git a/flight/PiOS.posix/posix/pios_debug.c b/flight/PiOS/posix/pios_debug.c similarity index 100% rename from flight/PiOS.posix/posix/pios_debug.c rename to flight/PiOS/posix/pios_debug.c diff --git a/flight/PiOS.posix/posix/pios_delay.c b/flight/PiOS/posix/pios_delay.c similarity index 100% rename from flight/PiOS.posix/posix/pios_delay.c rename to flight/PiOS/posix/pios_delay.c diff --git a/flight/PiOS.posix/posix/pios_iap.c b/flight/PiOS/posix/pios_iap.c similarity index 100% rename from flight/PiOS.posix/posix/pios_iap.c rename to flight/PiOS/posix/pios_iap.c diff --git a/flight/PiOS.posix/posix/pios_irq.c b/flight/PiOS/posix/pios_irq.c similarity index 100% rename from flight/PiOS.posix/posix/pios_irq.c rename to flight/PiOS/posix/pios_irq.c diff --git a/flight/PiOS.posix/posix/pios_led.c b/flight/PiOS/posix/pios_led.c similarity index 100% rename from flight/PiOS.posix/posix/pios_led.c rename to flight/PiOS/posix/pios_led.c diff --git a/flight/PiOS.posix/posix/pios_rcvr.c b/flight/PiOS/posix/pios_rcvr.c similarity index 100% rename from flight/PiOS.posix/posix/pios_rcvr.c rename to flight/PiOS/posix/pios_rcvr.c diff --git a/flight/PiOS.posix/posix/pios_sdcard.c b/flight/PiOS/posix/pios_sdcard.c similarity index 95% rename from flight/PiOS.posix/posix/pios_sdcard.c rename to flight/PiOS/posix/pios_sdcard.c index 1e43c8086..d9e0b3760 100644 --- a/flight/PiOS.posix/posix/pios_sdcard.c +++ b/flight/PiOS/posix/pios_sdcard.c @@ -38,7 +38,7 @@ * \param[in] mode currently only mode 0 supported * \return < 0 if initialisation failed */ -int32_t PIOS_SDCARD_Init(void) +int32_t PIOS_SDCARD_Init(uint32_t spi_id) { /* No error */ return 0; diff --git a/flight/PiOS.posix/posix/pios_servo.c b/flight/PiOS/posix/pios_servo.c similarity index 100% rename from flight/PiOS.posix/posix/pios_servo.c rename to flight/PiOS/posix/pios_servo.c diff --git a/flight/PiOS.posix/posix/pios_sys.c b/flight/PiOS/posix/pios_sys.c similarity index 100% rename from flight/PiOS.posix/posix/pios_sys.c rename to flight/PiOS/posix/pios_sys.c diff --git a/flight/PiOS.posix/posix/pios_udp.c b/flight/PiOS/posix/pios_udp.c similarity index 100% rename from flight/PiOS.posix/posix/pios_udp.c rename to flight/PiOS/posix/pios_udp.c diff --git a/flight/PiOS.posix/posix/pios_wdg.c b/flight/PiOS/posix/pios_wdg.c similarity index 96% rename from flight/PiOS.posix/posix/pios_wdg.c rename to flight/PiOS/posix/pios_wdg.c index 3a9fcc3fb..e60bb549d 100644 --- a/flight/PiOS.posix/posix/pios_wdg.c +++ b/flight/PiOS/posix/pios_wdg.c @@ -51,8 +51,9 @@ * @param[in] delayMs The delay period in ms * @returns Maximum recommended delay between updates */ -void PIOS_WDG_Init() +uint16_t PIOS_WDG_Init() { + return 0; } /** diff --git a/flight/targets/SimPosix/System/inc/FreeRTOSConfig.h b/flight/targets/SimPosix/System/inc/FreeRTOSConfig.h index 72d6e288a..f6602c721 100644 --- a/flight/targets/SimPosix/System/inc/FreeRTOSConfig.h +++ b/flight/targets/SimPosix/System/inc/FreeRTOSConfig.h @@ -1,103 +1,107 @@ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -/** - * @addtogroup PIOS PIOS - * @{ - * @addtogroup FreeRTOS FreeRTOS - * @{ - */ - -/* Notes: We use 5 task priorities */ - -#define configCPU_CLOCK_HZ (SYSCLK_FREQ) // really the NVIC clock ... -#define configTICK_RATE_HZ ((portTickType )1000) -#define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5) -#define configMINIMAL_STACK_SIZE ((unsigned short)512) -#define configTOTAL_HEAP_SIZE ((size_t)(180 * 1024)) // this is minimum, not total -#define configMAX_TASK_NAME_LEN (16) - -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 0 -#define configUSE_TRACE_FACILITY 0 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 0 -#define configUSE_MUTEXES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_COUNTING_SEMAPHORES 0 -#define configUSE_ALTERNATIVE_API 0 -#define configCHECK_FOR_STACK_OVERFLOW 2 -#define configQUEUE_REGISTRY_SIZE 10 - -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* run timers at max priority */ -#define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -//#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) - -/* Set the following definitions to 1 to include the API function, or zero -to exclude the API function. */ - -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 - -/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255 -(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */ -#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */ - -/* This is the value being used as per the ST library which permits 16 -priority values, 0 to 15. This must correspond to the -configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest -NVIC value of 255. */ -#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 - -/* Enable run time stats collection */ -#define configGENERATE_RUN_TIME_STATS 1 -#define INCLUDE_uxTaskGetRunTime 1 - -/* - * Once we move to CMSIS2 we can at least use: - * - * CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - * - * (still nothing for the DWT registers, surprisingly) - */ -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \ - do { \ - (*(unsigned long *)0xe000edfc) |= (1<<24); /* DEMCR |= DEMCR_TRCENA */ \ - (*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */ \ - } while(0) -#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004) /* DWT_CYCCNT */ - - -/** - * @} - */ - -#endif /* FREERTOS_CONFIG_H */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +/* Notes: We use 5 task priorities */ + + +#ifdef __APPLE__ + #define COND_SIGNALING + #define CHECK_TASK_RESUMES + #define RUNNING_THREAD_MUTEX +// #define TICK_SIGNAL +// #define TICK_SIGWAIT + #define IDLE_SLEEPS + + #define configUSE_PREEMPTION 1 + #define configIDLE_SHOULD_YIELD 0 +#endif +#ifdef __CYGWIN__ + #define COND_SIGNALING + #define CHECK_TASK_RESUMES +// #define RUNNING_THREAD_MUTEX +// #define TICK_SIGNAL + #define TICK_SIGWAIT + #define IDLE_SLEEPS + + #define configUSE_PREEMPTION 0 + #define configIDLE_SHOULD_YIELD 1 +#endif +#ifdef __linux__ + #define COND_SIGNALING + #define CHECK_TASK_RESUMES + #define RUNNING_THREAD_MUTEX +// #define TICK_SIGNAL +// #define TICK_SIGWAIT + #define IDLE_SLEEPS + + #define configUSE_PREEMPTION 1 + #define configIDLE_SHOULD_YIELD 0 +#endif + + +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ( ( unsigned long ) 72000000 ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) ) +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 0 +#define configUSE_ALTERNATIVE_API 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configQUEUE_REGISTRY_SIZE 10 + + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ + +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 0 + + + + +/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255 +(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */ +#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */ + + +/* This is the value being used as per the ST library which permits 16 +priority values, 0 to 15. This must correspond to the +configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest +NVIC value of 255. */ +#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 + +#endif /* FREERTOS_CONFIG_H */ + diff --git a/flight/targets/SimPosix/System/inc/FreeRTOSConfig_bk.h b/flight/targets/SimPosix/System/inc/FreeRTOSConfig_bk.h new file mode 100644 index 000000000..72d6e288a --- /dev/null +++ b/flight/targets/SimPosix/System/inc/FreeRTOSConfig_bk.h @@ -0,0 +1,103 @@ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +/** + * @addtogroup PIOS PIOS + * @{ + * @addtogroup FreeRTOS FreeRTOS + * @{ + */ + +/* Notes: We use 5 task priorities */ + +#define configCPU_CLOCK_HZ (SYSCLK_FREQ) // really the NVIC clock ... +#define configTICK_RATE_HZ ((portTickType )1000) +#define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5) +#define configMINIMAL_STACK_SIZE ((unsigned short)512) +#define configTOTAL_HEAP_SIZE ((size_t)(180 * 1024)) // this is minimum, not total +#define configMAX_TASK_NAME_LEN (16) + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 0 +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 0 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 0 +#define configUSE_ALTERNATIVE_API 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configQUEUE_REGISTRY_SIZE 10 + +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* run timers at max priority */ +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +//#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ + +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 + +/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255 +(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */ +#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */ + +/* This is the value being used as per the ST library which permits 16 +priority values, 0 to 15. This must correspond to the +configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest +NVIC value of 255. */ +#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 + +/* Enable run time stats collection */ +#define configGENERATE_RUN_TIME_STATS 1 +#define INCLUDE_uxTaskGetRunTime 1 + +/* + * Once we move to CMSIS2 we can at least use: + * + * CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + * + * (still nothing for the DWT registers, surprisingly) + */ +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \ + do { \ + (*(unsigned long *)0xe000edfc) |= (1<<24); /* DEMCR |= DEMCR_TRCENA */ \ + (*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */ \ + } while(0) +#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004) /* DWT_CYCCNT */ + + +/** + * @} + */ + +#endif /* FREERTOS_CONFIG_H */