mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-26 15:54:15 +01:00
LP-97 - Move the common Init process within the System module (coptercontrol/revolution)
This commit is contained in:
parent
3eaf1ef3c3
commit
b88681c69f
@ -1,12 +1,13 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotModules OpenPilot Modules
|
||||
* @addtogroup LibrePilotModules LibrePilot Modules
|
||||
* @{
|
||||
* @addtogroup SystemModule System Module
|
||||
* @{
|
||||
*
|
||||
* @file systemmod.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief System module
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -30,6 +31,6 @@
|
||||
#ifndef SYSTEMMOD_H
|
||||
#define SYSTEMMOD_H
|
||||
|
||||
int32_t SystemModInitialize(void);
|
||||
int32_t SystemModStart(void);
|
||||
|
||||
#endif // SYSTEMMOD_H
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotModules OpenPilot Modules
|
||||
* @brief The OpenPilot Modules do the majority of the control in OpenPilot. The
|
||||
* @addtogroup LibrePilotModules LibrePilot Modules
|
||||
* @brief The LibrePilot Modules do the majority of the control in LibrePilot. The
|
||||
* @ref SystemModule "System Module" starts all the other modules that then take care
|
||||
* of all the telemetry and control algorithms and such. This is done through the @ref PIOS
|
||||
* "PIOS Hardware abstraction layer" which then contains hardware specific implementations
|
||||
@ -16,7 +16,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file systemmod.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015.
|
||||
* @brief System module
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -119,6 +120,7 @@ static void systemTask(void *parameters);
|
||||
static void updateI2Cstats();
|
||||
static void updateWDGstats();
|
||||
#endif
|
||||
extern void PIOS_Board_Init(void);
|
||||
|
||||
extern uintptr_t pios_uavo_settings_fs_id;
|
||||
extern uintptr_t pios_user_fs_id;
|
||||
@ -134,8 +136,6 @@ int32_t SystemModStart(void)
|
||||
mallocFailed = false;
|
||||
// Create system task
|
||||
xTaskCreate(systemTask, "System", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY, &systemTaskHandle);
|
||||
// Register task
|
||||
PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_SYSTEM, systemTaskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -169,8 +169,6 @@ int32_t SystemModInitialize(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
SystemModStart();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -180,6 +178,12 @@ MODULE_INITCALL(SystemModInitialize, 0);
|
||||
*/
|
||||
static void systemTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
/* board driver init */
|
||||
PIOS_Board_Init();
|
||||
|
||||
/* Initialize all modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
while (!initTaskDone) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
@ -190,6 +194,9 @@ static void systemTask(__attribute__((unused)) void *parameters)
|
||||
/* start the delayed callback scheduler */
|
||||
PIOS_CALLBACKSCHEDULER_Start();
|
||||
|
||||
// Register task
|
||||
PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_SYSTEM, systemTaskHandle);
|
||||
|
||||
if (mallocFailed) {
|
||||
/* We failed to malloc during task creation,
|
||||
* system behaviour is undefined. Reset and let
|
||||
@ -529,6 +536,7 @@ static uint16_t GetFreeIrqStackSize(void)
|
||||
static void updateStats()
|
||||
{
|
||||
SystemStatsData stats;
|
||||
|
||||
// Get stats and update
|
||||
SystemStatsGet(&stats);
|
||||
stats.FlightTime = xTaskGetTickCount() * portTICK_RATE_MS;
|
||||
|
@ -7,7 +7,8 @@
|
||||
* @{
|
||||
*
|
||||
* @file pios_initcall.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Initcall header
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
@ -55,6 +56,7 @@ extern volatile int initTaskDone;
|
||||
|
||||
extern void InitModules();
|
||||
extern void StartModules();
|
||||
extern int32_t SystemModInitialize(void);
|
||||
|
||||
#define MODULE_INITCALL(ifn, sfn)
|
||||
|
||||
|
@ -56,9 +56,6 @@ void PIOS_Board_Init(void)
|
||||
/* Flash 2 wait state */
|
||||
FLASH_SetLatency(FLASH_Latency_2);
|
||||
|
||||
/* Delay system */
|
||||
PIOS_DELAY_Init();
|
||||
|
||||
const struct pios_board_info *bdinfo = &pios_board_info_blob;
|
||||
|
||||
#if defined(PIOS_INCLUDE_LED)
|
||||
|
@ -1,17 +1,18 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @brief These files are the core system files of OpenPilot.
|
||||
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
|
||||
* in the main() function of openpilot.c
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @brief These files are the core system files for CopterControl.
|
||||
* They are the ground layer just above PiOS. In practice, CopterControl actually starts
|
||||
* in the main() function of coptercontrol.c
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @brief This is where the OP firmware starts. Those files also define the compile-time
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @brief This is where the LP firmware starts. Those files also define the compile-time
|
||||
* options of the firmware.
|
||||
* @{
|
||||
* @file openpilot.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Sets up and runs main OpenPilot tasks.
|
||||
* @file coptercontrol.c
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Sets up and runs main tasks.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -32,18 +33,11 @@
|
||||
*/
|
||||
|
||||
#include "inc/openpilot.h"
|
||||
#include <uavobjectsinit.h>
|
||||
#include <hwsettings.h>
|
||||
|
||||
#include <systemmod.h>
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void Stack_Change(void);
|
||||
|
||||
/**
|
||||
* OpenPilot Main function:
|
||||
*
|
||||
@ -61,24 +55,9 @@ int main()
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
|
||||
/* Architecture dependant Hardware and
|
||||
* core subsystem initialisation
|
||||
* (see pios_board.c for your arch)
|
||||
* */
|
||||
PIOS_Board_Init();
|
||||
|
||||
#ifdef ERASE_FLASH
|
||||
PIOS_Flash_Jedec_EraseChip();
|
||||
#if defined(PIOS_LED_HEARTBEAT)
|
||||
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
|
||||
#endif /* PIOS_LED_HEARTBEAT */
|
||||
while (1) {
|
||||
;
|
||||
}
|
||||
#endif
|
||||
SystemModStart();
|
||||
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL
|
||||
/* swap the stack to use the IRQ stack */
|
||||
Stack_Change();
|
||||
|
||||
|
@ -4,10 +4,9 @@
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
||||
*
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @{
|
||||
* @brief Defines board specific static initializers for hardware for the CopterControl board.
|
||||
*****************************************************************************/
|
||||
@ -156,8 +155,6 @@ static const struct pios_mpu6000_cfg pios_mpu6000_cfg = {
|
||||
int32_t init_test;
|
||||
void PIOS_Board_Init(void)
|
||||
{
|
||||
/* Delay system */
|
||||
PIOS_DELAY_Init();
|
||||
|
||||
const struct pios_board_info *bdinfo = &pios_board_info_blob;
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @brief These files are the core system files of OpenPilot.
|
||||
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
|
||||
* in the main() function of openpilot.c
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @brief These files are the core system files for Revolution.
|
||||
* They are the ground layer just above PiOS. In practice, Revolution actually starts
|
||||
* in the main() function of revolution.c
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @brief This is where the OP firmware starts. Those files also define the compile-time
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @brief This is where the LP firmware starts. Those files also define the compile-time
|
||||
* options of the firmware.
|
||||
* @{
|
||||
* @file openpilot.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Sets up and runs main OpenPilot tasks.
|
||||
* @file revolution.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Sets up and runs main tasks.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -34,46 +35,12 @@
|
||||
extern "C" {
|
||||
#include "inc/openpilot.h"
|
||||
#include <uavobjectsinit.h>
|
||||
#include <systemmod.h>
|
||||
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
/* Local Variables */
|
||||
#define INCLUDE_TEST_TASKS 0
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static uint8_t sdcard_available;
|
||||
#endif
|
||||
char Buffer[1024];
|
||||
uint32_t Cache;
|
||||
|
||||
/* Function Prototypes */
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static void TaskTick(void *pvParameters);
|
||||
static void TaskTesting(void *pvParameters);
|
||||
static void TaskHIDTest(void *pvParameters);
|
||||
static void TaskServos(void *pvParameters);
|
||||
static void TaskSDCard(void *pvParameters);
|
||||
#endif
|
||||
int32_t CONSOLE_Parse(uint8_t port, char c);
|
||||
void OP_ADC_NotifyChange(uint32_t pin, uint32_t pin_value);
|
||||
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void Stack_Change(void);
|
||||
static void Stack_Change_Weak() __attribute__((weakref("Stack_Change")));
|
||||
|
||||
/* Local Variables */
|
||||
#define INIT_TASK_PRIORITY (tskIDLE_PRIORITY + configMAX_PRIORITIES - 1) // max priority
|
||||
#define INIT_TASK_STACK (1024 / 4) // XXX this seems excessive
|
||||
static xTaskHandle initTaskHandle;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void initTask(void *parameters);
|
||||
|
||||
/* Prototype of generated InitModules() function */
|
||||
extern void InitModules(void);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +54,6 @@ extern void InitModules(void);
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
int result;
|
||||
|
||||
/* NOTE: Do NOT modify the following start-up sequence */
|
||||
/* Any new initialization functions should be added in OpenPilotInit() */
|
||||
vPortInitialiseBlocks();
|
||||
@ -96,12 +61,7 @@ int main()
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
|
||||
/* For Revolution we use a FreeRTOS task to bring up the system so we can */
|
||||
/* always rely on FreeRTOS primitive */
|
||||
result = xTaskCreate(initTask, "init",
|
||||
INIT_TASK_STACK, NULL, INIT_TASK_PRIORITY,
|
||||
&initTaskHandle);
|
||||
PIOS_Assert(result == pdPASS);
|
||||
SystemModStart();
|
||||
|
||||
/* Start the FreeRTOS scheduler */
|
||||
vTaskStartScheduler();
|
||||
@ -117,22 +77,7 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Initialisation task.
|
||||
*
|
||||
* Runs board and module initialisation, then terminates.
|
||||
*/
|
||||
void initTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
/* board driver init */
|
||||
PIOS_Board_Init();
|
||||
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
/* terminate this task */
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -1,17 +1,18 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @brief These files are the core system files of OpenPilot.
|
||||
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
|
||||
* in the main() function of openpilot.c
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @brief These files are the core system files for Revolution.
|
||||
* They are the ground layer just above PiOS. In practice, Revolution actually starts
|
||||
* in the main() function of revolution.c
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @brief This is where the OP firmware starts. Those files also define the compile-time
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @brief This is where the LP firmware starts. Those files also define the compile-time
|
||||
* options of the firmware.
|
||||
* @{
|
||||
* @file openpilot.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Sets up and runs main OpenPilot tasks.
|
||||
* @file revolution.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Sets up and runs main tasks.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -34,29 +35,12 @@
|
||||
extern "C" {
|
||||
#include "inc/openpilot.h"
|
||||
#include <uavobjectsinit.h>
|
||||
#include <systemmod.h>
|
||||
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
/* Local Variables */
|
||||
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void Stack_Change(void);
|
||||
static void Stack_Change_Weak() __attribute__((weakref("Stack_Change")));
|
||||
|
||||
/* Local Variables */
|
||||
#define INIT_TASK_PRIORITY (tskIDLE_PRIORITY + configMAX_PRIORITIES - 1) // max priority
|
||||
#define INIT_TASK_STACK (1024 / 4) // XXX this seems excessive
|
||||
static xTaskHandle initTaskHandle;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void initTask(void *parameters);
|
||||
|
||||
/* Prototype of generated InitModules() function */
|
||||
extern void InitModules(void);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,8 +54,6 @@ extern void InitModules(void);
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
int result;
|
||||
|
||||
/* NOTE: Do NOT modify the following start-up sequence */
|
||||
/* Any new initialization functions should be added in OpenPilotInit() */
|
||||
vPortInitialiseBlocks();
|
||||
@ -79,12 +61,7 @@ int main()
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
|
||||
/* For Revolution we use a FreeRTOS task to bring up the system so we can */
|
||||
/* always rely on FreeRTOS primitive */
|
||||
result = xTaskCreate(initTask, "init",
|
||||
INIT_TASK_STACK, NULL, INIT_TASK_PRIORITY,
|
||||
&initTaskHandle);
|
||||
PIOS_Assert(result == pdPASS);
|
||||
SystemModStart();
|
||||
|
||||
/* Start the FreeRTOS scheduler */
|
||||
vTaskStartScheduler();
|
||||
@ -100,22 +77,7 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Initialisation task.
|
||||
*
|
||||
* Runs board and module initialisation, then terminates.
|
||||
*/
|
||||
void initTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
/* board driver init */
|
||||
PIOS_Board_Init();
|
||||
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
/* terminate this task */
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -1,17 +1,18 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @brief These files are the core system files of OpenPilot.
|
||||
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
|
||||
* in the main() function of openpilot.c
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @brief These files are the core system files for Revolution.
|
||||
* They are the ground layer just above PiOS. In practice, Revolution actually starts
|
||||
* in the main() function of revolution.c
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @brief This is where the OP firmware starts. Those files also define the compile-time
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @brief This is where the LP firmware starts. Those files also define the compile-time
|
||||
* options of the firmware.
|
||||
* @{
|
||||
* @file openpilot.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Sets up and runs main OpenPilot tasks.
|
||||
* @file revolution.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Sets up and runs main tasks.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -34,46 +35,12 @@
|
||||
extern "C" {
|
||||
#include "inc/openpilot.h"
|
||||
#include <uavobjectsinit.h>
|
||||
#include <systemmod.h>
|
||||
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
/* Local Variables */
|
||||
#define INCLUDE_TEST_TASKS 0
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static uint8_t sdcard_available;
|
||||
#endif
|
||||
char Buffer[1024];
|
||||
uint32_t Cache;
|
||||
|
||||
/* Function Prototypes */
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static void TaskTick(void *pvParameters);
|
||||
static void TaskTesting(void *pvParameters);
|
||||
static void TaskHIDTest(void *pvParameters);
|
||||
static void TaskServos(void *pvParameters);
|
||||
static void TaskSDCard(void *pvParameters);
|
||||
#endif
|
||||
int32_t CONSOLE_Parse(uint8_t port, char c);
|
||||
void OP_ADC_NotifyChange(uint32_t pin, uint32_t pin_value);
|
||||
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void Stack_Change(void);
|
||||
static void Stack_Change_Weak() __attribute__((weakref("Stack_Change")));
|
||||
|
||||
/* Local Variables */
|
||||
#define INIT_TASK_PRIORITY (tskIDLE_PRIORITY + configMAX_PRIORITIES - 1) // max priority
|
||||
#define INIT_TASK_STACK (1024 / 4) // XXX this seems excessive
|
||||
static xTaskHandle initTaskHandle;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void initTask(void *parameters);
|
||||
|
||||
/* Prototype of generated InitModules() function */
|
||||
extern void InitModules(void);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +54,6 @@ extern void InitModules(void);
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
int result;
|
||||
|
||||
/* NOTE: Do NOT modify the following start-up sequence */
|
||||
/* Any new initialization functions should be added in OpenPilotInit() */
|
||||
vPortInitialiseBlocks();
|
||||
@ -96,12 +61,7 @@ int main()
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
|
||||
/* For Revolution we use a FreeRTOS task to bring up the system so we can */
|
||||
/* always rely on FreeRTOS primitive */
|
||||
result = xTaskCreate(initTask, "init",
|
||||
INIT_TASK_STACK, NULL, INIT_TASK_PRIORITY,
|
||||
&initTaskHandle);
|
||||
PIOS_Assert(result == pdPASS);
|
||||
SystemModStart();
|
||||
|
||||
/* Start the FreeRTOS scheduler */
|
||||
vTaskStartScheduler();
|
||||
@ -117,22 +77,7 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Initialisation task.
|
||||
*
|
||||
* Runs board and module initialisation, then terminates.
|
||||
*/
|
||||
void initTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
/* board driver init */
|
||||
PIOS_Board_Init();
|
||||
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
/* terminate this task */
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#
|
||||
# TODO: This file should be reworked. It will be done as a part of sim target refactoring.
|
||||
#
|
||||
# Copyright (c) 2015 The LibrePilot Project, http://www.librepilot.org
|
||||
# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
|
||||
#
|
||||
#
|
||||
|
@ -1,17 +1,18 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @brief These files are the core system files of OpenPilot.
|
||||
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
|
||||
* in the main() function of openpilot.c
|
||||
* @addtogroup LibrePilotSystem LibrePilot System
|
||||
* @brief These files are the core system files for Simposix.
|
||||
* They are the ground layer just above PiOS. In practice, Simposix actually starts
|
||||
* in the main() function of simposix.c
|
||||
* @{
|
||||
* @addtogroup OpenPilotCore OpenPilot Core
|
||||
* @brief This is where the OP firmware starts. Those files also define the compile-time
|
||||
* @addtogroup LibrePilotCore LibrePilot Core
|
||||
* @brief This is where the LP firmware starts. Those files also define the compile-time
|
||||
* options of the firmware.
|
||||
* @{
|
||||
* @file openpilot.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Sets up and runs main OpenPilot tasks.
|
||||
* @file simposix.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
|
||||
* @brief Sets up and runs main tasks.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -35,46 +36,7 @@ extern "C" {
|
||||
#include "inc/openpilot.h"
|
||||
#include <systemmod.h>
|
||||
#include <uavobjectsinit.h>
|
||||
|
||||
/* Task Priorities */
|
||||
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
|
||||
|
||||
/* Global Variables */
|
||||
|
||||
/* Local Variables */
|
||||
#define INCLUDE_TEST_TASKS 0
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static uint8_t sdcard_available;
|
||||
#endif
|
||||
char Buffer[1024];
|
||||
uint32_t Cache;
|
||||
|
||||
/* Function Prototypes */
|
||||
#if INCLUDE_TEST_TASKS
|
||||
static void TaskTick(void *pvParameters);
|
||||
static void TaskTesting(void *pvParameters);
|
||||
static void TaskHIDTest(void *pvParameters);
|
||||
static void TaskServos(void *pvParameters);
|
||||
static void TaskSDCard(void *pvParameters);
|
||||
#endif
|
||||
int32_t CONSOLE_Parse(uint8_t port, char c);
|
||||
void OP_ADC_NotifyChange(uint32_t pin, uint32_t pin_value);
|
||||
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void Stack_Change(void);
|
||||
static void Stack_Change_Weak() __attribute__((weakref("Stack_Change")));
|
||||
|
||||
/* Local Variables */
|
||||
#define INIT_TASK_PRIORITY (tskIDLE_PRIORITY + configMAX_PRIORITIES - 1) // max priority
|
||||
#define INIT_TASK_STACK (1024 / 4) // XXX this seems excessive
|
||||
static xTaskHandle initTaskHandle;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void initTask(void *parameters);
|
||||
|
||||
/* Prototype of generated InitModules() function */
|
||||
extern void InitModules(void);
|
||||
#include <systemmod.h>
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,20 +50,10 @@ extern void InitModules(void);
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
int result;
|
||||
|
||||
/* NOTE: Do NOT modify the following start-up sequence */
|
||||
/* Any new initialization functions should be added in OpenPilotInit() */
|
||||
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
|
||||
/* For Revolution we use a FreeRTOS task to bring up the system so we can */
|
||||
/* always rely on FreeRTOS primitive */
|
||||
result = xTaskCreate(initTask, "init",
|
||||
INIT_TASK_STACK, NULL, INIT_TASK_PRIORITY,
|
||||
&initTaskHandle);
|
||||
PIOS_Assert(result == pdPASS);
|
||||
SystemModStart();
|
||||
|
||||
/* Start the FreeRTOS scheduler */
|
||||
vTaskStartScheduler();
|
||||
@ -117,22 +69,6 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Initialisation task.
|
||||
*
|
||||
* Runs board and module initialisation, then terminates.
|
||||
*/
|
||||
void initTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
/* board driver init */
|
||||
PIOS_Board_Init();
|
||||
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
/* terminate this task */
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
Loading…
x
Reference in New Issue
Block a user