/**
* Clock Frequency for ADC conversion.
+ * This frequency will be rounded down to an integer
+ * submultiple of CPU_FREQ.
*
* $WIZ$ type = "int"
* $WIZ$ supports = "at91"
+ * $WIZ$ max = 5000000
*/
#define CONFIG_ADC_CLOCK 4800000UL
* Minimum time for starting up a conversion [us].
*
* $WIZ$ type = "int"
- * $WIZ$ min = 0
+ * $WIZ$ min = 20
* $WIZ$ supports = "at91"
*/
#define CONFIG_ADC_STARTUP_TIME 20
/**
- * Minimum time for sample and hold [us].
+ * Minimum time for sample and hold [ns].
*
* $WIZ$ type = "int"
- * $WIZ$ min = 0
+ * $WIZ$ min = 600
* $WIZ$ supports = "at91"
*/
#define CONFIG_ADC_SHTIME 834
*/
#define DC_MOTOR_LOG_FORMAT LOG_FMT_TERSE
+
+/**
+ * Min value of DC motor speed.
+ * \note Generally this value is the min value of the ADC conversion,
+ * if you use it.
+ *
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_DC_MOTOR_MIN_SPEED 0
+
+
+/**
+ * Max value of DC motor speed.
+ * \note Generally this value is the max value of the ADC conversion,
+ * if you use it.
+ *
+ * $WIZ$ type = "int"
+ * $WIZ$ max = 65535
+ */
+#define CONFIG_DC_MOTOR_MAX_SPEED 65535
+
+
+/**
+ * Sampling period in millisecond.
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_DC_MOTOR_SAMPLE_PERIOD 40
+
+/**
+ * Amount of millisecond before to read sample.
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_DC_MOTOR_SAMPLE_DELAY 2
+
+/**
+ * This control set which mode the driver use to lock share
+ * resources when we use the preempitive kernel.
+ * If we set to 1 we use the semaphore module otherwise the
+ * driver disable the switch context every time we need to access
+ * to shared sources.
+ *
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_DC_MOTOR_USE_SEM 1
+
#endif /* CFG_DC_MOTOR_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * -->
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ *
+ * \brief Configuration file for embedded flash module.
+ */
+
+#ifndef CFG_EMB_FLASH_H
+#define CFG_EMB_FLASH_H
+
+/**
+ * Module logging level.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define CONFIG_FLASH_EMB_LOG_LEVEL LOG_LVL_INFO
+
+/**
+ * module logging format.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define CONFIG_FLASH_EMB_LOG_FORMAT LOG_FMT_TERSE
+
+
+/**
+ * Write emb flash timeout.
+ * For how many milliseconds the cpu wait
+ * to complete write operation.
+ *
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_FLASH_WR_TIMEOUT 100
+
+/**
+ * Check this to disable embedded flash deprecated API support.
+ *
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_FLASH_DISABLE_OLD_API 1
+
+#endif /* CFG_FLASH_AT91_H */
#ifndef CFG_FAT_H
#define CFG_FAT_H
+/**
+ * Module logging level.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define FAT_LOG_LEVEL LOG_LVL_ERR
+
+/**
+ * Module logging format.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define FAT_LOG_FORMAT LOG_FMT_VERBOSE
+
+
/**
* Use word alignment to access FAT structure.
* $WIZ$ type = "boolean"
*
* \brief Configuration file for formatted write module.
*
- *
* \author Daniele Basile <asterix@develer.com>
*/
*/
#define CONFIG_LCD_ADDRESS_FAST 1
+/**
+ * Number of columns in LCD display.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "lcd_hd44_cols"
+ */
+#define CONFIG_LCD_COLS LCD_HD44_COLS_16
+
+/**
+ * Number of rows in LCD display.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "lcd_hd44_rows"
+ */
+#define CONFIG_LCD_ROWS LCD_HD44_ROWS_2
+
#endif /* CFG_LCD_H */
*
* \brief Configuration file for pocketbus module.
*
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_POCKETBUS_H
#define CFG_POCKETBUS_H
+/**
+ * Module logging level.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define POCKETBUS_LOG_LEVEL LOG_LVL_ERR
+
+/**
+ * Module logging format.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define POCKETBUS_LOG_FORMAT LOG_FMT_TERSE
+
+
/**
*Buffer len for pockebus protocol.
* $WIZ$ type = "int"
*/
#define CONFIG_POCKETBUS_BUFLEN 128
+/**
+ * Command replay timeout in milliseconds.
+ * $WIZ$ type = "int"
+ */
+#define CONFIG_POCKETBUS_CMD_REPLY_TIMEOUT 50
+
#endif /* CFG_POCKETBUS_H */
#ifndef CFG_THERMO_H
#define CFG_THERMO_H
+/**
+ * Module logging level.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define CONFIG_THERMO_LOG_LEVEL LOG_LVL_ERR
+/**
+ * Module logging format.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define CONFIG_THERMO_LOG_FORMAT LOG_FMT_TERSE
+
+
/**
* Interval at which thermo control is performed [ms].
*
*
* \brief Configuration file for xmodem module.
*
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_XMODEM_H
#define CFG_XMODEM_H
+/**
+ * Module logging level.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define CONFIG_XMODEM_LOG_LEVEL LOG_LVL_ERR
+/**
+ * Module logging format.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define CONFIG_XMODEM_LOG_FORMAT LOG_FMT_TERSE
+
+
/// Enable Rx. $WIZ$ type = "boolean"
#define CONFIG_XMODEM_RECV 1
gps_WIZARD_CSRC = \
bertos/kern/sem.c \
bertos/mware/formatwr.c \
+ bertos/io/kblock.c \
bertos/net/nmea.c \
+ bertos/io/kfile_block.c \
bertos/drv/kbd.c \
bertos/gfx/line.c \
bertos/drv/lcd_rit128x96.c \
bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c \
- bertos/kern/kfile.c \
+ bertos/kern/signal.c \
+ bertos/io/kfile.c \
bertos/gfx/text_format.c \
- bertos/struct/heap.c \
+ bertos/drv/timer.c \
bertos/drv/ser.c \
bertos/mware/hex.c \
bertos/net/nmeap/src/nmeap01.c \
bertos/gfx/text.c \
bertos/cpu/cortex-m3/drv/timer_cm3.c \
- bertos/drv/timer.c \
- bertos/kern/signal.c \
+ bertos/struct/heap.c \
bertos/kern/proc.c \
bertos/mware/event.c \
bertos/gfx/bitmap.c \
gps_CPU_CPPASRC = bertos/cpu/cortex-m3/hw/crt_cm3.S bertos/cpu/cortex-m3/hw/vectors_cm3.S
gps_CPU_CPPAFLAGS = -g -gdwarf-2 -mthumb -mno-thumb-interwork
gps_CPU_CPPFLAGS = -O0 -g3 -gdwarf-2 -mthumb -mno-thumb-interwork -fno-strict-aliasing -fwrapv -fverbose-asm -Ibertos/cpu/cortex-m3/ -D__ARM_LM3S1968__
-gps_CPU_CSRC = bertos/cpu/cortex-m3/hw/init_lm3s.c bertos/cpu/cortex-m3/drv/irq_cm3.c bertos/cpu/cortex-m3/drv/gpio_lm3s.c bertos/cpu/cortex-m3/drv/clock_lm3s.c
+gps_CPU_CSRC = bertos/cpu/cortex-m3/hw/init_cm3.c bertos/cpu/cortex-m3/drv/irq_cm3.c bertos/cpu/cortex-m3/drv/gpio_lm3s.c bertos/cpu/cortex-m3/drv/clock_lm3s.c
gps_PROGRAMMER_CPU = lm3s
+gps_CPU_LDFLAGS = -mthumb -mno-thumb-interwork -nostartfiles -Wl,--no-warn-mismatch -T bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld
gps_STOPFLASH_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh
gps_CPU = cortex-m3
gps_STOPDEBUG_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh
gps_DEBUG_SCRIPT = bertos/prg_scripts/arm/debug.sh
-gps_CPU_LDFLAGS = -mthumb -mno-thumb-interwork -nostartfiles -Wl,--no-warn-mismatch -T bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld
-gps_FLASH_SCRIPT = bertos/prg_scripts/arm/flash-cortex.sh
+gps_FLASH_SCRIPT = bertos/prg_scripts/arm/flash-lm3s.sh
include $(gps_SRC_PATH)/gps_user.mk
#include <drv/flash.h>
#include <drv/kbd.h>
+#include <io/kblock.h>
+#include <io/kfile_block.h>
+
#include <kern/proc.h>
#include <kern/sem.h>
/* Storage stuff */
#define GPS_POS_MAGIC 0xdeadbeef
-static Flash flash;
+static Flash flash_blk;
+static KFileBlock flash;
-static void flash_load_target(void)
+struct SettingsData
{
uint32_t magic;
+ long target_lat, target_lon;
+};
+
+static void flash_load_target(void)
+{
+ struct SettingsData data;
- kfile_seek(&flash.fd, -FLASH_PAGE_SIZE_BYTES, KSM_SEEK_END);
- kfile_read(&flash.fd, &magic, sizeof(magic));
- if (magic == GPS_POS_MAGIC)
+ kfile_seek(&flash.fd, -sizeof(data), KSM_SEEK_END);
+ kfile_read(&flash.fd, &data, sizeof(data));
+
+ if (data.magic == GPS_POS_MAGIC)
{
- kfile_read(&flash.fd, &target_lat, sizeof(target_lat));
- kfile_read(&flash.fd, &target_lon, sizeof(target_lon));
+ target_lat = data.target_lat;
+ target_lon = data.target_lon;
}
}
static void flash_save_target(void)
{
- const uint32_t magic = GPS_POS_MAGIC;
+ struct SettingsData data;
+
+ data.magic = GPS_POS_MAGIC;
+ data.target_lat = target_lat;
+ data.target_lon = target_lon;
- kfile_seek(&flash.fd, -FLASH_PAGE_SIZE_BYTES, KSM_SEEK_END);
- kfile_write(&flash.fd, &magic, sizeof(magic));
- kfile_write(&flash.fd, &target_lat, sizeof(target_lat));
- kfile_write(&flash.fd, &target_lon, sizeof(target_lon));
+ kfile_seek(&flash.fd, -sizeof(data), KSM_SEEK_END);
+ kfile_write(&flash.fd, &data, sizeof(data));
kfile_flush(&flash.fd);
}
ABS(lon) % 1000000L,
lon >= 0 ? 'E' : 'W');
text_xprintf(bm, 2, 0, TEXT_FILL,
- "Alt. %d", gga.altitude);
+ "Alt. %ld", gga.altitude);
text_xprintf(bm, 3, 0, TEXT_FILL,
"Speed: %d", vtg.km_speed);
if (gga.quality < countof(gps_fix))
scrsvr_timestamp = ticks_to_ms(timer_clock_unlocked());
LED_INIT();
- flash_init(&flash);
+ flash_init(&flash_blk, 0);
+ kfileblock_init(&flash, &flash_blk.blk);
flash_load_target();
ser_init(&ser_port, SER_UART1);
sS'TOOLCHAIN'
p8
(dp9
-Vtarget
+S'target'
p10
Varm-none-eabi
p11
-sVthread
+sS'thread'
p12
Vsingle
p13
-sVconfigured
+sS'configured'
p14
-V/scratch/sandra/lite/src/gcc-4.2/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-eabi --enable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --with-newlib --with-pkgversion=Sourcery G++ Lite 2008q1-126 --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-headers=yes --with-sysroot=/opt/codesourcery/arm-none-eabi --with-build-sysroot=/scratch/sandra/lite/eabi/install/arm-none-eabi --enable-poison-system-directories --with-build-time-tools=/scratch/sandra/lite/eabi/install/arm-none-eabi/bin --with-build-time-tools=/scratch/sandra/lite/eabi/install/arm-none-eabi/bin
+V/scratch/julian/2010q1-release-eabi-lite/src/gcc-4.4-2010q1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-eabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs='%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared --disable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite 2010q1-188' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-headers=yes --with-sysroot=/opt/codesourcery/arm-none-eabi --with-build-sysroot=/scratch/julian/2010q1-release-eabi-lite/install/arm-none-eabi --with-gmp=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/2010q1-release-eabi-lite/install/arm-none-eabi/bin --with-build-time-tools=/scratch/julian/2010q1-release-eabi-lite/install/arm-none-eabi/bin
p15
-sVversion
+sS'version'
p16
-V4.2.3
+V4.4.1
p17
-sVbuild
+sS'build'
p18
-VSourcery G++ Lite 2008q1-126
+VSourcery G++ Lite 2010q1-188
p19
-sVpath
+sS'path'
p20
-V/usr/local/arm-2008q1/bin/arm-none-eabi-gcc
+V/localhome/toolchain/arm/bin/arm-none-eabi-gcc
p21
ssS'ENABLED_MODULES'
p22
(lp23
-S'kernel'
+S'ser'
p24
-aS'ser'
+aS'kernel'
p25
aS'text'
p26
aS'kbd'
p27
-aS'formatwr'
+aS'semaphores'
p28
-aS'text_format'
+aS'kblock'
p29
-aS'sprintf'
+aS'formatwr'
p30
-aS'semaphores'
-p31
aS'kfile'
+p31
+aS'text_format'
p32
aS'lcd_rit128x96'
p33
aS'heap'
p34
-aS'timer'
+aS'sprintf'
p35
-aS'debug'
+aS'signal'
p36
-aS'nmea'
+aS'timer'
p37
-aS'signal'
+aS'debug'
p38
-asS'CPU_NAME'
+aS'kfile_block'
p39
-VLM3S1968
+aS'nmea'
p40
-sS'PROJECT_HW_PATH'
+asS'CPU_NAME'
p41
-S'../..'
+VLM3S1968
p42
-sS'PROJECT_SRC_PATH'
+sS'PROJECT_HW_PATH'
p43
-S'.'
+S'../..'
p44
-sS'PRESET'
+sS'PROJECT_SRC_PATH'
p45
-NsS'OUTPUT'
+S'.'
p46
-(lp47
-s.
\ No newline at end of file
+sS'PRESET'
+p47
+I01
+sS'OUTPUT'
+p48
+(lp49
+S'codelite'
+p50
+as.
\ No newline at end of file