hostsim test
authorzer0 <zer0@platinum>
Tue, 19 Jan 2010 23:15:55 +0000 (00:15 +0100)
committerzer0 <zer0@platinum>
Tue, 19 Jan 2010 23:15:55 +0000 (00:15 +0100)
15 files changed:
config/Configure.help
config/config.in
config/generate_aversive_config
include/aversive/wait.h
mk/aversive_project.mk
modules/base/hostsim/Makefile [new file with mode: 0644]
modules/base/hostsim/hostsim.c [new file with mode: 0644]
modules/base/hostsim/hostsim.h [new file with mode: 0644]
modules/base/scheduler/scheduler_interrupt.c
modules/base/scheduler/test/.config
modules/base/scheduler/test/main.c
modules/comm/uart/Makefile
modules/comm/uart/uart_host.c
modules/hardware/timer/Makefile
modules/hardware/timer/timer_host.c [new file with mode: 0644]

index f300a4f..a960040 100644 (file)
@@ -50,6 +50,13 @@ CONFIG_MODULE_VECT2
   This module provides functions for converting 2D vectors from 
   polar to cartesian and vice versa.
 
   This module provides functions for converting 2D vectors from 
   polar to cartesian and vice versa.
 
+CONFIG_MODULE_HOSTSIM
+  AVR simulator. This code is used on host (PC for instance) to
+  generate a signal that will call other aversive modules like
+  scheduler or uart. The goal is to simulate the behaviour of
+  hardware interrupts in a unix application. This has no effect
+  when compiling for AVR.
+
 
 CONFIG_MODULE_SCHEDULER
   The 'scheduler' module is NOT a scheduler in the same way than in
 
 CONFIG_MODULE_SCHEDULER
   The 'scheduler' module is NOT a scheduler in the same way than in
index 415f082..305cb79 100644 (file)
@@ -131,6 +131,9 @@ dep_bool 'Vect2 lib' CONFIG_MODULE_VECT2 \
 dep_bool 'Geometry lib' CONFIG_MODULE_GEOMETRY \
        $CONFIG_MATH_LIB
 
 dep_bool 'Geometry lib' CONFIG_MODULE_GEOMETRY \
        $CONFIG_MATH_LIB
 
+#### Hostsim
+bool 'Hostsim' CONFIG_MODULE_HOSTSIM
+
 #### SCHEDULER
 bool 'Scheduler' CONFIG_MODULE_SCHEDULER
 
 #### SCHEDULER
 bool 'Scheduler' CONFIG_MODULE_SCHEDULER
 
index 534a131..c78c127 100755 (executable)
@@ -9,6 +9,7 @@
 #
 MODULES_LIST="CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL,/devices/brushless_motors/brushless_3phase_digital_hall
               CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE,/devices/brushless_motors/brushless_3phase_digital_hall_double
 #
 MODULES_LIST="CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL,/devices/brushless_motors/brushless_3phase_digital_hall
               CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE,/devices/brushless_motors/brushless_3phase_digital_hall_double
+              CONFIG_MODULE_HOSTSIM,base/hostsim
               CONFIG_MODULE_MENU,ihm/menu
               CONFIG_MODULE_PARSE,ihm/parse
               CONFIG_MODULE_RDLINE,ihm/rdline
               CONFIG_MODULE_MENU,ihm/menu
               CONFIG_MODULE_PARSE,ihm/parse
               CONFIG_MODULE_RDLINE,ihm/rdline
@@ -125,6 +126,11 @@ if grep "CONFIG_FDEVOPEN_COMPAT=y" $1 > /dev/null 2> /dev/null
     echo "CFLAGS += -D__STDIO_FDEVOPEN_COMPAT_12" >> $2
 fi
 
     echo "CFLAGS += -D__STDIO_FDEVOPEN_COMPAT_12" >> $2
 fi
 
+if grep "CONFIG_MODULE_HOSTSIM=y" $1 > /dev/null 2> /dev/null
+    then
+    echo "PTHREAD_LDFLAGS = -lpthread" >> $2
+fi
+
 
 
 ####
 
 
 ####
index 176152d..a845721 100644 (file)
 \r
 #ifdef HOST_VERSION\r
 \r
 \r
 #ifdef HOST_VERSION\r
 \r
-#define wait_3cyc(n) do {} while(0)\r
-#define wait_4cyc(n) do {} while(0)\r
-#define wait_ms(n) do {} while(0)\r
+#include <unistd.h>\r
+\r
+#define wait_3cyc(n) do { volatile int a = 0; a++; } while (0)\r
+#define wait_4cyc(n) do { volatile int a = 0; a++; } while (0)\r
+#define wait_ms(n) host_wait_ms(n)\r
 \r
 #else /* HOST_VERSION */\r
 \r
 \r
 #else /* HOST_VERSION */\r
 \r
index cf9c938..8e56130 100644 (file)
@@ -101,7 +101,7 @@ ifeq ($(HOST),avr)
 LDFLAGS += -mmcu=$(MCU) $(PRINTF_LDFLAGS)
 LDFLAGS += -Wl,-Map=$(addprefix compiler_files/,$(TARGET).map),--cref
 else
 LDFLAGS += -mmcu=$(MCU) $(PRINTF_LDFLAGS)
 LDFLAGS += -Wl,-Map=$(addprefix compiler_files/,$(TARGET).map),--cref
 else
-LDFLAGS += 
+LDFLAGS += $(PTHREAD_LDFLAGS)
 endif
 
 LDFLAGS += $(MATH_LIB)
 endif
 
 LDFLAGS += $(MATH_LIB)
diff --git a/modules/base/hostsim/Makefile b/modules/base/hostsim/Makefile
new file mode 100644 (file)
index 0000000..ca08af0
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = hostsim
+
+SRC  = hostsim.c
+
+###########################################
+
+include $(AVERSIVE_DIR)/mk/aversive_module.mk
diff --git a/modules/base/hostsim/hostsim.c b/modules/base/hostsim/hostsim.c
new file mode 100644 (file)
index 0000000..850d23a
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ *  Copyright Droids Corporation
+ *  Olivier Matz <zer0@droids-corp.org>
+ *
+ *  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 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Revision : $Id: main.c,v 1.10 2009-11-08 17:24:33 zer0 Exp $
+ *
+ */
+
+#ifdef HOST_VERSION
+/*
+ * AVR simulator. This code is used on host (PC for instance) to
+ * generate a signal that will call other aversive modules like
+ * scheduler or uart. The goal is to simulate the behaviour of
+ * hardware interrupts in a unix application.
+ */
+
+#include <aversive.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#ifdef CONFIG_MODULE_SCHEDULER
+#include <scheduler.h>
+#endif
+
+pthread_mutex_t mut;
+static volatile int cpt = 0;
+
+#ifdef SA_SIGINFO
+static void sigusr1(__attribute__((unused)) int sig,
+                   __attribute__((unused)) siginfo_t *info,
+                   __attribute__((unused)) void *uc)
+#else
+void sigusr1(__attribute__((unused)) int sig)
+#endif
+{
+       pthread_mutex_unlock(&mut);
+
+#ifdef CONFIG_MODULE_SCHEDULER
+       scheduler_interrupt();
+#endif
+}
+
+void host_wait_ms(int ms)
+{
+       struct timeval tv, tv2, diff;
+
+       gettimeofday(&tv, NULL);
+       diff.tv_sec = (1000 * ms) / 1000000;
+       diff.tv_usec = (1000 * ms) % 1000000;
+       timeradd(&tv, &diff, &tv);
+       gettimeofday(&tv2, NULL);
+
+       while (timercmp(&tv2, &tv, <)) {
+               usleep(1000);
+               gettimeofday(&tv2, NULL);
+       }
+}
+
+
+/* sends signal to child */
+void *parent(void *arg)
+{
+       pthread_t *thread = arg;
+       struct timeval cur_tv, prev_tv, tv_millisec;
+       int n;
+
+       gettimeofday(&prev_tv, NULL);
+
+       while (1) {
+               usleep(1000);
+               gettimeofday(&cur_tv, NULL);
+
+               n = 0;
+               while (timercmp(&prev_tv, &cur_tv, <)) {
+                       if (n > 5) {
+                               /* give some time between subsequent
+                                * signals */
+                               usleep(100);
+                               n = 0;
+                       }
+                       pthread_mutex_lock(&mut);
+                       pthread_kill(*thread, SIGUSR1);
+
+                       /* signal was acked */
+                       tv_millisec.tv_sec = 0;
+                       tv_millisec.tv_usec = 1000;
+                       timeradd(&prev_tv, &tv_millisec, &prev_tv);
+                       n ++;
+               }
+       }
+
+       pthread_exit(NULL);
+       return NULL;
+}
+
+int hostsim_init(void)
+{
+       struct sigaction sigact;
+       pthread_t parent_id, child_id;
+       int ret;
+
+       pthread_mutex_init(&mut, NULL);
+
+       parent_id = pthread_self();
+
+       pthread_mutex_lock(&mut);
+       ret = pthread_create(&child_id, NULL, parent, (void *)&parent_id);
+       if (ret) {
+               printf("pthread_create() returned %d\n", ret);
+               pthread_mutex_unlock(&mut);
+               return -1;
+       }
+
+       /* register a signal handler, which is interruptible */
+       memset(&sigact, 0, sizeof(sigact));
+       sigemptyset(&sigact.sa_mask);
+       sigact.sa_flags |= SA_NODEFER;
+       sigact.sa_sigaction = sigusr1;
+       sigaction(SIGUSR1, &sigact, NULL);
+
+       /* */
+       if (siginterrupt (SIGUSR1, 0) != 0)
+               return -1;
+
+       pthread_mutex_unlock(&mut);
+
+       return 0;
+}
+#endif /* HOST_VERSION */
diff --git a/modules/base/hostsim/hostsim.h b/modules/base/hostsim/hostsim.h
new file mode 100644 (file)
index 0000000..b61d9e3
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  Copyright Droids Corporation
+ *  Olivier Matz <zer0@droids-corp.org>
+ *
+ *  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 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Revision : $Id: main.c,v 1.10 2009-11-08 17:24:33 zer0 Exp $
+ *
+ */
+
+/* initialize hostsim framework */
+int hostsim_init(void);
+
+/* replacement for wait_ms() */
+void host_wait_ms(int ms);
index 15b9409..7045776 100644 (file)
@@ -45,13 +45,13 @@ void scheduler_enable_restore(uint8_t old_prio)
        priority_running = old_prio;
 }
 
        priority_running = old_prio;
 }
 
-/** 
+/**
  *  this function is called from a timer interruption. If an event has
  *  to be scheduled, it will execute the fonction (IRQ are allowed
  *  during the execution of the function). This interruption can be
  *  interrupted by itself too, in this case only events with a higher
  *  priority can be scheduled.
  *  this function is called from a timer interruption. If an event has
  *  to be scheduled, it will execute the fonction (IRQ are allowed
  *  during the execution of the function). This interruption can be
  *  interrupted by itself too, in this case only events with a higher
  *  priority can be scheduled.
- * 
+ *
  *  We assume that this function is called from a SIGNAL(), with
  *  global interrupt flag disabled --> that's why we can use cli() and
  *  sei() instead of IRQ_LOCK(flags).
  *  We assume that this function is called from a SIGNAL(), with
  *  global interrupt flag disabled --> that's why we can use cli() and
  *  sei() instead of IRQ_LOCK(flags).
index 73a8d18..47bbc9c 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# Automatically generated make config: don't edit
+# Automatically generated by make menuconfig: don't edit
 #
 
 #
 #
 
 #
 # CONFIG_MCU_ATMEGA645 is not set
 # CONFIG_MCU_ATMEGA6450 is not set
 CONFIG_MCU_ATMEGA128=y
 # CONFIG_MCU_ATMEGA645 is not set
 # CONFIG_MCU_ATMEGA6450 is not set
 CONFIG_MCU_ATMEGA128=y
+# CONFIG_MCU_ATMEGA1281 is not set
 # CONFIG_MCU_AT90CAN128 is not set
 # CONFIG_MCU_AT94K is not set
 # CONFIG_MCU_AT90S1200 is not set
 # CONFIG_MCU_AT90CAN128 is not set
 # CONFIG_MCU_AT94K is not set
 # CONFIG_MCU_AT90S1200 is not set
+# CONFIG_MCU_ATMEGA2560 is not set
+# CONFIG_MCU_ATMEGA256 is not set
 CONFIG_QUARTZ=16000000
 
 #
 CONFIG_QUARTZ=16000000
 
 #
@@ -60,6 +63,7 @@ CONFIG_QUARTZ=16000000
 CONFIG_OPTM_S=y
 CONFIG_MATH_LIB=y
 # CONFIG_FDEVOPEN_COMPAT is not set
 CONFIG_OPTM_S=y
 CONFIG_MATH_LIB=y
 # CONFIG_FDEVOPEN_COMPAT is not set
+# CONFIG_NO_PRINTF is not set
 # CONFIG_MINIMAL_PRINTF is not set
 CONFIG_STANDARD_PRINTF=y
 # CONFIG_ADVANCED_PRINTF is not set
 # CONFIG_MINIMAL_PRINTF is not set
 CONFIG_STANDARD_PRINTF=y
 # CONFIG_ADVANCED_PRINTF is not set
@@ -70,31 +74,31 @@ CONFIG_FORMAT_IHEX=y
 #
 # Base modules
 #
 #
 # Base modules
 #
-
-#
-# Enable math library in generation options to see all modules
-#
 CONFIG_MODULE_CIRBUF=y
 # CONFIG_MODULE_CIRBUF_LARGE is not set
 # CONFIG_MODULE_FIXED_POINT is not set
 # CONFIG_MODULE_VECT2 is not set
 CONFIG_MODULE_CIRBUF=y
 # CONFIG_MODULE_CIRBUF_LARGE is not set
 # CONFIG_MODULE_FIXED_POINT is not set
 # CONFIG_MODULE_VECT2 is not set
+# CONFIG_MODULE_GEOMETRY is not set
+CONFIG_MODULE_HOSTSIM=y
 CONFIG_MODULE_SCHEDULER=y
 CONFIG_MODULE_SCHEDULER=y
+# CONFIG_MODULE_SCHEDULER_STATS is not set
 CONFIG_MODULE_SCHEDULER_CREATE_CONFIG=y
 # CONFIG_MODULE_SCHEDULER_USE_TIMERS is not set
 CONFIG_MODULE_SCHEDULER_CREATE_CONFIG=y
 # CONFIG_MODULE_SCHEDULER_USE_TIMERS is not set
-CONFIG_MODULE_SCHEDULER_TIMER0=y
-# CONFIG_MODULE_SCHEDULER_MANUAL is not set
+# CONFIG_MODULE_SCHEDULER_TIMER0 is not set
+CONFIG_MODULE_SCHEDULER_MANUAL=y
 # CONFIG_MODULE_TIME is not set
 # CONFIG_MODULE_TIME_CREATE_CONFIG is not set
 # CONFIG_MODULE_TIME is not set
 # CONFIG_MODULE_TIME_CREATE_CONFIG is not set
+# CONFIG_MODULE_TIME_EXT is not set
+# CONFIG_MODULE_TIME_EXT_CREATE_CONFIG is not set
 
 #
 # Communication modules
 #
 
 #
 # Communication modules
 #
-
-#
-# uart needs circular buffer, mf2 client may need scheduler
-#
 CONFIG_MODULE_UART=y
 CONFIG_MODULE_UART=y
+# CONFIG_MODULE_UART_9BITS is not set
 # CONFIG_MODULE_UART_CREATE_CONFIG is not set
 # CONFIG_MODULE_UART_CREATE_CONFIG is not set
+# CONFIG_MODULE_SPI is not set
+# CONFIG_MODULE_SPI_CREATE_CONFIG is not set
 # CONFIG_MODULE_I2C is not set
 # CONFIG_MODULE_I2C_MASTER is not set
 # CONFIG_MODULE_I2C_MULTIMASTER is not set
 # CONFIG_MODULE_I2C is not set
 # CONFIG_MODULE_I2C_MASTER is not set
 # CONFIG_MODULE_I2C_MULTIMASTER is not set
@@ -108,11 +112,12 @@ CONFIG_MODULE_UART=y
 #
 # Hardware modules
 #
 #
 # Hardware modules
 #
-# CONFIG_MODULE_TIMER is not set
+CONFIG_MODULE_TIMER=y
 # CONFIG_MODULE_TIMER_CREATE_CONFIG is not set
 # CONFIG_MODULE_TIMER_DYNAMIC is not set
 # CONFIG_MODULE_PWM is not set
 # CONFIG_MODULE_PWM_CREATE_CONFIG is not set
 # CONFIG_MODULE_TIMER_CREATE_CONFIG is not set
 # CONFIG_MODULE_TIMER_DYNAMIC is not set
 # CONFIG_MODULE_PWM is not set
 # CONFIG_MODULE_PWM_CREATE_CONFIG is not set
+# CONFIG_MODULE_PWM_NG is not set
 # CONFIG_MODULE_ADC is not set
 # CONFIG_MODULE_ADC_CREATE_CONFIG is not set
 
 # CONFIG_MODULE_ADC is not set
 # CONFIG_MODULE_ADC_CREATE_CONFIG is not set
 
@@ -126,6 +131,7 @@ CONFIG_MODULE_UART=y
 # CONFIG_MODULE_RDLINE_KILL_BUF is not set
 # CONFIG_MODULE_RDLINE_HISTORY is not set
 # CONFIG_MODULE_PARSE is not set
 # CONFIG_MODULE_RDLINE_KILL_BUF is not set
 # CONFIG_MODULE_RDLINE_HISTORY is not set
 # CONFIG_MODULE_PARSE is not set
+# CONFIG_MODULE_PARSE_NO_FLOAT is not set
 
 #
 # External devices modules
 
 #
 # External devices modules
@@ -134,6 +140,8 @@ CONFIG_MODULE_UART=y
 # CONFIG_MODULE_LCD_CREATE_CONFIG is not set
 # CONFIG_MODULE_MULTISERVO is not set
 # CONFIG_MODULE_MULTISERVO_CREATE_CONFIG is not set
 # CONFIG_MODULE_LCD_CREATE_CONFIG is not set
 # CONFIG_MODULE_MULTISERVO is not set
 # CONFIG_MODULE_MULTISERVO_CREATE_CONFIG is not set
+# CONFIG_MODULE_AX12 is not set
+# CONFIG_MODULE_AX12_CREATE_CONFIG is not set
 
 #
 # Brushless motor drivers (you should enable pwm modules to see all)
 
 #
 # Brushless motor drivers (you should enable pwm modules to see all)
@@ -144,31 +152,32 @@ CONFIG_MODULE_UART=y
 # CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG is not set
 
 #
 # CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG is not set
 
 #
-# Encoders
+# Encoders (you need comm/spi for encoders_spi)
 #
 # CONFIG_MODULE_ENCODERS_MICROB is not set
 # CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG is not set
 # CONFIG_MODULE_ENCODERS_EIRBOT is not set
 # CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG is not set
 #
 # CONFIG_MODULE_ENCODERS_MICROB is not set
 # CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG is not set
 # CONFIG_MODULE_ENCODERS_EIRBOT is not set
 # CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG is not set
+# CONFIG_MODULE_ENCODERS_SPI is not set
+# CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG is not set
 
 #
 
 #
-# Robot specific modules
+# Robot specific modules (fixed point lib may be needed)
 #
 # CONFIG_MODULE_ROBOT_SYSTEM is not set
 #
 # CONFIG_MODULE_ROBOT_SYSTEM is not set
+# CONFIG_MODULE_ROBOT_SYSTEM_USE_F64 is not set
 # CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT is not set
 # CONFIG_MODULE_POSITION_MANAGER is not set
 # CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT is not set
 # CONFIG_MODULE_POSITION_MANAGER is not set
+# CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE is not set
 # CONFIG_MODULE_TRAJECTORY_MANAGER is not set
 # CONFIG_MODULE_BLOCKING_DETECTION_MANAGER is not set
 # CONFIG_MODULE_OBSTACLE_AVOIDANCE is not set
 # CONFIG_MODULE_TRAJECTORY_MANAGER is not set
 # CONFIG_MODULE_BLOCKING_DETECTION_MANAGER is not set
 # CONFIG_MODULE_OBSTACLE_AVOIDANCE is not set
+# CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG is not set
 
 #
 # Control system modules
 #
 # CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set
 
 #
 # Control system modules
 #
 # CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set
-
-#
-# Filters
-#
 # CONFIG_MODULE_PID is not set
 # CONFIG_MODULE_PID_CREATE_CONFIG is not set
 # CONFIG_MODULE_RAMP is not set
 # CONFIG_MODULE_PID is not set
 # CONFIG_MODULE_PID_CREATE_CONFIG is not set
 # CONFIG_MODULE_RAMP is not set
@@ -177,11 +186,13 @@ CONFIG_MODULE_UART=y
 # CONFIG_MODULE_BIQUAD is not set
 
 #
 # CONFIG_MODULE_BIQUAD is not set
 
 #
-# Crypto modules
+# Radio devices
 #
 #
+# CONFIG_MODULE_CC2420 is not set
+# CONFIG_MODULE_CC2420_CREATE_CONFIG is not set
 
 #
 
 #
-# Crypto modules depend on utils module
+# Crypto modules
 #
 # CONFIG_MODULE_AES is not set
 # CONFIG_MODULE_AES_CTR is not set
 #
 # CONFIG_MODULE_AES is not set
 # CONFIG_MODULE_AES_CTR is not set
@@ -192,20 +203,12 @@ CONFIG_MODULE_UART=y
 #
 # Encodings modules
 #
 #
 # Encodings modules
 #
-
-#
-# Encoding modules depend on utils module
-#
 # CONFIG_MODULE_BASE64 is not set
 # CONFIG_MODULE_HAMMING is not set
 
 #
 # Debug modules
 #
 # CONFIG_MODULE_BASE64 is not set
 # CONFIG_MODULE_HAMMING is not set
 
 #
 # Debug modules
 #
-
-#
-# Debug modules depend on utils module
-#
 # CONFIG_MODULE_DIAGNOSTIC is not set
 # CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set
 CONFIG_MODULE_ERROR=y
 # CONFIG_MODULE_DIAGNOSTIC is not set
 # CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set
 CONFIG_MODULE_ERROR=y
@@ -237,7 +240,9 @@ CONFIG_AVRDUDE_PROG_STK200=y
 # CONFIG_AVRDUDE_PROG_BSD is not set
 # CONFIG_AVRDUDE_PROG_DAPA is not set
 # CONFIG_AVRDUDE_PROG_JTAG1 is not set
 # CONFIG_AVRDUDE_PROG_BSD is not set
 # CONFIG_AVRDUDE_PROG_DAPA is not set
 # CONFIG_AVRDUDE_PROG_JTAG1 is not set
+# CONFIG_AVRDUDE_PROG_AVR109 is not set
 CONFIG_AVRDUDE_PORT="/dev/parport0"
 CONFIG_AVRDUDE_PORT="/dev/parport0"
+CONFIG_AVRDUDE_BAUDRATE=19200
 
 #
 # Avarice
 
 #
 # Avarice
@@ -246,3 +251,4 @@ CONFIG_AVARICE_PORT="/dev/ttyS0"
 CONFIG_AVARICE_DEBUG_PORT=1234
 CONFIG_AVARICE_PROG_MKI=y
 # CONFIG_AVARICE_PROG_MKII is not set
 CONFIG_AVARICE_DEBUG_PORT=1234
 CONFIG_AVARICE_PROG_MKI=y
 # CONFIG_AVARICE_PROG_MKII is not set
+# CONFIG_AVRDUDE_CHECK_SIGNATURE is not set
index 43aff0f..cc9242c 100644 (file)
@@ -23,6 +23,8 @@
 #include <aversive/wait.h>\r
 #include <stdio.h>\r
 #include <uart.h>\r
 #include <aversive/wait.h>\r
 #include <stdio.h>\r
 #include <uart.h>\r
+//#include <timer.h>\r
+#include <hostsim.h>\r
 \r
 uint8_t event_id;\r
 \r
 \r
 uint8_t event_id;\r
 \r
@@ -45,7 +47,7 @@ void f3(void * nothing)
 \r
 void supp(void * nothing)\r
 {\r
 \r
 void supp(void * nothing)\r
 {\r
-  scheduler_del_event(event_id);\r
+       scheduler_del_event(event_id);\r
 }\r
 \r
 int main(void)\r
 }\r
 \r
 int main(void)\r
@@ -67,17 +69,18 @@ int main(void)
        wait_ms(2000);\r
        printf("init3\n");\r
 \r
        wait_ms(2000);\r
        printf("init3\n");\r
 \r
+#ifdef HOST_VERSION\r
+       hostsim_init();\r
+#endif\r
+\r
        event_id = scheduler_add_periodical_event_priority(f1, NULL, 500000l/SCHEDULER_UNIT, 200);\r
        scheduler_add_periodical_event_priority(f2, NULL, 500000l/SCHEDULER_UNIT, 100);\r
        scheduler_add_periodical_event(f3, NULL, 1000000l/SCHEDULER_UNIT);\r
        event_id = scheduler_add_periodical_event_priority(f1, NULL, 500000l/SCHEDULER_UNIT, 200);\r
        scheduler_add_periodical_event_priority(f2, NULL, 500000l/SCHEDULER_UNIT, 100);\r
        scheduler_add_periodical_event(f3, NULL, 1000000l/SCHEDULER_UNIT);\r
-       \r
-       //  scheduler_add_single_event(supp,65);\r
-       \r
 \r
 \r
-#ifdef HOST_VERSION\r
-       for (i=0 ; i<50000 ; i++)\r
-               scheduler_interrupt();\r
-#endif\r
+       scheduler_add_single_event(supp, NULL, 5000000l/SCHEDULER_UNIT);\r
+\r
+       while (1);\r
+\r
        return 0;\r
 }\r
 \r
        return 0;\r
 }\r
 \r
index 483f156..28382d0 100644 (file)
@@ -14,8 +14,8 @@ SRC += uart_send9.c uart_send9_nowait.c
 SRC += uart_recv9.c uart_recv9_nowait.c
 endif
 
 SRC += uart_recv9.c uart_recv9_nowait.c
 endif
 
-else # is it ok ??
-SRC = uart_host.c
+else
+SRC = uart_host.c uart_events.c
 endif
 
 include $(AVERSIVE_DIR)/mk/aversive_module.mk
 endif
 
 include $(AVERSIVE_DIR)/mk/aversive_module.mk
index 8c58c44..429c4db 100644 (file)
@@ -24,7 +24,6 @@
 #include <uart.h>
 #include <uart_private.h>
 
 #include <uart.h>
 #include <uart_private.h>
 
-
 /* this file os a stub for host */
 
 void uart_init(void)
 /* this file os a stub for host */
 
 void uart_init(void)
@@ -59,12 +58,3 @@ int uart_send(uint8_t num, char c)
        return put_char(c);
 }
 
        return put_char(c);
 }
 
-void uart_register_tx_event(uint8_t num, void (*f)(char))
-{ 
-       tx_event = f;
-}
-
-void uart_register_rx_event(uint8_t num, void (*f)(char))
-{
-       rx_event = f;
-}
index 1afcd22..d47d603 100644 (file)
@@ -1,6 +1,7 @@
 TARGET = timer
 
 # List C source files here. (C dependencies are automatically generated.)
 TARGET = timer
 
 # List C source files here. (C dependencies are automatically generated.)
+ifeq ($(HOST),avr)
 SRC = timer_init.c \
 timer_intr.c \
 timer_conf_check.c \
 SRC = timer_init.c \
 timer_intr.c \
 timer_conf_check.c \
@@ -40,5 +41,8 @@ timer2_prescaler.c \
 timer3_prescaler.c \
 timer4_prescaler.c \
 timer5_prescaler.c
 timer3_prescaler.c \
 timer4_prescaler.c \
 timer5_prescaler.c
+else
+SRC = timer_host.c
+endif
 
 include $(AVERSIVE_DIR)/mk/aversive_module.mk
 
 include $(AVERSIVE_DIR)/mk/aversive_module.mk
diff --git a/modules/hardware/timer/timer_host.c b/modules/hardware/timer/timer_host.c
new file mode 100644 (file)
index 0000000..c9ee86f
--- /dev/null
@@ -0,0 +1,24 @@
+/*  
+ *  Copyright Droids Corporation, Microb Technology, (2010)
+ * 
+ *  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 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Revision : $Id: timer_init.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $
+ *
+ */
+
+void timer_init(void)
+{
+}