diff --git a/flight/OpenPilot_x86.patch b/flight/OpenPilot_x86.patch new file mode 100644 index 000000000..257fcae01 --- /dev/null +++ b/flight/OpenPilot_x86.patch @@ -0,0 +1,1065 @@ +Index: OpenPilot/Makefile.x86 +=================================================================== +--- OpenPilot/Makefile.x86 (Revision 0) ++++ OpenPilot/Makefile.x86 (Revision 0) +@@ -0,0 +1,616 @@ ++ ##### ++ # Project: OpenPilot ++ # ++ # ++ # Makefile for OpenPilot project build PiOS and the AP. ++ # ++ # 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 ++ # (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 ++ ##### ++ ++ ++# Set developer code and compile options ++# Set to YES to compile for debugging ++DEBUG ?= YES ++ ++# Set to YES to use the Servo output pins for debugging via scope or logic analyser ++ENABLE_DEBUG_PINS ?= NO ++ ++# Set to Yes to enable the AUX UART which is mapped on the S1 (Tx) and S2 (Rx) servo outputs ++ENABLE_AUX_UART ?= NO ++ ++# ++USE_BOOTLOADER ?= NO ++ ++ ++# Set to YES when using Code Sourcery toolchain ++CODE_SOURCERY ?= NO ++ ++# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe) ++TCHAIN_PREFIX ?= "" ++ ++# Remove command is different for Code Sourcery on Windows ++REMOVE_CMD ?= rm ++ ++FLASH_TOOL = OPENOCD ++ ++# YES enables -mthumb option to flags for source-files listed ++# in SRC and CPPSRC ++USE_THUMB_MODE = YES ++ ++# List of modules to include ++MODULES = Telemetry Stabilization ++#MODULES = Telemetry GPS ManualControl Actuator Altitude Attitude Stabilization ++#MODULES = Telemetry Example ++#MODULES = Telemetry MK/MKSerial ++ ++#MODULES += Osd/OsdEtStd ++ ++ ++# MCU name, submodel and board ++# - MCU used for compiler-option (-mcpu) ++# - MODEL used for linker-script name (-T) and passed as define ++# - BOARD just passed as define (optional) ++MCU = i686 ++#CHIP = STM32F103RET ++#BOARD = STM3210E_OP ++ifeq ($(USE_BOOTLOADER), YES) ++MODEL = HD_BL ++ ++else ++MODEL = HD_NB ++endif ++ ++# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.) ++OUTDIR = Build ++ ++# Target file name (without extension). ++TARGET = OpenPilot ++ ++# Paths ++OPSYSTEM = ./System ++OPSYSTEMINC = $(OPSYSTEM)/inc ++OPUAVTALK = ./UAVTalk ++OPUAVTALKINC = $(OPUAVTALK)/inc ++OPUAVOBJ = ./UAVObjects ++OPUAVOBJINC = $(OPUAVOBJ)/inc ++OPTESTS = ./Tests ++OPMODULEDIR = ./Modules ++PIOS = ../PiOS.x86 ++PIOSINC = $(PIOS)/inc ++PIOSX86 = $(PIOS)/x86 ++APPLIBDIR = $(PIOSX86)/Libraries ++RTOSDIR = $(APPLIBDIR)/FreeRTOS ++RTOSSRCDIR = $(RTOSDIR)/Source ++RTOSINCDIR = $(RTOSSRCDIR)/include ++DOXYGENDIR = ../Doc/Doxygen ++ ++# List C source files here. (C dependencies are automatically generated.) ++# use file-extension c for "c-only"-files ++ ++MODNAMES = $(notdir ${MODULES}) ++ ++ifndef TESTAPP ++## MODULES ++SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}} ++SRC += ${OUTDIR}/InitMods.c ++## OPENPILOT CORE: ++SRC += ${OPMODULEDIR}/System/systemmod.c ++SRC += $(OPSYSTEM)/openpilot.c ++SRC += $(OPSYSTEM)/pios_board_x86.c ++SRC += $(OPSYSTEM)/alarms.c ++SRC += $(OPUAVTALK)/uavtalk.c ++SRC += $(OPUAVOBJ)/uavobjectmanager.c ++SRC += $(OPUAVOBJ)/uavobjectsinit.c ++SRC += $(OPUAVOBJ)/eventdispatcher.c ++else ++## TESTCODE ++SRC += $(OPTESTS)/test_common.c ++SRC += $(OPTESTS)/$(TESTAPP).c ++endif ++ ++ ++ ++## UAVOBJECTS ++ifndef TESTAPP ++SRC += $(OPUAVOBJ)/exampleobject1.c ++SRC += $(OPUAVOBJ)/exampleobject2.c ++SRC += $(OPUAVOBJ)/examplesettings.c ++SRC += $(OPUAVOBJ)/objectpersistence.c ++SRC += $(OPUAVOBJ)/positionactual.c ++SRC += $(OPUAVOBJ)/gcstelemetrystats.c ++SRC += $(OPUAVOBJ)/flighttelemetrystats.c ++SRC += $(OPUAVOBJ)/systemstats.c ++SRC += $(OPUAVOBJ)/systemalarms.c ++SRC += $(OPUAVOBJ)/systemsettings.c ++SRC += $(OPUAVOBJ)/telemetrysettings.c ++SRC += $(OPUAVOBJ)/actuatorcommand.c ++SRC += $(OPUAVOBJ)/actuatordesired.c ++SRC += $(OPUAVOBJ)/actuatorsettings.c ++SRC += $(OPUAVOBJ)/manualcontrolcommand.c ++SRC += $(OPUAVOBJ)/manualcontrolsettings.c ++SRC += $(OPUAVOBJ)/attitudedesired.c ++SRC += $(OPUAVOBJ)/stabilizationsettings.c ++SRC += $(OPUAVOBJ)/altitudeactual.c ++SRC += $(OPUAVOBJ)/attitudeactual.c ++SRC += $(OPUAVOBJ)/attitudesettings.c ++SRC += $(OPUAVOBJ)/flightbatterystate.c ++endif ++ ++## PIOS Hardware (x86) ++SRC += $(PIOSX86)/pios_sys.c ++SRC += $(PIOSX86)/pios_led.c ++SRC += $(PIOSX86)/pios_delay.c ++SRC += $(PIOSX86)/pios_sdcard.c ++SRC += $(PIOSX86)/pios_udp.c ++SRC += $(PIOSX86)/pios_com.c ++# ++## RTOS ++SRC += $(RTOSSRCDIR)/list.c ++SRC += $(RTOSSRCDIR)/queue.c ++SRC += $(RTOSSRCDIR)/tasks.c ++# ++## RTOS Portable ++SRC += $(RTOSSRCDIR)/portable/GCC/Posix/port.c ++SRC += $(RTOSSRCDIR)/portable/MemMang/heap_3.c ++ ++ ++ ++# List C source files here which must be compiled in ARM-Mode (no -mthumb). ++# use file-extension c for "c-only"-files ++## just for testing, timer.c could be compiled in thumb-mode too ++SRCARM = ++ ++# List C++ source files here. ++# use file-extension .cpp for C++-files (not .C) ++CPPSRC = ++ ++# List C++ source files here which must be compiled in ARM-Mode. ++# use file-extension .cpp for C++-files (not .C) ++#CPPSRCARM = $(TARGET).cpp ++CPPSRCARM = ++ ++ ++# List any extra directories to look for include files here. ++# Each directory must be seperated by a space. ++EXTRAINCDIRS = $(OPSYSTEM) ++EXTRAINCDIRS += $(OPSYSTEMINC) ++EXTRAINCDIRS += $(OPUAVTALK) ++EXTRAINCDIRS += $(OPUAVTALKINC) ++EXTRAINCDIRS += $(OPUAVOBJ) ++EXTRAINCDIRS += $(OPUAVOBJINC) ++EXTRAINCDIRS += $(MODEXAMPLE) ++EXTRAINCDIRS += $(MODEXAMPLEINC) ++EXTRAINCDIRS += $(MODSYSTEMINC) ++EXTRAINCDIRS += $(MODTELEMETRY) ++EXTRAINCDIRS += $(MODTELEMETRYINC) ++EXTRAINCDIRS += $(MODGPS) ++EXTRAINCDIRS += $(MODGPSINC) ++EXTRAINCDIRS += $(MODMANUALCONTROL) ++EXTRAINCDIRS += $(MODMANUALCONTROLINC) ++EXTRAINCDIRS += $(MODACTUATOR) ++EXTRAINCDIRS += $(MODACTUATORINC) ++EXTRAINCDIRS += $(MODALTITUDE) ++EXTRAINCDIRS += $(MODALTITUDEINC) ++EXTRAINCDIRS += $(MODATTITUDE) ++EXTRAINCDIRS += $(MODATTITUDEINC) ++EXTRAINCDIRS += $(PIOS) ++EXTRAINCDIRS += $(PIOSINC) ++EXTRAINCDIRS += $(PIOSX86) ++EXTRAINCDIRS += $(MININIDIR) ++EXTRAINCDIRS += $(RTOSINCDIR) ++EXTRAINCDIRS += $(APPLIBDIR) ++EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/Posix ++ ++EXTRAINCDIRS += ${foreach MOD, ${MODULES}, Modules/${MOD}/inc} ${OPMODULEDIR}/System/inc ++ ++ ++# List any extra directories to look for library files here. ++# Also add directories where the linker should search for ++# includes from linker-script to the list ++# Each directory must be seperated by a space. ++EXTRA_LIBDIRS = ++ ++# Extra Libraries ++# Each library-name must be seperated by a space. ++# i.e. to link with libxyz.a, libabc.a and libefsl.a: ++# EXTRA_LIBS = xyz abc efsl ++# for newlib-lpc (file: libnewlibc-lpc.a): ++# EXTRA_LIBS = newlib-lpc ++EXTRA_LIBS = ++ ++# Path to Linker-Scripts ++LINKERSCRIPTPATH = $(PIOSSTM32F10X) ++ ++# Optimization level, can be [0, 1, 2, 3, s]. ++# 0 = turn off optimization. s = optimize for size. ++# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) ++ ++ifeq ($(DEBUG),YES) ++OPT = 0 ++else ++OPT = s ++endif ++ ++# Output format. (can be ihex or binary or both) ++# binary to create a load-image in raw-binary format i.e. for SAM-BA, ++# ihex to create a load-image in Intel hex format ++#LOADFORMAT = ihex ++#LOADFORMAT = binary ++LOADFORMAT = both ++ ++# Debugging format. ++#DEBUGF = dwarf-2 ++ ++# Place project-specific -D (define) and/or ++# -U options for C here. ++ifeq ($(ENABLE_DEBUG_PINS), YES) ++CDEFS += -DPIOS_ENABLE_DEBUG_PINS ++endif ++ifeq ($(ENABLE_AUX_UART), YES) ++CDEFS += -DPIOS_ENABLE_AUX_UART ++endif ++ifeq ($(USE_BOOTLOADER), YES) ++CDEFS += -DUSE_BOOTLOADER ++endif ++ ++ ++ ++# Compiler flag to set the C Standard level. ++# c89 - "ANSI" C ++# gnu89 - c89 plus GCC extensions ++# c99 - ISO C99 standard (not yet fully implemented) ++# gnu99 - c99 plus GCC extensions ++CSTANDARD = -std=gnu99 ++ ++#----- ++ ++# Compiler flags. ++ ++# -g*: generate debugging information ++# -O*: optimization level ++# -f...: tuning, see GCC manual and avr-libc documentation ++# -Wall...: warning level ++# -Wa,...: tell GCC to pass this to the assembler. ++# -adhlns...: create assembler listing ++# ++# Flags for C and C++ (arm-elf-gcc/arm-elf-g++) ++ ++ifeq ($(DEBUG),YES) ++CFLAGS = -g$(DEBUGF) -DDEBUG ++endif ++ ++CFLAGS += -DX86_WRAPPERS ++CFLAGS += -O$(OPT) ++CFLAGS += -mcpu=$(MCU) ++CFLAGS += $(CDEFS) ++CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I. ++ ++CFLAGS += -fomit-frame-pointer ++ifeq ($(CODE_SOURCERY), YES) ++CFLAGS += -fpromote-loop-indices ++endif ++ ++CFLAGS += -Wall ++CFLAGS += -Werror ++# Compiler flags to generate dependency files: ++CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d ++ ++# flags only for C ++#CONLYFLAGS += -Wnested-externs ++CONLYFLAGS += $(CSTANDARD) ++ ++# Assembler flags. ++# -Wa,...: tell GCC to pass this to the assembler. ++# -ahlns: create listing ++ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp ++ASFLAGS += $(ADEFS) ++ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<)))) ++ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) ++ ++MATH_LIB = -lm ++ ++# Linker flags. ++# -Wl,...: tell GCC to pass this to linker. ++# -Map: create map file ++# --cref: add cross reference to map file ++LDFLAGS += -lpthread ++LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) ++LDFLAGS += -lc ++LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) ++LDFLAGS += $(MATH_LIB) ++LDFLAGS += -lc -lgcc ++ ++ ++ ++ ++# Define programs and commands. ++CC = $(TCHAIN_PREFIX)gcc ++CPP = $(TCHAIN_PREFIX)g++ ++AR = $(TCHAIN_PREFIX)ar ++OBJCOPY = $(TCHAIN_PREFIX)objcopy ++OBJDUMP = $(TCHAIN_PREFIX)objdump ++SIZE = $(TCHAIN_PREFIX)size ++NM = $(TCHAIN_PREFIX)nm ++REMOVE = $(REMOVE_CMD) -f ++###SHELL = sh ++###COPY = cp ++ ++ ++ ++# Define Messages ++# English ++MSG_ERRORS_NONE = Errors: none ++MSG_BEGIN = ${quote}-------- begin (mode: $(RUN_MODE)) --------${quote} ++MSG_END = ${quote}-------- end --------${quote} ++MSG_MODINIT = ${quote}**** Generating ModInit.c${quote} ++MSG_SIZE_BEFORE = ${quote}Size before:${quote} ++MSG_SIZE_AFTER = ${quote}Size after build:${quote} ++MSG_LOAD_FILE = ${quote}Creating load file:${quote} ++MSG_EXTENDED_LISTING = ${quote}Creating Extended Listing/Disassembly:${quote} ++MSG_SYMBOL_TABLE = ${quote}Creating Symbol Table:${quote} ++MSG_LINKING = ${quote}**** Linking :${quote} ++MSG_COMPILING = ${quote}**** Compiling C :${quote} ++MSG_COMPILING_ARM = ${quote}**** Compiling C (ARM-only):${quote} ++MSG_COMPILINGCPP = ${quote}Compiling C++ :${quote} ++MSG_COMPILINGCPP_ARM = ${quote}Compiling C++ (ARM-only):${quote} ++MSG_ASSEMBLING = ${quote}**** Assembling:${quote} ++MSG_ASSEMBLING_ARM = ${quote}****Assembling (ARM-only):${quote} ++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} ++ ++# List of all source files. ++ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) ++# List of all source files without directory and file-extension. ++ALLSRCBASE = $(notdir $(basename $(ALLSRC))) ++ ++# Define all object files. ++ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE))) ++ ++# Define all listing files (used for make clean). ++LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE))) ++# Define all depedency-files (used for make clean). ++DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE))) ++ ++elf: $(OUTDIR)/$(TARGET).elf ++lss: $(OUTDIR)/$(TARGET).lss ++sym: $(OUTDIR)/$(TARGET).sym ++hex: $(OUTDIR)/$(TARGET).hex ++bin: $(OUTDIR)/$(TARGET).bin ++ ++# Default target. ++#all: begin gccversion sizebefore build sizeafter finished end ++#all: begin gccversion build sizeafter finished end ++all: elf ++ ++ifeq ($(LOADFORMAT),ihex) ++build: elf hex lss sym ++else ++ifeq ($(LOADFORMAT),binary) ++build: elf bin lss sym ++else ++ifeq ($(LOADFORMAT),both) ++build: elf hex bin lss sym ++else ++$(error "$(MSG_FORMATERROR) $(FORMAT)") ++endif ++endif ++endif ++ ++# Test if quotes are needed for the echo-command ++result = ${shell echo "test"} ++ifeq (${result}, test) ++ quote = ' ++else ++ quote = ++endif ++ ++${OUTDIR}/InitMods.c: Makefile.x86 ++ @echo ${MSG_MODINIT} ++ @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c ++ @echo ${quote}${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);}${quote} >> ${OUTDIR}/InitMods.c ++ @echo ${quote}void InitModules() {${quote} >> ${OUTDIR}/InitMods.c ++ @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c ++ @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c ++ ++# Eye candy. ++begin: ++## @echo ++ @echo $(MSG_BEGIN) ++ ++finished: ++## @echo $(MSG_ERRORS_NONE) ++ ++end: ++ @echo $(MSG_END) ++## @echo ++ ++# Display sizes of sections. ++ELFSIZE = $(SIZE) -A $(OUTDIR)/$(TARGET).elf ++##ELFSIZE = $(SIZE) --format=Berkeley --common $(OUTDIR)/$(TARGET).elf ++sizebefore: ++# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi ++ ++sizeafter: ++# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi ++ @echo $(MSG_SIZE_AFTER) ++ $(ELFSIZE) ++ ++# Display compiler version information. ++gccversion : ++ @$(CC) --version ++# @echo $(ALLOBJ) ++ ++# Program the device. ++ifeq ($(FLASH_TOOL),OPENOCD) ++# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". ++program: $(OUTDIR)/$(TARGET).elf ++ @echo ${quote}Programming with OPENOCD${quote} ++ $(OOCD_EXE) $(OOCD_CL) ++endif ++ ++# Create final output file (.hex) from ELF output file. ++%.hex: %.elf ++## @echo ++ @echo $(MSG_LOAD_FILE) $@ ++ $(OBJCOPY) -O ihex $< $@ ++ ++# Create final output file (.bin) from ELF output file. ++%.bin: %.elf ++## @echo ++ @echo $(MSG_LOAD_FILE) $@ ++ $(OBJCOPY) -O binary $< $@ ++ ++# Create extended listing file/disassambly from ELF output file. ++# using objdump testing: option -C ++%.lss: %.elf ++## @echo ++ @echo $(MSG_EXTENDED_LISTING) $@ ++ $(OBJDUMP) -h -S -C -r $< > $@ ++# $(OBJDUMP) -x -S $< > $@ ++ ++# Create a symbol table from ELF output file. ++%.sym: %.elf ++## @echo ++ @echo $(MSG_SYMBOL_TABLE) $@ ++ $(NM) -n $< > $@ ++ ++# Link: create ELF output file from object files. ++.SECONDARY : $(TARGET).elf ++.PRECIOUS : $(ALLOBJ) ++%.elf: $(ALLOBJ) ++ @echo $(MSG_LINKING) $@ ++# use $(CC) for C-only projects or $(CPP) for C++-projects: ++ $(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) ++## @echo ++ @echo $(MSG_ASSEMBLING) $$< to $$@ ++ $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src)))) ++ ++# Assemble: create object files from assembler source files. ARM-only ++define ASSEMBLE_ARM_TEMPLATE ++$(OUTDIR)/$(notdir $(basename $(1))).o : $(1) ++## @echo ++ @echo $(MSG_ASSEMBLING_ARM) $$< to $$@ ++ $(CC) -c $$(ASFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src)))) ++ ++ ++# Compile: create object files from C source files. ++define COMPILE_C_TEMPLATE ++$(OUTDIR)/$(notdir $(basename $(1))).o : $(1) ++## @echo ++ @echo $(MSG_COMPILING) $$< to $$@ ++ $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) ++ ++# Compile: create object files from C source files. ARM-only ++define COMPILE_C_ARM_TEMPLATE ++$(OUTDIR)/$(notdir $(basename $(1))).o : $(1) ++## @echo ++ @echo $(MSG_COMPILING_ARM) $$< to $$@ ++ $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src)))) ++ ++ ++# Compile: create object files from C++ source files. ++define COMPILE_CPP_TEMPLATE ++$(OUTDIR)/$(notdir $(basename $(1))).o : $(1) ++## @echo ++ @echo $(MSG_COMPILINGCPP) $$< to $$@ ++ $(CC) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src)))) ++ ++# Compile: create object files from C++ source files. ARM-only ++define COMPILE_CPP_ARM_TEMPLATE ++$(OUTDIR)/$(notdir $(basename $(1))).o : $(1) ++## @echo ++ @echo $(MSG_COMPILINGCPP_ARM) $$< to $$@ ++ $(CC) -c $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@ ++endef ++$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src)))) ++ ++ ++# Compile: create assembler files from C source files. ARM/Thumb ++$(SRC:.c=.s) : %.s : %.c ++ @echo $(MSG_ASMFROMC) $< to $@ ++ $(CC) $(THUMB) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@ ++ ++# Compile: create assembler files from C source files. ARM only ++$(SRCARM:.c=.s) : %.s : %.c ++ @echo $(MSG_ASMFROMC_ARM) $< to $@ ++ $(CC) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@ ++ ++# Generate Doxygen documents ++docs: ++ doxygen $(DOXYGENDIR)/doxygen.cfg ++ ++# Target: clean project. ++clean: begin clean_list finished end ++ ++clean_list : ++## @echo ++ @echo $(MSG_CLEANING) ++ $(REMOVE) $(OUTDIR)/$(TARGET).map ++ $(REMOVE) $(OUTDIR)/$(TARGET).elf ++ $(REMOVE) $(OUTDIR)/$(TARGET).hex ++ $(REMOVE) $(OUTDIR)/$(TARGET).bin ++ $(REMOVE) $(OUTDIR)/$(TARGET).sym ++ $(REMOVE) $(OUTDIR)/$(TARGET).lss ++ $(REMOVE) $(ALLOBJ) ++ $(REMOVE) $(LSTFILES) ++ $(REMOVE) $(DEPFILES) ++ $(REMOVE) $(SRC:.c=.s) ++ $(REMOVE) $(SRCARM:.c=.s) ++ $(REMOVE) $(CPPSRC:.cpp=.s) ++ $(REMOVE) $(CPPSRCARM:.cpp=.s) ++ ++ ++# Create output files directory ++# all known MS Windows OS define the ComSpec environment variable ++ifdef ComSpec ++$(shell md $(OUTDIR) 2>NUL) ++else ++$(shell mkdir $(OUTDIR) 2>/dev/null) ++endif ++ ++# Include the dependency files. ++ifdef ComSpec ++-include $(shell md $(OUTDIR)\dep 2>NUL) $(wildcard $(OUTDIR)/dep/*) ++else ++-include $(shell mkdir $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) ++endif ++ ++ ++ ++# Listing of phony targets. ++.PHONY : all begin finish end sizebefore sizeafter gccversion \ ++build elf hex bin lss sym clean clean_list program ++ +Index: OpenPilot/System/pios_board_x86.c +=================================================================== +--- OpenPilot/System/pios_board_x86.c (Revision 0) ++++ OpenPilot/System/pios_board_x86.c (Revision 0) +@@ -0,0 +1,112 @@ ++/** ++ ****************************************************************************** ++ * ++ * @file pios_board.c ++ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. ++ * @brief Defines board specific static initializers for hardware for the OpenPilot board. ++ * @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 ++#include ++#include ++ ++ ++const struct pios_udp_cfg pios_udp0_cfg = { ++ .ip = "0.0.0.0", ++ .port = 9000, ++}; ++const struct pios_udp_cfg pios_udp1_cfg = { ++ .ip = "0.0.0.0", ++ .port = 9001, ++}; ++const struct pios_udp_cfg pios_udp2_cfg = { ++ .ip = "0.0.0.0", ++ .port = 9002, ++}; ++ ++#ifdef PIOS_COM_AUX ++/* ++ * AUX USART ++ */ ++const struct pios_udp_cfg pios_udp3_cfg = { ++ .ip = "0.0.0.0", ++ .port = 9003, ++}; ++#endif ++ ++/* ++ * Board specific number of devices. ++ */ ++struct pios_udp_dev pios_udp_devs[] = { ++#define PIOS_UDP_TELEM 0 ++ { ++ .cfg = &pios_udp0_cfg, ++ }, ++#define PIOS_UDP_GPS 1 ++ { ++ .cfg = &pios_udp1_cfg, ++ }, ++#define PIOS_UDP_LOCAL 2 ++ { ++ .cfg = &pios_udp2_cfg, ++ }, ++#ifdef PIOS_COM_AUX ++#define PIOS_UDP_AUX 3 ++ { ++ .cfg = &pios_udp3_cfg, ++ }, ++#endif ++}; ++ ++uint8_t pios_udp_num_devices = NELEMENTS(pios_udp_devs); ++ ++/* ++ * COM devices ++ */ ++ ++/* ++ * Board specific number of devices. ++ */ ++extern const struct pios_com_driver pios_serial_com_driver; ++extern const struct pios_com_driver pios_udp_com_driver; ++ ++struct pios_com_dev pios_com_devs[] = { ++ { ++ .id = PIOS_UDP_TELEM, ++ .driver = &pios_udp_com_driver, ++ }, ++ { ++ .id = PIOS_UDP_GPS, ++ .driver = &pios_udp_com_driver, ++ }, ++ { ++ .id = PIOS_UDP_LOCAL, ++ .driver = &pios_udp_com_driver, ++ }, ++#ifdef PIOS_COM_AUX ++ { ++ .id = PIOS_UDP_AUX, ++ .driver = &pios_udp_com_driver, ++ }, ++#endif ++}; ++ ++const uint8_t pios_com_num_devices = NELEMENTS(pios_com_devs); ++ +Index: OpenPilot/System/inc/pios_config.h +=================================================================== +--- OpenPilot/System/inc/pios_config.h (Revision 966) ++++ OpenPilot/System/inc/pios_config.h (Arbeitskopie) +@@ -53,6 +53,9 @@ + #define PIOS_INCLUDE_FREERTOS + #define PIOS_INCLUDE_GPIO + #define PIOS_INCLUDE_EXTI ++/* Only available on x86 so far */ ++#define PIOS_INCLUDE_UDP ++//#define PIOS_INCLUDE_SERIAL + + + /* Defaults for Logging */ +Index: OpenPilot/System/inc/pios_board_x86.h +=================================================================== +--- OpenPilot/System/inc/pios_board_x86.h (Revision 0) ++++ OpenPilot/System/inc/pios_board_x86.h (Revision 0) +@@ -0,0 +1,67 @@ ++/** ++ ****************************************************************************** ++ * ++ * @file pios_board.h ++ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. ++ * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. ++ * @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 PIOS_BOARD_H ++#define PIOS_BOARD_H ++ ++ ++ ++ ++//------------------------ ++// PIOS_LED ++//------------------------ ++//#define PIOS_LED_LED1_GPIO_PORT GPIOC ++//#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_12 ++//#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOC ++//#define PIOS_LED_LED2_GPIO_PORT GPIOC ++//#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_13 ++//#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOC ++#define PIOS_LED_NUM 2 ++//#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT } ++//#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN } ++//#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK } ++ ++ ++//------------------------- ++// COM ++// ++// See also pios_board_x86.c ++//------------------------- ++//#define PIOS_USART_TX_BUFFER_SIZE 256 ++#define PIOS_COM_BUFFER_SIZE 1024 ++#define PIOS_UDP_RX_BUFFER_SIZE PIOS_COM_BUFFER_SIZE ++ ++#define PIOS_COM_TELEM_RF 0 ++#define PIOS_COM_GPS 1 ++#define PIOS_COM_TELEM_USB 2 ++ ++#ifdef PIOS_ENABLE_AUX_UART ++#define PIOS_COM_AUX 3 ++#define PIOS_COM_DEBUG PIOS_COM_AUX ++#endif ++ ++ ++#endif /* PIOS_BOARD_H */ +Index: OpenPilot/System/openpilot.c +=================================================================== +--- OpenPilot/System/openpilot.c (Revision 966) ++++ OpenPilot/System/openpilot.c (Arbeitskopie) +@@ -96,12 +96,14 @@ + /* Delay system */ + PIOS_DELAY_Init(); + ++#ifndef X86_WRAPPERS + /* SPI Init */ + PIOS_SPI_Init(); + + /* Enable and mount the SDCard */ + PIOS_SDCARD_Init(); + PIOS_SDCARD_MountFS(0); ++#endif + + /* Initialize UAVObject libraries */ + EventDispatcherInitialize(); +@@ -113,6 +115,7 @@ + + /* Initialize the PiOS library */ + PIOS_COM_Init(); ++#ifndef X86_WRAPPERS + PIOS_Servo_Init(); + PIOS_ADC_Init(); + PIOS_GPIO_Init(); +@@ -127,6 +130,7 @@ + #endif + PIOS_USB_Init(0); + PIOS_I2C_Init(); ++#endif /*X86_WRAPPERS*/ + + /* Initialize modules */ + InitModules(); +Index: OpenPilot/UAVObjects/uavobjectmanager.c +=================================================================== +--- OpenPilot/UAVObjects/uavobjectmanager.c (Revision 966) ++++ OpenPilot/UAVObjects/uavobjectmanager.c (Arbeitskopie) +@@ -529,16 +529,28 @@ + } + + // Write the object ID ++#ifndef X86_WRAPPERS + DFS_WriteFile(file, PIOS_SDCARD_Sector, (uint8_t*)&objEntry->id, &bytesWritten, 4); ++#else ++ bytesWritten=fwrite((uint8_t*)&objEntry->id,1,4,*file); ++#endif + + // Write the instance ID + if (!objEntry->isSingleInstance) + { ++#ifndef X86_WRAPPERS + DFS_WriteFile(file, PIOS_SDCARD_Sector, (uint8_t*)&instEntry->instId, &bytesWritten, 2); ++#else ++ bytesWritten=fwrite((uint8_t*)&instEntry->instId,1,2,*file); ++#endif + } + + // Write the data and check that the write was successful ++#ifndef X86_WRAPPERS + DFS_WriteFile(file, PIOS_SDCARD_Sector, instEntry->data, &bytesWritten, objEntry->numBytes); ++#else ++ bytesWritten=fwrite((uint8_t*)&instEntry->data,1,objEntry->numBytes,*file); ++#endif + if ( bytesWritten != objEntry->numBytes ) + { + xSemaphoreGiveRecursive(mutex); +@@ -582,7 +594,11 @@ + objectFilename(objEntry, filename); + + // Open file ++#ifndef X86_WRAPPERS + if ( DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_WRITE, PIOS_SDCARD_Sector, &file) != DFS_OK ) ++#else ++ if ((file=fopen((char*)filename,"w"))==NULL) ++#endif + { + xSemaphoreGiveRecursive(mutex); + return -1; +@@ -591,13 +607,21 @@ + // Append object + if ( UAVObjSaveToFile(obj, instId, &file) == -1 ) + { ++#ifndef X86_WRAPPERS + DFS_Close(&file); ++#else ++ fclose(file); ++#endif + xSemaphoreGiveRecursive(mutex); + return -1; + } + + // Done, close file and unlock ++#ifndef X86_WRAPPERS + DFS_Close(&file); ++#else ++ fclose(file); ++#endif + xSemaphoreGiveRecursive(mutex); + return 0; + } +@@ -626,7 +650,11 @@ + xSemaphoreTakeRecursive(mutex, portMAX_DELAY); + + // Read the object ID ++#ifndef X86_WRAPPERS + if ( DFS_ReadFile(file, PIOS_SDCARD_Sector, (uint8_t*)&objId, &bytesRead, 4) != DFS_OK ) ++#else ++ if ((bytesRead=fread((uint8_t*)&objId,1,4,*file))!=4) ++#endif + { + xSemaphoreGiveRecursive(mutex); + return 0; +@@ -645,7 +673,11 @@ + instId = 0; + if ( !objEntry->isSingleInstance ) + { ++#ifndef X86_WRAPPERS + if ( DFS_ReadFile(file, PIOS_SDCARD_Sector, (uint8_t*)&instId, &bytesRead, 2) != DFS_OK ) ++#else ++ if ((bytesRead=fread((uint8_t*)&instId,1,2,*file))!=2) ++#endif + { + xSemaphoreGiveRecursive(mutex); + return 0; +@@ -668,7 +700,11 @@ + } + + // Read the instance data ++#ifndef X86_WRAPPERS + if ( DFS_ReadFile(file, PIOS_SDCARD_Sector, (uint8_t*)instEntry->data, &bytesRead, objEntry->numBytes) != DFS_OK ) ++#else ++ if ((bytesRead=fread((uint8_t*)&instEntry->data,1,objEntry->numBytes,*file))!=objEntry->numBytes) ++#endif + { + xSemaphoreGiveRecursive(mutex); + return 0; +@@ -714,7 +750,11 @@ + objectFilename(objEntry, filename); + + // Open file ++#ifndef X86_WRAPPERS + if ( DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_WRITE, PIOS_SDCARD_Sector, &file) != DFS_OK ) ++#else ++ if ((file=fopen((char*)filename,"r"))==NULL) ++#endif + { + xSemaphoreGiveRecursive(mutex); + return -1; +@@ -724,7 +764,11 @@ + loadedObj = UAVObjLoadFromFile(&file); + if (loadedObj == 0) + { ++#ifndef X86_WRAPPERS + DFS_Close(&file); ++#else ++ fclose(file); ++#endif + xSemaphoreGiveRecursive(mutex); + return -1; + } +@@ -733,13 +777,21 @@ + loadedObjEntry = (ObjectList*)loadedObj; + if ( loadedObjEntry->id != objEntry->id ) + { ++#ifndef X86_WRAPPERS + DFS_Close(&file); ++#else ++ fclose(file); ++#endif + xSemaphoreGiveRecursive(mutex); + return -1; + } + + // Done, close file and unlock ++#ifndef X86_WRAPPERS + DFS_Close(&file); ++#else ++ fclose(file); ++#endif + xSemaphoreGiveRecursive(mutex); + return 0; + } +@@ -771,7 +823,11 @@ + objectFilename(objEntry, filename); + + // Delete file ++#ifndef X86_WRAPPERS + DFS_UnlinkFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, PIOS_SDCARD_Sector); ++#else ++ unlink((char*)filename); ++#endif + + // Done + xSemaphoreGiveRecursive(mutex); +Index: OpenPilot/UAVObjects/inc/uavobjectmanager.h +=================================================================== +--- OpenPilot/UAVObjects/inc/uavobjectmanager.h (Revision 966) ++++ OpenPilot/UAVObjects/inc/uavobjectmanager.h (Arbeitskopie) +@@ -29,7 +29,11 @@ + #define UAVOBJ_ALL_INSTANCES 0xFFFF + #define UAVOBJ_MAX_INSTANCES 1000 + ++#ifndef X86_WRAPPERS + typedef uint32_t UAVObjHandle; ++#else ++typedef size_t UAVObjHandle; /* on x86_64 pointers are not 32 bit */ ++#endif + + /** + * Object update mode, used by multiple modules (e.g. telemetry and logger) +Index: OpenPilot/UAVTalk/uavtalk.c +=================================================================== +--- OpenPilot/UAVTalk/uavtalk.c (Revision 966) ++++ OpenPilot/UAVTalk/uavtalk.c (Arbeitskopie) +@@ -76,7 +76,7 @@ + + // Private functions + static uint8_t updateCRC(uint8_t crc, const uint8_t* data, int32_t length); +-static int32_t objectTransaction(uint32_t objectId, uint16_t instId, uint8_t type, int32_t timeout); ++static int32_t objectTransaction(UAVObjHandle objectId, uint16_t instId, uint8_t type, int32_t timeout); + static int32_t sendObject(UAVObjHandle obj, uint16_t instId, uint8_t type); + static int32_t sendSingleObject(UAVObjHandle obj, uint16_t instId, uint8_t type); + static int32_t receiveObject(uint8_t type, UAVObjHandle obj, uint16_t instId, uint8_t* data, int32_t length); +Index: OpenPilot/Modules/System/systemmod.c +=================================================================== +--- OpenPilot/Modules/System/systemmod.c (Revision 966) ++++ OpenPilot/Modules/System/systemmod.c (Arbeitskopie) +@@ -208,7 +208,11 @@ + // Get stats and update + SystemStatsGet(&stats); + stats.FlightTime = xTaskGetTickCount()*portTICK_RATE_MS; ++#ifndef X86_WRAPPERS + stats.HeapRemaining = xPortGetFreeHeapSize(); ++#else ++ stats.HeapRemaining = 10240; ++#endif + stats.CPULoad = 100 - (uint8_t)round(100.0*((float)idleCounter/(float)(SYSTEM_UPDATE_PERIOD_MS/1000))/(float)IDLE_COUNTS_PER_SEC_AT_NO_LOAD); + idleCounterClear = 1; + SystemStatsSet(&stats); diff --git a/flight/PiOS.x86/pios.h b/flight/PiOS.x86/pios.h index 47e16ce02..32eba7eff 100644 --- a/flight/PiOS.x86/pios.h +++ b/flight/PiOS.x86/pios.h @@ -46,13 +46,7 @@ #include #include #include - -#if defined(PIOS_INCLUDE_SDCARD) - -/* minIni Includes */ -#include - -#endif +#include /* PIOS Board Specific Device Configuration */ #include "pios_board_x86.h" diff --git a/flight/PiOS.x86/x86/Libraries/minIni/LICENSE b/flight/PiOS.x86/x86/Libraries/minIni/LICENSE deleted file mode 100644 index 68c771a09..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - diff --git a/flight/PiOS.x86/x86/Libraries/minIni/NOTICE b/flight/PiOS.x86/x86/Libraries/minIni/NOTICE deleted file mode 100644 index 6ce0ef3bd..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/NOTICE +++ /dev/null @@ -1,12 +0,0 @@ -minIni is a programmer's library to read and write "INI" files in embedded -systems. The library takes little resources and can be configured for various -kinds of file I/O libraries. - -The method for portable INI file management in minIni is, in part based, on the -article "Multiplatform .INI Files" by Joseph J. Graf in the March 1994 issue of -Dr. Dobb's Journal. - -The C++ class in minIni.h was contributed by Steven Van Ingelgem. - -The option to compile minIni as a read-only library was contributed by Luca -Bassanello. diff --git a/flight/PiOS.x86/x86/Libraries/minIni/UPDATING.txt b/flight/PiOS.x86/x86/Libraries/minIni/UPDATING.txt deleted file mode 100644 index 577ade917..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/UPDATING.txt +++ /dev/null @@ -1,5 +0,0 @@ -Notes when upgrading MinINI to newer versions -Gussy - 11/09 - --> Do not overwrite the following files, these files are platofrm depantant -----> minGlue.h \ No newline at end of file diff --git a/flight/PiOS.x86/x86/Libraries/minIni/VERSION.txt b/flight/PiOS.x86/x86/Libraries/minIni/VERSION.txt deleted file mode 100644 index 61a0f4963..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -Current version is 0.8 \ No newline at end of file diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-FatFs.h b/flight/PiOS.x86/x86/Libraries/minIni/minGlue-FatFs.h deleted file mode 100644 index 3c14e4e83..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-FatFs.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Glue functions for the minIni library, based on the FatFs and Tiny-FatFs - * libraries, see http://elm-chan.org/fsw/ff/00index_e.html - * - * Copyright (c) ITB CompuPhase, 2008-2009 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -#define INI_BUFFERSIZE 256 /* maximum line length, maximum path length */ - -/* You must set _USE_STRFUNC to 1 or 2 in the include file ff.h (or tff.h) - * to enable the "string functions" fgets() and fputs(). - */ -#include "ff.h" /* include tff.h for Tiny-FatFs */ -#define INI_FILETYPE FIL - -#define ini_openread(filename,file) (f_open((file),(filename),FA_READ+FA_OPEN_EXISTING) == 0) -#define ini_openwrite(filename,file) (f_open((file),(filename),FA_WRITE+FA_CREATE_ALWAYS) == 0) -#define ini_close(file) f_close(file) -#define ini_read(buffer,size,file) fgets((buffer),(size),(file)) -#define ini_write(buffer,file) fputs((buffer),(file)) -#define ini_rename(source,dest) f_rename((source),(dest)) -#define ini_remove(filename) f_unlink(filename) -#define ini_rewind(file) f_lseek((file),0) diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-efsl.h b/flight/PiOS.x86/x86/Libraries/minIni/minGlue-efsl.h deleted file mode 100644 index ebb587a39..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-efsl.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Glue functions for the minIni library, based on the EFS Library, see - * http://www.efsl.be/ - * - * Copyright (c) ITB CompuPhase, 2008-2009 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -#define INI_BUFFERSIZE 256 /* maximum line length, maximum path length */ - -#include "efs.h" -#define INI_FILETYPE EmbeddedFile -#define INI_LINETERM "\r\n" /* set line termination explicitly */ - - -extern EmbeddedFileSystem g_efs; - -#define ini_openread(filename,file) (file_fopen((file),&g_efs.myFs,(char*)(filename),'r') == 0) -#define ini_openwrite(filename,file) (file_fopen((file),&g_efs.myFs,(char*)(filename),'w') == 0) -#define ini_close(file) file_fclose(file) -#define ini_read(buffer,size,file) (file_read((file),(size),(buffer)) > 0) -#define ini_write(buffer,file) file_write((file),strlen(buffer),(char*)(buffer)) -#define ini_remove(filename) rmfile(&g_efs.myFs,(char*)(filename)) -#define ini_rewind(file) file_setpos(*(file),0) - -/* EFSL lacks a rename function, so instead we copy the file to the new name - * and delete the old file - */ -static int ini_rename(char *source, const char *dest) -{ - EmbeddedFile fr, fw; - int n; - - if (file_fopen(&fr, &g_efs.myFs, source, 'r') != 0) - return 0; - if (rmfile(&g_efs.myFs, (char*)dest) != 0) - return 0; - if (file_fopen(&fw, &g_efs.myFs, (char*)dest, 'w') != 0) - return 0; - - /* With some "insider knowledge", we can save some memory: the "source" - * parameter holds a filename that was built from the "dest" parameter. It - * was built in buffer and this buffer has the size INI_BUFFERSIZE. We can - * reuse this buffer for copying the file. - */ - while (n=file_read(&fr, INI_BUFFERSIZE, source)) - file_write(&fw, n, source); - - file_fclose(&fr); - file_fclose(&fw); - - /* Now we need to delete the source file. However, we have garbled the buffer - * that held the filename of the source. So we need to build it again. - */ - ini_tempname(source, dest, INI_BUFFERSIZE); - return rmfile(&g_efs.myFs, source) == 0; -} diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-stdio.h b/flight/PiOS.x86/x86/Libraries/minIni/minGlue-stdio.h deleted file mode 100644 index 8388564fc..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minGlue-stdio.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Glue functions for the minIni library, based on the C/C++ stdio library - * - * Or better said: this file contains macros that maps the function interface - * used by minIni to the standard C/C++ file I/O functions. - * - * Copyright (c) ITB CompuPhase, 2008-2009 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -/* map required file I/O to the standard C library */ -#include -#define ini_openread(filename,file) ((*(file) = fopen((filename),"rt")) != NULL) -#define ini_openwrite(filename,file) ((*(file) = fopen((filename),"wt")) != NULL) -#define ini_close(file) fclose(*(file)) -#define ini_read(buffer,size,file) fgets((buffer),(size),*(file)) -#define ini_write(buffer,file) fputs((buffer),*(file)) -#define ini_rename(source,dest) rename((source),(dest)) -#define ini_remove(filename) remove(filename) -#define ini_rewind(file) rewind(*(file)) diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minGlue.c b/flight/PiOS.x86/x86/Libraries/minIni/minGlue.c deleted file mode 100644 index 10f20168f..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minGlue.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "dosfs.h" -#include "pios.h" -#include "minGlue.h" - -/* Global Variables */ -extern uint8_t PIOS_SDCARD_Sector[SECTOR_SIZE]; -extern VOLINFO PIOS_SDCARD_VolInfo; - -/* Local Variables */ -static uint32_t SuccessCount; - -int dosfs_ini_openread(const char *filename, PFILEINFO file) -{ - if(DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_READ, PIOS_SDCARD_Sector, file)) { - /* Error opening file */ - return 0; - } - - /* No errors */ - return 1; -} - -int dosfs_ini_openwrite(const char *filename, PFILEINFO file) -{ - /* TODO: Check this works */ - if(DFS_OpenFile(&PIOS_SDCARD_VolInfo, (uint8_t *)filename, DFS_WRITE, PIOS_SDCARD_Sector, file)) { - /* Error opening file */ - return 0; - } - - /* No errors */ - return 1; -} - -int dosfs_ini_close(PFILEINFO file) -{ - /* This doesn't actually do anything */ - DFS_Close(file); - - /* No errors */ - return 1; -} - -int dosfs_ini_read(char *buffer, int size, PFILEINFO file) -{ - if(PIOS_SDCARD_ReadLine(file, (uint8_t *)buffer, size) < 0) - { - /* Error reading line */ - return 0; - } - - /* No errors */ - return 1; -} - -int dosfs_ini_write(const char *buffer, PFILEINFO file) -{ - /* TODO: Check this works */ - DFS_WriteFile(file, PIOS_SDCARD_Sector, (uint8_t *)buffer, &SuccessCount, sizeof(buffer)); - - /* No errors */ - return 1; -} - -int dosfs_ini_rename(const char *source, const char *dest) -{ - if(PIOS_SDCARD_FileCopy((char *)source, (char *)dest)) { - /* Error renaming file */ - return 0; - } - - /* No errors */ - return 1; -} - -int dosfs_ini_remove(const char *filename) -{ - /* Remove the file */ - if(PIOS_SDCARD_FileDelete((char *)filename)) { - /* Error deleting file */ - return 0; - } - - /* No errors */ - return 1; -} - -int dosfs_ini_rewind(PFILEINFO file) -{ - /* TODO: Check this works */ - DFS_Seek(file, 0, PIOS_SDCARD_Sector); - /* No errors */ - return 1; -} - diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minGlue.h b/flight/PiOS.x86/x86/Libraries/minIni/minGlue.h deleted file mode 100644 index d71d7be0d..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minGlue.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Glue functions for the minIni library */ - -#define INI_LINETERM "\r\n" -#define NDEBUG -#define INI_BUFFERSIZE 80 -// #define INI_BUFFERSIZE 256 /* maximum line length, maximum path length */ - -#include -#include -#define INI_FILETYPE FILE* - -#define ini_openread(filename,file) ((*file=fopen((char*)filename,"r"))!=NULL) -#define ini_openwrite(filename,file) ((*file=fopen((char*)filename,"2"))!=NULL) -#define ini_close(file) fclose(*file) -#define ini_read(buffer,size,file) fread(buffer,1,size,*file) -#define ini_write(buffer,file) fprintf(*file,"%s",buffer) -#define ini_rename(source,dest) rename(source,dest) -#define ini_remove(filename) unlink(filename) -#define ini_rewind(file) rewind(*file) - -//#include "dosfs.h" -//#define INI_FILETYPE FILEINFO - - -//#define ini_openread(filename,file) dosfs_ini_openread(filename,file) -//#define ini_openwrite(filename,file) dosfs_ini_openwrite(filename,file) -//#define ini_close(file) dosfs_ini_close(file) -//#define ini_read(buffer,size,file) dosfs_ini_read(buffer,size,file) -//#define ini_write(buffer,file) dosfs_ini_write(buffer,file) -//#define ini_rename(source,dest) dosfs_ini_rename(source,dest) -//#define ini_remove(filename) dosfs_ini_remove(filename) -//#define ini_rewind(file) dosfs_ini_rewind(file) - -//extern int dosfs_ini_openread(const char *filename, PFILEINFO file); -//extern int dosfs_ini_openwrite(const char *filename, PFILEINFO file); -//extern int dosfs_ini_close(PFILEINFO file); -//extern int dosfs_ini_read(char *buffer, int size, PFILEINFO file); -//extern int dosfs_ini_write(const char *buffer, PFILEINFO file); -//extern int dosfs_ini_rename(const char *source, const char *dest); -//extern int dosfs_ini_remove(const char *filename); -//extern int dosfs_ini_rewind(PFILEINFO file); - diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minIni.c b/flight/PiOS.x86/x86/Libraries/minIni/minIni.c deleted file mode 100644 index 87400029e..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minIni.c +++ /dev/null @@ -1,649 +0,0 @@ -/* minIni - Multi-Platform INI file parser, suitable for embedded systems - * - * These routines are in part based on the article "Multiplatform .INI Files" - * by Joseph J. Graf in the March 1994 issue of Dr. Dobb's Journal. - * - * Copyright (c) ITB CompuPhase, 2008-2009 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Version: $Id: minIni.c 24 2009-05-06 08:01:53Z thiadmer.riemersma $ - */ - -#if (defined _UNICODE || defined __UNICODE__ || defined UNICODE) && !defined MININI_ANSI -# if !defined UNICODE /* for Windows */ -# define UNICODE -# endif -# if !defined _UNICODE /* for C library */ -# define _UNICODE -# endif -#endif - -#include "minIni.h" -#if defined NDEBUG - #define assert(e) -#else - #include -#endif - -#if !defined __T - #include - #include - /* definition of TCHAR already in minIni.h */ - #define __T(s) s - #define _tcscat strcat - #define _tcschr strchr - #define _tcscmp strcmp - #define _tcscpy strcpy - #define _tcsicmp stricmp - #define _tcslen strlen - #define _tcsncpy strncpy - #define _tcsnicmp strnicmp - #define _tcsrchr strrchr - #define _tcstol strtol - #define _tfgets fgets - #define _tfputs fputs - #define _tfopen fopen - #define _tremove remove - #define _trename rename -#endif - -#if defined __linux || defined __linux__ - #define __LINUX__ -#endif -#if defined FREEBSD && !defined __FreeBSD__ - #define __FreeBSD__ -#endif -#if !defined strnicmp - #if defined __LINUX__ || defined __FreeBSD__ || defined __OpenBSD__ - #define strnicmp strncasecmp - #endif -#endif - -#if !defined INI_LINETERM - #define INI_LINETERM __T("\n") -#endif -#if !defined INI_FILETYPE - #define INI_FILETYPE FILE* -#endif - -#if !defined sizearray - #define sizearray(a) (sizeof(a) / sizeof((a)[0])) -#endif - -enum quote_option { - QUOTE_NONE, - QUOTE_ENQUOTE, - QUOTE_DEQUOTE, -}; - -static TCHAR *skipleading(const TCHAR *str) -{ - assert(str != NULL); - while (*str != '\0' && *str <= ' ') - str++; - return (TCHAR *)str; -} - -static TCHAR *skiptrailing(const TCHAR *str, const TCHAR *base) -{ - assert(str != NULL); - assert(base != NULL); - while (str > base && *(str-1) <= ' ') - str--; - return (TCHAR *)str; -} - -static TCHAR *striptrailing(TCHAR *str) -{ - TCHAR *ptr = skiptrailing(_tcschr(str, '\0'), str); - assert(ptr != NULL); - *ptr='\0'; - return str; -} - -static TCHAR *save_strncpy(TCHAR *dest, const TCHAR *source, size_t maxlen, enum quote_option option) -{ - int d, s; - - assert(maxlen>0); - if (option == QUOTE_ENQUOTE && maxlen < 3) - option = QUOTE_NONE; /* cannot store two quotes and a terminating zero in less than 3 characters */ - - switch (option) { - case QUOTE_NONE: - _tcsncpy(dest,source,maxlen); - dest[maxlen-1]='\0'; - break; - case QUOTE_ENQUOTE: - d = 0; - dest[d++] = '"'; - for (s = 0; source[s] != '\0' && d < maxlen - 2; s++, d++) { - if (source[s] == '"') { - if (d >= maxlen - 3) - break; /* no space to store the escape character plus the one that follows it */ - dest[d++] = '\\'; - } /* if */ - dest[d] = source[s]; - } /* for */ - dest[d++] = '"'; - dest[d] = '\0'; - break; - case QUOTE_DEQUOTE: - for (d = s = 0; source[s] != '\0' && d < maxlen - 1; s++, d++) { - if ((source[s] == '"' || source[s] == '\\') && source[s + 1] == '"') - s++; - dest[d] = source[s]; - } /* for */ - dest[d] = '\0'; - break; - default: - assert(0); - } /* switch */ - - return dest; -} - -static int getkeystring(INI_FILETYPE *fp, const TCHAR *Section, const TCHAR *Key, - int idxSection, int idxKey, TCHAR *Buffer, int BufferSize) -{ - TCHAR *sp, *ep; - int len, idx, isstring; - TCHAR LocalBuffer[INI_BUFFERSIZE]; - - assert(fp != NULL); - /* Move through file 1 line at a time until a section is matched or EOF. If - * parameter Section is NULL, only look at keys above the first section. If - * idxSection is postive, copy the relevant section name. - */ - len = (Section != NULL) ? _tcslen(Section) : 0; - if (len > 0 || idxSection >= 0) { - idx = -1; - do { - if (!ini_read(LocalBuffer, INI_BUFFERSIZE, fp)) - return 0; - sp = skipleading(LocalBuffer); - ep = _tcschr(sp, ']'); - } while (*sp != '[' || ep == NULL || (((int)(ep-sp-1) != len || _tcsnicmp(sp+1,Section,len) != 0) && ++idx != idxSection)); - if (idxSection >= 0) { - if (idx == idxSection) { - assert(ep != NULL); - assert(*ep == ']'); - *ep = '\0'; - save_strncpy(Buffer, sp + 1, BufferSize, QUOTE_NONE); - return 1; - } /* if */ - return 0; /* no more section found */ - } /* if */ - } /* if */ - - /* Now that the section has been found, find the entry. - * Stop searching upon leaving the section's area. - */ - assert(Key != NULL || idxKey >= 0); - len = (Key != NULL) ? (int)_tcslen(Key) : 0; - idx = -1; - do { - if (!ini_read(LocalBuffer,INI_BUFFERSIZE,fp) || *(sp = skipleading(LocalBuffer)) == '[') - return 0; - sp = skipleading(LocalBuffer); - ep = _tcschr(sp, '='); /* Parse out the equal sign */ - if (ep == NULL) - ep = _tcschr(sp, ':'); - } while (*sp == ';' || *sp == '#' || ep == NULL || (((int)(skiptrailing(ep,sp)-sp) != len || _tcsnicmp(sp,Key,len) != 0) && ++idx != idxKey)); - if (idxKey >= 0) { - if (idx == idxKey) { - assert(ep != NULL); - assert(*ep == '=' || *ep == ':'); - *ep = '\0'; - striptrailing(sp); - save_strncpy(Buffer, sp, BufferSize, QUOTE_NONE); - return 1; - } /* if */ - return 0; /* no more key found (in this section) */ - } /* if */ - - /* Copy up to BufferSize chars to buffer */ - assert(ep != NULL); - assert(*ep == '=' || *ep == ':'); - sp = skipleading(ep + 1); - /* Remove a trailing comment */ - isstring = 0; - for (ep = sp; *ep != '\0' && ((*ep != ';' && *ep != '#') || isstring); ep++) { - if (*ep == '"') { - if (*(ep + 1) == '"') - ep++; /* skip "" (both quotes) */ - else - isstring = !isstring; /* single quote, toggle isstring */ - } else if (*ep == '\\' && *(ep + 1) == '"') { - ep++; /* skip \" (both quotes */ - } /* if */ - } /* for */ - assert(ep != NULL && (*ep == '\0' || *ep == ';' || *ep == '#')); - *ep = '\0'; /* terminate at a comment */ - striptrailing(sp); - /* Remove double quotes surrounding a value */ - isstring = QUOTE_NONE; - if (*sp == '"' && (ep = _tcschr(sp, '\0')) != NULL && *(ep - 1) == '"') { - sp++; - *--ep = '\0'; - isstring = QUOTE_DEQUOTE; /* this is a string, so remove escaped characters */ - } /* if */ - save_strncpy(Buffer, sp, BufferSize, isstring); - return 1; -} - -/** ini_gets() - * \param Section the name of the section to search for - * \param Key the name of the entry to find the value of - * \param DefValue default string in the event of a failed read - * \param Buffer a pointer to the buffer to copy into - * \param BufferSize the maximum number of characters to copy - * \param Filename the name and full path of the .ini file to read from - * - * \return the number of characters copied into the supplied buffer - */ -int ini_gets(const TCHAR *Section, const TCHAR *Key, const TCHAR *DefValue, - TCHAR *Buffer, int BufferSize, const TCHAR *Filename) -{ - INI_FILETYPE fp; - int ok = 0; - - if (Buffer == NULL || BufferSize <= 0 || Key == NULL) - return 0; - if (ini_openread(Filename, &fp)) { - ok = getkeystring(&fp, Section, Key, -1, -1, Buffer, BufferSize); - ini_close(&fp); - } /* if */ - if (!ok) - save_strncpy(Buffer, DefValue, BufferSize, QUOTE_NONE); - return _tcslen(Buffer); -} - -/** ini_getl() - * \param Section the name of the section to search for - * \param Key the name of the entry to find the value of - * \param DefValue the default value in the event of a failed read - * \param Filename the name of the .ini file to read from - * - * \return the value located at Key - */ -long ini_getl(const TCHAR *Section, const TCHAR *Key, long DefValue, const TCHAR *Filename) -{ - TCHAR buff[64]; - int len = ini_gets(Section, Key, __T(""), buff, sizearray(buff), Filename); - return (len == 0) ? DefValue : _tcstol(buff,NULL,10); -} - -/** ini_getsection() - * \param idx the zero-based sequence number of the section to return - * \param Buffer a pointer to the buffer to copy into - * \param BufferSize the maximum number of characters to copy - * \param Filename the name and full path of the .ini file to read from - * - * \return the number of characters copied into the supplied buffer - */ -int ini_getsection(int idx, TCHAR *Buffer, int BufferSize, const TCHAR *Filename) -{ - INI_FILETYPE fp; - int ok = 0; - - if (Buffer == NULL || BufferSize <= 0 || idx < 0) - return 0; - if (ini_openread(Filename, &fp)) { - ok = getkeystring(&fp, NULL, NULL, idx, -1, Buffer, BufferSize); - ini_close(&fp); - } /* if */ - if (!ok) - *Buffer = '\0'; - return _tcslen(Buffer); -} - -/** ini_getkey() - * \param Section the name of the section to browse through, or NULL to - * browse through the keys outside any section - * \param idx the zero-based sequence number of the key to return - * \param Buffer a pointer to the buffer to copy into - * \param BufferSize the maximum number of characters to copy - * \param Filename the name and full path of the .ini file to read from - * - * \return the number of characters copied into the supplied buffer - */ -int ini_getkey(const TCHAR *Section, int idx, TCHAR *Buffer, int BufferSize, const TCHAR *Filename) -{ - INI_FILETYPE fp; - int ok = 0; - - if (Buffer == NULL || BufferSize <= 0 || idx < 0) - return 0; - if (ini_openread(Filename, &fp)) { - ok = getkeystring(&fp, Section, NULL, -1, idx, Buffer, BufferSize); - ini_close(&fp); - } /* if */ - if (!ok) - *Buffer = '\0'; - return _tcslen(Buffer); -} - - -#if ! defined INI_READONLY -static void ini_tempname(TCHAR *dest, const TCHAR *source, int maxlength) -{ - TCHAR *p; - - save_strncpy(dest, source, maxlength, QUOTE_NONE); - p = _tcsrchr(dest, '\0'); - assert(p != NULL); - *(p - 1) = '~'; -} - -static enum quote_option check_enquote(const TCHAR *Value) -{ - const TCHAR *p; - - /* run through the value, if it has trailing spaces, or '"', ';' or '#' - * characters, enquote it - */ - assert(Value != NULL); - for (p = Value; *p != '\0' && *p != '"' && *p != ';' && *p != '#'; p++) - /* nothing */; - return (*p != '\0' || (p > Value && *(p - 1) == ' ')) ? QUOTE_ENQUOTE : QUOTE_NONE; -} - -static void writesection(TCHAR *LocalBuffer, const TCHAR *Section, INI_FILETYPE *fp) -{ - TCHAR *p; - - if (Section != NULL && _tcslen(Section) > 0) { - LocalBuffer[0] = '['; - save_strncpy(LocalBuffer + 1, Section, INI_BUFFERSIZE - 4, QUOTE_NONE); /* -1 for '[', -1 for ']', -2 for '\r\n' */ - p = _tcsrchr(LocalBuffer, '\0'); - assert(p != NULL); - *p++ = ']'; - _tcscpy(p, INI_LINETERM); /* copy line terminator (typically "\n") */ - ini_write(LocalBuffer, fp); - } /* if */ -} - -static void writekey(TCHAR *LocalBuffer, const TCHAR *Key, const TCHAR *Value, INI_FILETYPE *fp) -{ - TCHAR *p; - enum quote_option option = check_enquote(Value); - save_strncpy(LocalBuffer, Key, INI_BUFFERSIZE - 3, QUOTE_NONE); /* -1 for '=', -2 for '\r\n' */ - p = _tcsrchr(LocalBuffer, '\0'); - assert(p != NULL); - *p++ = '='; - save_strncpy(p, Value, INI_BUFFERSIZE - (p - LocalBuffer) - 2, option); /* -2 for '\r\n' */ - p = _tcsrchr(LocalBuffer, '\0'); - assert(p != NULL); - _tcscpy(p, INI_LINETERM); /* copy line terminator (typically "\n") */ - ini_write(LocalBuffer, fp); -} - -static void write_quoted(const TCHAR *Value, INI_FILETYPE *fp) -{ - TCHAR s[3]; - int idx; - if (check_enquote(Value) == QUOTE_NONE) { - ini_write(Value, fp); - } else { - ini_write("\"", fp); - for (idx = 0; Value[idx] != '\0'; idx++) { - if (Value[idx] == '"') { - s[0] = '\\'; - s[1] = Value[idx]; - s[2] = '\0'; - } else { - s[0] = Value[idx]; - s[1] = '\0'; - } /* if */ - ini_write(s, fp); - } /* for */ - ini_write("\"", fp); - } /* if */ -} - -/** ini_puts() - * \param Section the name of the section to write the string in - * \param Key the name of the entry to write, or NULL to erase all keys in the section - * \param Value a pointer to the buffer the string, or NULL to erase the key - * \param Filename the name and full path of the .ini file to write to - * - * \return 1 if successful, otherwise 0 - */ -int ini_puts(const TCHAR *Section, const TCHAR *Key, const TCHAR *Value, const TCHAR *Filename) -{ - INI_FILETYPE rfp; - INI_FILETYPE wfp; - TCHAR *sp, *ep; - TCHAR LocalBuffer[INI_BUFFERSIZE]; - int len, match, count; - - assert(Filename!=NULL); - if (!ini_openread(Filename, &rfp)) { - /* If the .ini file doesn't exist, make a new file */ - if (Key!=NULL && Value!=NULL) { - if (!ini_openwrite(Filename, &wfp)) - return 0; - writesection(LocalBuffer, Section, &wfp); - writekey(LocalBuffer, Key, Value, &wfp); - ini_close(&wfp); - } /* if */ - return 1; - } /* if */ - - /* If parameters Key and Value are valid (so this is not an "erase" request) - * and the setting already exists and it already has the correct value, do - * nothing. This early bail-out avoids rewriting the INI file for no reason. - */ - if (Key!=NULL && Value!=NULL) { - match = getkeystring(&rfp, Section, Key, -1, -1, LocalBuffer, sizearray(LocalBuffer)); - if (match && _tcscmp(LocalBuffer,Value)==0) { - ini_close(&rfp); - return 1; - } /* if */ - /* key not found, or different value -> proceed (but rewind the input file first) */ - ini_rewind(&rfp); - } /* if */ - - /* Get a temporary file name to copy to. Use the existing name, but with - * the last character set to a '~'. - */ - ini_tempname(LocalBuffer, Filename, INI_BUFFERSIZE); - if (!ini_openwrite(LocalBuffer, &wfp)) { - ini_close(&rfp); - return 0; - } /* if */ - - /* Move through the file one line at a time until a section is - * matched or until EOF. Copy to temp file as it is read. - */ - count = 0; - len = (Section != NULL) ? _tcslen(Section) : 0; - if (len > 0) { - do { - if (!ini_read(LocalBuffer, INI_BUFFERSIZE, &rfp)) { - /* Failed to find section, so add one to the end */ - if (Key!=NULL && Value!=NULL) { - ini_write(INI_LINETERM, &wfp); /* force a new line (there may not have been one) behind the last line of the INI file */ - writesection(LocalBuffer, Section, &wfp); - writekey(LocalBuffer, Key, Value, &wfp); - } /* if */ - /* Clean up and rename */ - ini_close(&rfp); - ini_close(&wfp); - ini_remove(Filename); - ini_tempname(LocalBuffer, Filename, INI_BUFFERSIZE); - ini_rename(LocalBuffer, Filename); - return 1; - } /* if */ - /* Copy the line from source to dest, but not if this is the section that - * we are looking for and this section must be removed - */ - sp = skipleading(LocalBuffer); - ep = _tcschr(sp, ']'); - match = (*sp == '[' && ep != NULL && (int)(ep-sp-1) == len && _tcsnicmp(sp + 1,Section,len) == 0); - if (!match || Key!=NULL) { - /* Remove blank lines, but insert a blank line (possibly one that was - * removed on the previous iteration) before a new section. This creates - * "neat" INI files. - */ - if (_tcslen(sp) > 0) { - if (*sp == '[' && count > 0) - ini_write(INI_LINETERM, &wfp); - ini_write(sp, &wfp); - count++; - } /* if */ - } /* if */ - } while (!match); - } /* if */ - - /* Now that the section has been found, find the entry. Stop searching - * upon leaving the section's area. Copy the file as it is read - * and create an entry if one is not found. - */ - len = (Key!=NULL) ? _tcslen(Key) : 0; - for( ;; ) { - if (!ini_read(LocalBuffer, INI_BUFFERSIZE, &rfp)) { - /* EOF without an entry so make one */ - if (Key!=NULL && Value!=NULL) { - ini_write(INI_LINETERM, &wfp); /* force a new line (there may not have been one) behind the last line of the INI file */ - writekey(LocalBuffer, Key, Value, &wfp); - } /* if */ - /* Clean up and rename */ - ini_close(&rfp); - ini_close(&wfp); - ini_remove(Filename); - ini_tempname(LocalBuffer, Filename, INI_BUFFERSIZE); - ini_rename(LocalBuffer, Filename); - return 1; - } /* if */ - sp = skipleading(LocalBuffer); - ep = _tcschr(sp, '='); /* Parse out the equal sign */ - if (ep == NULL) - ep = _tcschr(sp, ':'); - match = (ep != NULL && (int)(skiptrailing(ep,sp)-sp) == len && _tcsnicmp(sp,Key,len) == 0); - if ((Key!=NULL && match) || *sp == '[') - break; /* found the key, or found a new section */ - /* in the section that we re-write, do not copy empty lines */ - if (Key!=NULL && _tcslen(sp) > 0) - ini_write(sp, &wfp); - } /* for */ - if (*sp == '[') { - /* found start of new section, the key was not in the specified - * section, so we add it just before the new section - */ - if (Key!=NULL && Value!=NULL) { - /* We cannot use "writekey()" here, because we need to preserve the - * contents of LocalBuffer. - */ - ini_write(Key, &wfp); - ini_write("=", &wfp); - write_quoted(Value, &wfp); - ini_write(INI_LINETERM INI_LINETERM, &wfp); /* put a blank line between the current and the next section */ - } /* if */ - /* write the new section header that we read previously */ - ini_write(sp, &wfp); - } else { - /* We found the key; ignore the line just read (with the key and - * the current value) and write the key with the new value. - */ - if (Key!=NULL && Value!=NULL) - writekey(LocalBuffer, Key, Value, &wfp); - } /* if */ - /* Copy the rest of the INI file (removing empty lines, except before a section) */ - while (ini_read(LocalBuffer, INI_BUFFERSIZE, &rfp)) { - sp = skipleading(LocalBuffer); - if (_tcslen(sp) > 0) { - if (*sp == '[') - ini_write(INI_LINETERM, &wfp); - ini_write(sp, &wfp); - } /* if */ - } /* while */ - /* Clean up and rename */ - ini_close(&rfp); - ini_close(&wfp); - ini_remove(Filename); - ini_tempname(LocalBuffer, Filename, INI_BUFFERSIZE); - ini_rename(LocalBuffer, Filename); - return 1; -} - -/* Ansi C "itoa" based on Kernighan & Ritchie's "Ansi C" book. */ -#define ABS(v) ((v) < 0 ? -(v) : (v)) - -static void strreverse(TCHAR *str) -{ - TCHAR t; - int i, j; - - for (i = 0, j = _tcslen(str) - 1; i < j; i++, j--) { - t = str[i]; - str[i] = str[j]; - str[j] = t; - } /* for */ -} - -static void long2str(long value, TCHAR *str) -{ - int i = 0; - long sign = value; - int n; - - /* generate digits in reverse order */ - do { - n = (int)(value % 10); /* get next lowest digit */ - str[i++] = (TCHAR)(ABS(n) + '0'); /* handle case of negative digit */ - } while (value /= 10); /* delete the lowest digit */ - if (sign < 0) - str[i++] = '-'; - str[i] = '\0'; - - strreverse(str); -} - -/** ini_putl() - * \param Section the name of the section to write the value in - * \param Key the name of the entry to write, or NULL to erase all keys in the section - * \param Value the value to write - * \param Filename the name and full path of the .ini file to write to - * - * \return 1 if successful, otherwise 0 - */ -int ini_putl(const TCHAR *Section, const TCHAR *Key, long Value, const TCHAR *Filename) -{ - TCHAR str[32]; - long2str(Value, str); - return ini_puts(Section, Key, str, Filename); -} -#endif /* !INI_READONLY */ - - -#if defined PORTABLE_STRNICMP -int strnicmp(const TCHAR *s1, const TCHAR *s2, size_t n) -{ - register unsigned TCHAR c1, c2; - - while (n-- != 0 && (*s1 || *s2)) { - c1 = *(const unsigned TCHAR *)s1++; - if ('a' <= c1 && c1 <= 'z') - c1 += ('A' - 'a'); - c2 = *(const unsigned TCHAR *)s2++; - if ('a' <= c2 && c2 <= 'z') - c2 += ('A' - 'a'); - if (c1 != c2) - return c1 - c2; - } /* while */ - return 0; -} -#endif /* PORTABLE_STRNICMP */ diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minIni.h b/flight/PiOS.x86/x86/Libraries/minIni/minIni.h deleted file mode 100644 index 096fa51bc..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/minIni.h +++ /dev/null @@ -1,84 +0,0 @@ -/* minIni - Multi-Platform INI file parser, suitable for embedded systems - * - * Copyright (c) ITB CompuPhase, 2008-2009 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Version: $Id: minIni.h 24 2009-05-06 08:01:53Z thiadmer.riemersma $ - */ -#ifndef MININI_H -#define MININI_H - -#include "minGlue.h" - -#if (defined _UNICODE || defined __UNICODE__ || defined UNICODE) && !defined INI_ANSIONLY - #include -#elif !defined __T - typedef char TCHAR; -#endif - -#if !defined INI_BUFFERSIZE - #define INI_BUFFERSIZE 512 -#endif - -#if defined __cplusplus - extern "C" { -#endif - -long ini_getl(const TCHAR *Section, const TCHAR *Key, long DefValue, const TCHAR *Filename); -int ini_gets(const TCHAR *Section, const TCHAR *Key, const TCHAR *DefValue, TCHAR *Buffer, int BufferSize, const TCHAR *Filename); -int ini_putl(const TCHAR *Section, const TCHAR *Key, long Value, const TCHAR *Filename); -int ini_puts(const TCHAR *Section, const TCHAR *Key, const TCHAR *Value, const TCHAR *Filename); -int ini_getsection(int idx, TCHAR *Buffer, int BufferSize, const TCHAR *Filename); -int ini_getkey(const TCHAR *Section, int idx, TCHAR *Buffer, int BufferSize, const TCHAR *Filename); - -#if defined __cplusplus - } -#endif - -#if defined __cplusplus -#include - -/* The C++ class in minIni.h was contributed by Steven Van Ingelgem. */ -class minIni -{ -public: - minIni(const std::string& filename) : iniFilename(filename) - { } - - long getl(const std::string& Section, const std::string& Key, long DefValue=0) const - { return ini_getl(Section.c_str(), Key.c_str(), DefValue, iniFilename.c_str()); } - - long geti(const std::string& Section, const std::string& Key, int DefValue=0) const - { return reinterpret_cast( this->getl(Section, Key, DefValue) ); } - - std::string gets(const std::string& Section, const std::string& Key, const std::string& DefValue="") const - { - char buffer[INI_BUFFERSIZE]; - ini_gets(Section.c_str(), Key.c_str(), DefValue.c_str(), buffer, INI_BUFFERSIZE, iniFilename.c_str()); - return buffer; - } - - bool put(const std::string& Section, const std::string& Key, long Value) const - { return ini_putl(Section.c_str(), Key.c_str(), Value, iniFilename.c_str()); } - - bool put(const std::string& Section, const std::string& Key, const std::string& Value) const - { return ini_puts(Section.c_str(), Key.c_str(), Value.c_str(), iniFilename.c_str()); } - -private: - std::string iniFilename; -}; - -#endif /* __cplusplus */ - -#endif /* MININI_H */ diff --git a/flight/PiOS.x86/x86/Libraries/minIni/minIni.pdf b/flight/PiOS.x86/x86/Libraries/minIni/minIni.pdf deleted file mode 100644 index 88f487b45..000000000 Binary files a/flight/PiOS.x86/x86/Libraries/minIni/minIni.pdf and /dev/null differ diff --git a/flight/PiOS.x86/x86/Libraries/minIni/test.c b/flight/PiOS.x86/x86/Libraries/minIni/test.c deleted file mode 100644 index cd4cd8183..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/test.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Simple test program - * - * wcl386 -wx -d2 -q test.c minini.c - */ -#include -#include -#include -#include "minIni.h" - -#define sizearray(a) (sizeof(a) / sizeof((a)[0])) - -const char inifile[] = "test.ini"; - -int main(void) -{ - char str[100]; - long n; - int s, k; - char section[50]; - - /* string reading */ - n = ini_gets("first", "string", "aap", str, sizearray(str), inifile); - assert(n==4 && strcmp(str,"noot")==0); - n = ini_gets("second", "string", "aap", str, sizearray(str), inifile); - assert(n==4 && strcmp(str,"mies")==0); - n = ini_gets("first", "dummy", "aap", str, sizearray(str), inifile); - assert(n==3 && strcmp(str,"aap")==0); - printf("1. String reading tests passed\n"); - - /* value reading */ - n = ini_getl("first", "val", -1, inifile); - assert(n==1); - n = ini_getl("second", "val", -1, inifile); - assert(n==2); - n = ini_getl("first", "dummy", -1, inifile); - assert(n==-1); - printf("2. Value reading tests passed\n"); - - /* string writing */ - n = ini_puts("first", "alt", "flagged as \"correct\"", inifile); - assert(n==1); - n = ini_gets("first", "alt", "aap", str, sizearray(str), inifile); - assert(n==20 && strcmp(str,"flagged as \"correct\"")==0); - /* ----- */ - n = ini_puts("second", "alt", "correct", inifile); - assert(n==1); - n = ini_gets("second", "alt", "aap", str, sizearray(str), inifile); - assert(n==7 && strcmp(str,"correct")==0); - /* ----- */ - n = ini_puts("third", "alt", "correct", inifile); - assert(n==1); - n = ini_gets("third", "alt", "aap", str, sizearray(str), inifile); - assert(n==7 && strcmp(str,"correct")==0); - /* ----- */ - printf("3. String writing tests passed\n"); - - /* section/key enumeration */ - for (s = 0; ini_getsection(s, section, sizearray(section), inifile) > 0; s++) { - printf("[%s]\n", section); - for (k = 0; ini_getkey(section, k, str, sizearray(str), inifile) > 0; k++) { - printf("\t%s\n", str); - } /* for */ - } /* for */ - - /* string deletion */ - n = ini_puts("first", "alt", NULL, inifile); - assert(n==1); - n = ini_puts("second", "alt", NULL, inifile); - assert(n==1); - n = ini_puts("third", NULL, NULL, inifile); - assert(n==1); - - return 0; -} - diff --git a/flight/PiOS.x86/x86/Libraries/minIni/test.ini b/flight/PiOS.x86/x86/Libraries/minIni/test.ini deleted file mode 100644 index 131fbdde8..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/test.ini +++ /dev/null @@ -1,8 +0,0 @@ -[First] -String=noot # trailing commment -Val=1 - -[Second] -Val = 2 -String = mies -#comment=3 diff --git a/flight/PiOS.x86/x86/Libraries/minIni/test_settings.ini b/flight/PiOS.x86/x86/Libraries/minIni/test_settings.ini deleted file mode 100644 index 2f10defba..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/test_settings.ini +++ /dev/null @@ -1,20 +0,0 @@ -# -# Test ini-File for minIni with FatFs on STM32 -# - -[Meta] -Version=0.0.1 -Author=Erwin Lindemann - -[Motor] -RPM_max=4000 -IGN_time1=123 -IGN_time2=543 - -[Regulator1] -Kp=10 -Ki=11 -Kd=12 -Limit_max=200 -Limit_min=100 - diff --git a/flight/PiOS.x86/x86/Libraries/minIni/wxMinIni.h b/flight/PiOS.x86/x86/Libraries/minIni/wxMinIni.h deleted file mode 100644 index 51609f959..000000000 --- a/flight/PiOS.x86/x86/Libraries/minIni/wxMinIni.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef WXMININI_H -#define WXMININI_H - -#include -#include "minini.h" - -#if defined __linux || defined __linux__ || defined __LINUX__ \ - || defined FREEBSD || defined __FreeBSD__ || defined __OpenBSD__ - #define DIRSEP_CHAR '/' - #define DIRSEP_STR "/" -#else - #define DIRSEP_CHAR '\\' - #define DIRSEP_STR "\\" -#endif - -class minIni { -public: - minIni(const wxString& name, const wxString& path=wxT("")) - { - if (path.Len() > 0) - iniFilename = path; - else - iniFilename = wxGetCwd(); - int len = iniFilename.Len(); - if (len > 0 && iniFilename[len] != DIRSEP_CHAR) - iniFilename += wxT(DIRSEP_STR); - iniFilename += name; - } - - long getl(const wxString& Section, const wxString& Key, long DefValue=0, const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - return ini_getl(Section.utf8_str(), Key.utf8_str(), DefValue, name.utf8_str()); - } - - int geti(const wxString& Section, const wxString& Key, int DefValue=0, const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - return (int)ini_getl(Section.utf8_str(), Key.utf8_str(), DefValue, name.utf8_str()); - } - - wxString gets(const wxString& Section, const wxString& Key, const wxString& DefValue=wxT(""), const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - char buffer[INI_BUFFERSIZE]; - ini_gets(Section.utf8_str(), Key.utf8_str(), DefValue.utf8_str(), buffer, INI_BUFFERSIZE, name.utf8_str()); - wxString result = wxString::FromUTF8(buffer); - return result; - } - - bool put(const wxString& Section, const wxString& Key, long Value, const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - return ini_putl(Section.utf8_str(), Key.utf8_str(), Value, name.utf8_str()); - } - - bool put(const wxString& Section, const wxString& Key, int Value, const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - return ini_putl(Section.utf8_str(), Key.utf8_str(), Value, name.utf8_str()); - } - - bool put(const wxString& Section, const wxString& Key, const wxString& Value, const wxString& Filename=wxT("")) - { - wxString name = Filename.Len() > 0 ? Filename : iniFilename; - return ini_puts(Section.utf8_str(), Key.utf8_str(), Value.utf8_str(), name.utf8_str()); - } - -private: - wxString iniFilename; -}; - -#endif /* WXMININI_H */