mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Flight/TaskMonitor: Create TaskMonitor library, used to monitor the remaining task size of all running tasks.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2349 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1bdc03bb1c
commit
407e660c97
@ -6,7 +6,7 @@
|
||||
#
|
||||
# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
|
||||
#
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
@ -119,6 +119,16 @@ RTOSINCDIR = $(RTOSSRCDIR)/include
|
||||
DOXYGENDIR = ../Doc/Doxygen
|
||||
AHRSBOOTLOADER = ../Bootloaders/AHRS/
|
||||
AHRSBOOTLOADERINC = $(AHRSBOOTLOADER)/inc
|
||||
#PYMITE = $(FLIGHTLIB)/PyMite
|
||||
#PYMITELIB = $(PYMITE)/lib
|
||||
#PYMITEPLAT = $(PYMITE)/platform/openpilot
|
||||
#PYMITETOOLS = $(PYMITE)/tools
|
||||
#PYMITEVM = $(PYMITE)/vm
|
||||
#PYMITEINC = $(PYMITEVM)
|
||||
#PYMITEINC += $(PYMITEPLAT)
|
||||
#PYMITEINC += $(OUTDIR)
|
||||
#FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib
|
||||
#FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
# use file-extension c for "c-only"-files
|
||||
@ -134,6 +144,7 @@ SRC += ${OPMODULEDIR}/System/systemmod.c
|
||||
SRC += $(OPSYSTEM)/openpilot.c
|
||||
SRC += $(OPSYSTEM)/pios_board.c
|
||||
SRC += $(OPSYSTEM)/alarms.c
|
||||
SRC += $(OPSYSTEM)/taskmonitor.c
|
||||
SRC += $(OPUAVTALK)/uavtalk.c
|
||||
SRC += $(OPUAVOBJ)/uavobjectmanager.c
|
||||
SRC += $(OPUAVOBJ)/uavobjectsinit.c
|
||||
@ -186,6 +197,7 @@ SRC += $(OPUAVOBJ)/ratedesired.c
|
||||
SRC += $(OPUAVOBJ)/pipxtrememodemsettings.c
|
||||
SRC += $(OPUAVOBJ)/pipxtrememodemstatus.c
|
||||
SRC += $(OPUAVOBJ)/batterysettings.c
|
||||
SRC += $(OPUAVOBJ)/taskinfo.c
|
||||
endif
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
@ -279,6 +291,11 @@ SRC += $(DOSFSDIR)/dfs_sdcard.c
|
||||
SRC += $(AHRSBOOTLOADER)/ahrs_spi_program_master.c
|
||||
SRC += $(AHRSBOOTLOADER)/ahrs_spi_program.c
|
||||
|
||||
## PyMite files
|
||||
#SRC += $(wildcard ${PYMITEVM}/*.c)
|
||||
#SRC += $(wildcard ${PYMITEPLAT}/*.c)
|
||||
#SRC += $(wildcard ${OUTDIR}/pmlib*.c)
|
||||
|
||||
## Mass Storage Device
|
||||
#SRC += $(MSDDIR)/msd.c
|
||||
#SRC += $(MSDDIR)/msd_bot.c
|
||||
@ -336,6 +353,7 @@ EXTRAINCDIRS += $(RTOSINCDIR)
|
||||
EXTRAINCDIRS += $(APPLIBDIR)
|
||||
EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
|
||||
EXTRAINCDIRS += $(AHRSBOOTLOADERINC)
|
||||
#EXTRAINCDIRS += $(PYMITEINC)
|
||||
|
||||
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, Modules/${MOD}/inc} ${OPMODULEDIR}/System/inc
|
||||
|
||||
@ -511,6 +529,7 @@ OBJDUMP = $(TCHAIN_PREFIX)objdump
|
||||
SIZE = $(TCHAIN_PREFIX)size
|
||||
NM = $(TCHAIN_PREFIX)nm
|
||||
REMOVE = $(REMOVE_CMD) -f
|
||||
PYTHON = python
|
||||
###SHELL = sh
|
||||
###COPY = cp
|
||||
|
||||
@ -538,6 +557,7 @@ MSG_CLEANING = ${quote}Cleaning project:${quote}
|
||||
MSG_FORMATERROR = ${quote}Can not handle output-format${quote}
|
||||
MSG_ASMFROMC = ${quote}Creating asm-File from C-Source:${quote}
|
||||
MSG_ASMFROMC_ARM = ${quote}Creating asm-File from C-Source (ARM-only):${quote}
|
||||
#MSG_PYMITEINIT = ${quote}**** Generating PyMite intermediate code${quote}
|
||||
|
||||
# List of all source files.
|
||||
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
|
||||
@ -560,7 +580,7 @@ bin: $(OUTDIR)/$(TARGET).bin
|
||||
|
||||
# Default target.
|
||||
#all: begin gccversion sizebefore build sizeafter finished end
|
||||
all: begin gccversion build sizeafter finished end
|
||||
all: begin gencode gccversion build sizeafter finished end
|
||||
|
||||
ifeq ($(LOADFORMAT),ihex)
|
||||
build: elf hex lss sym
|
||||
@ -584,6 +604,10 @@ else
|
||||
quote =
|
||||
endif
|
||||
|
||||
# Generate intermediate code
|
||||
gencode: ${OUTDIR}/InitMods.c #$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h
|
||||
|
||||
# Generate code for module initialization
|
||||
${OUTDIR}/InitMods.c: Makefile
|
||||
@echo ${MSG_MODINIT}
|
||||
@echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c
|
||||
@ -592,6 +616,13 @@ ${OUTDIR}/InitMods.c: Makefile
|
||||
@echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c
|
||||
@echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c
|
||||
|
||||
# Generate code for PyMite
|
||||
#$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py)
|
||||
# @echo ${MSG_PYMITEINIT}
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py)
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
|
||||
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
|
||||
|
||||
# Eye candy.
|
||||
begin:
|
||||
## @echo
|
||||
@ -670,7 +701,7 @@ endif
|
||||
$(CC) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
|
||||
# $(CPP) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
define ASSEMBLE_TEMPLATE
|
||||
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
|
||||
@ -754,6 +785,8 @@ clean_list :
|
||||
$(REMOVE) $(OUTDIR)/$(TARGET).bin
|
||||
$(REMOVE) $(OUTDIR)/$(TARGET).sym
|
||||
$(REMOVE) $(OUTDIR)/$(TARGET).lss
|
||||
$(REMOVE) $(wildcard $(OUTDIR)/*.c)
|
||||
$(REMOVE) $(wildcard $(OUTDIR)/*.h)
|
||||
$(REMOVE) $(ALLOBJ)
|
||||
$(REMOVE) $(LSTFILES)
|
||||
$(REMOVE) $(DEPFILES)
|
||||
@ -782,5 +815,5 @@ endif
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
build elf hex bin lss sym clean clean_list program
|
||||
build elf hex bin lss sym clean clean_list program gencode
|
||||
|
||||
|
@ -78,6 +78,7 @@ int32_t AHRSCommsInitialize(void)
|
||||
|
||||
// Start main task
|
||||
xTaskCreate(ahrscommsTask, (signed char *)"AHRSComms", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_AHRSCOMMS, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ int32_t ActuatorInitialize()
|
||||
|
||||
// Start main task
|
||||
xTaskCreate(actuatorTask, (signed char*)"Actuator", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_ACTUATOR, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ int32_t AltitudeInitialize()
|
||||
{
|
||||
// Start main task
|
||||
xTaskCreate(altitudeTask, (signed char *)"Altitude", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_ALTITUDE, taskHandle);
|
||||
|
||||
// init down-sampling data
|
||||
alt_ds_temp = 0;
|
||||
|
@ -81,6 +81,7 @@ int32_t GPSInitialize(void)
|
||||
|
||||
// Start gps task
|
||||
xReturn = xTaskCreate(gpsTask, (signed char *)"GPS", STACK_SIZE, NULL, TASK_PRIORITY, &gpsTaskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_GPS, gpsTaskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ int32_t GuidanceInitialize()
|
||||
{
|
||||
// Start main task
|
||||
xTaskCreate(guidanceTask, (signed char *)"Guidance", STACK_SIZE, NULL, TASK_PRIORITY, &guidanceTaskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_GUIDANCE, guidanceTaskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ int32_t ManualControlInitialize()
|
||||
{
|
||||
// Start main task
|
||||
xTaskCreate(manualControlTask, (signed char *)"ManualControl", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_MANUALCONTROL, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ int32_t StabilizationInitialize()
|
||||
SettingsUpdatedCb(StabilizationSettingsHandle());
|
||||
// Start main task
|
||||
xTaskCreate(stabilizationTask, (signed char*)"Stabilization", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_STABILIZATION, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "systemstats.h"
|
||||
#include "i2cstats.h"
|
||||
#include "taskmonitor.h"
|
||||
|
||||
|
||||
// Private constants
|
||||
@ -97,6 +98,9 @@ static void systemTask(void *parameters)
|
||||
// System initialization
|
||||
OpenPilotInit();
|
||||
|
||||
// Register task
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_SYSTEM, systemTaskHandle);
|
||||
|
||||
// Initialize vars
|
||||
idleCounter = 0;
|
||||
idleCounterClear = 0;
|
||||
@ -114,6 +118,9 @@ static void systemTask(void *parameters)
|
||||
updateSystemAlarms();
|
||||
updateI2Cstats();
|
||||
|
||||
// Update the task status object
|
||||
TaskMonitorUpdateAll();
|
||||
|
||||
// Flash the heartbeat LED
|
||||
PIOS_LED_Toggle(LED1);
|
||||
|
||||
|
@ -113,6 +113,9 @@ int32_t TelemetryInitialize(void)
|
||||
xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle);
|
||||
xTaskCreate(telemetryTxPriTask, (signed char *)"TelPriTx", STACK_SIZE, NULL, TASK_PRIORITY_TXPRI, &telemetryTxPriTaskHandle);
|
||||
xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYTX, telemetryTxTaskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYTXPRI, telemetryTxPriTaskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYRX, telemetryRxTaskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ int32_t WatchdogInitialize()
|
||||
|
||||
// Start main task
|
||||
xTaskCreate(watchdogTask, (signed char *)"Watchdog", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_WATCHDOG, taskHandle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "uavobjectmanager.h"
|
||||
#include "eventdispatcher.h"
|
||||
#include "alarms.h"
|
||||
#include "taskmonitor.h"
|
||||
#include "uavtalk.h"
|
||||
|
||||
/* Global Functions */
|
||||
|
42
flight/OpenPilot/System/inc/taskmonitor.h
Normal file
42
flight/OpenPilot/System/inc/taskmonitor.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotLibraries OpenPilot System Libraries
|
||||
* @{
|
||||
* @file taskmonitor.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Include file of the task monitoring library
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef TASKMONITOR_H
|
||||
#define TASKMONITOR_H
|
||||
|
||||
#include "taskinfo.h"
|
||||
|
||||
int32_t TaskMonitorInitialize(void);
|
||||
int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle);
|
||||
void TaskMonitorUpdateAll(void);
|
||||
|
||||
#endif // TASKMONITOR_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -63,6 +63,9 @@ void PIOS_Board_Init(void) {
|
||||
/* Initialize the alarms library */
|
||||
AlarmsInitialize();
|
||||
|
||||
/* Initialize the task monitor library */
|
||||
TaskMonitorInitialize();
|
||||
|
||||
/* Initialize the PiOS library */
|
||||
PIOS_COM_Init();
|
||||
PIOS_Servo_Init();
|
||||
|
100
flight/OpenPilot/System/taskmonitor.c
Normal file
100
flight/OpenPilot/System/taskmonitor.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotLibraries OpenPilot System Libraries
|
||||
* @{
|
||||
* @file taskmonitor.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Task monitoring library
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "openpilot.h"
|
||||
//#include "taskmonitor.h"
|
||||
|
||||
// Private constants
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static xSemaphoreHandle lock;
|
||||
static xTaskHandle handles[TASKINFO_RUNNING_NUMELEM];
|
||||
|
||||
// Private functions
|
||||
|
||||
/**
|
||||
* Initialize library
|
||||
*/
|
||||
int32_t TaskMonitorInitialize(void)
|
||||
{
|
||||
lock = xSemaphoreCreateRecursiveMutex();
|
||||
memset(handles, 0, sizeof(xTaskHandle)*TASKINFO_RUNNING_NUMELEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a task handle with the library
|
||||
*/
|
||||
int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle)
|
||||
{
|
||||
if (task < TASKINFO_RUNNING_NUMELEM)
|
||||
{
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
handles[task] = handle;
|
||||
xSemaphoreGiveRecursive(lock);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status of all tasks
|
||||
*/
|
||||
void TaskMonitorUpdateAll(void)
|
||||
{
|
||||
TaskInfoData data;
|
||||
int n;
|
||||
|
||||
// Lock
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
|
||||
// Update all task information
|
||||
for (n = 0; n < TASKINFO_RUNNING_NUMELEM; ++n)
|
||||
{
|
||||
if (handles[n] != 0)
|
||||
{
|
||||
data.Running[n] = TASKINFO_RUNNING_TRUE;
|
||||
data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Running[n] = TASKINFO_RUNNING_FALSE;
|
||||
data.StackRemaining[n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Update object
|
||||
TaskInfoSet(&data);
|
||||
|
||||
// Done
|
||||
xSemaphoreGiveRecursive(lock);
|
||||
}
|
103
flight/OpenPilot/UAVObjects/inc/taskinfo.h
Normal file
103
flight/OpenPilot/UAVObjects/inc/taskinfo.h
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup TaskInfo TaskInfo
|
||||
* @brief Task information
|
||||
*
|
||||
* Autogenerated files and functions for TaskInfo Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file taskinfo.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the TaskInfo object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: taskinfo.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef TASKINFO_H
|
||||
#define TASKINFO_H
|
||||
|
||||
// Object constants
|
||||
#define TASKINFO_OBJID 3297598544U
|
||||
#define TASKINFO_NAME "TaskInfo"
|
||||
#define TASKINFO_METANAME "TaskInfoMeta"
|
||||
#define TASKINFO_ISSINGLEINST 1
|
||||
#define TASKINFO_ISSETTINGS 0
|
||||
#define TASKINFO_NUMBYTES sizeof(TaskInfoData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function TaskInfoGet(dataOut)
|
||||
* @brief Populate a TaskInfoData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define TaskInfoGet(dataOut) UAVObjGetData(TaskInfoHandle(), dataOut)
|
||||
#define TaskInfoSet(dataIn) UAVObjSetData(TaskInfoHandle(), dataIn)
|
||||
#define TaskInfoInstGet(instId, dataOut) UAVObjGetInstanceData(TaskInfoHandle(), instId, dataOut)
|
||||
#define TaskInfoInstSet(instId, dataIn) UAVObjSetInstanceData(TaskInfoHandle(), instId, dataIn)
|
||||
#define TaskInfoConnectQueue(queue) UAVObjConnectQueue(TaskInfoHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define TaskInfoConnectCallback(cb) UAVObjConnectCallback(TaskInfoHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define TaskInfoCreateInstance() UAVObjCreateInstance(TaskInfoHandle())
|
||||
#define TaskInfoRequestUpdate() UAVObjRequestUpdate(TaskInfoHandle())
|
||||
#define TaskInfoRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(TaskInfoHandle(), instId)
|
||||
#define TaskInfoUpdated() UAVObjUpdated(TaskInfoHandle())
|
||||
#define TaskInfoInstUpdated(instId) UAVObjUpdated(TaskInfoHandle(), instId)
|
||||
#define TaskInfoGetMetadata(dataOut) UAVObjGetMetadata(TaskInfoHandle(), dataOut)
|
||||
#define TaskInfoSetMetadata(dataIn) UAVObjSetMetadata(TaskInfoHandle(), dataIn)
|
||||
#define TaskInfoReadOnly(dataIn) UAVObjReadOnly(TaskInfoHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint16_t StackRemaining[12];
|
||||
uint8_t Running[12];
|
||||
|
||||
} __attribute__((packed)) TaskInfoData;
|
||||
|
||||
// Field information
|
||||
// Field StackRemaining information
|
||||
/* Array element names for field StackRemaining */
|
||||
typedef enum { TASKINFO_STACKREMAINING_SYSTEM=0, TASKINFO_STACKREMAINING_ACTUATOR=1, TASKINFO_STACKREMAINING_TELEMETRYTX=2, TASKINFO_STACKREMAINING_TELEMETRYTXPRI=3, TASKINFO_STACKREMAINING_TELEMETRYRX=4, TASKINFO_STACKREMAINING_GPS=5, TASKINFO_STACKREMAINING_MANUALCONTROL=6, TASKINFO_STACKREMAINING_ALTITUDE=7, TASKINFO_STACKREMAINING_AHRSCOMMS=8, TASKINFO_STACKREMAINING_STABILIZATION=9, TASKINFO_STACKREMAINING_GUIDANCE=10, TASKINFO_STACKREMAINING_WATCHDOG=11 } TaskInfoStackRemainingElem;
|
||||
/* Number of elements for field StackRemaining */
|
||||
#define TASKINFO_STACKREMAINING_NUMELEM 12
|
||||
// Field Running information
|
||||
/* Enumeration options for field Running */
|
||||
typedef enum { TASKINFO_RUNNING_FALSE=0, TASKINFO_RUNNING_TRUE=1 } TaskInfoRunningOptions;
|
||||
/* Array element names for field Running */
|
||||
typedef enum { TASKINFO_RUNNING_SYSTEM=0, TASKINFO_RUNNING_ACTUATOR=1, TASKINFO_RUNNING_TELEMETRYTX=2, TASKINFO_RUNNING_TELEMETRYTXPRI=3, TASKINFO_RUNNING_TELEMETRYRX=4, TASKINFO_RUNNING_GPS=5, TASKINFO_RUNNING_MANUALCONTROL=6, TASKINFO_RUNNING_ALTITUDE=7, TASKINFO_RUNNING_AHRSCOMMS=8, TASKINFO_RUNNING_STABILIZATION=9, TASKINFO_RUNNING_GUIDANCE=10, TASKINFO_RUNNING_WATCHDOG=11 } TaskInfoRunningElem;
|
||||
/* Number of elements for field Running */
|
||||
#define TASKINFO_RUNNING_NUMELEM 12
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t TaskInfoInitialize();
|
||||
UAVObjHandle TaskInfoHandle();
|
||||
|
||||
#endif // TASKINFO_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
111
flight/OpenPilot/UAVObjects/taskinfo.c
Normal file
111
flight/OpenPilot/UAVObjects/taskinfo.c
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup TaskInfo TaskInfo
|
||||
* @brief Task information
|
||||
*
|
||||
* Autogenerated files and functions for TaskInfo Object
|
||||
* @{
|
||||
*
|
||||
* @file taskinfo.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the TaskInfo object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: taskinfo.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "taskinfo.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t TaskInfoInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(TASKINFO_OBJID, TASKINFO_NAME, TASKINFO_METANAME, 0,
|
||||
TASKINFO_ISSINGLEINST, TASKINFO_ISSETTINGS, TASKINFO_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
TaskInfoData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(TaskInfoData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.access = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 10000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.loggingUpdatePeriod = 1000;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle TaskInfoHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "systemalarms.h"
|
||||
#include "systemsettings.h"
|
||||
#include "systemstats.h"
|
||||
#include "taskinfo.h"
|
||||
#include "telemetrysettings.h"
|
||||
#include "velocityactual.h"
|
||||
#include "velocitydesired.h"
|
||||
@ -109,6 +110,7 @@ void UAVObjectsInitializeAll()
|
||||
SystemAlarmsInitialize();
|
||||
SystemSettingsInitialize();
|
||||
SystemStatsInitialize();
|
||||
TaskInfoInitialize();
|
||||
TelemetrySettingsInitialize();
|
||||
VelocityActualInitialize();
|
||||
VelocityDesiredInitialize();
|
||||
|
@ -58,7 +58,7 @@ to exclude the API function. */
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#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). */
|
||||
|
Loading…
x
Reference in New Issue
Block a user