Some fix to comply to new bertos version.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 10 Sep 2010 09:53:23 +0000 (09:53 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 10 Sep 2010 09:53:23 +0000 (09:53 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4229 38d2e660-2303-0410-9eaa-f027e97ec537

12 files changed:
boards/ek-lm3s1968/examples/gps/cfg/cfg_adc.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_dc_motor.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_emb_flash.h [new file with mode: 0644]
boards/ek-lm3s1968/examples/gps/cfg/cfg_fat.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_formatwr.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_lcd_hd44.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_pocketbus.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_thermo.h
boards/ek-lm3s1968/examples/gps/cfg/cfg_xmodem.h
boards/ek-lm3s1968/examples/gps/gps.mk
boards/ek-lm3s1968/examples/gps/main.c
boards/ek-lm3s1968/examples/gps/project.bertos

index 90aeb7bdfd13119341ca045ebf4d4ccb117eaa7c..df2587be517232fd86b9192faa5c39172c793330 100644 (file)
 
 /**
  * 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
index 05af01b8ed545cf8929b28f83d4678ad2b4e3a84..59650e431f8df5c35957d87c4eeb9cb3adb377fe 100644 (file)
  */
 #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 */
diff --git a/boards/ek-lm3s1968/examples/gps/cfg/cfg_emb_flash.h b/boards/ek-lm3s1968/examples/gps/cfg/cfg_emb_flash.h
new file mode 100644 (file)
index 0000000..9378552
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * \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 */
index 83772f45047a2d37e8dc8e3d41d9a8f99a2b07b3..fcd717af3591aede4c4b578bab04e6f794d445c2 100644 (file)
 #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"
index ec13eaaf2a50fc22d03397855723ce7401d1e475..bac8aca7a75e261781267798dc669bc548e9396b 100644 (file)
@@ -32,7 +32,6 @@
  *
  * \brief Configuration file for formatted write module.
  *
- *
  * \author Daniele Basile <asterix@develer.com>
  */
 
index 78f1f20bb9088b5accd1772a37401e939b29b0b6..7bea43766328eb6b69640e8c29210cc2289f4a06 100644 (file)
  */
 #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 */
 
index 4ea138438e7994ae9a641fb342b543e116ecfc2f..aa0b090bb1aadaf9d6e65197474c586bdd404465 100644 (file)
  *
  * \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 */
index 0099fa8706e09c6fd22631803277ddd58df3fbb0..2734f8990b9c8a6bb98a11b8e13fa3364818caf1 100644 (file)
 #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].
  *
index a7bff93088099b9eb9856705a2927ecd304ff817..38db7359a17e9208be9c5c36e31be52aa76ad3fd 100644 (file)
  *
  * \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
 
index 99c68f3628e304259c99ca893dde2b7f1b932e4e..752fe65e2ff66e7e93a9154516b607989f0adcb7 100644 (file)
@@ -21,21 +21,23 @@ gps_HW_PATH = boards/ek-lm3s1968
 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 \
@@ -91,13 +93,13 @@ gps_ASRC = $(gps_CPU_ASRC) $(gps_WIZARD_ASRC) $(gps_USER_ASRC)
 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
index 5e32dc5ef8a0af6c4268c4609da7bd1465185563..0c2f4e6a2bd161c456c99efe512cccc11594b0a3 100644 (file)
@@ -45,6 +45,9 @@
 #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>
 
@@ -83,29 +86,39 @@ static long target_lat, target_lon;
 
 /* 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);
 }
 
@@ -451,7 +464,7 @@ static void gps_data(Bitmap *bm)
                                                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))
@@ -531,7 +544,8 @@ static void init(void)
        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);
index 4e4b40a110c3b667cf15d2d1d105fb5164cdf8e8..8737046dd64d9d9a8229b5a35392b00ec721f120 100644 (file)
@@ -17,78 +17,85 @@ p7
 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