diff --git a/conf/autopilot/booz2_test_progs.makefile b/conf/autopilot/booz2_test_progs.makefile index d95f6c5659..a3ce7e0aa8 100644 --- a/conf/autopilot/booz2_test_progs.makefile +++ b/conf/autopilot/booz2_test_progs.makefile @@ -22,6 +22,28 @@ # # +# +# test downlink +# +test_downlink.ARCHDIR = $(ARCHI) +test_downlink.ARCH = arm7tdmi +test_downlink.TARGET = test_downlink +test_downlink.TARGETDIR = test_downlink + +test_downlink.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS) +test_downlink.CFLAGS += -DPERIPHERALS_AUTO_INIT +test_downlink.srcs += $(SRC_BOOZ_TEST)/booz2_test_downlink.c +test_downlink.CFLAGS += -DUSE_LED +test_downlink.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./10.))' -DTIME_LED=1 +test_downlink.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c + +test_downlink.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 +test_downlink.srcs += $(SRC_ARCH)/uart_hw.c + +test_downlink.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 +test_downlink.srcs += downlink.c pprz_transport.c + + # # tunnel hw @@ -38,10 +60,7 @@ tunnel.CFLAGS += -DLED tunnel.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c tunnel.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 -#tunnel.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 tunnel.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -#tunnel.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B19200 -#tunnel.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 tunnel.srcs += $(SRC_ARCH)/uart_hw.c @@ -219,20 +238,21 @@ test_max1168.TARGET = test_max1168 test_max1168.TARGETDIR = test_max1168 test_max1168.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -test_max1168.srcs += $(SRC_BOOZ_TEST)/booz2_test_max1168.c +test_max1168.CFLAGS += -DPERIPHERALS_AUTO_INIT +test_max1168.srcs += $(SRC_BOOZ_TEST)/booz2_test_max1168.c +test_max1168.CFLAGS += -DUSE_LED test_max1168.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' -DTIME_LED=1 -test_max1168.CFLAGS += -DLED -test_max1168.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c +test_max1168.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test_max1168.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -test_max1168.srcs += $(SRC_ARCH)/uart_hw.c +test_max1168.srcs += $(SRC_ARCH)/uart_hw.c test_max1168.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 -test_max1168.srcs += downlink.c pprz_transport.c +test_max1168.srcs += downlink.c pprz_transport.c test_max1168.CFLAGS += -DMAX1168_EOC_VIC_SLOT=8 -DSSP_VIC_SLOT=9 -test_max1168.srcs += $(SRC_BOOZ)/booz2_max1168.c $(SRC_BOOZ_ARCH)/booz2_max1168_hw.c - +test_max1168.srcs += $(SRC_BOOZ)/peripherals/booz_max1168.c \ + $(SRC_BOOZ_ARCH)/peripherals/booz_max1168_arch.c diff --git a/sw/airborne/booz/test/booz2_test_downlink.c b/sw/airborne/booz/test/booz2_test_downlink.c new file mode 100644 index 0000000000..9569c9c93c --- /dev/null +++ b/sw/airborne/booz/test/booz2_test_downlink.c @@ -0,0 +1,61 @@ +/* + * $Id$ + * + * Copyright (C) 2008-2009 Antoine Drouin + * + * This file is part of paparazzi. + * + * paparazzi 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, or (at your option) + * any later version. + * + * paparazzi 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 paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include "init_hw.h" +#include "sys_time.h" +#include "interrupt_hw.h" + +#include "messages.h" +#include "downlink.h" + +static inline void main_init( void ); +static inline void main_periodic_task( void ); +static inline void main_event_task( void ); + +int main( void ) { + main_init(); + while(1) { + if (sys_time_periodic()) + main_periodic_task(); + main_event_task(); + } + return 0; +} + +static inline void main_init( void ) { + hw_init(); + sys_time_init(); + int_enable(); +} + +static inline void main_periodic_task( void ) { + LED_TOGGLE(2); + DOWNLINK_SEND_TIME(DefaultChannel, &cpu_time_sec); +} + +static inline void main_event_task( void ) { + +} + diff --git a/sw/airborne/booz/test/booz2_test_max1168.c b/sw/airborne/booz/test/booz2_test_max1168.c index 73c6bd2a05..c934c94aea 100644 --- a/sw/airborne/booz/test/booz2_test_max1168.c +++ b/sw/airborne/booz/test/booz2_test_max1168.c @@ -26,15 +26,13 @@ #include "std.h" #include "init_hw.h" #include "sys_time.h" -#include "led.h" -#include "uart.h" +#include "interrupt_hw.h" #include "messages.h" #include "downlink.h" -#include "interrupt_hw.h" #include "armVIC.h" #include "LPC21xx.h" -#include "booz2_max1168.h" +#include "peripherals/booz_max1168.h" static inline void main_init( void ); static inline void main_periodic_task( void ); @@ -60,28 +58,25 @@ int main( void ) { static inline void main_init( void ) { hw_init(); sys_time_init(); - led_init(); - - uart1_init_tx(); main_init_ssp(); - booz2_max1168_init(); + booz_max1168_init(); int_enable(); } static inline void main_periodic_task( void ) { LED_TOGGLE(3); - booz2_max1168_read(); + booz_max1168_read(); } static inline void main_event_task( void ) { - if (booz2_max1168_status == STA_MAX1168_DATA_AVAILABLE) { + if (booz_max1168_status == STA_MAX1168_DATA_AVAILABLE) { RunOnceEvery(10, { - DOWNLINK_SEND_IMU_GYRO_RAW(&booz2_max1168_values[0], &booz2_max1168_values[1], &booz2_max1168_values[2]); - DOWNLINK_SEND_IMU_ACCEL_RAW(&booz2_max1168_values[3], &booz2_max1168_values[4], &booz2_max1168_values[6]); - DOWNLINK_SEND_BOOT(&booz2_max1168_values[7]); }); - booz2_max1168_status = STA_MAX1168_IDLE; + DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &booz_max1168_values[0], &booz_max1168_values[1], &booz_max1168_values[2]); + DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &booz_max1168_values[3], &booz_max1168_values[4], &booz_max1168_values[6]); + DOWNLINK_SEND_BOOT(DefaultChannel, &booz_max1168_values[7]); }); + booz_max1168_status = STA_MAX1168_IDLE; } } diff --git a/sw/airborne/booz/test/booz2_test_modem.c b/sw/airborne/booz/test/booz2_test_modem.c index 2492f7b884..4807e91208 100644 --- a/sw/airborne/booz/test/booz2_test_modem.c +++ b/sw/airborne/booz/test/booz2_test_modem.c @@ -36,8 +36,6 @@ static inline void main_init( void ); static inline void main_periodic_task( void ); static inline void main_event_task( void ); -uint32_t t0, t1, diff; - int main( void ) { main_init(); while(1) {