From 19199755fb53f9cc344ada50da6ffda36c346ec1 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Thu, 18 Nov 2010 23:04:20 +0100 Subject: [PATCH] cleanup a LOT of trailing whitespaces --- sw/airborne/3dmg.c | 12 +- sw/airborne/OSAMNav.c | 136 +-- sw/airborne/actuators.c | 2 +- sw/airborne/agl_vfilter.c | 38 +- sw/airborne/alt_vfilter.c | 52 +- sw/airborne/anemotaxis.c | 4 +- sw/airborne/ap_downlink.h | 4 +- sw/airborne/arch/avr/ant_tracker.c | 2 +- sw/airborne/arch/avr/dc_mc_link.c | 12 +- sw/airborne/arch/avr/dc_mc_power.c | 2 +- sw/airborne/arch/avr/i2c_ap.c | 10 +- sw/airborne/arch/avr/i2c_ap.h | 4 +- sw/airborne/arch/avr/init_hw.h | 2 +- sw/airborne/arch/avr/interrupt_hw.h | 4 +- sw/airborne/arch/avr/link_mcu_hw.h | 4 +- sw/airborne/arch/avr/modem_hw.c | 10 +- sw/airborne/arch/avr/modem_hw.h | 6 +- sw/airborne/arch/avr/ppm_hw.c | 16 +- sw/airborne/arch/avr/ppm_hw.h | 8 +- sw/airborne/arch/avr/servos_4017.c | 8 +- sw/airborne/arch/avr/servos_4017.h | 2 +- sw/airborne/arch/avr/servos_direct_hw.c | 2 +- sw/airborne/arch/avr/servos_esc_hw.c | 6 +- sw/airborne/arch/avr/servos_esc_hw.h | 2 +- sw/airborne/arch/avr/spi_hw.c | 10 +- sw/airborne/arch/avr/spi_hw.h | 6 +- sw/airborne/arch/avr/sys_time_hw.h | 4 +- sw/airborne/arch/avr/uart_hw.c | 56 +- sw/airborne/arch/avr/uart_hw.h | 4 +- sw/airborne/arch/avr/uart_tunnel.c | 12 +- sw/airborne/arch/lpc21/ADS8344.c | 14 +- sw/airborne/arch/lpc21/ADS8344.h | 4 +- sw/airborne/arch/lpc21/armVIC.h | 16 +- sw/airborne/arch/lpc21/efsl/conf/config.h | 34 +- sw/airborne/arch/lpc21/efsl/inc/debug.h | 6 +- sw/airborne/arch/lpc21/efsl/inc/disc.h | 4 +- sw/airborne/arch/lpc21/efsl/inc/error.h | 20 +- sw/airborne/arch/lpc21/efsl/inc/file.h | 14 +- sw/airborne/arch/lpc21/efsl/inc/fs.h | 22 +- .../lpc21/efsl/inc/interfaces/LPC2000_regs.h | 2 +- .../lpc21/efsl/inc/interfaces/lpc2000_spi.h | 4 +- .../arch/lpc21/efsl/inc/interfaces/sd.h | 4 +- sw/airborne/arch/lpc21/efsl/inc/ioman.h | 8 +- sw/airborne/arch/lpc21/efsl/inc/types.h | 26 +- sw/airborne/arch/lpc21/efsl/src/debug.c | 48 +- sw/airborne/arch/lpc21/efsl/src/dir.c | 80 +- sw/airborne/arch/lpc21/efsl/src/disc.c | 10 +- sw/airborne/arch/lpc21/efsl/src/efs.c | 4 +- sw/airborne/arch/lpc21/efsl/src/fat.c | 116 +-- sw/airborne/arch/lpc21/efsl/src/file.c | 100 +-- sw/airborne/arch/lpc21/efsl/src/fs.c | 102 +-- .../lpc21/efsl/src/interfaces/lpc2000_spi.c | 40 +- .../arch/lpc21/efsl/src/interfaces/sd.c | 44 +- sw/airborne/arch/lpc21/efsl/src/ioman.c | 62 +- sw/airborne/arch/lpc21/efsl/src/ls.c | 26 +- sw/airborne/arch/lpc21/efsl/src/mkfs.c | 70 +- sw/airborne/arch/lpc21/efsl/src/partition.c | 30 +- sw/airborne/arch/lpc21/efsl/src/plibc.c | 8 +- sw/airborne/arch/lpc21/efsl/src/time.c | 8 +- sw/airborne/arch/lpc21/efsl/src/ui.c | 44 +- sw/airborne/arch/lpc21/gpio.h | 2 +- sw/airborne/arch/lpc21/include/LPC21xx.h | 4 +- sw/airborne/arch/lpc21/interrupt_hw.h | 4 +- sw/airborne/arch/lpc21/link_mcu_hw.h | 20 +- .../arch/lpc21/lpcusb/examples/armVIC.c | 4 +- .../arch/lpc21/lpcusb/examples/armVIC.h | 16 +- .../arch/lpc21/lpcusb/examples/blockdev.h | 4 +- .../arch/lpc21/lpcusb/examples/blockdev_sd.c | 6 +- .../arch/lpc21/lpcusb/examples/console.c | 16 +- .../arch/lpc21/lpcusb/examples/console.h | 4 +- .../arch/lpc21/lpcusb/examples/lpc2000_spi.c | 14 +- .../arch/lpc21/lpcusb/examples/lpc2000_spi0.c | 6 +- .../arch/lpc21/lpcusb/examples/main_msc.c | 24 +- .../arch/lpc21/lpcusb/examples/msc_bot.c | 70 +- .../arch/lpc21/lpcusb/examples/msc_bot.h | 4 +- .../arch/lpc21/lpcusb/examples/msc_scsi.c | 66 +- .../arch/lpc21/lpcusb/examples/msc_scsi.h | 4 +- .../arch/lpc21/lpcusb/examples/printf.c | 4 +- sw/airborne/arch/lpc21/lpcusb/examples/spi.h | 4 +- .../arch/lpc21/lpcusb/examples/startup.c | 40 +- .../arch/lpc21/lpcusb/examples/startup.h | 4 +- sw/airborne/arch/lpc21/lpcusb/type.h | 4 +- sw/airborne/arch/lpc21/lpcusb/usbapi.h | 4 +- sw/airborne/arch/lpc21/lpcusb/usbcontrol.c | 20 +- sw/airborne/arch/lpc21/lpcusb/usbdebug.h | 4 +- sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.c | 126 +-- sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.h | 4 +- sw/airborne/arch/lpc21/lpcusb/usbinit.c | 16 +- sw/airborne/arch/lpc21/lpcusb/usbstdreq.c | 70 +- sw/airborne/arch/lpc21/lpcusb/usbstruct.h | 4 +- sw/airborne/arch/lpc21/max1167_hw.c | 12 +- sw/airborne/arch/lpc21/max1167_hw.h | 4 +- sw/airborne/arch/lpc21/micromag_hw.c | 12 +- sw/airborne/arch/lpc21/micromag_hw.h | 2 +- sw/airborne/arch/lpc21/modem_hw.c | 14 +- sw/airborne/arch/lpc21/modem_hw.h | 2 +- .../arch/lpc21/modules/adcs/max11040_hw.c | 26 +- .../arch/lpc21/modules/adcs/max11040_hw.h | 4 +- .../arch/lpc21/modules/core/trigger_ext_hw.c | 4 +- .../arch/lpc21/modules/core/trigger_ext_hw.h | 4 +- .../arch/lpc21/modules/display/lcd_dogm_hw.c | 12 +- .../modules/sensors/mag_micromag_fw_hw.c | 14 +- .../modules/sensors/mag_micromag_fw_hw.h | 2 +- sw/airborne/arch/lpc21/servos_4015_MAT_hw.c | 8 +- sw/airborne/arch/lpc21/servos_4015_MAT_hw.h | 4 +- sw/airborne/arch/lpc21/servos_4015_hw.c | 12 +- sw/airborne/arch/lpc21/servos_4015_hw_new.c | 20 +- sw/airborne/arch/lpc21/servos_4017_hw.c | 6 +- sw/airborne/arch/lpc21/servos_4017_hw.h | 4 +- sw/airborne/arch/lpc21/servos_direct_hw.c | 24 +- sw/airborne/arch/lpc21/servos_direct_hw.h | 14 +- sw/airborne/arch/lpc21/servos_ppm_hw.c | 10 +- sw/airborne/arch/lpc21/servos_ppm_hw.h | 6 +- .../arch/lpc21/test/bootloader/bootloader.c | 6 +- .../arch/lpc21/test/bootloader/console.c | 12 +- .../arch/lpc21/test/bootloader/lpc21iap.h | 4 +- .../arch/lpc21/test/bootloader/printf.c | 4 +- .../arch/lpc21/test/bootloader/startup.c | 36 +- .../arch/lpc21/test/bootloader/usbcontrol.c | 24 +- .../arch/lpc21/test/bootloader/usbdescrip.c | 10 +- .../arch/lpc21/test/bootloader/usbhw_lpc.c | 110 +-- .../arch/lpc21/test/bootloader/usbinit.c | 10 +- .../arch/lpc21/test/bootloader/usbstdreq.c | 34 +- sw/airborne/arch/lpc21/test/dev_board.h | 8 +- sw/airborne/arch/lpc21/test/ledswitch.c | 14 +- sw/airborne/arch/lpc21/test/lpc2138.h | 62 +- sw/airborne/arch/lpc21/test/timer.c | 32 +- sw/airborne/arch/lpc21/test/uart.c | 6 +- sw/airborne/arch/lpc21/uart_hw.c | 20 +- sw/airborne/arch/lpc21/uart_hw.h | 4 +- sw/airborne/arch/lpc21/uart_tunnel.c | 2 +- sw/airborne/arch/lpc21/usb_msc_hw.c | 30 +- sw/airborne/arch/lpc21/usb_msc_hw.h | 4 +- sw/airborne/arch/lpc21/usb_ser_hw.c | 66 +- sw/airborne/arch/lpc21/usb_tunnel.c | 16 +- sw/airborne/arch/sim/baro_MS5534A.h | 4 +- sw/airborne/arch/sim/ivy_transport.h | 2 +- sw/airborne/arch/sim/jsbsim_gps.c | 4 +- sw/airborne/arch/sim/jsbsim_ir.c | 2 +- sw/airborne/arch/sim/led_hw.h | 2 +- sw/airborne/arch/sim/max1167_hw.c | 4 +- sw/airborne/arch/sim/max1167_hw.h | 4 +- sw/airborne/arch/sim/micromag_hw.c | 4 +- sw/airborne/arch/sim/micromag_hw.h | 4 +- .../arch/sim/modules/core/trigger_ext_hw.c | 4 +- .../arch/sim/modules/core/trigger_ext_hw.h | 4 +- .../arch/sim/modules/enose/sim_enose.c | 4 +- sw/airborne/arch/sim/sim_ap.c | 6 +- sw/airborne/arch/sim/sim_gps.c | 2 +- sw/airborne/arch/stm32/i2c_hw.h | 4 +- sw/airborne/arch/stm32/interrupt_hw.h | 4 +- sw/airborne/arch/stm32/link_mcu_hw.h | 20 +- sw/airborne/arch/stm32/stm32_exceptions.c | 4 +- sw/airborne/arch/stm32/stm32_exceptions.h | 4 +- sw/airborne/arch/stm32/stm32_vector_table.c | 6 +- sw/airborne/arch/stm32/stm32_vector_table.h | 4 +- sw/airborne/arch/stm32/sys_time_hw.h | 4 +- sw/airborne/arch/stm32/uart_hw.c | 20 +- sw/airborne/arch/stm32/uart_hw.h | 14 +- sw/airborne/boards/beth.h | 10 +- sw/airborne/boards/booz/baro_board.c | 4 +- sw/airborne/boards/booz/test_baro.c | 6 +- sw/airborne/boards/lisa_l/baro_board.c | 2 +- sw/airborne/boards/lisa_l/baro_board.h | 12 +- sw/airborne/boards/lisa_l/test_baro.c | 10 +- sw/airborne/boards/lisa_l_1.0.h | 2 +- sw/airborne/boards/lisa_m_1.0.h | 4 +- sw/airborne/boards/olimex_lpc_h2148.h | 10 +- sw/airborne/boards/olimex_stm32-h103.h | 2 +- sw/airborne/bomb.c | 10 +- sw/airborne/booz/arch/sim/booz2_analog_hw.c | 4 +- sw/airborne/booz/arch/sim/booz2_analog_hw.h | 4 +- sw/airborne/booz/arch/sim/booz2_pwm_hw.c | 4 +- sw/airborne/booz/arch/sim/booz2_pwm_hw.h | 4 +- .../arch/sim/booz2_unsimulated_peripherals.c | 4 +- .../booz/test/booz2_test_buss_bldc_hexa.c | 8 +- .../booz/test/booz2_test_buss_bldc_hexa.h | 2 +- sw/airborne/booz/test/booz2_test_gps.c | 10 +- sw/airborne/booz/test/booz2_test_led.c | 4 +- sw/airborne/booz/test/booz2_test_max1168.c | 12 +- sw/airborne/booz/test/booz2_test_micromag.c | 12 +- sw/airborne/booz/test/booz2_test_modem.c | 4 +- .../booz/test/booz2_test_radio_control.c | 20 +- sw/airborne/booz/test/booz2_test_rc.c | 4 +- sw/airborne/booz/test/booz2_test_usb.c | 4 +- sw/airborne/booz/test/booz2_tunnel.c | 6 +- sw/airborne/booz/test/booz2_tunnel_bb.c | 4 +- sw/airborne/booz/test/booz_test_telemetry.c | 4 +- sw/airborne/booz/test/test_mlkf.c | 8 +- sw/airborne/booz/test/test_scaling.c | 20 +- sw/airborne/common_nav.c | 10 +- sw/airborne/common_nav.h | 6 +- sw/airborne/csc/arm7/buss_twi_blmc_hw.c | 14 +- sw/airborne/csc/csc_adc.c | 2 +- sw/airborne/csc/csc_ap_link.c | 4 +- sw/airborne/csc/csc_ap_main.c | 14 +- sw/airborne/csc/csc_autopilot.c | 14 +- sw/airborne/csc/csc_autopilot.h | 6 +- sw/airborne/csc/csc_baro.c | 6 +- sw/airborne/csc/csc_can.c | 24 +- sw/airborne/csc/csc_datalink.c | 4 +- sw/airborne/csc/csc_main.c | 8 +- sw/airborne/csc/csc_me4_link.c | 8 +- sw/airborne/csc/csc_msg_def.h | 36 +- sw/airborne/csc/csc_protocol.c | 14 +- sw/airborne/csc/csc_protocol.h | 10 +- sw/airborne/csc/csc_rc_spektrum.c | 10 +- sw/airborne/csc/csc_rc_spektrum.h | 6 +- sw/airborne/csc/csc_servos.h | 6 +- sw/airborne/csc/csc_telemetry.c | 4 +- sw/airborne/csc/csc_throttle.c | 10 +- sw/airborne/csc/csc_throttle.h | 6 +- sw/airborne/csc/csc_vane.c | 4 +- sw/airborne/csc/csc_xsens.c | 32 +- sw/airborne/csc/csc_xsens.h | 8 +- sw/airborne/csc/mercury_ap.h | 6 +- sw/airborne/csc/mercury_csc_main.c | 32 +- sw/airborne/csc/mercury_main.c | 14 +- sw/airborne/csc/mercury_xsens.c | 28 +- sw/airborne/csc/mercury_xsens.h | 8 +- sw/airborne/csc/ppm_bridge_main.c | 4 +- sw/airborne/datalink.c | 4 +- sw/airborne/datalink.h | 8 +- sw/airborne/discsurvey.c | 6 +- sw/airborne/downlink.c | 4 +- sw/airborne/downlink.h | 4 +- sw/airborne/downlink_transport.h | 4 +- sw/airborne/fbw_downlink.h | 4 +- .../firmwares/beth/bench_sensors_can.c | 2 +- .../firmwares/beth/bench_sensors_i2c.c | 4 +- sw/airborne/firmwares/beth/main_beth.c | 4 +- sw/airborne/firmwares/beth/main_coders.c | 52 +- sw/airborne/firmwares/beth/main_overo.c | 22 +- sw/airborne/firmwares/beth/overo_controller.c | 22 +- sw/airborne/firmwares/beth/overo_controller.h | 4 +- sw/airborne/firmwares/beth/overo_estimator.c | 8 +- sw/airborne/firmwares/beth/overo_estimator.h | 2 +- sw/airborne/firmwares/beth/overo_gcs_com.c | 12 +- .../firmwares/beth/overo_sfb_controller.c | 78 +- .../firmwares/beth/overo_sfb_controller.h | 8 +- sw/airborne/firmwares/beth/overo_test_uart.c | 24 +- .../firmwares/beth/overo_twist_controller.c | 86 +- .../firmwares/beth/overo_twist_controller.h | 4 +- sw/airborne/firmwares/beth/rcv_telemetry.c | 10 +- sw/airborne/firmwares/beth/uart_hw.c | 40 +- sw/airborne/firmwares/beth/uart_hw.h | 6 +- sw/airborne/firmwares/logger/main_logger.c | 38 +- .../firmwares/motor_bench/main_motor_bench.c | 4 +- sw/airborne/firmwares/motor_bench/mb_modes.c | 2 +- sw/airborne/firmwares/motor_bench/mb_servo.c | 6 +- sw/airborne/firmwares/motor_bench/mb_servo.h | 2 +- sw/airborne/firmwares/motor_bench/mb_tacho.c | 6 +- .../firmwares/motor_bench/mb_twi_controller.c | 2 +- .../firmwares/motor_bench/mb_twi_controller.h | 2 +- .../motor_bench/mb_twi_controller_asctech.c | 6 +- .../motor_bench/mb_twi_controller_mkk.c | 2 +- .../firmwares/non_ap/led_flasher/blitzer.c | 4 +- .../rotorcraft/guidance/guidance_v.c | 2 +- .../stabilization_attitude_euler_int.c | 4 +- sw/airborne/firmwares/tutorial/main_demo5.c | 2 +- sw/airborne/firmwares/vor/i86_vor_audio.h | 2 +- .../firmwares/vor/i86_vor_test_filters.c | 6 +- .../firmwares/vor/i86_vor_test_float_demod.c | 8 +- .../firmwares/vor/i86_vor_test_int_demod.c | 8 +- .../vor/i86_vor_test_int_demod_decim.c | 4 +- .../firmwares/vor/lpc_vor_convertions.c | 6 +- sw/airborne/firmwares/vor/lpc_vor_main.c | 2 +- sw/airborne/firmwares/vor/vor_float_demod.c | 14 +- sw/airborne/firmwares/vor/vor_float_demod.h | 4 +- sw/airborne/firmwares/vor/vor_float_filters.h | 8 +- sw/airborne/firmwares/vor/vor_int_demod.c | 22 +- sw/airborne/firmwares/vor/vor_int_demod.h | 4 +- .../firmwares/vor/vor_int_demod_decim.c | 16 +- .../firmwares/vor/vor_int_demod_decim.h | 2 +- sw/airborne/firmwares/vor/vor_int_filters.h | 12 +- .../firmwares/vor/vor_int_filters_decim.h | 60 +- sw/airborne/firmwares/wind_tunnel/main.c | 4 +- sw/airborne/firmwares/wind_tunnel/main_mb.c | 6 +- sw/airborne/firmwares/wind_tunnel/wt_baro.c | 6 +- sw/airborne/firmwares/wind_tunnel/wt_baro.h | 6 +- sw/airborne/firmwares/wind_tunnel/wt_servo.c | 4 +- sw/airborne/flightzone.c | 54 +- sw/airborne/flightzone.h | 22 +- sw/airborne/fms/fms_autopilot_msg.h | 62 +- sw/airborne/fms/fms_gs_com.c | 10 +- sw/airborne/fms/fms_gs_com.h | 4 +- sw/airborne/fms/fms_network.c | 18 +- sw/airborne/fms/fms_periodic.c | 14 +- sw/airborne/fms/fms_periodic.h | 4 +- sw/airborne/fms/fms_serial_port.c | 16 +- sw/airborne/fms/fms_serial_port.h | 6 +- sw/airborne/fms/fms_spi_autopilot_msg.c | 2 +- sw/airborne/fms/fms_spi_link.c | 6 +- sw/airborne/fms/fms_spi_link.h | 6 +- sw/airborne/fms/fms_spistream.h | 22 +- sw/airborne/fms/fms_spistream_client.c | 110 +-- sw/airborne/fms/fms_spistream_daemon.c | 160 ++-- sw/airborne/fms/fms_test_datalink.c | 2 +- sw/airborne/fms/libeknav/estimate_attitude.c | 56 +- .../fms/libeknav/paparazzi_eigen_conversion.h | 10 +- sw/airborne/fms/libeknav/raw_log_to_ascii.c | 6 +- sw/airborne/fms/lpc_test_spi.c | 12 +- sw/airborne/fms/onboard_logger.c | 10 +- sw/airborne/fms/onboard_transport.c | 4 +- sw/airborne/fms/overo_blmc_calibrate.c | 4 +- sw/airborne/fms/overo_test_gps_passthrough.c | 74 +- sw/airborne/fms/overo_test_passthrough.c | 26 +- sw/airborne/fms/overo_test_periodic.c | 8 +- sw/airborne/fms/overo_test_spi_link.c | 78 +- sw/airborne/fms/overo_test_telemetry2.c | 6 +- sw/airborne/fms/test_telemetry.c | 6 +- sw/airborne/fms/udp_transport.h | 2 +- sw/airborne/fms/udp_transport2.c | 4 +- sw/airborne/fms/udp_transport2.h | 2 +- sw/airborne/gyro.c | 6 +- sw/airborne/gyro.h | 4 +- sw/airborne/infrared.h | 4 +- sw/airborne/inter_mcu.c | 4 +- sw/airborne/inter_mcu.h | 6 +- sw/airborne/latlong.c | 4 +- sw/airborne/led.h | 6 +- sw/airborne/link_mcu.c | 12 +- sw/airborne/link_mcu.h | 8 +- .../lisa/arch/stm32/lisa_overo_link_arch.c | 12 +- sw/airborne/lisa/lisa_overo_link.h | 2 +- sw/airborne/lisa/lisa_spistream.h | 256 +++--- .../lisa/lisa_stm_gps_passthrough_main.c | 312 +++---- sw/airborne/lisa/lisa_stm_passthrough_main.c | 2 +- sw/airborne/lisa/stm_test_spi_link.c | 14 +- sw/airborne/lisa/test/hs_gyro.c | 12 +- .../lisa/test/lisa_test_actuators_mkk.c | 6 +- sw/airborne/lisa/test/lisa_test_adxl345.c | 48 +- sw/airborne/lisa/test/lisa_test_adxl345_dma.c | 82 +- sw/airborne/lisa/test/lisa_test_aspirin.c | 52 +- sw/airborne/lisa/test/lisa_test_hmc5843.c | 20 +- sw/airborne/lisa/test/lisa_test_itg3200.c | 22 +- sw/airborne/lisa/test/lisa_test_max1168.c | 16 +- sw/airborne/lisa/test/lisa_test_ms2001.c | 20 +- sw/airborne/lisa/test/lisa_test_ms2100.c | 16 +- sw/airborne/lisa/test/lisa_test_sc18is600.c | 12 +- sw/airborne/lisa/test/lisa_tunnel.c | 6 +- .../lisa/test/test_mc_asctec_v1_simple.c | 10 +- sw/airborne/lisa/test_csc_servo.c | 30 +- sw/airborne/lisa/test_datalink.c | 6 +- sw/airborne/lisa/test_float.c | 4 +- sw/airborne/lisa/test_led.c | 4 +- sw/airborne/lisa/test_mc.c | 12 +- sw/airborne/lisa/test_periodic.c | 6 +- sw/airborne/lisa/test_servos.c | 4 +- sw/airborne/lisa/test_spi_slave.c | 8 +- sw/airborne/lisa/test_spi_slave2.c | 36 +- sw/airborne/lisa/test_uart.c | 4 +- sw/airborne/lisa/tunnel_hw.c | 8 +- sw/airborne/math/pprz_algebra_float.h | 2 +- sw/airborne/math/pprz_geodetic_double.c | 10 +- sw/airborne/math/pprz_geodetic_float.c | 14 +- sw/airborne/math/pprz_geodetic_int.c | 24 +- sw/airborne/math/pprz_geodetic_int.h | 4 +- sw/airborne/math/pprz_simple_matrix.h | 2 +- sw/airborne/math/pprz_trig_int.c | 810 +++++++++--------- sw/airborne/math/pprz_trig_int.h | 4 +- sw/airborne/max1167.h | 2 +- sw/airborne/micromag.c | 4 +- sw/airborne/modem.h | 4 +- sw/airborne/modules/MPPT/sim_MPPT.c | 6 +- sw/airborne/modules/adcs/max11040.c | 4 +- sw/airborne/modules/cam_control/booz_cam.c | 4 +- sw/airborne/modules/cam_control/booz_cam.h | 4 +- sw/airborne/modules/cam_control/cam_track.c | 6 +- sw/airborne/modules/cam_control/cam_track.h | 6 +- sw/airborne/modules/core/extra_pprz_dl.c | 4 +- sw/airborne/modules/core/extra_pprz_dl.h | 6 +- sw/airborne/modules/core/sys_mon.c | 4 +- sw/airborne/modules/core/sys_mon.h | 6 +- sw/airborne/modules/core/trigger_ext.c | 4 +- sw/airborne/modules/core/trigger_ext.h | 4 +- sw/airborne/modules/demo_module/demo_module.c | 4 +- sw/airborne/modules/demo_module/demo_module.h | 6 +- .../deploy_sonar_buoy/deploy_sonar_buoy.c | 16 +- sw/airborne/modules/digital_cam/dc.c | 4 +- sw/airborne/modules/digital_cam/dc.h | 20 +- sw/airborne/modules/display/lcd_dogm.c | 6 +- sw/airborne/modules/enose/enose.c | 8 +- sw/airborne/modules/enose/enose.h | 6 +- .../modules/gps_i2c/runtime_configure.h | 2 +- sw/airborne/modules/gsm/gsm.c | 42 +- sw/airborne/modules/gsm/gsm.h | 6 +- sw/airborne/modules/ins/VN100.h | 4 +- sw/airborne/modules/ins/fw_ins_vn100.c | 4 +- sw/airborne/modules/ins/ins_module.h | 4 +- sw/airborne/modules/ins/ins_xsens.h | 4 +- sw/airborne/modules/light/light.c | 6 +- sw/airborne/modules/light/light.h | 6 +- sw/airborne/modules/max3100/max3100_hw.c | 14 +- sw/airborne/modules/max3100/max3100_hw.h | 6 +- sw/airborne/modules/meteo/humid_hih.c | 4 +- sw/airborne/modules/meteo/humid_sht.c | 20 +- sw/airborne/modules/meteo/humid_sht.h | 2 +- sw/airborne/modules/meteo/humid_sht_i2c.c | 12 +- sw/airborne/modules/meteo/light_temt.c | 4 +- sw/airborne/modules/meteo/temp_temod.c | 2 +- sw/airborne/modules/meteo/windturbine.c | 4 +- sw/airborne/modules/meteo/windturbine.h | 4 +- sw/airborne/modules/multi/tcas.c | 6 +- sw/airborne/modules/multi/tcas.h | 6 +- sw/airborne/modules/poles/nav_poles.c | 2 +- sw/airborne/modules/sensors/baro_MS5534A.c | 8 +- sw/airborne/modules/sensors/baro_MS5534A.h | 4 +- sw/airborne/modules/sensors/baro_bmp.h | 2 +- sw/airborne/modules/sensors/mag_micromag_fw.c | 2 +- sw/airborne/modules/sensors/mag_micromag_fw.h | 2 +- sw/airborne/modules/sensors/trigger_ext.c | 4 +- .../modules/sonar/sonar_maxbotix_booz.c | 4 +- .../modules/sonar/sonar_maxbotix_booz.h | 6 +- .../modules/vehicle_interface/vi_datalink.c | 4 +- .../modules/vehicle_interface/vi_datalink.h | 2 +- .../modules/vehicle_interface/vi_overo_link.c | 2 +- .../vehicle_interface/vi_test_signal.c | 10 +- .../vehicle_interface/vi_test_signal.h | 4 +- sw/airborne/nav.c | 60 +- sw/airborne/obsolete/max1167.h | 2 +- sw/airborne/pprz_transport.c | 4 +- sw/airborne/pprz_transport.h | 6 +- sw/airborne/print.h | 4 +- sw/airborne/rc_settings.c | 4 +- sw/airborne/rc_settings.h | 6 +- sw/airborne/sd_card/main.c | 4 +- sw/airborne/sd_card/sd_card.c | 6 +- sw/airborne/sd_card/sd_card.h | 6 +- sw/airborne/setup_actuators.c | 6 +- sw/airborne/snav.c | 16 +- .../subsystems/ahrs/ahrs_float_cmpl_rmat.c | 24 +- .../subsystems/ahrs/ahrs_float_cmpl_rmat.h | 4 +- .../subsystems/ahrs/ahrs_float_utils.h | 4 +- .../subsystems/ahrs/ahrs_int_cmpl_euler.c | 16 +- sw/airborne/sys_time.h | 2 +- .../test/ahrs/run_ahrs_on_flight_log.c | 6 +- sw/airborne/test/peripherals/test_ami601.c | 8 +- sw/airborne/test/test_algebra.c | 138 +-- sw/airborne/test/test_bla.c | 2 +- sw/airborne/test/test_esc_asctecv1_simple.c | 6 +- sw/airborne/test/test_geodetic.c | 92 +- sw/airborne/test/test_matrix.c | 4 +- sw/airborne/test/test_nav.c | 2 +- sw/airborne/test/test_telemetry.c | 4 +- sw/airborne/traffic_info.c | 6 +- sw/airborne/traffic_info.h | 4 +- sw/airborne/uart.h | 4 +- sw/airborne/usb_serial.h | 4 +- sw/airborne/xbee.c | 4 +- sw/airborne/xbee.h | 8 +- sw/airborne/xbee24.h | 4 +- sw/airborne/xbee868.h | 4 +- 453 files changed, 3876 insertions(+), 3876 deletions(-) diff --git a/sw/airborne/3dmg.c b/sw/airborne/3dmg.c index def0be0e53..6715e86cf6 100644 --- a/sw/airborne/3dmg.c +++ b/sw/airborne/3dmg.c @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -58,7 +58,7 @@ void _3dmg_capture_neutral ( void ) { state++; \ } \ } - + #define READ_LSB(my_short, my_char) { \ { \ my_short += (((int16_t)my_char)&0x00FF); \ @@ -119,7 +119,7 @@ static inline void on_3dmg_receive(uint8_t c) { case 12: READ_LSB(foo, c); /* accel_z_lsb */ - break ; + break ; case 13: READ_MSB(_3dmg_roll_dot, c); break ; @@ -137,7 +137,7 @@ static inline void on_3dmg_receive(uint8_t c) { break ; case 18: READ_LSB(_3dmg_yaw_dot, c); - break ; + break ; case 19: READ_MSB(_3dmg_timer_tick, c); break ; @@ -145,7 +145,7 @@ static inline void on_3dmg_receive(uint8_t c) { READ_LSB(_3dmg_timer_tick, c); break ; case 21: - checksum_read = (((uint16_t)c)&0x00FF)<<8; + checksum_read = (((uint16_t)c)&0x00FF)<<8; state++; break ; case 22: diff --git a/sw/airborne/OSAMNav.c b/sw/airborne/OSAMNav.c index 5362d031e2..1186a4abb3 100644 --- a/sw/airborne/OSAMNav.c +++ b/sw/airborne/OSAMNav.c @@ -2,9 +2,9 @@ /************** Flower Navigation **********************************************/ -/** Makes a flower pattern. +/** Makes a flower pattern. CenterWP is the center of the flower. The Navigation Height is taken from this waypoint. - EdgeWP defines the radius of the flower (distance from CenterWP to EdgeWP) + EdgeWP defines the radius of the flower (distance from CenterWP to EdgeWP) */ enum FlowerStatus { Outside, FlowerLine, Circle }; @@ -39,7 +39,7 @@ bool_t InitializeFlower(uint8_t CenterWP, uint8_t EdgeWP) EdgeCurrentX = waypoints[Edge].x - waypoints[Center].x; EdgeCurrentY = waypoints[Edge].y - waypoints[Center].y; - + Flowerradius = sqrt(EdgeCurrentX*EdgeCurrentX+EdgeCurrentY*EdgeCurrentY); TransCurrentX = estimator_x - waypoints[Center].x; @@ -67,7 +67,7 @@ bool_t FlowerNav(void) TransCurrentX = estimator_x - waypoints[Center].x; TransCurrentY = estimator_y - waypoints[Center].y; DistanceFromCenter = sqrt(TransCurrentX*TransCurrentX+TransCurrentY*TransCurrentY); - + bool_t InCircle = TRUE; float CircleTheta; @@ -79,7 +79,7 @@ bool_t FlowerNav(void) switch(CFlowerStatus) { - case Outside: + case Outside: nav_route_xy(FlyFromX,FlyFromY,Fly2X,Fly2Y); if(InCircle) { @@ -108,7 +108,7 @@ bool_t FlowerNav(void) if(InCircle) { EdgeCurrentX = waypoints[Edge].x - waypoints[Center].x; - EdgeCurrentY = waypoints[Edge].y - waypoints[Center].y; + EdgeCurrentY = waypoints[Edge].y - waypoints[Center].y; Flowerradius = sqrt(EdgeCurrentX*EdgeCurrentX+EdgeCurrentY*EdgeCurrentY); if(DistanceFromCenter > Flowerradius) CFlowerStatus = Outside; @@ -125,14 +125,14 @@ bool_t FlowerNav(void) } return TRUE; -} +} /************** Bungee Takeoff **********************************************/ -/** Takeoff functions for bungee takeoff. -Run initialize function when the plane is on the bungee, the bungee is fully extended and you are ready to -launch the plane. After initialized, the plane will follow a line drawn by the position of the plane on initialization and the -position of the bungee (given in the arguments). Once the plane crosses the throttle line, which is perpendicular to the line the plane is following, +/** Takeoff functions for bungee takeoff. +Run initialize function when the plane is on the bungee, the bungee is fully extended and you are ready to +launch the plane. After initialized, the plane will follow a line drawn by the position of the plane on initialization and the +position of the bungee (given in the arguments). Once the plane crosses the throttle line, which is perpendicular to the line the plane is following, and intersects the position of the bungee (plus or minus a fixed distance (TakeOff_Distance in airframe file) from the bungee just in case the bungee doesn't release directly above the bungee) the prop will come on. The plane will then continue to follow the line until it has reached a specific height (defined in as Takeoff_Height in airframe file) above the bungee waypoint and speed (defined as Takeoff_Speed in the airframe file). @@ -190,7 +190,7 @@ bool_t InitializeBungeeTakeoff(uint8_t BungeeWP) //Find Launch line slope and Throttle line slope float MLaunch = Currenty/Currentx; - + //Find Throttle Point (the point where the throttle line and launch line intersect) if(Currentx < 0) throttlePx = TDistance/sqrt(MLaunch*MLaunch+1); @@ -210,7 +210,7 @@ bool_t InitializeBungeeTakeoff(uint8_t BungeeWP) if(Currenty > ((ThrottleSlope*Currentx)+ThrottleB)) AboveLine = TRUE; else - AboveLine = FALSE; + AboveLine = FALSE; //Enable Launch Status and turn kill throttle on CTakeoffStatus = Launch; @@ -234,11 +234,11 @@ bool_t BungeeTakeoff(void) switch(CTakeoffStatus) { case Launch: - //Follow Launch Line + //Follow Launch Line NavVerticalAutoThrottleMode(0); NavVerticalAltitudeMode(BungeeAlt+Takeoff_Height, 0.); nav_route_xy(initialx,initialy,throttlePx,throttlePy); - + kill_throttle = 1; //recalculate lines if below min speed @@ -253,7 +253,7 @@ bool_t BungeeTakeoff(void) //Find Launch line slope float MLaunch = Currenty/Currentx; - + //Find Throttle Point (the point where the throttle line and launch line intersect) if(Currentx < 0) throttlePx = TDistance/sqrt(MLaunch*MLaunch+1); @@ -273,7 +273,7 @@ bool_t BungeeTakeoff(void) if(Currenty > ((ThrottleSlope*Currentx)+ThrottleB)) AboveLine = TRUE; else - AboveLine = FALSE; + AboveLine = FALSE; //Translate the throttle point back throttlePx = throttlePx+(waypoints[BungeeWaypoint].x); @@ -300,12 +300,12 @@ bool_t BungeeTakeoff(void) NavVerticalThrottleMode(9600*(1)); nav_route_xy(initialx,initialy,throttlePx,throttlePy); kill_throttle = 0; - + if((estimator_z > BungeeAlt+Takeoff_Height-10) && (estimator_hspeed_mod > Takeoff_Speed)) { CTakeoffStatus = Finished; return FALSE; - } + } else { return TRUE; @@ -354,7 +354,7 @@ bool_t InitializePolygonSurvey(uint8_t EntryWP, uint8_t Size, float sw, float Or float XIntercept1 = 0; float XIntercept2 = 0; - SurveyTheta = RadOfDeg(Orientation); + SurveyTheta = RadOfDeg(Orientation); PolySurveySweepNum = 0; PolySurveySweepBackNum = 0; @@ -495,7 +495,7 @@ bool_t InitializePolygonSurvey(uint8_t EntryWP, uint8_t Size, float sw, float Or XIntercept1 = EvaluateLineForX(ys, Edges[i]); } } - + //Find point to come from and point to go to if(fabs(EntryPoint.x - XIntercept2) <= fabs(EntryPoint.x - XIntercept1)) { @@ -527,7 +527,7 @@ bool_t InitializePolygonSurvey(uint8_t EntryWP, uint8_t Size, float sw, float Or SurveyCircle.y = EntryPoint.y; //Go into entry circle state - CSurveyStatus = Entry; + CSurveyStatus = Entry; LINE_STOP_FUNCTION; } @@ -547,7 +547,7 @@ bool_t PolygonSurvey(void) float XIntercept2 = 0; float DInt1 = 0; float DInt2 = 0; - + NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(waypoints[SurveyEntryWP].a, 0.); @@ -560,7 +560,7 @@ bool_t PolygonSurvey(void) RotateAndTranslateToWorld(&C, 0, SmallestCorner.x, SmallestCorner.y); RotateAndTranslateToWorld(&C, SurveyTheta, 0, 0); - //follow the circle + //follow the circle nav_circle_XY(C.x, C.y, SurveyRadius); if(NavQdrCloseTo(SurveyCircleQdr) && NavCircleCount() > .1 && estimator_z > waypoints[SurveyEntryWP].a-10) @@ -603,7 +603,7 @@ bool_t PolygonSurvey(void) PolySurveySweepBackNum++; } else - { + { //Find y value of the first sweep ys = LastPoint.y+dSweep; } @@ -669,18 +669,18 @@ bool_t PolygonSurvey(void) } } - + if(fabs(LastPoint.x-SurveyToWP.x) > fabs(SurveyFromWP.x-SurveyToWP.x)) SurveyCircle.x = LastPoint.x; else SurveyCircle.x = SurveyFromWP.x; - + if(!SweepingBack) SurveyCircle.y = LastPoint.y+(dSweep/2); else - SurveyCircle.y = LastPoint.y; + SurveyCircle.y = LastPoint.y; //Find the direction to circle if(ys > 0 && SurveyToWP.x > SurveyFromWP.x) @@ -691,7 +691,7 @@ bool_t PolygonSurvey(void) SurveyRadius = -dSweep/2; //Go into circle state - CSurveyStatus = SweepCircle; + CSurveyStatus = SweepCircle; nav_init_stage(); LINE_STOP_FUNCTION; PolySurveySweepNum++; @@ -705,7 +705,7 @@ bool_t PolygonSurvey(void) RotateAndTranslateToWorld(&C, 0, SmallestCorner.x, SmallestCorner.y); RotateAndTranslateToWorld(&C, SurveyTheta, 0, 0); - //follow the circle + //follow the circle nav_circle_XY(C.x, C.y, SurveyRadius); if(NavQdrCloseTo(SurveyCircleQdr) && NavCircleCount() > 0) @@ -759,7 +759,7 @@ bool_t VerticalRaster(uint8_t l1, uint8_t l2, float radius, float AltSweep) { struct point l2_c3 = { waypoints[l1].x + radius * -u_y, waypoints[l1].y + radius * u_x, alt }; - + struct point l1_c1 = { waypoints[l2].x + radius * -u_y, waypoints[l2].y + radius * u_x, alt }; @@ -770,18 +770,18 @@ bool_t VerticalRaster(uint8_t l1, uint8_t l2, float radius, float AltSweep) { waypoints[l2].y + radius * -u_x, alt }; float qdr_out_2_1 = M_PI/3. - atan2(u_y, u_x); - + float qdr_out_2_2 = -M_PI/3. - atan2(u_y, u_x); float qdr_out_2_3 = M_PI - atan2(u_y, u_x); /* Vertical target */ NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(WaypointAlt(l1), 0.); - + switch (line_status) { case LR12: /* From wp l2 to wp l1 */ NavSegment(l2, l1); - if (NavApproachingFrom(l1, l2, CARROT)) { + if (NavApproachingFrom(l1, l2, CARROT)) { line_status = LQC21; waypoints[l1].a = waypoints[l1].a+AltSweep; nav_init_stage(); @@ -810,7 +810,7 @@ bool_t VerticalRaster(uint8_t l1, uint8_t l2, float radius, float AltSweep) { break; case LR21: /* From wp l1 to wp l2 */ NavSegment(l1, l2); - if (NavApproachingFrom(l2, l1, CARROT)) { + if (NavApproachingFrom(l2, l1, CARROT)) { line_status = LQC12; waypoints[l1].a = waypoints[l1].a+AltSweep; nav_init_stage(); @@ -885,9 +885,9 @@ bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius) FinalLandAltitude = Landing_FinalHeight; FinalLandCount = 1; waypoints[AFWaypoint].a = waypoints[TDWaypoint].a + Landing_AFHeight; - + float x_0 = waypoints[TDWaypoint].x - waypoints[AFWaypoint].x; - float y_0 = waypoints[TDWaypoint].y - waypoints[AFWaypoint].y; + float y_0 = waypoints[TDWaypoint].y - waypoints[AFWaypoint].y; /* Unit vector from AF to TD */ float d = sqrt(x_0*x_0+y_0*y_0); @@ -895,8 +895,8 @@ bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius) float y_1 = y_0 / d; LandCircle.x = waypoints[AFWaypoint].x + y_1 * LandRadius; - LandCircle.y = waypoints[AFWaypoint].y - x_1 * LandRadius; - + LandCircle.y = waypoints[AFWaypoint].y - x_1 * LandRadius; + LandCircleQDR = atan2(waypoints[AFWaypoint].x-LandCircle.x, waypoints[AFWaypoint].y-LandCircle.y); if(LandRadius > 0) @@ -909,8 +909,8 @@ bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius) ApproachQDR = LandCircleQDR+RadOfDeg(90); LandCircleQDR = LandCircleQDR+RadOfDeg(45); } - - + + return FALSE; } @@ -920,49 +920,49 @@ bool_t SkidLanding(void) { case CircleDown: NavVerticalAutoThrottleMode(0); /* No pitch */ - + if(NavCircleCount() < .1) { NavVerticalAltitudeMode(LandAppAlt, 0); } else NavVerticalAltitudeMode(waypoints[AFWaypoint].a, 0); - - nav_circle_XY(LandCircle.x, LandCircle.y, LandRadius); - + + nav_circle_XY(LandCircle.x, LandCircle.y, LandRadius); + if(estimator_z < waypoints[AFWaypoint].a + 5) { CLandingStatus = LandingWait; nav_init_stage(); } - + break; - + case LandingWait: NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(waypoints[AFWaypoint].a, 0); nav_circle_XY(LandCircle.x, LandCircle.y, LandRadius); - + if(NavCircleCount() > 0.5 && NavQdrCloseTo(DegOfRad(ApproachQDR))) { CLandingStatus = Approach; nav_init_stage(); } break; - + case Approach: kill_throttle = 1; NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(waypoints[AFWaypoint].a, 0); nav_circle_XY(LandCircle.x, LandCircle.y, LandRadius); - + if(NavQdrCloseTo(DegOfRad(LandCircleQDR))) { CLandingStatus = Final; nav_init_stage(); } break; - + case Final: kill_throttle = 1; NavVerticalAutoThrottleMode(0); @@ -974,9 +974,9 @@ bool_t SkidLanding(void) FinalLandCount++; } break; - + default: - + break; } return TRUE; @@ -1049,46 +1049,46 @@ bool_t FlightLine(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Befo CFLStatus = FLCircleS; nav_init_stage(); - break; + break; case FLCircleS: NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(waypoints[From_WP].a, 0); - + nav_circle_XY(FLCircle.x, FLCircle.y, FLRadius); - + if(NavCircleCount() > 0.2 && NavQdrCloseTo(DegOfRad(FLQDR))) { CFLStatus = FLLine; LINE_START_FUNCTION; nav_init_stage(); } - break; - + break; + case FLLine: NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(waypoints[From_WP].a, 0); - + nav_route_xy(FLFROMWP.x,FLFROMWP.y,FLTOWP.x,FLTOWP.y); - + if(nav_approaching_xy(FLTOWP.x,FLTOWP.y,FLFROMWP.x,FLFROMWP.y, 0)) { CFLStatus = FLFinished; LINE_STOP_FUNCTION; nav_init_stage(); - } - break; + } + break; case FLFinished: CFLStatus = FLInitialize; nav_init_stage(); - return FALSE; - break; + return FALSE; + break; - default: + default: break; } return TRUE; @@ -1100,7 +1100,7 @@ static uint8_t FLBlockCount = 0; bool_t FlightLineBlock(uint8_t First_WP, uint8_t Last_WP, float radius, float Space_Before, float Space_After) { if(First_WP < Last_WP) - { + { FlightLine(First_WP+FLBlockCount, First_WP+FLBlockCount+1, radius, Space_Before, Space_After); if(CFLStatus == FLInitialize) @@ -1113,9 +1113,9 @@ bool_t FlightLineBlock(uint8_t First_WP, uint8_t Last_WP, float radius, float Sp } } } - else + else { - FlightLine(First_WP-FLBlockCount, First_WP-FLBlockCount-1, radius, Space_Before, Space_After); + FlightLine(First_WP-FLBlockCount, First_WP-FLBlockCount-1, radius, Space_Before, Space_After); if(CFLStatus == FLInitialize) { diff --git a/sw/airborne/actuators.c b/sw/airborne/actuators.c index 9845a50a65..ec21c7845f 100644 --- a/sw/airborne/actuators.c +++ b/sw/airborne/actuators.c @@ -16,7 +16,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/agl_vfilter.c b/sw/airborne/agl_vfilter.c index a943c85e64..e0573771e3 100644 --- a/sw/airborne/agl_vfilter.c +++ b/sw/airborne/agl_vfilter.c @@ -8,9 +8,9 @@ X = [ z zdot bias ] -temps : +temps : predict 86us - update 46us + update 46us */ /* initial covariance diagonal */ @@ -37,7 +37,7 @@ void agl_vf_init(float init_z, float init_zdot, float init_bias) { agl_vf_bias = init_bias; int i, j; for (i=0; i /* - Slave address + Slave address front = 0x52 back = 0x54 right = 0x56 @@ -65,9 +65,9 @@ void dc_mc_link_periodic(void) { #include "led.h" -ISR (TWI_vect) { +ISR (TWI_vect) { switch (TWSR & 0xF8) { - case SR_SLA_ACK: + case SR_SLA_ACK: // LED_OFF(1); dc_mc_link_twi_rx_buf_idx = 0; TWCR |= _BV(TWINT) | _BV(TWEA); @@ -86,16 +86,16 @@ ISR (TWI_vect) { // LED_ON(1); dc_mc_link_event = TRUE; break; - case SW_SLA_ACK: + case SW_SLA_ACK: case SW_DATA_ACK: TWCR |= (1< SYS_TICS_OF_USEC(PPM_DATA_MAX_LEN) || + if( width > SYS_TICS_OF_USEC(PPM_DATA_MAX_LEN) || width < SYS_TICS_OF_USEC(PPM_DATA_MIN_LEN)) RestartPpmCycle(); ppm_pulses[state - 1] = width; @@ -112,7 +112,7 @@ SIGNAL( SIG_INPUT_CAPTURE1 ) if (state >= PPM_NB_PULSES) { ppm_valid = TRUE; RestartPpmCycle(); - } else + } else state++; } return; diff --git a/sw/airborne/arch/avr/ppm_hw.h b/sw/airborne/arch/avr/ppm_hw.h index 4fc1c0cbe2..ee92b41d44 100644 --- a/sw/airborne/arch/avr/ppm_hw.h +++ b/sw/airborne/arch/avr/ppm_hw.h @@ -8,7 +8,7 @@ * If you require actual microsecond values, divide by CLOCK. * For an 8 Mhz clock and typical servo values, these will range * from 0x1F00 to 0x4000. - * + * * Copied from autopilot (autopilot.sf.net) thanx alot Trammell * * (c) 2002 Trammell Hudson @@ -29,7 +29,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -62,10 +62,10 @@ ppm_init( void ) #endif /* No noise cancelation */ sbi( TCCR1B, ICNC1 ); - + /* Set ICP to input, no internal pull up */ cbi( PPM_DDR, PPM_PIN); - + /* Enable interrupt on input capture */ sbi( TIMSK, TICIE1 ); diff --git a/sw/airborne/arch/avr/servos_4017.c b/sw/airborne/arch/avr/servos_4017.c index f4380c9fa8..3a2b94388a 100644 --- a/sw/airborne/arch/avr/servos_4017.c +++ b/sw/airborne/arch/avr/servos_4017.c @@ -17,7 +17,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -81,10 +81,10 @@ void actuators_init( void ) { } -/* +/* * Interrupt routine - * - * write the next pulse width to OCR register and + * + * write the next pulse width to OCR register and * assert the servo signal. It will be cleared by * the following compare match. */ diff --git a/sw/airborne/arch/avr/servos_4017.h b/sw/airborne/arch/avr/servos_4017.h index f32a9e8f15..c8da04fd3c 100644 --- a/sw/airborne/arch/avr/servos_4017.h +++ b/sw/airborne/arch/avr/servos_4017.h @@ -17,7 +17,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/avr/servos_direct_hw.c b/sw/airborne/arch/avr/servos_direct_hw.c index 5c0feb2d6c..4e308d2eea 100644 --- a/sw/airborne/arch/avr/servos_direct_hw.c +++ b/sw/airborne/arch/avr/servos_direct_hw.c @@ -1,6 +1,6 @@ /* Implementation of command.h */ -/* +/* 3 servos on OC3A OC3B OC3C using Timer3 prescaled at 8 */ diff --git a/sw/airborne/arch/avr/servos_esc_hw.c b/sw/airborne/arch/avr/servos_esc_hw.c index 2ff13d7542..125bb01eb6 100644 --- a/sw/airborne/arch/avr/servos_esc_hw.c +++ b/sw/airborne/arch/avr/servos_esc_hw.c @@ -17,7 +17,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -27,7 +27,7 @@ /** Implementation of actuators.h */ /* - + 4 DC motor controller with mosfets on OCR1A OCR3A OCR3B OCR3C */ @@ -39,7 +39,7 @@ void actuators_init ( void ) { /* OC1A output */ - DDRB |= _BV(5); + DDRB |= _BV(5); /* fast PWM, 10 bits */ TCCR1A |= _BV(WGM10) | _BV(WGM11) | _BV(COM1A1); TCCR1B |= _BV(WGM12); diff --git a/sw/airborne/arch/avr/servos_esc_hw.h b/sw/airborne/arch/avr/servos_esc_hw.h index 6e52753353..d5424b6e7a 100644 --- a/sw/airborne/arch/avr/servos_esc_hw.h +++ b/sw/airborne/arch/avr/servos_esc_hw.h @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/avr/spi_hw.c b/sw/airborne/arch/avr/spi_hw.c index 430d6bf6a2..eb30bcc7af 100644 --- a/sw/airborne/arch/avr/spi_hw.c +++ b/sw/airborne/arch/avr/spi_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -94,8 +94,8 @@ volatile uint8_t spi_cur_slave; uint8_t spi_nb_ovrn; void spi_init( void) { - /* Set MOSI and SCK output, all others input */ - MASTER_SPI_DDR |= _BV(MASTER_SPI_MOSI_PIN)| _BV(MASTER_SPI_SCK_PIN); + /* Set MOSI and SCK output, all others input */ + MASTER_SPI_DDR |= _BV(MASTER_SPI_MOSI_PIN)| _BV(MASTER_SPI_SCK_PIN); /* enable pull up for miso */ // SPI_PORT |= _BV(MASTER_SPI_MISO_PIN); @@ -108,7 +108,7 @@ void spi_init( void) { /* Set SS1 output */ SetBit( MASTER_SPI_SS1_DDR, MASTER_SPI_SS1_PIN); /* SS1 idles high (don't select slave yet)*/ - + /* Set SS2 output */ SetBit( MASTER_SPI_SS2_DDR, MASTER_SPI_SS2_PIN); /* SS2 idles high (don't select slave yet)*/ diff --git a/sw/airborne/arch/avr/spi_hw.h b/sw/airborne/arch/avr/spi_hw.h index 43eae1295c..384009ff61 100644 --- a/sw/airborne/arch/avr/spi_hw.h +++ b/sw/airborne/arch/avr/spi_hw.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2005-2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -46,7 +46,7 @@ extern volatile uint8_t spi_idx_buf; #ifdef SPI_MASTER -/* Enable SPI, Master, clock fck/16, interrupt */ +/* Enable SPI, Master, clock fck/16, interrupt */ #define SpiStart() { \ SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0); \ uint8_t foo; \ diff --git a/sw/airborne/arch/avr/sys_time_hw.h b/sw/airborne/arch/avr/sys_time_hw.h index 3d96a60c76..ba47e709ee 100644 --- a/sw/airborne/arch/avr/sys_time_hw.h +++ b/sw/airborne/arch/avr/sys_time_hw.h @@ -23,7 +23,7 @@ */ /* - *\brief AVR timer functions + *\brief AVR timer functions * */ @@ -111,7 +111,7 @@ static inline bool_t sys_time_periodic( void ) { return (tmr2_ov_cnt & 0x1); } -#else +#else //#define TMR2_PER_SEC 7812 static inline bool_t sys_time_periodic( void ) { if( !bit_is_set( TIFR, TOV2 ) ) diff --git a/sw/airborne/arch/avr/uart_hw.c b/sw/airborne/arch/avr/uart_hw.c index fc332c4722..b1c8aac337 100644 --- a/sw/airborne/arch/avr/uart_hw.c +++ b/sw/airborne/arch/avr/uart_hw.c @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -48,29 +48,29 @@ static uint8_t tx_buf[ TX_BUF_SIZE ]; */ void uart0_init_tx( void ) { - UBRRH = 0; + UBRRH = 0; UBRRL = F_CPU/(16*UART0_BAUD)-1; - /* single speed */ - UCSRA = 0; - /* Enable transmitter */ - UCSRB = _BV(TXEN); - /* Set frame format: 8data, 1stop bit */ - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); + /* single speed */ + UCSRA = 0; + /* Enable transmitter */ + UCSRB = _BV(TXEN); + /* Set frame format: 8data, 1stop bit */ + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); } void uart0_init_rx( void ) { - /* Enable receiver */ - UCSRB |= _BV(RXEN); + /* Enable receiver */ + UCSRB |= _BV(RXEN); /* Enable uart receive interrupt */ - sbi( UCSRB, RXCIE ); + sbi( UCSRB, RXCIE ); } bool_t uart0_check_free_space( uint8_t len) { int8_t space; if ((space = (tx_tail - tx_head)) <= 0) space += TX_BUF_SIZE; - + return (uint8_t)(space - 1) >= len; } @@ -119,11 +119,11 @@ void uart0_init_tx( void ) { UBRR0H = 0; UBRR0L = F_CPU/(16*UART0_BAUD)-1; - /* single speed */ - UCSR0A = 0; - /* Enable transmitter */ + /* single speed */ + UCSR0A = 0; + /* Enable transmitter */ UCSR0B = _BV(TXEN); - /* Set frame format: 8data, 1stop bit */ + /* Set frame format: 8data, 1stop bit */ UCSR0C = _BV(UCSZ1) | _BV(UCSZ0); tx_head0 = 0; @@ -131,9 +131,9 @@ void uart0_init_tx( void ) { } void uart0_init_rx( void ) { - /* Enable receiver */ + /* Enable receiver */ UCSR0B |= _BV(RXEN); - + /* Enable uart receive interrupt */ sbi(UCSR0B, RXCIE ); } @@ -142,7 +142,7 @@ bool_t uart0_check_free_space( uint8_t len) { int8_t space; if ((space = (tx_tail0 - tx_head0)) <= 0) space += TX_BUF_SIZE; - + return (uint16_t)(space - 1) >= len; } @@ -190,14 +190,14 @@ uint8_t uart1_rx_buffer[UART1_RX_BUFFER_SIZE]; void uart1_init_tx( void ) { /* set baud rate */ - UBRR1H = 0; + UBRR1H = 0; UBRR1L = F_CPU/(16*UART1_BAUD)-1; - /* single speed */ - UCSR1A = 0; - /* Enable transmitter */ + /* single speed */ + UCSR1A = 0; + /* Enable transmitter */ UCSR1B = _BV(TXEN); - /* Set frame format: 8data, 1stop bit */ + /* Set frame format: 8data, 1stop bit */ UCSR1C = _BV(UCSZ1) | _BV(UCSZ0); tx_head1 = 0; @@ -205,17 +205,17 @@ void uart1_init_tx( void ) { } void uart1_init_rx( void ) { - /* Enable receiver */ + /* Enable receiver */ UCSR1B |= _BV(RXEN); /* Enable uart receive interrupt */ - sbi(UCSR1B, RXCIE ); + sbi(UCSR1B, RXCIE ); } bool_t uart1_check_free_space( uint8_t len) { int8_t space; if ((space = (tx_tail1 - tx_head1)) <= 0) space += TX_BUF_SIZE; - + return (uint16_t)(space - 1) >= len; } diff --git a/sw/airborne/arch/avr/uart_hw.h b/sw/airborne/arch/avr/uart_hw.h index c0f7caf4a7..e8ca0c1af7 100644 --- a/sw/airborne/arch/avr/uart_hw.h +++ b/sw/airborne/arch/avr/uart_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/avr/uart_tunnel.c b/sw/airborne/arch/avr/uart_tunnel.c index 475cb0a204..bf7563d5a1 100644 --- a/sw/airborne/arch/avr/uart_tunnel.c +++ b/sw/airborne/arch/avr/uart_tunnel.c @@ -29,18 +29,18 @@ int main( void ) { /* setup PC_TX as output */ UART_PC_DDR |= _BV(UART_PC_TX); - + /* setup PC_RX as input, no pullup */ UART_PC_DDR &= ~_BV(UART_PC_RX); UART_PC_PORT &= ~_BV(UART_PC_RX); - + /* setup PERPH_TX as output */ UART_PERPH_DDR |= _BV(UART_PERPH_TX); - + /* setup PERPH_RX as input, no pullup */ UART_PERPH_DDR &= ~_BV(UART_PERPH_RX); UART_PERPH_PORT &= ~_BV(UART_PERPH_RX); - + while(1) { if (bit_is_set(UART_PERPH_PIN, UART_PERPH_RX)) { @@ -53,9 +53,9 @@ int main( void ) { } else { cbi(UART_PERPH_PORT, UART_PERPH_TX); } - + } - + return 0; } diff --git a/sw/airborne/arch/lpc21/ADS8344.c b/sw/airborne/arch/lpc21/ADS8344.c index cc2129b57d..dd72abcac8 100644 --- a/sw/airborne/arch/lpc21/ADS8344.c +++ b/sw/airborne/arch/lpc21/ADS8344.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008- ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -32,7 +32,7 @@ #define ADS8344_SS_IODIR IO0DIR #define ADS8344_SS_IOSET IO0SET #define ADS8344_SS_IOCLR IO0CLR -#define ADS8344_SS_PIN 20 +#define ADS8344_SS_PIN 20 #define ADS8344Select() SetBit(ADS8344_SS_IOCLR,ADS8344_SS_PIN) #define ADS8344Unselect() SetBit(ADS8344_SS_IOSET,ADS8344_SS_PIN) @@ -67,7 +67,7 @@ uint16_t ADS8344_values[NB_CHANNELS]; /* SSPCR0 settings */ #define SSP_DSS 0x07 << 0 /* data size : 8 bits */ #define SSP_FRF 0x00 << 4 /* frame format : SPI */ -#define SSP_CPOL 0x00 << 6 /* clock polarity : idle low */ +#define SSP_CPOL 0x00 << 6 /* clock polarity : idle low */ #define SSP_CPHA 0x00 << 7 /* clock phase : 1 */ #define SSP_SCR 0x0E << 8 /* serial clock rate : 1MHz */ @@ -87,17 +87,17 @@ void ADS8344_init( void ) { /* setup pins for SSP (SCK, MISO, MOSI) */ PINSEL1 |= 2 << 2 | 2 << 4 | 2 << 6; - + /* setup SSP */ SSPCR0 = SSP_DSS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR; SSPCR1 = SSP_LBM | SSP_MS | SSP_SOD; SSPCPSR = CPSDVSR; /* -> 50kHz */ - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT(VIC_SPI1); // SPI1 selected as IRQ VICIntEnable = VIC_BIT(VIC_SPI1); // SPI1 interrupt enabled VICVectCntl7 = VIC_ENABLE | VIC_SPI1; - VICVectAddr7 = (uint32_t)SPI1_ISR; // address of the ISR + VICVectAddr7 = (uint32_t)SPI1_ISR; // address of the ISR /* setup slave select */ /* configure SS pin */ diff --git a/sw/airborne/arch/lpc21/ADS8344.h b/sw/airborne/arch/lpc21/ADS8344.h index 78f1bc8326..72cec8b93b 100644 --- a/sw/airborne/arch/lpc21/ADS8344.h +++ b/sw/airborne/arch/lpc21/ADS8344.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008- ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/lpc21/armVIC.h b/sw/airborne/arch/lpc21/armVIC.h index 5ae3f11766..c8637a41e3 100644 --- a/sw/airborne/arch/lpc21/armVIC.h +++ b/sw/airborne/arch/lpc21/armVIC.h @@ -52,8 +52,8 @@ * routines to operate properly with THUMB code. The MACRO performs * the following steps: * - * 1 - Recover SPSR value from stack - * 2 - and restore its value + * 1 - Recover SPSR value from stack + * 2 - and restore its value * 3 - Pop the return address & the saved general registers from * the IRQ stack & return * @@ -69,7 +69,7 @@ * Description: * This function sets the IRQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -85,7 +85,7 @@ unsigned disableIRQ(void); * Description: * This function clears the IRQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -102,7 +102,7 @@ unsigned enableIRQ(void); * This function restores the IRQ disable bit in the status register * to the value contained within passed oldCPSR * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -118,7 +118,7 @@ unsigned restoreIRQ(unsigned oldCPSR); * Description: * This function sets the FIQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -134,7 +134,7 @@ unsigned disableFIQ(void); * Description: * This function clears the FIQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -151,7 +151,7 @@ unsigned enableFIQ(void); * This function restores the FIQ disable bit in the status register * to the value contained within passed oldCPSR * - * Calling Sequence: + * Calling Sequence: * void * * Returns: diff --git a/sw/airborne/arch/lpc21/efsl/conf/config.h b/sw/airborne/arch/lpc21/efsl/conf/config.h index fcb34982d1..f063569441 100644 --- a/sw/airborne/arch/lpc21/efsl/conf/config.h +++ b/sw/airborne/arch/lpc21/efsl/conf/config.h @@ -9,7 +9,7 @@ * Here you will define for what hardware-endpoint EFSL should be compiled. * Look in interfaces.h to see what systems are supported, and add your own - * there if you need to write your own driver. Then, define the name you + * there if you need to write your own driver. Then, define the name you * selected for your hardware there here. Make sure that you only select one * device! */ @@ -22,13 +22,13 @@ /* defines the interface for LPC213x (0=SPI0 1=SPI1) */ //#define HW_ENDPOINT_LPC2000_SPINUM (0) //#define HW_ENDPOINT_LPC2000_SPINUM (1) - + /*#define HW_ENDPOINT_DSP_TI6713_SD*/ /* Memory configuration -------------------- - + * Here you must configure wheter your processor can access memory byte * oriented. All x86 processors can do it, AVR's can do it to. Some DSP * or other microcontrollers can't. If you have an 8 bit system you're safe. @@ -40,9 +40,9 @@ /* Cache configuration ------------------- - + * Here you must configure how much memory of cache you can/want to use. - * The number you put at IOMAN_NUMBUFFER is multiplied by 512. So 1 means + * The number you put at IOMAN_NUMBUFFER is multiplied by 512. So 1 means * 512 bytes cache, 4 means 2048 bytes cache. More is better. * The number after IOMAN_NUMITERATIONS should be untouched. * The last field (IOMAN_DO_MEMALLOC) is to tell ioman to allocate it's @@ -55,9 +55,9 @@ #define IOMAN_NUMITERATIONS 3 #define IOMAN_DO_MEMALLOC -/* Cluster pre-allocation +/* Cluster pre-allocation ---------------------- - + * When writing files, the function that performs the actual write has to * calculate how many clusters it will need for that request. It then allocates * that number of new clusters to the file. Since this involves some calculations @@ -77,28 +77,28 @@ /* Endianess configuration ----------------------- - + * Here you can configure wheter your architecture is little or big endian. This * is important since all FAT structures are stored in intel little endian order. * So if you have a big endian system the library has to convert all figures to * big endian in order to work. */ #define LITTLE_ENDIAN - + /* Date and Time support --------------------- - + * Here you can enable or disable date and time support. If you enable * it you will have to create 6 functions, that are described in the * EFSL manual. If the functions are not present when linking your * program with the library you will get unresolved dependencies. */ /*#define DATE_TIME_SUPPORT*/ - + /* Error reporting support ----------------------- - + * When you receive an error in userland, it usually only gives limited * information (most likely, fail or success). If error detection and * reporting is important for you, you can enable more detailed error @@ -118,9 +118,9 @@ #define FULL_ERROR_SUPPORT /*#define BASE_ERROR_SUPPORT*/ -/* List options +/* List options ------------ - + * In this section youcan configure what kind of data you will get from * directory listing requests. Please refer to the documentation for * more information @@ -133,10 +133,10 @@ /* Debugging configuration ----------------------- - + * Here you can configure the debugging behaviour. Debugging is different - * on every platform (see debug.h for more information). - * If your hardware has no means of output (printf) dont define any anything, + * on every platform (see debug.h for more information). + * If your hardware has no means of output (printf) dont define any anything, * and nothing will happen. For real world use debugging should be turned off. */ diff --git a/sw/airborne/arch/lpc21/efsl/inc/debug.h b/sw/airborne/arch/lpc21/efsl/inc/debug.h index 39e3243ed6..0abaf84999 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/debug.h +++ b/sw/airborne/arch/lpc21/efsl/inc/debug.h @@ -51,7 +51,7 @@ #ifdef DEBUG #if defined(HW_ENDPOINT_LINUX) || defined(HW_ENDPOINT_LINUX64) - #define HW_ENDPOINT_LINUX_ALL + #define HW_ENDPOINT_LINUX_ALL #endif #ifdef HW_ENDPOINT_ATMEGA128_SD @@ -69,7 +69,7 @@ #ifdef HW_ENDPOINT_LINUX_ALL #include #include - + #define TXT(x) x #define DBG(x) debug x #define FUNC_IN(x) debug_funcin(x) @@ -96,7 +96,7 @@ #endif #ifdef HW_ENDPOINT_LPC2000_SD #include "interfaces/lpc2000_dbg_printf.h" - + #define TXT(x) x #define DBG(x) debug x #define FUNC_IN(x) ; diff --git a/sw/airborne/arch/lpc21/efsl/inc/disc.h b/sw/airborne/arch/lpc21/efsl/inc/disc.h index 0f90406954..eafe09dd83 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/disc.h +++ b/sw/airborne/arch/lpc21/efsl/inc/disc.h @@ -68,8 +68,8 @@ typedef struct PartitionField PartitionField; #define SIZE_PARTITION_FIELD 16 /***************************************************************************************\ - Disc - -- + Disc + -- * CompactFlash* sourcedisc Pointer to the hardwareobject that this disc is on. * PartitionField* partitions Array of PartitionFields, containing the partition info \***************************************************************************************/ diff --git a/sw/airborne/arch/lpc21/efsl/inc/error.h b/sw/airborne/arch/lpc21/efsl/inc/error.h index 237b807b20..6ebad4c1cc 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/error.h +++ b/sw/airborne/arch/lpc21/efsl/inc/error.h @@ -58,8 +58,8 @@ #define ioman_setError(ioman,errval) ioman->error = errval #define ioman_getError(ioman) ioman->error #else - #define IOMAN_ERR_EUINT8 - #define ioman_setError(ioman,errval) + #define IOMAN_ERR_EUINT8 + #define ioman_setError(ioman,errval) #define ioman_getError(ioman) 0 #endif @@ -68,8 +68,8 @@ #define disc_setError(disc,errval) disc->error = errval #define disc_getError(disc) disc->error #else - #define DISC_ERR_EUINT8 - #define disc_setError(disc,errval) + #define DISC_ERR_EUINT8 + #define disc_setError(disc,errval) #define disc_getError(disc) 0 #endif @@ -78,8 +78,8 @@ #define part_setError(part,errval) part->error = errval #define part_getError(part) part->error #else - #define PART_ERR_EUINT8 - #define part_setError(part,errval) + #define PART_ERR_EUINT8 + #define part_setError(part,errval) #define part_getError(part) 0 #endif @@ -88,8 +88,8 @@ #define fs_setError(fs,errval) fs->error = errval #define fs_getError(fs) fs->error #else - #define FILESYSTEM_ERR_EUINT8 - #define fs_setError(fs,errval) + #define FILESYSTEM_ERR_EUINT8 + #define fs_setError(fs,errval) #define fs_getError(fs) 0 #endif @@ -98,8 +98,8 @@ #define file_setError(file,errval) file->error = errval #define file_getError(file) file->error #else - #define FILE_ERR_EUINT8 - #define file_setError(file,errval) + #define FILE_ERR_EUINT8 + #define file_setError(file,errval) #define file_getError(file) 0 #endif diff --git a/sw/airborne/arch/lpc21/efsl/inc/file.h b/sw/airborne/arch/lpc21/efsl/inc/file.h index 2511d80019..3b7f7f39d7 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/file.h +++ b/sw/airborne/arch/lpc21/efsl/inc/file.h @@ -53,13 +53,13 @@ #define FILE_STATUS_WRITE 1 /*****************************************************************************\ - * File - * ------ - * FileRecord DirEntry Copy of the FileRecord for this file + * File + * ------ + * FileRecord DirEntry Copy of the FileRecord for this file * FileLocation Location Location of the direntry - * FileSystem *fs Pointer to the filesystem this file is on - * FileCache Cache Pointer to the cache object of the file - * euint8 FileStatus Contains bitfield regarding filestatus + * FileSystem *fs Pointer to the filesystem this file is on + * FileCache Cache Pointer to the cache object of the file + * euint8 FileStatus Contains bitfield regarding filestatus * euint32 FilePtr Offsetpointer for fread/fwrite functions * euint32 FileSize Working copy of the filesize, always use this, it is more up to date than DirEntry->FileSize, @@ -83,7 +83,7 @@ esint16 file_setpos(File *file,euint32 pos); euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf); euint32 file_read (File *file,euint32 size,euint8 *buf); euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf); -euint32 file_write (File* file,euint32 size,euint8* buf); +euint32 file_write (File* file,euint32 size,euint8* buf); eint8* file_normalToFatName(eint8* filename,eint8* fatfilename); euint8 file_validateChar(euint8 c); void file_initFile(File *file, FileSystem *fs, FileLocation *loc); diff --git a/sw/airborne/arch/lpc21/efsl/inc/fs.h b/sw/airborne/arch/lpc21/efsl/inc/fs.h index ad55ab652f..f592ed15af 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/fs.h +++ b/sw/airborne/arch/lpc21/efsl/inc/fs.h @@ -51,16 +51,16 @@ /*****************************************************************************************\ VolumeId - ------ + ------ * ushort BytesPerSector Must be 512 or shit happens. * uchar SectorsPerCluster Must be multiple of 2 (1,2,4,8,16 or 32) * ushort ReservedSectorCount Number of sectors after which the first FAT begins. * uchar NumberOfFats Should be 2 * ushort RootEntryCount Number of filerecords the Rootdir can contain. NOT for FAT32 -* ushort SectorCount16 Number of Sectors for 12/16 bit FAT +* ushort SectorCount16 Number of Sectors for 12/16 bit FAT * ushort FatSectorCount16 Number of Sectors for 1 FAT on FAT12/16 bit FAT's * ulong SectorCount32 Number of Sectors for 32 bit FAT -* ulong FatSectorCount32 Number of Sectors for 1 FAT on FAT32 +* ulong FatSectorCount32 Number of Sectors for 1 FAT on FAT32 * ulong RootCluster Clusternumber of the first cluster of the RootDir on FAT 32 This is NOT a complete volumeId copy, no direct I/O is possible. \*****************************************************************************************/ @@ -86,7 +86,7 @@ typedef struct VolumeId VolumeId; * ulong DataClusterCount Number of dataclusters. This number determines the FATType. * ulong FatSectorCount Number of sectors for 1 FAT, regardless of FATType * ulong SectorCount Number of sectors, regardless of FATType -* ulong FirstSectorRootDir First sector of the RootDir. +* ulong FirstSectorRootDir First sector of the RootDir. * uchar type Determines FATType (FAT12 FAT16 or FAT32 are defined) \**************************************************************************************************/ @@ -118,16 +118,16 @@ struct FileLocation{ typedef struct FileLocation FileLocation; /*****************************************************************************\ -* FileCache -* ----------- -* This struct acts as cache for the current file. It contains the current -* FATPointer (next location in the FAT table), LogicCluster -* (the last part of the file that was read) and DataCluster -* (the last cluster that was read). +* FileCache +* ----------- +* This struct acts as cache for the current file. It contains the current +* FATPointer (next location in the FAT table), LogicCluster +* (the last part of the file that was read) and DataCluster +* (the last cluster that was read). * euint8 Linear For how many more clusters the file is nonfragmented * euint32 LogicCluster This field determines the n'th cluster of the file as current * euint32 DiscCluster If this field is 0, it means the cache is invalid. Otherwise - it is the clusternumber corresponding with + it is the clusternumber corresponding with logic(FirstCluster+LogicCluster). * euint32 FirstCluster First cluster of the chain. Zero or one are invalid. * euint32 LastCluster Last cluster of the chain (is not always filled in) diff --git a/sw/airborne/arch/lpc21/efsl/inc/interfaces/LPC2000_regs.h b/sw/airborne/arch/lpc21/efsl/inc/interfaces/LPC2000_regs.h index 15d0e973fa..79341825a5 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/interfaces/LPC2000_regs.h +++ b/sw/airborne/arch/lpc21/efsl/inc/interfaces/LPC2000_regs.h @@ -69,4 +69,4 @@ #define PREINT (*((volatile unsigned short*) 0xE0024080)) #define PREFRAC (*((volatile unsigned short*) 0xE0024084)) -#endif +#endif diff --git a/sw/airborne/arch/lpc21/efsl/inc/interfaces/lpc2000_spi.h b/sw/airborne/arch/lpc21/efsl/inc/interfaces/lpc2000_spi.h index d8920b09fc..0556ce0b5f 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/interfaces/lpc2000_spi.h +++ b/sw/airborne/arch/lpc21/efsl/inc/interfaces/lpc2000_spi.h @@ -29,8 +29,8 @@ * LPC2000 ARM7 Interface (c)2005 Martin Thomas * \*****************************************************************************/ -#ifndef __LPC2000_SPI_H_ -#define __LPC2000_SPI_H_ +#ifndef __LPC2000_SPI_H_ +#define __LPC2000_SPI_H_ #ifndef FALSE #define FALSE 0x00 diff --git a/sw/airborne/arch/lpc21/efsl/inc/interfaces/sd.h b/sw/airborne/arch/lpc21/efsl/inc/interfaces/sd.h index 3b5a797f61..d1cc3a787b 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/interfaces/sd.h +++ b/sw/airborne/arch/lpc21/efsl/inc/interfaces/sd.h @@ -31,8 +31,8 @@ * (c)2006 Michael De Nil * \*****************************************************************************/ -#ifndef __SD_H_ -#define __SD_H_ +#ifndef __SD_H_ +#define __SD_H_ #include "config.h" #include "types.h" diff --git a/sw/airborne/arch/lpc21/efsl/inc/ioman.h b/sw/airborne/arch/lpc21/efsl/inc/ioman.h index 83d93e874c..539cc85669 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/ioman.h +++ b/sw/airborne/arch/lpc21/efsl/inc/ioman.h @@ -59,15 +59,15 @@ typedef struct IOManStack IOManStack; struct IOManager{ hwInterface *iface; - + euint8 *bufptr; euint16 numbuf; euint16 numit; - + IOMAN_ERR_EUINT8 - + IOManStack stack[IOMAN_NUMBUFFER][IOMAN_NUMITERATIONS]; - + euint32 sector[IOMAN_NUMBUFFER]; euint8 status[IOMAN_NUMBUFFER]; euint8 usage[IOMAN_NUMBUFFER]; diff --git a/sw/airborne/arch/lpc21/efsl/inc/types.h b/sw/airborne/arch/lpc21/efsl/inc/types.h index cac904ebdb..7050d19c94 100644 --- a/sw/airborne/arch/lpc21/efsl/inc/types.h +++ b/sw/airborne/arch/lpc21/efsl/inc/types.h @@ -47,8 +47,8 @@ typedef unsigned char euint8; typedef short eint16; typedef signed short esint16; - typedef unsigned short euint16; - typedef long eint32; + typedef unsigned short euint16; + typedef long eint32; typedef signed long esint32; typedef unsigned long euint32; #elif defined(HW_ENDPOINT_LINUX64) @@ -57,8 +57,8 @@ typedef unsigned char euint8; typedef short eint16; typedef signed short esint16; - typedef unsigned short euint16; - typedef int eint32; + typedef unsigned short euint16; + typedef int eint32; typedef signed int esint32; typedef unsigned int euint32; #elif defined (HW_ENDPOINT_ATMEGA128_SD) @@ -67,18 +67,18 @@ typedef unsigned char euint8; typedef short eint16; typedef signed short esint16; - typedef unsigned short euint16; - typedef long eint32; + typedef unsigned short euint16; + typedef long eint32; typedef signed long esint32; - typedef unsigned long euint32; + typedef unsigned long euint32; #elif defined(HW_ENDPOINT_DSP_TI6713_SD) typedef char eint8; typedef signed char esint8; typedef unsigned char euint8; typedef short eint16; typedef signed short esint16; - typedef unsigned short euint16; - typedef int eint32; + typedef unsigned short euint16; + typedef int eint32; typedef signed int esint32; typedef unsigned int euint32; #elif defined(NIOS_2) @@ -90,17 +90,17 @@ typedef unsigned short euint16; typedef int eint32; typedef signed int esint32; - typedef unsigned int euint32; + typedef unsigned int euint32; #else typedef char eint8; typedef signed char esint8; typedef unsigned char euint8; typedef short eint16; typedef signed short esint16; - typedef unsigned short euint16; - typedef long eint32; + typedef unsigned short euint16; + typedef long eint32; typedef signed long esint32; - typedef unsigned long euint32; + typedef unsigned long euint32; #endif #endif diff --git a/sw/airborne/arch/lpc21/efsl/src/debug.c b/sw/airborne/arch/lpc21/efsl/src/debug.c index d3ef43df58..e72134e4ce 100644 --- a/sw/airborne/arch/lpc21/efsl/src/debug.c +++ b/sw/airborne/arch/lpc21/efsl/src/debug.c @@ -46,7 +46,7 @@ #ifdef HW_ENDPOINT_LINUX_ALL /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void debug(const eint8 *format, ...) * Description: This function prints debug output to the screen (target dependant) * and if DO_FUNC_DEBUG is defined also to a localfile. @@ -61,7 +61,7 @@ void debug(const eint8 *format, ...) extern FILE* debugfile; extern volatile euint8 tw; #endif - + va_start(ap, format); vprintf(format,ap); #ifdef DO_FUNC_DEBUG @@ -75,7 +75,7 @@ void debug(const eint8 *format, ...) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void debug_funcin(const eint8 *format, ...) * Description: This function marks the entrance of a function, which * increments a tabfieldcounter. A tree like structure can the be found in the @@ -90,24 +90,24 @@ void debug_funcin(const eint8 *format, ...) va_list ap; extern FILE* debugfile; extern volatile unsigned char tw; - + if(debugfile==NULL)return; - + for(c=0;c0)tw--; - + for(c=0;c=90) debug(PSTR("\n")); } @@ -208,16 +208,16 @@ void debug(const eint8 *format, ...) void debug_init(void) { unsigned short ubrr; - + ubrr = ((unsigned short)DEBUG_UBRR); - + switch(DEBUG_PORT){ case 0: UBRR0H = (euint8) (ubrr>>8); UBRR0L = (euint8) (ubrr); UCSR0B = ( (1<>8); UBRR1L = (euint8) (ubrr); UCSR1B = ( (1<part,loc->Sector,IOM_MODE_READONLY); *filerec=*(((FileRecord*)buf)+loc->Offset); part_relSect(fs->part,buf); -} +} /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void dir_createDirectoryEntry(FileSystem *fs,FileRecord *filerec,FileLocation *loc) * Description: This function writes the filerecord stored in filerec to disc at - * location loc. + * location loc. * Return value: void */ void dir_createDirectoryEntry(FileSystem *fs,FileRecord *filerec,FileLocation *loc) { euint8 *buf; - + buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE); memCpy(filerec,buf+(loc->Offset*sizeof(*filerec)),sizeof(*filerec)); part_relSect(fs->part,buf); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilename) * Description: This function fills in a filerecord with safe default values, and - * a given fatfilename. If your system has a means of knowing time, here is an - * excellent place to apply it to the filerecord. + * a given fatfilename. If your system has a means of knowing time, here is an + * excellent place to apply it to the filerecord. * Return value: void */ void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilename) @@ -82,7 +82,7 @@ void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilenam filerec->NTReserved=0x00; filerec->MilliSecTimeStamp=0x00; filerec->CreatedTime=time_getTime(); - filerec->CreatedDate=time_getDate(); + filerec->CreatedDate=time_getDate(); filerec->AccessDate=filerec->CreatedDate; filerec->FirstClusterHigh=0x0000; filerec->WriteTime=filerec->CreatedTime; @@ -92,7 +92,7 @@ void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilenam } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void dir_setFirstCluster(File *file,euint32 cluster_addr) * Description: This function requires modification to release it from * depending on the file object. @@ -101,15 +101,15 @@ void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilenam void dir_setFirstCluster(FileSystem *fs,FileLocation *loc,euint32 cluster_addr) { euint8 *buf; - + buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE); (((FileRecord*)buf)+loc->Offset)->FirstClusterHigh=cluster_addr>>16; - (((FileRecord*)buf)+loc->Offset)->FirstClusterLow=cluster_addr&0xFFFF; + (((FileRecord*)buf)+loc->Offset)->FirstClusterLow=cluster_addr&0xFFFF; part_relSect(fs->part,buf); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void dir_setFileSize(FileSystem *fs, FileLocation *loc,euint32 numbytes) * Description: This function changes the filesize recorded at loc->Sector * to 'numbytes'. @@ -118,14 +118,14 @@ void dir_setFirstCluster(FileSystem *fs,FileLocation *loc,euint32 cluster_addr) void dir_setFileSize(FileSystem *fs, FileLocation *loc,euint32 numbytes) { euint8 *buf; - + buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE); (((FileRecord*)buf)+loc->Offset)->FileSize=numbytes; part_relSect(fs->part,buf); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint8 dir_updateDirectoryEntry(FileSystem *fs,FileRecord *entry,FileLocation *loc)) * This function changes the entire entity stores at loc to the data recorded * in entry. This is for custom updates to the directoryentry. @@ -134,14 +134,14 @@ void dir_setFileSize(FileSystem *fs, FileLocation *loc,euint32 numbytes) esint8 dir_updateDirectoryEntry(FileSystem *fs,FileRecord *entry,FileLocation *loc) { euint8 *buf; - + buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE); memCpy(entry,buf+(loc->Offset*sizeof(*entry)),sizeof(*entry)); part_relSect(fs->part,buf); return(0); } -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findFileinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) * This function searches for a given fatfilename in the buffer provided. * It will iterate through the 16 direntry's in the buffer and searches @@ -155,7 +155,7 @@ euint32 dir_findFileinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) { FileRecord fileEntry; euint8 c; - + for(c=0; c<16; c++) { fileEntry = *(((FileRecord*)buf) + c); @@ -182,7 +182,7 @@ euint32 dir_findFileinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) return(0); } -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findFreeEntryinBuf(euint8* buf, FileLocation *loc) * This function searches for a free entry in a given sector 'buf'. * It will put the offset into the loc->Offset field, given that loc is not 0. @@ -192,7 +192,7 @@ euint32 dir_findFreeEntryinBuf(euint8* buf, FileLocation *loc) { FileRecord fileEntry; euint8 c; - + for(c=0;c<16;c++){ fileEntry = *(((FileRecord*)buf) + c); if( !( (fileEntry.Attribute & 0x0F) == 0x0F ) ){ @@ -206,7 +206,7 @@ euint32 dir_findFreeEntryinBuf(euint8* buf, FileLocation *loc) return(0); } -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) * Description: This function searches for a given fatfilename in a buffer. * Return value: Returns 0 on not found, and the firstcluster when the name is found. @@ -228,7 +228,7 @@ euint32 dir_findinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc, euint8 mo } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in a full cluster. @@ -238,7 +238,7 @@ euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLoc { euint8 c,*buf=0; euint32 fclus; - + for(c=0;cvolumeId.SectorsPerCluster;c++){ buf = part_getSect(fs->part,fs_clusterToSector(fs,cluster)+c,IOM_MODE_READONLY); if((fclus=dir_findinBuf(buf,fatname,loc,mode))){ @@ -251,7 +251,7 @@ euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLoc return(0); } -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in a directory, following the clusterchains. @@ -261,14 +261,14 @@ euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileL { euint32 c=0,cluster; ClusterChain Cache; - + Cache.DiscCluster = Cache.FirstCluster = firstcluster; Cache.LogicCluster = Cache.LastCluster = Cache.Linear = 0; - + if(firstcluster <= 1){ - return(dir_findinRootArea(fs,fatname,loc,mode)); + return(dir_findinRootArea(fs,fatname,loc,mode)); } - + while(!fat_LogicToDiscCluster(fs,&Cache,c++)){ if((cluster=dir_findinCluster(fs,Cache.DiscCluster,fatname,loc,mode))){ return(cluster); @@ -277,7 +277,7 @@ euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileL return(0); } -/* **************************************************************************** +/* **************************************************************************** * euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in the rootdirectory-area of a FAT12/FAT16 filesystem. @@ -287,23 +287,23 @@ euint32 dir_findinRootArea(FileSystem *fs,eint8* fatname, FileLocation *loc, eui { euint32 c,fclus; euint8 *buf=0; - + if((fs->type != FAT12) && (fs->type != FAT16))return(0); - + for(c=fs->FirstSectorRootDir;c<(fs->FirstSectorRootDir+fs->volumeId.RootEntryCount/32);c++){ buf = part_getSect(fs->part,c,IOM_MODE_READONLY); if((fclus=dir_findinBuf(buf,fatname,loc,mode))){ if(loc)loc->Sector=c; part_relSect(fs->part,buf); return(fclus); - } - part_relSect(fs->part,buf); + } + part_relSect(fs->part,buf); } part_relSect(fs->part,buf); return(0); } -/* **************************************************************************** +/* **************************************************************************** * esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename) * This function will take a full directory path, and strip off all leading * dirs and characters, leaving you with the MS-DOS notation of the actual filename. @@ -312,21 +312,21 @@ euint32 dir_findinRootArea(FileSystem *fs,eint8* fatname, FileLocation *loc, eui esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename) { eint8 ffnamec[11],*next,nn=0; - + memClr(ffnamec,11); memClr(fatfilename,11); next = filename; - + if(*filename=='/')next++; - + while((next=file_normalToFatName(next,ffnamec))){ - memCpy(ffnamec,fatfilename,11); + memCpy(ffnamec,fatfilename,11); nn++; } if(nn)return(1); return(0); } -/* **************************************************************************** +/* **************************************************************************** * esint8 dir_addCluster(FileSystem *fs,euint32 firstCluster) * This function extends a directory by 1 cluster + optional the number of * clusters you want pre-allocated. It will also delete the contents of that @@ -337,7 +337,7 @@ esint8 dir_addCluster(FileSystem *fs,euint32 firstCluster) { euint32 lastc,logicalc; ClusterChain cache; - + fs_initClusterChain(fs,&cache,firstCluster); if(fat_allocClusterChain(fs,&cache,1)){ return(-1); diff --git a/sw/airborne/arch/lpc21/efsl/src/disc.c b/sw/airborne/arch/lpc21/efsl/src/disc.c index 8657f0bab5..f4d4ef5c9d 100644 --- a/sw/airborne/arch/lpc21/efsl/src/disc.c +++ b/sw/airborne/arch/lpc21/efsl/src/disc.c @@ -35,7 +35,7 @@ #include "disc.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void disc_initDisc(Disc *disc,hcInterface* source) * Description: This initialises the disc by loading the MBR and setting the * pointer to the hardware object. @@ -46,9 +46,9 @@ void disc_initDisc(Disc *disc,IOManager* ioman) disc_setError(disc,DISC_NOERROR); disc_loadMBR(disc); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void disc_loadMBR(Disc *disc) * Description: This functions copies the partitiontable to the partitions field. */ @@ -56,13 +56,13 @@ void disc_loadMBR(Disc *disc) { euint8 x; euint8 *buf; - + buf=ioman_getSector(disc->ioman,LBA_ADDR_MBR,IOM_MODE_READONLY|IOM_MODE_EXP_REQ); for(x=0;x<4;x++){ ex_getPartitionField(buf,&(disc->partitions[x]),PARTITION_TABLE_OFFSET+(x*SIZE_PARTITION_FIELD)); } ioman_releaseSector(disc->ioman,buf); } -/*****************************************************************************/ +/*****************************************************************************/ diff --git a/sw/airborne/arch/lpc21/efsl/src/efs.c b/sw/airborne/arch/lpc21/efsl/src/efs.c index f67eef9f30..6635218620 100644 --- a/sw/airborne/arch/lpc21/efsl/src/efs.c +++ b/sw/airborne/arch/lpc21/efsl/src/efs.c @@ -35,7 +35,7 @@ #include "efs.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint8 efs_init(EmbeddedFileSystem * efs,eint8* opts) * Description: This function initialises all subelements of a filesystem. * It sets the pointerchain and verifies each step. @@ -51,7 +51,7 @@ esint8 efs_init(EmbeddedFileSystem * efs,eint8* opts) if(efs->myPart.activePartition==-1){ efs->myDisc.partitions[0].type=0x0B; efs->myDisc.partitions[0].LBA_begin=0; - efs->myDisc.partitions[0].numSectors=efs->myCard.sectorCount; + efs->myDisc.partitions[0].numSectors=efs->myCard.sectorCount; /*efs->myPart.activePartition = 0;*/ /*efs->myPart.disc = &(efs->myDisc);*/ part_initPartition(&efs->myPart, &efs->myDisc); diff --git a/sw/airborne/arch/lpc21/efsl/src/fat.c b/sw/airborne/arch/lpc21/efsl/src/fat.c index b3594b435a..968de5f135 100644 --- a/sw/airborne/arch/lpc21/efsl/src/fat.c +++ b/sw/airborne/arch/lpc21/efsl/src/fat.c @@ -35,16 +35,16 @@ #include "fs.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * unsigned long fat_getSectorAddressFatEntry(FileSystem *fs,unsigned long cluster_addr) * Description: Returns the sectornumber that holds the fat entry for cluster cluster_addr. * This works for all FAT types. * Return value: Sectornumber, or 0. Warning, no boundary check. */ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr) -{ +{ euint32 base = fs->volumeId.ReservedSectorCount,res; - + switch(fs->type){ case FAT12: res=(cluster_addr*3/1024); @@ -69,14 +69,14 @@ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr) }else{ return(base+res); } - break; + break; } return(0); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * unsigned long fat_getNextClusterAddress(FileSystem *fs,unsigned long cluster_addr * Description: This function loads the sector of the fat which contains the entry * for cluster_addr. It then fetches and (if required) calculates it's value. @@ -85,20 +85,20 @@ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr) */ euint32 fat_getNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint16 *linear) { - euint8 *buf; + euint8 *buf; euint8 hb,lb; euint16 offset; euint32 sector; euint32 nextcluster=0; - + sector=fat_getSectorAddressFatEntry(fs,cluster_addr); if( (fs->FatSectorCount <= (sector-fs->volumeId.ReservedSectorCount)) || sector==0 ) { return(0); } - + buf=part_getSect(fs->part,sector,IOM_MODE_READONLY); - + switch(fs->type) { case FAT12: @@ -126,34 +126,34 @@ euint32 fat_getNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint16 *l nextcluster = *((euint32 *)buf + offset); break; } - + part_relSect(fs->part,buf); - + return(nextcluster); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fat_setNextClusterAddress(FileSystem *fs,unsigned long cluster_addr,unsigned long next_cluster_addr) * Description: This function makes an entry in the fattable for cluster_addr. The value it puts there - * is next_cluster_addr. + * is next_cluster_addr. */ void fat_setNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint32 next_cluster_addr) { - euint8 *buf,*buf2; + euint8 *buf,*buf2; euint16 offset; euint32 sector; - + sector=fat_getSectorAddressFatEntry(fs,cluster_addr); - + if(( fs->FatSectorCount <= (sector - fs->volumeId.ReservedSectorCount )||(sector==0))){ DBG((TXT("HARDERROR:::fat_getNextClusterAddress READ PAST FAT BOUNDARY\n"))); return; } - + buf=part_getSect(fs->part,sector,IOM_MODE_READWRITE); - + switch(fs->type){ case FAT12: offset = ((cluster_addr%1024)*3/2)%512; @@ -192,12 +192,12 @@ void fat_setNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint32 next_ part_relSect(fs->part,buf); break; } - + } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * short fat_isEocMarker(FileSystem *fs,unsigned long fat_entry) * Description: Checks if a certain value is the EoC marker for the filesystem * noted in fs->type. @@ -224,10 +224,10 @@ eint16 fat_isEocMarker(FileSystem *fs,euint32 fat_entry) } return(1); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * unsigned long fat_giveEocMarker(FileSystem *fs) * Description: Returns an EoC markernumber valid for the filesystem noted in * fs->type. @@ -251,9 +251,9 @@ euint32 fat_giveEocMarker(FileSystem *fs) } return(0); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 fat_getNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr, euint8* buf) * Description: This function retrieves the contents of a FAT field. It does not fetch * it's own buffer, it is given as a parameter. (ioman makes this function rather obsolete) @@ -266,7 +266,7 @@ euint32 fat_getNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr, euint euint8 hb,lb; euint16 offset; euint32 nextcluster=0; - + switch(fs->type) { case FAT12: @@ -296,9 +296,9 @@ euint32 fat_getNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr, euint } return(nextcluster); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fat_setNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr,euint32 next_cluster_addr,euint8* buf) * Description: This function fills in a fat entry. The entry is cluster_addr and the * data entered is next_cluster_addr. This function is also given a *buf, so it does @@ -310,7 +310,7 @@ void fat_setNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr,euint32 n { euint16 offset; euint8 *buf2; - + switch(fs->type) { case FAT12: @@ -350,10 +350,10 @@ void fat_setNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr,euint32 n } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint16 fat_getNextClusterChain(FileSystem *fs, ClusterChain *Cache) * Description: This function is to advance the clusterchain of a Cache. - * First, the function verifies if the Cache is valid. It could correct it if it + * First, the function verifies if the Cache is valid. It could correct it if it * is not, but this is not done at the time. If the cachen is valid, the next step is * to see what the next cluster is, if this is the End of Clustermark, the cache is * updated to know the lastcluster but will remain untouched otherwise. -1 is returned. @@ -384,29 +384,29 @@ esint16 fat_getNextClusterChain(FileSystem *fs, ClusterChain *Cache) part_relSect(fs->part,buf); return(-1); } - + Cache->DiscCluster=dc; Cache->LogicCluster++; - + lr=Cache->DiscCluster-1; nlr=lr+1; - + while(nlr-1==lr && fat_getSectorAddressFatEntry(fs,nlr)==sect) { lr=nlr; nlr=fat_getNextClusterAddressWBuf(fs,lr,buf); - lin++; + lin++; } - + Cache->Linear=lin-1<0?0:lin-1; - + part_relSect(fs->part,buf); return(0); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint16 fat_LogicToDiscCluster(FileSystem *fs, ClusterChain *Cache,euint32 logiccluster) * Description: This function is used to follow clusterchains. When called it will convert * a logical cluster, to a disc cluster, using a Cache object. All it does is call @@ -422,11 +422,11 @@ esint16 fat_LogicToDiscCluster(FileSystem *fs, ClusterChain *Cache,euint32 logic Cache->DiscCluster=Cache->FirstCluster; Cache->Linear=0; } - + if(Cache->LogicCluster==logiccluster){ return(0); } - + while(Cache->LogicCluster!=logiccluster) { if(Cache->Linear!=0) @@ -446,10 +446,10 @@ esint16 fat_LogicToDiscCluster(FileSystem *fs, ClusterChain *Cache,euint32 logic } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * eint16 fat_allocClusterChain(FileSystem *fs,ClusterChain *Cache,euint32 num_clusters) * Description: This function extends a clusterchain by num_clusters. It returns the - * number of clusters it *failed* to allocate. + * number of clusters it *failed* to allocate. * Return value: 0 on success, all other values are the number of clusters it could * not allocate. */ @@ -460,10 +460,10 @@ eint16 fat_allocClusterChain(FileSystem *fs,ClusterChain *Cache,euint32 num_clus euint8 overflow=0; if(Cache->FirstCluster<=1)return(num_clusters); - + lc=fs_getLastCluster(fs,Cache); cc=lc; - + while(ncl > 0){ cc++; if(cc>=fs->DataClusterCount+1){ @@ -498,7 +498,7 @@ eint16 fat_allocClusterChain(FileSystem *fs,ClusterChain *Cache,euint32 num_clus return(0); } -/* **************************************************************************** +/* **************************************************************************** * eint16 fat_unlinkClusterChain(FileSystem *fs,ClusterChain *Cache) * Description: This function removes a clusterchain. Starting at FirstCluster * it follows the chain until the end, resetting all values to 0. @@ -507,12 +507,12 @@ eint16 fat_allocClusterChain(FileSystem *fs,ClusterChain *Cache,euint32 num_clus eint16 fat_unlinkClusterChain(FileSystem *fs,ClusterChain *Cache) { euint32 c,tbd=0; - + Cache->LogicCluster=0; Cache->DiscCluster=Cache->FirstCluster; - + c=0; - + while(!fat_LogicToDiscCluster(fs,Cache,c++)){ if(tbd!=0){ fat_setNextClusterAddress(fs,tbd,0); @@ -520,7 +520,7 @@ eint16 fat_unlinkClusterChain(FileSystem *fs,ClusterChain *Cache) tbd=Cache->DiscCluster; } fat_setNextClusterAddress(fs,Cache->DiscCluster,0); - fs->FreeClusterCount+=c; + fs->FreeClusterCount+=c; return(0); } @@ -528,14 +528,14 @@ euint32 fat_countClustersInChain(FileSystem *fs,euint32 firstcluster) { ClusterChain cache; euint32 c=0; - + if(firstcluster<=1)return(0); - + cache.DiscCluster = cache.LogicCluster = cache.LastCluster = cache.Linear = 0; cache.FirstCluster = firstcluster; - + while(!(fat_LogicToDiscCluster(fs,&cache,c++))); - + return(c-1); } @@ -543,10 +543,10 @@ euint32 fat_DiscToLogicCluster(FileSystem *fs,euint32 firstcluster,euint32 discc { ClusterChain cache; euint32 c=0,r=0; - + cache.DiscCluster = cache.LogicCluster = cache.LastCluster = cache.Linear = 0; cache.FirstCluster = firstcluster; - + while(!(fat_LogicToDiscCluster(fs,&cache,c++)) && !r){ if(cache.DiscCluster == disccluster){ r = cache.LogicCluster; @@ -558,7 +558,7 @@ euint32 fat_DiscToLogicCluster(FileSystem *fs,euint32 firstcluster,euint32 discc euint32 fat_countFreeClusters(FileSystem *fs) { euint32 c=2,fc=0; - + while(c<=fs->DataClusterCount+1){ if(fat_getNextClusterAddress(fs,c,0)==0)fc++; c++; diff --git a/sw/airborne/arch/lpc21/efsl/src/file.c b/sw/airborne/arch/lpc21/efsl/src/file.c index 5d88a41bea..9e3c82e6e6 100644 --- a/sw/airborne/arch/lpc21/efsl/src/file.c +++ b/sw/airborne/arch/lpc21/efsl/src/file.c @@ -35,7 +35,7 @@ #include "file.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf) * Description: This function reads 'size' bytes from 'file' starting at * 'offset' and puts the result in '*buf'. @@ -49,21 +49,21 @@ euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf) euint32 rclus,rsec; euint32 btr; euint8 *tbuf; - + if(!file_getAttr(file,FILE_STATUS_OPEN))return(0); - + if(offset>=file->FileSize) size_left=0; /* Offset check */ - + if( (offset+size > file->FileSize) && size_left!=0) size_left=file->FileSize-offset; - + while(size_left>0){ - + cclus = coffset/(512*file->fs->volumeId.SectorsPerCluster); csec = (coffset/(512))%file->fs->volumeId.SectorsPerCluster; cbyte = coffset%512; - + if(cbyte!=0 || size_left<512){ btr = 512-(coffset%512)>=size_left?size_left:512-(coffset%512); }else{ @@ -75,8 +75,8 @@ euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf) } rclus=file->Cache.DiscCluster; rsec=fs_clusterToSector(file->fs,rclus); - - + + if(btr==512){ /*part_readBuf(file->fs->part,rsec+csec,buf+bytes_read);*/ part_directSectorRead(file->fs->part,rsec+csec,buf+bytes_read); @@ -86,17 +86,17 @@ euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf) memCpy(tbuf+(coffset%512),buf+bytes_read,btr); part_relSect(file->fs->part,tbuf); } - + coffset+=btr; bytes_read+=btr; size_left-=btr; } - + return(bytes_read); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 file_read (File *file,euint32 size,euint8 *buf) * Description: This function reads from a file, taking the FilePtr into account * and advancing it according to the freadcall. @@ -105,14 +105,14 @@ euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf) euint32 file_read(File *file,euint32 size,euint8 *buf) { euint32 r; - + r=file_fread(file,file->FilePtr,size,buf); file->FilePtr+=r; return(r); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 file_write(File *file, euint32 size,euint8 *buf) * Description: This function writes to a file, taking FilePtr into account * and advancing it according to the fwritecall. @@ -121,14 +121,14 @@ euint32 file_read(File *file,euint32 size,euint8 *buf) euint32 file_write(File *file, euint32 size,euint8 *buf) { euint32 r; - + r=file_fwrite(file,file->FilePtr,size,buf); file->FilePtr+=r; return(r); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint16 file_setpos(File *file,euint32 pos) * Description: This function does a sanity check on the requested position * and changes the fileptr accordingly. @@ -144,7 +144,7 @@ esint16 file_setpos(File *file,euint32 pos) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf) * Description: This function writes to a file, at offset 'offset' and size 'size'. * It also updates the FileSize in the object, and discstructure. @@ -161,25 +161,25 @@ euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf) euint8 *tbuf; if(!file_getAttr(file,FILE_STATUS_OPEN) || !file_getAttr(file,FILE_STATUS_WRITE))return(0); - + if(offset>file->FileSize){ offset=file->FileSize; } - + need_cluster = file_requiredCluster(file,offset,size); - + if(need_cluster){ if(fat_allocClusterChain(file->fs,&(file->Cache),need_cluster+CLUSTER_PREALLOC_FILE)!=0){ return(0); } } - + while(size_left>0){ - + cclus = coffset/(512*file->fs->volumeId.SectorsPerCluster); csec = (coffset/(512))%file->fs->volumeId.SectorsPerCluster; cbyte = coffset%512; - + if(cbyte!=0 || size_left<512){ btr = 512-(coffset%512)>=size_left?size_left:512-(coffset%512); }else{ @@ -193,7 +193,7 @@ euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf) } rclus=file->Cache.DiscCluster; rsec=fs_clusterToSector(file->fs,rclus); - + if(btr==512){ /*part_writeBuf(file->fs->part,rsec+csec,buf+bytes_written);*/ part_directSectorWrite(file->fs->part,rsec+csec,buf+bytes_written); @@ -204,23 +204,23 @@ euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf) /*part_writeBuf(file->fs->part,rsec+csec,tbuf);*/ part_relSect(file->fs->part,tbuf); } - + coffset+=btr; bytes_written+=btr; size_left-=btr; } - + if(bytes_written>file->FileSize-offset){ file->FileSize+=bytes_written-(file->FileSize-offset); } - - return(bytes_written); + + return(bytes_written); } /* ***************************************************************************\ - * signed eint8 file_fopen(FileSystem *fs,File* file,eint8* filename) - * Description: This functions opens a file. - * This function is about to be redesigned. No Docs. + * signed eint8 file_fopen(FileSystem *fs,File* file,eint8* filename) + * Description: This functions opens a file. + * This function is about to be redesigned. No Docs. * Return value: */ esint8 file_fopen(File* file,FileSystem *fs,eint8* filename,eint8 mode) @@ -231,7 +231,7 @@ esint8 file_fopen(File* file,FileSystem *fs,eint8* filename,eint8 mode) euint32 sec; dir_getFatFileName(filename,fatfilename); - + switch(mode) { case MODE_READ: @@ -320,7 +320,7 @@ esint8 file_fopen(File* file,FileSystem *fs,eint8* filename,eint8 mode) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint8 file_fclose(File *file) * Description: This function closes a file, by clearing the object. * Return value: 0 on success. @@ -340,7 +340,7 @@ esint8 file_fclose(File *file) dir_setFileSize(file->fs,&(file->Location),file->FileSize); } } - + memClr(file,sizeof(*file)); file_setAttr(file,FILE_STATUS_OPEN,0); file_setAttr(file,FILE_STATUS_WRITE,0); @@ -348,7 +348,7 @@ esint8 file_fclose(File *file) } -/* **************************************************************************** +/* **************************************************************************** * void file_initFile(File *file, FileSystem *fs, FileLocation *loc) * Description: This function initialises a new file object, by filling in * the fs pointer, filesize (note, that DirEntry must already be filled in) @@ -363,18 +363,18 @@ void file_initFile(File *file, FileSystem *fs, FileLocation *loc) file->Location.Sector=loc->Sector; file->Location.Offset=loc->Offset; file->Cache.Linear=0; - file->Cache.FirstCluster=(((euint32)file->DirEntry.FirstClusterHigh)<<16)+ + file->Cache.FirstCluster=(((euint32)file->DirEntry.FirstClusterHigh)<<16)+ file->DirEntry.FirstClusterLow; - file->Cache.LastCluster=0; + file->Cache.LastCluster=0; file->Cache.LogicCluster=0; file->Cache.DiscCluster=file->Cache.FirstCluster; } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint8* file_normalToFatName(eint8* filename,eint8* fatfilename) - * Description: This function converts a human readable filename (limited to - * 8.3 eint8 character) to a valid FAT (not VFAT) filename. Invalid characters are + * Description: This function converts a human readable filename (limited to + * 8.3 eint8 character) to a valid FAT (not VFAT) filename. Invalid characters are * changed to capital X and only the first 11 characters are used. * Furthermore all letters are capitalised. * Return value: pointer after the filename @@ -382,14 +382,14 @@ void file_initFile(File *file, FileSystem *fs, FileLocation *loc) eint8* file_normalToFatName(eint8* filename,eint8* fatfilename) { euint8 c,dot=0,vc=0; - + for(c=0;c<11;c++)fatfilename[c]=' '; - + c=0; - + if(*filename == '.'){ fatfilename[0]='.'; - vc++; + vc++; if(*(filename+1) == '.'){ fatfilename[1]='.'; filename+=2; @@ -405,7 +405,7 @@ eint8* file_normalToFatName(eint8* filename,eint8* fatfilename) if(dot){ if(c<=10){ fatfilename[c]=file_validateChar(*filename); - c++; + c++; } }else{ if(c<=7){ @@ -417,7 +417,7 @@ eint8* file_normalToFatName(eint8* filename,eint8* fatfilename) filename++; } } - + if(vc>0){ if(*filename=='\0'){ return(filename); @@ -430,12 +430,12 @@ eint8* file_normalToFatName(eint8* filename,eint8* fatfilename) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * * Description: This function takes the character c, and if it is not a * * valid FAT Filename character returns X. If it is a lowercase letter the * * uppercase equivalent is returned. The remaining characters are returned * - * as they are. + * as they are. * Return value: The validated char */ euint8 file_validateChar(euint8 c) @@ -449,7 +449,7 @@ euint8 file_validateChar(euint8 c) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void ioman_setAttr(IOManager *ioman,euint16 bufplace,euint8 attribute,euint8 val) * Description: This sets the attribute of 'bufplace' to the given value (binary). * @@ -465,7 +465,7 @@ void file_setAttr(File* file,euint8 attribute,euint8 val) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint8 ioman_getAttr(IOManager *ioman,euint16 bufplace,euint8 attribute) * Description: This function retrieves an attribute from the bufstat array. * It returns nonzero when it attribute is true and 0 when it is false. diff --git a/sw/airborne/arch/lpc21/efsl/src/fs.c b/sw/airborne/arch/lpc21/efsl/src/fs.c index 42bf6bbf62..7b537818fa 100644 --- a/sw/airborne/arch/lpc21/efsl/src/fs.c +++ b/sw/airborne/arch/lpc21/efsl/src/fs.c @@ -38,7 +38,7 @@ #include "dir.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * eint16 fs_initFs(FileSystem *fs,Partition *part) * Description: This functions glues the initialisation of the filesystem together. * It loads the volumeID, computes the FS type and searches for the rootsector. @@ -55,12 +55,12 @@ eint16 fs_initFs(FileSystem *fs,Partition *part) fs_countDataSectors(fs); fs_determineFatType(fs); fs_findFirstSectorRootDir(fs); - fs_initCurrentDir(fs); + fs_initCurrentDir(fs); return(0); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * eint16 fs_isValidFat(Partition *part) * Description: This functions loads the volumeID and checks if the magic * value is present. @@ -69,7 +69,7 @@ eint16 fs_initFs(FileSystem *fs,Partition *part) eint16 fs_isValidFat(Partition *part) { euint8 *buf; - + buf=part_getSect(part,0,IOM_MODE_READONLY|IOM_MODE_EXP_REQ); /* Load Volume label */ if( ex_getb16(buf,0x1FE) != 0xAA55 ){ return (0); @@ -77,18 +77,18 @@ eint16 fs_isValidFat(Partition *part) part_relSect(part,buf); return(1); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fs_loadVolumeId(FileSystem *fs, Partition *part) * Description: This function loads all relevant fields from the volumeid. */ void fs_loadVolumeId(FileSystem *fs, Partition *part) { euint8 *buf; - + buf=part_getSect(part,0,IOM_MODE_READONLY|IOM_MODE_EXP_REQ); - + fs->volumeId.BytesPerSector=ex_getb16(buf,0x0B); fs->volumeId.SectorsPerCluster=*((eint8*)(buf+0x0D)); fs->volumeId.ReservedSectorCount=ex_getb16(buf,0x0E); @@ -99,13 +99,13 @@ void fs_loadVolumeId(FileSystem *fs, Partition *part) fs->volumeId.SectorCount32=ex_getb32(buf,0x20); fs->volumeId.FatSectorCount32=ex_getb32(buf,0x24); fs->volumeId.RootCluster=ex_getb32(buf,0x2C); - - part_relSect(part,buf); - -} -/*****************************************************************************/ -/* **************************************************************************** + part_relSect(part,buf); + +} +/*****************************************************************************/ + +/* **************************************************************************** * esint16 fs_verifySanity(FileSystem *fs) * Description: Does some sanity calculations. * Return value: 1 on success, 0 when discrepancies were found. @@ -130,12 +130,12 @@ esint16 fs_verifySanity(FileSystem *fs) if(fs->volumeId.FatSectorCount16 > fs->part->disc->partitions[fs->part->activePartition].numSectors)sane=0; }else{ if(fs->volumeId.FatSectorCount32 > fs->part->disc->partitions[fs->part->activePartition].numSectors)sane=0; - } + } return(sane); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fs_countDataSectors(FileSystem *fs) * Description: This functions calculates the sectorcounts, fatsectorcounts and * dataclustercounts. It fills in the general fields. @@ -177,9 +177,9 @@ void fs_countDataSectors(FileSystem *fs) fs->DataClusterCount=dataSectorCount/fs->volumeId.SectorsPerCluster; } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fs_determineFatType(FileSystem *fs) * Description: This function looks af the Dataclustercount and determines the * FAT type. It fills in fs->type. @@ -201,9 +201,9 @@ void fs_determineFatType(FileSystem *fs) fs->type=FAT32; } } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void fs_findFirstSectorRootDir(FileSystem *fs) * Description: This functions fills in the fs->FirstSectorRootDir field, even * for FAT32, although that is not necessary (because you have FirstClusterRootDir). @@ -211,14 +211,14 @@ void fs_determineFatType(FileSystem *fs) void fs_findFirstSectorRootDir(FileSystem *fs) { if(fs->type==FAT32) - fs->FirstSectorRootDir = fs->volumeId.ReservedSectorCount + + fs->FirstSectorRootDir = fs->volumeId.ReservedSectorCount + (fs->volumeId.NumberOfFats*fs->volumeId.FatSectorCount32) + (fs->volumeId.RootCluster-2)*fs->volumeId.SectorsPerCluster; else - fs->FirstSectorRootDir = fs->volumeId.ReservedSectorCount + + fs->FirstSectorRootDir = fs->volumeId.ReservedSectorCount + (fs->volumeId.NumberOfFats*fs->volumeId.FatSectorCount16); } -/*****************************************************************************/ +/*****************************************************************************/ void fs_initCurrentDir(FileSystem *fs) { @@ -226,7 +226,7 @@ void fs_initCurrentDir(FileSystem *fs) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * long fs_clusterToSector(FileSystem *fs,euint32 cluster) * Description: This function converts a clusternumber in the effective sector * number where this cluster starts. Boundary check is not implemented @@ -235,7 +235,7 @@ void fs_initCurrentDir(FileSystem *fs) euint32 fs_clusterToSector(FileSystem *fs,euint32 cluster) { eint32 base; - + if(fs->type==FAT32) { base= @@ -251,13 +251,13 @@ euint32 fs_clusterToSector(FileSystem *fs,euint32 cluster) } return( base + (cluster-2)*fs->volumeId.SectorsPerCluster ); } -/*****************************************************************************/ +/*****************************************************************************/ /* Function is unused, but may be usefull */ euint32 fs_sectorToCluster(FileSystem *fs,euint32 sector) { eint32 base; - + if(fs->type==FAT32) { base= @@ -275,18 +275,18 @@ euint32 fs_sectorToCluster(FileSystem *fs,euint32 sector) } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 fs_getNextFreeCluster(FileSystem *fs,euint32 startingcluster) * Description: This functions searches for a free cluster, starting it's search at - * cluster startingcluster. This allow to speed up searches and try to avoid + * cluster startingcluster. This allow to speed up searches and try to avoid * fragmentation. Implementing rollover search is still to be done. - * Return value: If a free cluster is found it's number is returned. If none is + * Return value: If a free cluster is found it's number is returned. If none is * found 0 is returned. */ euint32 fs_getNextFreeCluster(FileSystem *fs,euint32 startingcluster) { euint32 r; - + while(startingclusterDataClusterCount){ r=fat_getNextClusterAddress(fs,startingcluster,0); if(r==0){ @@ -296,23 +296,23 @@ euint32 fs_getNextFreeCluster(FileSystem *fs,euint32 startingcluster) } return(0); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 fs_giveFreeClusterHint(FileSystem *fs) - * + * * Description: This function should return a clusternumber that is free or - * lies close before free clusters. The result MUST be checked to see if + * lies close before free clusters. The result MUST be checked to see if * it is free! Implementationhint: search the largest clusternumber in the * files in the rootdirectory. - * + * * Return value: Returns it's best guess. */ euint32 fs_giveFreeClusterHint(FileSystem *fs) { return(2); /* Now THIS is a hint ;) */ } -/*****************************************************************************/ +/*****************************************************************************/ /* **************************************************************************** * esint8 fs_findFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint32 *lastDir) @@ -324,7 +324,7 @@ euint32 fs_giveFreeClusterHint(FileSystem *fs) * currentdir (That you can change with chdir()) as startingpoint. * The lastdir pointer will be the first cluster of the last directory fs_findfile * enters. It starts out at the root/current dir and then traverses the path along with - * fs_findFile. + * fs_findFile. * It is set to 0 in case of errors (like dir/dir/dir/file/dir/dir...) * Return value: Returns 0 when nothing was found, 1 when the thing found * was a file and 2 if the thing found was a directory. @@ -334,7 +334,7 @@ esint8 fs_findFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint32 *las { euint32 fccd,tmpclus; eint8 ffname[11],*next,it=0,filefound=0; - + if(*filename=='/'){ fccd = fs_getFirstClusterRootDir(fs); filename++; @@ -346,8 +346,8 @@ esint8 fs_findFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint32 *las fccd = fs->FirstClusterCurrentDir; if(lastDir)*lastDir=fccd; } - - + + while((next=file_normalToFatName(filename,ffname))!=0){ if((tmpclus=dir_findinDir(fs,ffname,fccd,loc,DIRFIND_FILE))==0){ /* We didn't find what we wanted */ @@ -356,7 +356,7 @@ esint8 fs_findFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint32 *las */ if((file_normalToFatName(next,ffname))!=0){ if(lastDir)*lastDir=0; - } + } return(0); } it++; @@ -371,11 +371,11 @@ esint8 fs_findFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint32 *las if(lastDir)*lastDir=0; return(0); }else{ - filename=next; + filename=next; } } } - + if(it==0)return(0); if(loc->attrib&ATTR_DIRECTORY || !filefound)return(2); return(1); @@ -386,7 +386,7 @@ esint16 fs_findFreeFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint8 { euint32 targetdir=0; eint8 ffname[11]; - + if(fs_findFile(fs,filename,loc,&targetdir))return(0); if(!dir_getFatFileName(filename,ffname))return(0); if(dir_findinDir(fs,ffname,targetdir,loc,DIRFIND_FREE)){ @@ -400,12 +400,12 @@ esint16 fs_findFreeFile(FileSystem *fs,eint8* filename,FileLocation *loc,euint8 } } } - + return(0); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 fs_getLastCluster(FileSystem *fs,ClusterChain *Cache) * Description: This function searches the last cluster of a chain. * Return value: The LastCluster (also stored in cache); @@ -416,7 +416,7 @@ euint32 fs_getLastCluster(FileSystem *fs,ClusterChain *Cache) Cache->DiscCluster=Cache->FirstCluster; Cache->LogicCluster=0; } - + if(Cache->LastCluster==0) { while(fat_getNextClusterChain(fs, Cache)==0) @@ -477,7 +477,7 @@ esint8 fs_clearCluster(FileSystem *fs,euint32 cluster) { euint16 c; euint8* buf; - + for(c=0;c<(fs->volumeId.SectorsPerCluster);c++){ buf = part_getSect(fs->part,fs_clusterToSector(fs,cluster)+c,IOM_MODE_READWRITE); memClr(buf,512); @@ -489,7 +489,7 @@ esint8 fs_clearCluster(FileSystem *fs,euint32 cluster) esint8 fs_getFsInfo(FileSystem *fs,euint8 force_update) { euint8 *buf; - + if(!fs->type==FAT32)return(0); buf = part_getSect(fs->part,FS_INFO_SECTOR,IOM_MODE_READONLY); if(ex_getb32(buf,0)!=FSINFO_MAGIC_BEGIN || ex_getb32(buf,508)!=FSINFO_MAGIC_END){ diff --git a/sw/airborne/arch/lpc21/efsl/src/interfaces/lpc2000_spi.c b/sw/airborne/arch/lpc21/efsl/src/interfaces/lpc2000_spi.c index 9c50543e50..cbd9bf91ae 100644 --- a/sw/airborne/arch/lpc21/efsl/src/interfaces/lpc2000_spi.c +++ b/sw/airborne/arch/lpc21/efsl/src/interfaces/lpc2000_spi.c @@ -90,7 +90,7 @@ #define SPI_MOSI_PIN 19 /* to Card P0.19 out */ /* Card-Select P0.20 - GPIO out during startup Function 03 during normal operation */ -#define SPI_SS_PIN 20 +#define SPI_SS_PIN 20 #define SPI_PINSEL PINSEL1 #define SPI_SCK_FUNCBIT 2 @@ -117,9 +117,9 @@ esint8 if_initInterface(hwInterface* file, eint8* opts) { euint32 sc; - + if_spiInit(file); /* init at low speed */ - + if(sd_Init(file)<0) { DBG((TXT("Card failed to init, breaking up...\n"))); return(-1); @@ -128,27 +128,27 @@ esint8 if_initInterface(hwInterface* file, eint8* opts) DBG((TXT("Card didn't return the ready state, breaking up...\n"))); return(-2); } - + // file->sectorCount=4; /* FIXME ASAP!! */ - + sd_getDriveSize(file, &sc); file->sectorCount = sc/512; if( (sc%512) != 0) { file->sectorCount--; } DBG((TXT("Drive Size is %lu Bytes (%lu Sectors)\n"), sc, file->sectorCount)); - + /* increase speed after init */ #if ( HW_ENDPOINT_LPC2000_SPINUM == 1 ) SSPCR0 = ((8-1)<<0) | (0<> 16), (euint16) place); @@ -228,7 +228,7 @@ esint8 sd_writeSector(hwInterface *iface,euint32 address, euint8* buf) sd_Resp8b(iface); /* Card response */ if_spiSend(iface,0xfe); /* Start block */ - for(i=0;i<512;i++) + for(i=0;i<512;i++) if_spiSend(iface,buf[i]); /* Send data */ if_spiSend(iface,0xff); /* Checksum part 1 */ if_spiSend(iface,0xff); /* Checksum part 2 */ @@ -269,19 +269,19 @@ esint8 sd_readSector(hwInterface *iface,euint32 address, euint8* buf, euint16 le /*DBG((TXT("sd_readSector::Trying to read sector %u and store it at %p.\n"),address,&buf[0]));*/ place=512*address; sd_Command(iface,CMDREAD, (euint16) (place >> 16), (euint16) place); - - cardresp=sd_Resp8b(iface); /* Card response */ + + cardresp=sd_Resp8b(iface); /* Card response */ /* Wait for startblock */ do - firstblock=sd_Resp8b(iface); + firstblock=sd_Resp8b(iface); while(firstblock==0xff && fb_timeout--); if(cardresp!=0x00 || firstblock!=0xfe){ sd_Resp8bError(iface,firstblock); return(-1); } - + for(i=0;i<512;i++){ c = if_spiSend(iface,0xff); if(iiface=iface; - + ioman->bufptr = ioman_getBuffer(ioman,bufferarea); ioman->numbuf = IOMAN_NUMBUFFER; ioman->numit = IOMAN_NUMITERATIONS; - + ioman_reset(ioman); return(0); } @@ -54,13 +54,13 @@ esint8 ioman_init(IOManager *ioman, hwInterface *iface, euint8* bufferarea) void ioman_reset(IOManager *ioman) { euint16 nb,ni; - + memClr(ioman->sector,sizeof(euint32)*ioman->numbuf); memClr(ioman->status,sizeof(euint8) *ioman->numbuf); memClr(ioman->usage ,sizeof(euint8) *ioman->numbuf); memClr(ioman->itptr ,sizeof(euint8) *ioman->numbuf); ioman_setError(ioman,IOMAN_NOERROR); - + for(nb=0;nbnumbuf;nb++){ for(ni=0;ninumit;ni++){ ioman->stack[nb][ni].sector=0; @@ -87,7 +87,7 @@ void ioman_setAttr(IOManager *ioman,euint16 bufplace,euint8 attribute,euint8 val ioman_setError(ioman,IOMAN_ERR_SETATTROUTOFBOUNDS); return; /* Out of bounds */ } - + if(val){ ioman->status[bufplace]|=1<itptr[bufplace]==0 || ioman->itptr[bufplace]>IOMAN_NUMITERATIONS)return(-1); ioman->sector[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].sector; ioman->status[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].status; - ioman->usage[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].usage; + ioman->usage[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].usage; ioman->itptr[bufplace]--; return(0); } @@ -214,7 +214,7 @@ esint8 ioman_push(IOManager *ioman,euint16 bufplace) return(-1); } if(ioman->itptr[bufplace]>=IOMAN_NUMITERATIONS){ - ioman_setError(ioman,IOMAN_ERR_PUSHBEYONDSTACK); + ioman_setError(ioman,IOMAN_ERR_PUSHBEYONDSTACK); return(-1); } ioman->itptr[bufplace]++; @@ -252,9 +252,9 @@ esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf) if(buf==0){ return(-1); } - + r=if_readBuf(ioman->iface,address,buf); - + if(r!=0){ ioman_setError(ioman,IOMAN_ERR_READFAIL); return(-1); @@ -268,7 +268,7 @@ esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf) esint8 r; if(buf==0)return(-1); - + r=if_writeBuf(ioman->iface,address,buf); if(r<=0){ @@ -295,7 +295,7 @@ void ioman_resetCacheItem(IOManager *ioman,euint16 bufplace) esint32 ioman_findSectorInCache(IOManager *ioman, euint32 address) { euint16 c; - + for(c=0;cnumbuf;c++){ if(ioman_isValid(c) && ioman->sector[c] == address)return(c); } @@ -306,7 +306,7 @@ esint32 ioman_findSectorInCache(IOManager *ioman, euint32 address) esint32 ioman_findFreeSpot(IOManager *ioman) { euint16 c; - + for(c=0;cnumbuf;c++){ if(!ioman_isValid(c))return(c); } @@ -319,7 +319,7 @@ esint32 ioman_findUnusedSpot(IOManager *ioman) esint32 r=-1; euint16 c; euint8 fr=0,lr=0xFF; - + for(c=0;cnumbuf;c++){ if(ioman_getUseCnt(ioman,c)==0){ if(!ioman_isWritable(c) && !fr){ @@ -350,7 +350,7 @@ esint32 ioman_findOverallocableSpot(IOManager *ioman) euint8 points,lp=0xFF; euint16 c; esint32 r=-1; - + for(c=0;cnumbuf;c++){ if(ioman->itptr[c]numit){ points = 0; @@ -370,7 +370,7 @@ esint32 ioman_findOverallocableSpot(IOManager *ioman) esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace) { euint8* buf; - + if((buf = ioman_getPtr(ioman,bufplace))==0){ ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE); return(-1); @@ -389,7 +389,7 @@ esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplac esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace) { euint8* buf; - + if((buf = ioman_getPtr(ioman,bufplace))==0){ ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE); return(-1); @@ -399,7 +399,7 @@ esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace) return(-1); } if(!(ioman_writeSector(ioman,ioman->sector[bufplace],buf))){ - ioman_setError(ioman,IOMAN_ERR_WRITEFAIL); + ioman_setError(ioman,IOMAN_ERR_WRITEFAIL); return(-1); } if(ioman->usage==0)ioman_setNotWritable(bufplace); @@ -410,11 +410,11 @@ esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace) esint8 ioman_flushRange(IOManager *ioman,euint32 address_low, euint32 address_high) { euint32 c; - + if(address_low>address_high){ c=address_low; address_low=address_high;address_high=c; } - + for(c=0;cnumbuf;c++){ if((ioman->sector[c]>=address_low) && (ioman->sector[c]<=address_high) && (ioman_isWritable(c))){ if(ioman_flushSector(ioman,c)){ @@ -430,7 +430,7 @@ esint8 ioman_flushRange(IOManager *ioman,euint32 address_low, euint32 address_hi esint8 ioman_flushAll(IOManager *ioman) { euint16 c; - + for(c=0;cnumbuf;c++){ if(ioman_isWritable(c)){ if(ioman_flushSector(ioman,c)){ @@ -446,7 +446,7 @@ esint8 ioman_flushAll(IOManager *ioman) euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode) { esint32 bp; - + if((bp=ioman_findSectorInCache(ioman,address))!=-1){ if(ioman_isReqRw(mode)){ ioman_setWritable(bp); @@ -455,13 +455,13 @@ euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode) if(!ioman_isReqExp(mode))ioman_incRefCnt(ioman,bp); return(ioman_getPtr(ioman,bp)); } - + if((bp=ioman_findFreeSpot(ioman))==-1){ if(((bp=ioman_findUnusedSpot(ioman))!=-1)&&(ioman_isWritable(bp))){ ioman_flushSector(ioman,bp); } } - + if(bp!=-1){ ioman_resetCacheItem(ioman,bp); if((ioman_putSectorInCache(ioman,address,bp))){ @@ -474,7 +474,7 @@ euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode) if(!ioman_isReqExp(mode))ioman_incRefCnt(ioman,bp); return(ioman_getPtr(ioman,bp)); } - + if((bp=ioman_findOverallocableSpot(ioman))!=-1){ if(ioman_isWritable(bp)){ ioman_flushSector(ioman,bp); @@ -501,10 +501,10 @@ euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode) esint8 ioman_releaseSector(IOManager *ioman,euint8* buf) { euint16 bp; - + bp=ioman_getBp(ioman,buf); ioman_decUseCnt(ioman,bp); - + if(ioman_getUseCnt(ioman,bp)==0 && ioman->itptr[bp]!=0){ if(ioman_isWritable(bp)){ ioman_flushSector(ioman,bp); @@ -520,13 +520,13 @@ esint8 ioman_directSectorRead(IOManager *ioman,euint32 address, euint8* buf) { euint8* ibuf; esint16 bp; - + if((bp=ioman_findSectorInCache(ioman,address))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(ibuf,buf,512); return(0); } - + if((bp=ioman_findFreeSpot(ioman))!=-1){ if((ioman_putSectorInCache(ioman,address,bp))){ return(-1); @@ -548,14 +548,14 @@ esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf) { euint8* ibuf; esint16 bp; - + if((bp=ioman_findSectorInCache(ioman,address))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); ioman_setWritable(bp); return(0); } - + if((bp=ioman_findFreeSpot(ioman))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); @@ -577,7 +577,7 @@ esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf) void ioman_printStatus(IOManager *ioman) { euint16 c; - + DBG((TXT("IO-Manager -- Report\n====================\n"))); DBG((TXT("Buffer is %i sectors, from %p to %p\n"), ioman->numbuf,ioman->bufptr,ioman->bufptr+(ioman->numbuf*512))); diff --git a/sw/airborne/arch/lpc21/efsl/src/ls.c b/sw/airborne/arch/lpc21/efsl/src/ls.c index a1168680e6..84e585cb5d 100644 --- a/sw/airborne/arch/lpc21/efsl/src/ls.c +++ b/sw/airborne/arch/lpc21/efsl/src/ls.c @@ -38,19 +38,19 @@ esint8 ls_openDir(DirList *dlist,FileSystem *fs,eint8* dirname) { FileLocation loc; euint32 fc; - + dlist->fs=fs; - + if(fs_findFile(dlist->fs,dirname,&loc,&fc)!=2) { return(-1); } - + fs_initClusterChain(dlist->fs,&(dlist->Cache),fc); memClr(&(dlist->currentEntry),sizeof(dlist->currentEntry)); dlist->rEntry=0; dlist->cEntry=0xFFFF; - + return(0); } /*****************************************************************************/ @@ -80,24 +80,24 @@ esint8 ls_getNext(DirList *dlist) esint8 ls_getRealDirEntry(DirList *dlist) { euint8* buf; - + if(dlist->Cache.FirstCluster<=1)return(-1); - + if(fat_LogicToDiscCluster(dlist->fs, &(dlist->Cache), (dlist->rEntry)/(16 * dlist->fs->volumeId.SectorsPerCluster))){ return(-1); } - + buf = part_getSect(dlist->fs->part, fs_clusterToSector(dlist->fs,dlist->Cache.DiscCluster) + (dlist->rEntry/16)%dlist->fs->volumeId.SectorsPerCluster, IOM_MODE_READONLY); - + /*memCpy(buf+(dlist->rEntry%16)*32,&(dlist->currentEntry),32);*/ ls_fileEntryToDirListEntry(dlist,buf,32*(dlist->rEntry%16)); - + part_relSect(dlist->fs->part,buf); - + return(0); } /*****************************************************************************/ @@ -105,10 +105,10 @@ esint8 ls_getRealDirEntry(DirList *dlist) esint8 ls_getRootAreaEntry(DirList *dlist) { euint8 *buf=0; - + if((dlist->fs->type != FAT12) && (dlist->fs->type != FAT16))return(-1); if(dlist->rEntry>=dlist->fs->volumeId.RootEntryCount)return(-1); - + buf = part_getSect(dlist->fs->part, dlist->fs->FirstSectorRootDir+dlist->rEntry/16, IOM_MODE_READONLY); @@ -130,7 +130,7 @@ esint8 ls_isValidFileEntry(ListDirEntry *entry) void ls_fileEntryToDirListEntry(DirList *dlist, euint8* buf, euint16 offset) { if(offset>480 || offset%32)return; - + buf+=offset; memCpy(buf+OFFSET_DE_FILENAME,dlist->currentEntry.FileName,LIST_MAXLENFILENAME); dlist->currentEntry.Attribute = *(buf+OFFSET_DE_ATTRIBUTE); diff --git a/sw/airborne/arch/lpc21/efsl/src/mkfs.c b/sw/airborne/arch/lpc21/efsl/src/mkfs.c index 1657138961..47edb7ff66 100644 --- a/sw/airborne/arch/lpc21/efsl/src/mkfs.c +++ b/sw/airborne/arch/lpc21/efsl/src/mkfs.c @@ -39,45 +39,45 @@ signed short mkfs_makevfat(Partition *part) unsigned long c,cc,ret; unsigned long ns,fs,ds,dc; unsigned char buf[512]; - + ns=part->disc->partitions[part->activePartition].numSectors; - + if( ns < 66581 ){ DBG((TXT("This is not possible due to insufficient sectors. Sorry\n"))); return(MKFS_ERR_TOOLITTLESECTORS); } - + ret=0; - + for(c=1<<6;c>=1;c>>=1){ - + /* First guess */ ds = ns - 32; fs = ((ds/c)+127)/128; /* ds was guess too large, so fs is too large now too. */ - + for(cc=0;cc<2;cc++){ - + /* Round 2, error round */ ds = ns - 32 - 2*fs; - fs = ((ds/c)+127)/128; + fs = ((ds/c)+127)/128; /* Since fs was too large, ds became too small. So the fs for this small ds is too small as well. */ - + /* Round 3, correction round */ ds = ns - 32 - 2*fs; - fs = ((ds/c)+127)/128; + fs = ((ds/c)+127)/128; /* The fs was too small, so ds was too large. The calculated fs should be slightly too large. */ - + } - + /* Round 4, finalise */ - ds = ns - 32 - 2*fs; + ds = ns - 32 - 2*fs; dc = ds / c; if(ret<(fs*128-dc)/128)ret=(fs*128-dc)/128; - + /* Check if with current setting we have a valid fat ? */ - + if(dc >= 65525 + 16){ break; } @@ -85,60 +85,60 @@ signed short mkfs_makevfat(Partition *part) /* Generate BPB */ memClr(buf,512); - + /* Boot code */ *(buf+0)=0xE9; *(buf+1)=0x00; *(buf+2)=0x00; /* RESET */ - + /* OEM name */ memCpy("DSCOSMSH",buf+3,8); - + /* Bytes/Sector */ *((unsigned short*)(buf+11)) = 512; - + /* Sectors/Cluster */ *(buf+13) = c; - + /* Reserved Sectors */ *((unsigned short*)(buf+14)) = 32; - + /* Number of FAT Tables */ *(buf+16) = 2; - + /* RootEntryCount */ *((unsigned short*)(buf+17)) = 0; - + /* Total Sector Count __16 */ *((unsigned short*)(buf+19)) = 0; - + /* Media (crap) */ *(buf+21) = 0xF8; - + /* FAT size 16 */ *((unsigned short*)(buf+22)) = 0; - + /* Total Sector Count __32 */ *((unsigned long*)(buf+32)) = ns; - + /* Fat Size 32 */ *((unsigned long*)(buf+36)) = fs; - + /* First Cluster Root Dir */ *((unsigned long*)(buf+44)) = 2; - + /* VolumeID */ *((unsigned long*)(buf+67)) = 0x13371337; - + /* Volume Label */ memCpy("DISCOSMASH!",buf+71,11); - + /* Filesystemtype */ memCpy("FAT32 ",buf+82,8); - + /* Magic */ *(buf+510) = 0x55; *(buf+511) = 0xAA; - + part_writeBuf(part,0,buf); - + memClr(buf,512); for(c=32;c<(32+2*fs);c++){ part_writeBuf(part,c,buf); @@ -148,6 +148,6 @@ signed short mkfs_makevfat(Partition *part) *(((unsigned long*)buf)+2)=0x0FFFFFF8; part_writeBuf(part,32,buf); part_writeBuf(part,32+fs,buf); - + return(0); } diff --git a/sw/airborne/arch/lpc21/efsl/src/partition.c b/sw/airborne/arch/lpc21/efsl/src/partition.c index ecbf97cc70..6ad086b604 100644 --- a/sw/airborne/arch/lpc21/efsl/src/partition.c +++ b/sw/airborne/arch/lpc21/efsl/src/partition.c @@ -35,7 +35,7 @@ #include "partition.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * void part_initPartition(Partition *part,Disc* refDisc) * Description: This function searches the 4 partitions for a FAT class partition * and marks the first one found as the active to be used partition. @@ -43,19 +43,19 @@ void part_initPartition(Partition *part,Disc* refDisc) { eint16 c; - + part->disc=refDisc; part->activePartition=-1; /* No partition selected */ part_setError(part,PART_NOERROR); for(c=3;c>=0;c--){ if(part_isFatPart(part->disc->partitions[c].type)) part->activePartition=c; - } + } } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * eint16 part_isFatPart(euint8 type) * Description: This functions checks if a partitiontype (eint8) is of the FAT * type in the broadest sense. I @@ -74,14 +74,14 @@ eint16 part_isFatPart(euint8 type) } return(0); } -/*****************************************************************************/ +/*****************************************************************************/ esint8 part_readBuf(Partition *part, euint32 address, euint8* buf) { return(if_readBuf(part->disc->ioman->iface,part_getRealLBA(part,address), buf)); } -/* **************************************************************************** +/* **************************************************************************** * eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf) * Description: This function writes 512 bytes, from buf. It's offset is address * sectors from the beginning of the partition. @@ -92,10 +92,10 @@ eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf) /*DBG((TXT("part_writeBuf :: %li\n"),address));*/ return(if_writeBuf(part->disc->ioman->iface,part_getRealLBA(part,address),buf)); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint32 part_getRealLBA(Partition *part,euint32 address) * Description: This function calculates what the partition offset for * a partition is + the address. @@ -105,9 +105,9 @@ euint32 part_getRealLBA(Partition *part,euint32 address) { return(part->disc->partitions[part->activePartition].LBA_begin+address); } -/*****************************************************************************/ +/*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * euint8* part_getSect(Partition *part, euint32 address, euint8 mode) * Description: This function calls ioman_getSector, but recalculates the sector * address to be partition relative. @@ -118,7 +118,7 @@ euint8* part_getSect(Partition *part, euint32 address, euint8 mode) return(ioman_getSector(part->disc->ioman,part_getRealLBA(part,address),mode)); } -/* **************************************************************************** +/* **************************************************************************** * esint8 part_relSect(Partition *part, euint8* buf) * Description: This function calls ioman_releaseSector. * Return value: Whatever releaseSector returns. @@ -130,9 +130,9 @@ esint8 part_relSect(Partition *part, euint8* buf) esint8 part_flushPart(Partition *part,euint32 addr_l, euint32 addr_h) { - return( - ioman_flushRange(part->disc->ioman,part_getRealLBA(part,addr_l),part_getRealLBA(part,addr_h)) - ); + return( + ioman_flushRange(part->disc->ioman,part_getRealLBA(part,addr_l),part_getRealLBA(part,addr_h)) + ); } esint8 part_directSectorRead(Partition *part,euint32 address, euint8* buf) diff --git a/sw/airborne/arch/lpc21/efsl/src/plibc.c b/sw/airborne/arch/lpc21/efsl/src/plibc.c index 6c0db1118a..2a2ad9559b 100644 --- a/sw/airborne/arch/lpc21/efsl/src/plibc.c +++ b/sw/airborne/arch/lpc21/efsl/src/plibc.c @@ -34,7 +34,7 @@ #include "plibc.h" /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * unsigned short strMatch(char* bufa, char*bufb, unsigned long n) * Description: Compares bufa and bufb for a length of n bytes. * Return value: Returns the number of character NOT matching. @@ -46,10 +46,10 @@ euint16 strMatch(eint8* bufa, eint8*bufb,euint32 n) for(c=0;c127?127<<9:(y&0x3F)<<9) | ((m==0||m>12)?1:(m&0xF)<<5) | @@ -61,11 +61,11 @@ euint16 fs_makeTime(void) return(0); #else euint8 s,m,h; - + s = time_getSecond(); m = time_getMinute(); h = time_getHour(); - + return( (h>23?0:(h&0x1F)<<11) | (m>59?0:(m&0x3F)<<5) | diff --git a/sw/airborne/arch/lpc21/efsl/src/ui.c b/sw/airborne/arch/lpc21/efsl/src/ui.c index 9d2c13b406..3c711af537 100644 --- a/sw/airborne/arch/lpc21/efsl/src/ui.c +++ b/sw/airborne/arch/lpc21/efsl/src/ui.c @@ -56,7 +56,7 @@ short listFiles(FileSystem *fs, char *dirname) unsigned char buf[512]; File dir; unsigned short i; - + /* Find out if we are searching in the root dir or in */ if(dirname[0]=='/' && dirname[1]=='\0') { @@ -79,11 +79,11 @@ short listFiles(FileSystem *fs, char *dirname) FUNC_OUT((TXT(""))); return(-1); } - + /* Find out what the startcluster of the directory is */ part_readBuf(fs->part,loc.Sector, buf); fileEntry = *(((FileRecord*)buf) + loc.Offset); - startCluster = (((unsigned long)fileEntry.FirstClusterHigh)<<16) + startCluster = (((unsigned long)fileEntry.FirstClusterHigh)<<16) + fileEntry.FirstClusterLow; /* Init of dir */ @@ -91,7 +91,7 @@ short listFiles(FileSystem *fs, char *dirname) dir.Cache.LogicCluster=-1; dir.Cache.FirstCluster=startCluster; dir.DirEntry.Attribute=ATTR_DIRECTORY; - + while((file_fread(&dir,offset,512,buf))) { DBG((TXT("Read 512 bytes from dir with offset %li.\n"),offset)); @@ -115,15 +115,15 @@ short listFiles(FileSystem *fs, char *dirname) offset+=512; } } - + FUNC_OUT((TXT(""))); return(counter); - + return(-1); } /*****************************************************************************/ -/* **************************************************************************** +/* **************************************************************************** * esint16 rmfile(FileSystem *fs,euint8* filename) * Description: This function takes a filename as argument and deletes it, * by freeing it's clusterchain, and deleting it's entry from the directory. @@ -135,7 +135,7 @@ esint16 rmfile(FileSystem *fs,euint8* filename) ClusterChain cache; euint8* buf; euint32 firstCluster=0; - + if((fs_findFile(fs,(eint8*)filename,&loc,0))==1){ buf=part_getSect(fs->part,loc.Sector,IOM_MODE_READWRITE); firstCluster = ex_getb16(buf,loc.Offset*32+20); @@ -164,26 +164,26 @@ esint8 mkdir(FileSystem *fs,eint8* dirname) euint32 nc,parentdir; euint8* buf; eint8 ffname[11]; - + if( fs_findFile(fs,dirname,&loc,&parentdir) ){ return(-1); } if(parentdir==0)return(-2); - + if(!fs_findFreeFile(fs,dirname,&loc,0))return(-3); - + /* You may never search for a free cluster, and the call * functions that may cause changes to the FAT table, that * is why getNextFreeCluster has to be called AFTER calling * fs_findFreeFile, which may have to expand a directory in - * order to store the new filerecord !! + * order to store the new filerecord !! */ - + nc = fs_getNextFreeCluster(fs,fs_giveFreeClusterHint(fs)); if(nc==0)return(0); - + fs_clearCluster(fs,nc); - + buf = part_getSect(fs->part,loc.Sector,IOM_MODE_READWRITE); dir_getFatFileName(dirname,ffname); @@ -194,11 +194,11 @@ esint8 mkdir(FileSystem *fs,eint8* dirname) direntry.FirstClusterLow=nc&0xFFFF; direntry.Attribute = ATTR_DIRECTORY; memCpy(&direntry,buf+(32*loc.Offset),32); - + part_relSect(fs->part,buf); - + buf = part_getSect(fs->part,fs_clusterToSector(fs,nc),IOM_MODE_READWRITE); - + memClr(&direntry,sizeof(direntry)); memCpy(". ",&direntry,11); direntry.Attribute = ATTR_DIRECTORY; @@ -206,14 +206,14 @@ esint8 mkdir(FileSystem *fs,eint8* dirname) direntry.FirstClusterHigh=nc>>16; direntry.FirstClusterLow=nc&0xFFFF; memCpy(&direntry,buf,32); - + if(fs->type == FAT32 && parentdir == fs->volumeId.RootCluster){ parentdir = 0; } if(fs->type != FAT32 && parentdir<=1){ parentdir = 0; - } - + } + memClr(&direntry,sizeof(direntry)); memCpy(".. ",&direntry,11); direntry.Attribute = ATTR_DIRECTORY; @@ -223,7 +223,7 @@ esint8 mkdir(FileSystem *fs,eint8* dirname) memCpy(&direntry,buf+32,32); part_relSect(fs->part,buf); - + fat_setNextClusterAddress(fs,nc,fat_giveEocMarker(fs)); return(0); diff --git a/sw/airborne/arch/lpc21/gpio.h b/sw/airborne/arch/lpc21/gpio.h index 139db1a23c..1c4de8541b 100644 --- a/sw/airborne/arch/lpc21/gpio.h +++ b/sw/airborne/arch/lpc21/gpio.h @@ -16,7 +16,7 @@ extern bool_t gpio1_status; #define GpioOn1() { \ gpio1_status = TRUE; \ IO0SET = _BV(GPIO_1_PIN); \ -} +} #define GpioOff1() { \ gpio1_status = FALSE; \ diff --git a/sw/airborne/arch/lpc21/include/LPC21xx.h b/sw/airborne/arch/lpc21/include/LPC21xx.h index 29855e67df..b57c5d2d22 100644 --- a/sw/airborne/arch/lpc21/include/LPC21xx.h +++ b/sw/airborne/arch/lpc21/include/LPC21xx.h @@ -3,7 +3,7 @@ * $RCSfile$ * $Revision$ * - * Header file for Philips LPC21xx ARM Processors + * Header file for Philips LPC21xx ARM Processors * Copyright 2004 R O SoftWare * * No guarantees, warrantees, or promises, implied or otherwise. @@ -356,7 +356,7 @@ // Digital to Analog Converter #define DACR (*(REG32*) 0xE006C000) - + /////////////////////////////////////////////////////////////////////////////// // System Contol Block #define SCB ((scbRegs_t *)0xE01FC000) diff --git a/sw/airborne/arch/lpc21/interrupt_hw.h b/sw/airborne/arch/lpc21/interrupt_hw.h index 881aa2139c..a4eb8c753d 100644 --- a/sw/airborne/arch/lpc21/interrupt_hw.h +++ b/sw/airborne/arch/lpc21/interrupt_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file interrupt_hw.h diff --git a/sw/airborne/arch/lpc21/link_mcu_hw.h b/sw/airborne/arch/lpc21/link_mcu_hw.h index 995990a9de..0e49ab3ed5 100644 --- a/sw/airborne/arch/lpc21/link_mcu_hw.h +++ b/sw/airborne/arch/lpc21/link_mcu_hw.h @@ -17,26 +17,26 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \brief handling of arm7 inter mcu link - * + * */ #ifndef LINK_MCU_HW_H #define LINK_MCU_HW_H -#define CRC_INIT 0x0 -#define CrcLow(x) ((x)&0xff) -#define CrcHigh(x) ((x)>>8) +#define CRC_INIT 0x0 +#define CrcLow(x) ((x)&0xff) +#define CrcHigh(x) ((x)>>8) -static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) { - uint8_t a = ((uint8_t)CrcHigh(crc)) + data; - uint8_t b = ((uint8_t)CrcLow(crc)) + a; - crc = b | a << 8; - return crc; +static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) { + uint8_t a = ((uint8_t)CrcHigh(crc)) + data; + uint8_t b = ((uint8_t)CrcLow(crc)) + a; + crc = b | a << 8; + return crc; } #endif /* LINK_MCU_HW_H */ diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.c b/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.c index 75269820a3..122d7ac3a8 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.c @@ -21,13 +21,13 @@ static inline unsigned __get_cpsr(void) { unsigned long retval; - asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ ); + asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ ); return retval; } static inline void __set_cpsr(unsigned val) { - asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) ); + asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) ); } unsigned disableIRQ(void) diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.h b/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.h index 7d6dede0b2..e9fc63bb97 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/armVIC.h @@ -46,8 +46,8 @@ * routines to operate properly with THUMB code. The MACRO performs * the following steps: * - * 1 - Recover SPSR value from stack - * 2 - and restore its value + * 1 - Recover SPSR value from stack + * 2 - and restore its value * 3 - Pop the return address & the saved general registers from * the IRQ stack & return * @@ -63,7 +63,7 @@ * Description: * This function sets the IRQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -79,7 +79,7 @@ unsigned disableIRQ(void); * Description: * This function clears the IRQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -96,7 +96,7 @@ unsigned enableIRQ(void); * This function restores the IRQ disable bit in the status register * to the value contained within passed oldCPSR * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -112,7 +112,7 @@ unsigned restoreIRQ(unsigned oldCPSR); * Description: * This function sets the FIQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -128,7 +128,7 @@ unsigned disableFIQ(void); * Description: * This function clears the FIQ disable bit in the status register * - * Calling Sequence: + * Calling Sequence: * void * * Returns: @@ -145,7 +145,7 @@ unsigned enableFIQ(void); * This function restores the FIQ disable bit in the status register * to the value contained within passed oldCPSR * - * Calling Sequence: + * Calling Sequence: * void * * Returns: diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/blockdev.h b/sw/airborne/arch/lpc21/lpcusb/examples/blockdev.h index 0933f71a07..bd7a5a9646 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/blockdev.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/blockdev.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/blockdev_sd.c b/sw/airborne/arch/lpc21/lpcusb/examples/blockdev_sd.c index e7c23346e9..86a793494a 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/blockdev_sd.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/blockdev_sd.c @@ -93,15 +93,15 @@ static void Resp8bError(U8 value) case 0x04: DBG("Illegal command.\n"); break; case 0x02: DBG("Erase reset (see SanDisk docs p5-13).\n"); break; case 0x01: DBG("Card is initialising.\n"); break; - default: - DBG("Unknown error 0x%x (see SanDisk docs p5-13).\n", value); + default: + DBG("Unknown error 0x%x (see SanDisk docs p5-13).\n", value); break; } } /* **************************************************************************** - calculates size of card from CSD + calculates size of card from CSD (extension by Martin Thomas, inspired by code from Holger Klabunde) */ int BlockDevGetSize(U32 *pdwDriveSize) diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/console.c b/sw/airborne/arch/lpc21/lpcusb/examples/console.c index 1ea604b6dc..f976a514e2 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/console.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/console.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -45,29 +45,29 @@ /* Initialize Serial Interface */ -void ConsoleInit(int iDivider) -{ +void ConsoleInit(int iDivider) +{ PINSEL0 = (PINSEL0 & ~0x0000000F) | 0x00000005; /* Enable RxD0 and TxD0 */ U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U0DLL = iDivider & 0xFF; /* set divider / baud rate */ U0DLM = iDivider >> 8; U0LCR = 0x03; /* DLAB = 0 */ - + // enable FIFO U0FCR = 1; } /* Write character to Serial Port */ -int putchar(int ch) -{ +int putchar(int ch) +{ if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = '\r'; } while (!(U0LSR & 0x20)); U0THR = ch; - + return ch; } diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/console.h b/sw/airborne/arch/lpc21/lpcusb/examples/console.h index 072e8d53fd..da1e3aac06 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/console.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/console.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/lpc2000_spi.c b/sw/airborne/arch/lpc21/lpcusb/examples/lpc2000_spi.c index 7808a04f0e..367dac047b 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/lpc2000_spi.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/lpc2000_spi.c @@ -45,7 +45,7 @@ /* Pin Connect Block */ #define PINSEL0 (*((volatile unsigned long *) 0xE002C000)) #define PINSEL1 (*((volatile unsigned long *) 0xE002C004)) -#define PINSEL2 (*((volatile unsigned long *) 0xE002C014)) +#define PINSEL2 (*((volatile unsigned long *) 0xE002C014)) /* SSP Controller */ #define SSPCR0 (*((volatile unsigned short* ) 0xE0068000)) @@ -58,7 +58,7 @@ #define SSPMIS (*((volatile unsigned char * ) 0xE006801C)) #define SSPICR (*((volatile unsigned char * ) 0xE0068020)) #define SSPDMACR (*((volatile unsigned char * ) 0xE0068024)) - + // SSPCR0 Bit-Definitions #define CPOL 6 #define CPHA 7 @@ -78,7 +78,7 @@ #define SPI_MISO_PIN 18 /* from Card P0.18 in */ #define SPI_MOSI_PIN 19 /* to Card P0.19 out */ /* Card-Select P0.20 - GPIO out during startup */ -#define SPI_SS_PIN 20 +#define SPI_SS_PIN 20 #define SPI_PINSEL PINSEL1 #define SPI_SCK_FUNCBIT 2 @@ -87,7 +87,7 @@ #define SPI_SS_FUNCBIT 8 #define SPI_PRESCALE_REG SSPCPSR - + /* only needed during init: */ #define SELECT_CARD() IOCLR0 = (1<bOperationCode >> 5) & 0x7; if (iCDBLen < aiCDBLen[bGroupCode]) { @@ -161,32 +161,32 @@ U8 * SCSIHandleCmd(U8 *pbCDB, U8 iCDBLen, int *piRspLen, BOOL *pfDevIn) DBG("TEST UNIT READY\n"); *piRspLen = 0; break; - + // request sense (6) case SCSI_CMD_REQUEST_SENSE: DBG("REQUEST SENSE (%06X)\n", dwSense); // check params *piRspLen = MIN(18, pCDB->bLength); break; - + case SCSI_CMD_FORMAT_UNIT: DBG("FORMAT UNIT %02X\n", pbCDB[1]); *piRspLen = 0; break; - + // inquiry (6) case SCSI_CMD_INQUIRY: DBG("INQUIRY\n"); // see SPC3r23, 4.3.4.6 *piRspLen = MIN(36, pCDB->bLength); break; - + // read capacity (10) case SCSI_CMD_READ_CAPACITY_10: DBG("READ CAPACITY\n"); *piRspLen = 8; break; - + // read (10) case SCSI_CMD_READ_10: dwLBA = (pbCDB[2] << 24) | (pbCDB[3] << 16) | (pbCDB[4] << 8) | (pbCDB[5]); @@ -213,9 +213,9 @@ U8 * SCSIHandleCmd(U8 *pbCDB, U8 iCDBLen, int *piRspLen, BOOL *pfDevIn) } *piRspLen = 0; break; - + default: - DBG("Unhandled SCSI: "); + DBG("Unhandled SCSI: "); for (i = 0; i < iCDBLen; i++) { DBG(" %02X", pbCDB[i]); } @@ -225,8 +225,8 @@ U8 * SCSIHandleCmd(U8 *pbCDB, U8 iCDBLen, int *piRspLen, BOOL *pfDevIn) *piRspLen = 0; return NULL; } - - + + return abBlockBuf; } @@ -235,12 +235,12 @@ U8 * SCSIHandleCmd(U8 *pbCDB, U8 iCDBLen, int *piRspLen, BOOL *pfDevIn) SCSIHandleData ============== Handles a block of SCSI data. - + IN pbCDB Command data block iCDBLen Command data block len IN/OUT pbData Data buffer IN dwOffset Offset in data - + Returns a pointer to the next data to be exchanged if successful, returns NULL otherwise. **************************************************************************/ @@ -250,9 +250,9 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) U32 dwLBA; U32 dwBufPos, dwBlockNr; U32 dwDevSize, dwMaxBlock; - + pCDB = (TCDB6 *)pbCDB; - + switch (pCDB->bOperationCode) { // test unit ready @@ -261,7 +261,7 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) return NULL; } break; - + // request sense case SCSI_CMD_REQUEST_SENSE: memcpy(pbData, abSense, 18); @@ -272,23 +272,23 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) // reset sense data dwSense = 0; break; - + case SCSI_CMD_FORMAT_UNIT: // nothing to do, ignore this command break; - + // inquiry case SCSI_CMD_INQUIRY: memcpy(pbData, abInquiry, sizeof(abInquiry)); break; - + // read capacity case SCSI_CMD_READ_CAPACITY_10: // get size of drive (bytes) BlockDevGetSize(&dwDevSize); // calculate highest LBA dwMaxBlock = (dwDevSize - 1) / 512; - + pbData[0] = (dwMaxBlock >> 24) & 0xFF; pbData[1] = (dwMaxBlock >> 16) & 0xFF; pbData[2] = (dwMaxBlock >> 8) & 0xFF; @@ -298,7 +298,7 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) pbData[6] = (BLOCKSIZE >> 8) & 0xFF; pbData[7] = (BLOCKSIZE >> 0) & 0xFF; break; - + // read10 case SCSI_CMD_READ_10: dwLBA = (pbCDB[2] << 24) | (pbCDB[3] << 16) | (pbCDB[4] << 8) | (pbCDB[5]); @@ -321,7 +321,7 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) // write10 case SCSI_CMD_WRITE_10: dwLBA = (pbCDB[2] << 24) | (pbCDB[3] << 16) | (pbCDB[4] << 8) | (pbCDB[5]); - + // copy data to block buffer dwBufPos = ((dwOffset + 64) & (BLOCKSIZE - 1)); if (dwBufPos == 0) { @@ -336,17 +336,17 @@ U8 * SCSIHandleData(U8 *pbCDB, U8 iCDBLen, U8 *pbData, U32 dwOffset) } // return pointer to next data return abBlockBuf + dwBufPos; - + case SCSI_CMD_VERIFY_10: // dummy implementation break; - + default: // unsupported command dwSense = INVALID_CMD_OPCODE; return NULL; } - + // default: return pointer to start of block buffer return abBlockBuf; } diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/msc_scsi.h b/sw/airborne/arch/lpc21/lpcusb/examples/msc_scsi.h index ea5ed531cf..38a07ed179 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/msc_scsi.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/msc_scsi.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/printf.c b/sw/airborne/arch/lpc21/lpcusb/examples/printf.c index 768d4c1151..2ec4ef47f8 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/printf.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/printf.c @@ -187,7 +187,7 @@ static int print(char **out, const char *format, va_list args ) int printf(const char *format, ...) { va_list args; - + va_start( args, format ); return print( 0, format, args ); } @@ -195,7 +195,7 @@ int printf(const char *format, ...) int sprintf(char *out, const char *format, ...) { va_list args; - + va_start( args, format ); return print( &out, format, args ); } diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/spi.h b/sw/airborne/arch/lpc21/lpcusb/examples/spi.h index 6eba8ba3ea..89310ea9b5 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/spi.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/spi.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/startup.c b/sw/airborne/arch/lpc21/lpcusb/examples/startup.c index ebaa1e0cf3..311141258f 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/startup.c +++ b/sw/airborne/arch/lpc21/lpcusb/examples/startup.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -27,7 +27,7 @@ /* Initialisation functions for exception handlers, PLL and MAM - + Partially copied from Jim Lynch's tutorial */ @@ -58,21 +58,21 @@ void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF"))); /* ---------------------------------------------------- */ void IRQ_Routine (void) { - while (1) ; + while (1) ; } void FIQ_Routine (void) { - while (1) ; + while (1) ; } void SWI_Routine (void) { - while (1) ; + while (1) ; } void UNDEF_Routine (void) { - while (1) ; + while (1) ; } @@ -89,29 +89,29 @@ static void feed(void) } -void Initialize(void) +void Initialize(void) { - - + + // Setting the Phased Lock Loop (PLL) // ---------------------------------- // // Olimex LPC-P2148 has a 12.0000 mhz crystal // // We'd like the LPC2148 to run at 60 mhz (has to be an even multiple of crystal) - // + // // According to the Philips LPC2148 manual: M = cclk / Fosc where: M = PLL multiplier (bits 0-4 of PLLCFG) // cclk = 60000000 hz // Fosc = 12000000 hz // - // Solving: M = 60000000 / 12000000 = 5 + // Solving: M = 60000000 / 12000000 = 5 // // Note: M - 1 must be entered into bits 0-4 of PLLCFG (assign 4 to these bits) // // // The Current Controlled Oscilator (CCO) must operate in the range 156 mhz to 320 mhz // - // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency + // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency // cclk = 60000000 hz // P = PLL divisor (bits 5-6 of PLLCFG) // @@ -127,26 +127,26 @@ void Initialize(void) // Final note: to load PLLCFG register, we must use the 0xAA followed 0x55 write sequence to the PLLFEED register // this is done in the short function feed() below // - + // Setting Multiplier and Divider values PLLCFG = 0x24; feed(); - - // Enabling the PLL */ + + // Enabling the PLL */ PLLCON = 0x1; feed(); - + // Wait for the PLL to lock to set frequency while(!(PLLSTAT & PLOCK)) ; - + // Connect the PLL as the clock source PLLCON = 0x3; feed(); - + // Enabling MAM and setting number of clocks used for Flash memory fetch MAMTIM = 0x3; MAMCR = 0x2; - + // Setting peripheral Clock (pclk) to System Clock (cclk) VPBDIV = 0x1; } diff --git a/sw/airborne/arch/lpc21/lpcusb/examples/startup.h b/sw/airborne/arch/lpc21/lpcusb/examples/startup.h index 3e3a1ecfbb..bf53516c39 100644 --- a/sw/airborne/arch/lpc21/lpcusb/examples/startup.h +++ b/sw/airborne/arch/lpc21/lpcusb/examples/startup.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/type.h b/sw/airborne/arch/lpc21/lpcusb/type.h index 0b6e17ec3f..f028c8847c 100644 --- a/sw/airborne/arch/lpc21/lpcusb/type.h +++ b/sw/airborne/arch/lpc21/lpcusb/type.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/usbapi.h b/sw/airborne/arch/lpc21/lpcusb/usbapi.h index 118077d3f8..388581c8aa 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbapi.h +++ b/sw/airborne/arch/lpc21/lpcusb/usbapi.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/usbcontrol.c b/sw/airborne/arch/lpc21/lpcusb/usbcontrol.c index 5afa4cd9e6..9fc852a0e5 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbcontrol.c +++ b/sw/airborne/arch/lpc21/lpcusb/usbcontrol.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -28,10 +28,10 @@ /** @file Control transfer handler. - + This module handles control transfers and is normally installed on the endpoint 0 callback. - + Control transfers can be of the following type: 0 Standard; 1 Class; @@ -73,11 +73,11 @@ static U8 *apbDataStore[4] = {NULL, NULL, NULL, NULL}; /** Local function to handle a request by calling one of the installed request handlers. - + In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *ppbData or update the data pointer. - + @param [in] pSetup The setup packet @param [in,out] *piLen Pointer to data length @param [in,out] ppbData Data buffer. @@ -88,7 +88,7 @@ static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) { TFnHandleRequest *pfnHandler; int iType; - + iType = REQTYPE_GET_TYPE(pSetup->bmRequestType); pfnHandler = apfnReqHandlers[iType]; if (pfnHandler == NULL) { @@ -102,7 +102,7 @@ static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) /** Local function to stall the control endpoint - + @param [in] bEPStat Endpoint status */ static void StallControlPipe(U8 bEPStat __attribute__ ((unused))) @@ -173,7 +173,7 @@ void USBHandleControlTransfer(U8 bEP, U8 bEPStat) DataIn(); } } - else { + else { if (iResidue > 0) { // store data iChunk = USBHwEPRead(0x00, pbData, iResidue); @@ -216,7 +216,7 @@ void USBHandleControlTransfer(U8 bEP, U8 bEPStat) /** Registers a callback for handling requests - + @param [in] iType Type of request, e.g. REQTYPE_TYPE_STANDARD @param [in] *pfnHandler Callback function pointer @param [in] *pbDataStore Data storage area for this type of request diff --git a/sw/airborne/arch/lpc21/lpcusb/usbdebug.h b/sw/airborne/arch/lpc21/lpcusb/usbdebug.h index fa8fde87be..e13f8a20e1 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbdebug.h +++ b/sw/airborne/arch/lpc21/lpcusb/usbdebug.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.c b/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.c index e83fd666a1..6b5a1b3ac0 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.c +++ b/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -67,8 +67,8 @@ static TFnFrameHandler *_pfnFrameHandler = NULL; /** Local function to wait for a device interrupt (and clear it) - - @param [in] dwIntr Interrupts to wait for + + @param [in] dwIntr Interrupts to wait for */ static void Wait4DevInt(U32 dwIntr) { @@ -79,7 +79,7 @@ static void Wait4DevInt(U32 dwIntr) /** Local function to send a command to the USB protocol engine - + @param [in] bCmd Command to send */ static void USBHwCmd(U8 bCmd) @@ -94,7 +94,7 @@ static void USBHwCmd(U8 bCmd) /** Local function to send a command + data to the USB protocol engine - + @param [in] bCmd Command to send @param [in] bData Data to send */ @@ -111,7 +111,7 @@ static void USBHwCmdWrite(U8 bCmd, U16 bData) /** Local function to send a command to the USB protocol engine and read data - + @param [in] bCmd Command to send @return the data @@ -120,7 +120,7 @@ static U8 USBHwCmdRead(U8 bCmd) { // write command code USBHwCmd(bCmd); - + // get data USBCmdCode = 0x00000200 | (bCmd << 16); Wait4DevInt(CDFULL); @@ -131,11 +131,11 @@ static U8 USBHwCmdRead(U8 bCmd) /** 'Realizes' an endpoint, meaning that buffer space is reserved for it. An endpoint needs to be realised before it can be used. - + From experiments, it appears that a USB reset causes USBReEP to re-initialise to 3 (= just the control endpoints). However, a USB bus reset does not disturb the USBMaxPSize settings. - + @param [in] idx Endpoint index @param [in] wMaxPSize Maximum packet size for this endpoint */ @@ -150,7 +150,7 @@ static void USBHwEPRealize(int idx, U16 wMaxPSize) /** Enables or disables an endpoint - + @param [in] idx Endpoint index @param [in] fEnable TRUE to enable, FALSE to disable */ @@ -162,16 +162,16 @@ static void USBHwEPEnable(int idx, BOOL fEnable) /** Configures an endpoint and enables it - + @param [in] bEP Endpoint number @param [in] wMaxPacketSize Maximum packet size for this EP */ void USBHwEPConfig(U8 bEP, U16 wMaxPacketSize) { int idx; - + idx = EP2IDX(bEP); - + // realise EP USBHwEPRealize(idx, wMaxPacketSize); @@ -182,38 +182,38 @@ void USBHwEPConfig(U8 bEP, U16 wMaxPacketSize) /** Registers an endpoint event callback - + @param [in] bEP Endpoint number @param [in] pfnHandler Callback function */ void USBHwRegisterEPIntHandler(U8 bEP, TFnEPIntHandler *pfnHandler) { int idx; - + idx = EP2IDX(bEP); ASSERT(idx<32); /* add handler to list of EP handlers */ _apfnEPIntHandlers[idx / 2] = pfnHandler; - + /* enable EP interrupt */ USBEpIntEn |= (1 << idx); USBDevIntEn |= EP_SLOW; - + DBG("Registered handler for EP 0x%x\n", bEP); } /** Registers an device status callback - + @param [in] pfnHandler Callback function */ void USBHwRegisterDevIntHandler(TFnDevIntHandler *pfnHandler) { _pfnDevIntHandler = pfnHandler; - + // enable device interrupt USBDevIntEn |= DEV_STAT; @@ -223,13 +223,13 @@ void USBHwRegisterDevIntHandler(TFnDevIntHandler *pfnHandler) /** Registers the frame callback - + @param [in] pfnHandler Callback function */ void USBHwRegisterFrameHandler(TFnFrameHandler *pfnHandler) { _pfnFrameHandler = pfnHandler; - + // enable device interrupt USBDevIntEn |= FRAME; @@ -239,7 +239,7 @@ void USBHwRegisterFrameHandler(TFnFrameHandler *pfnHandler) /** Sets the USB address. - + @param [in] bAddr Device address to set */ void USBHwSetAddress(U8 bAddr) @@ -250,7 +250,7 @@ void USBHwSetAddress(U8 bAddr) /** Connects or disconnects from the USB bus - + @param [in] fConnect If TRUE, connect, otherwise disconnect */ void USBHwConnect(BOOL fConnect) @@ -261,15 +261,15 @@ void USBHwConnect(BOOL fConnect) /** Enables interrupt on NAK condition - + For IN endpoints a NAK is generated when the host wants to read data from the device, but none is available in the endpoint buffer. For OUT endpoints a NAK is generated when the host wants to write data to the device, but the endpoint buffer is still full. - + The endpoint interrupt handlers can distinguish regular (ACK) interrupts from NAK interrupt by checking the bits in their bEPStatus argument. - + @param [in] bIntBits Bitmap indicating which NAK interrupts to enable */ void USBHwNakIntEnable(U8 bIntBits) @@ -280,7 +280,7 @@ void USBHwNakIntEnable(U8 bIntBits) /** Gets the status from a specific endpoint. - + @param [in] bEP Endpoint number @return Endpoint status byte (containing EP_STATUS_xxx bits) */ @@ -294,7 +294,7 @@ U8 USBHwEPGetStatus(U8 bEP) /** Sets the stalled property of an endpoint - + @param [in] bEP Endpoint number @param [in] fStall TRUE to stall, FALSE to unstall */ @@ -308,28 +308,28 @@ void USBHwEPStall(U8 bEP, BOOL fStall) /** Writes data to an endpoint buffer - + @param [in] bEP Endpoint number @param [in] pbBuf Endpoint data @param [in] iLen Number of bytes to write - + @return TRUE if the data was successfully written or <0 in case of error. */ int USBHwEPWrite(U8 bEP, U8 *pbBuf, int iLen) { int idx; - + idx = EP2IDX(bEP); - + // DBG("<%d", iLen); // DBG("<"); // set write enable for specific endpoint USBCtrl = WR_EN | ((bEP & 0xF) << 2); - + // set packet length USBTxPLen = iLen; - + // write data while (USBCtrl & WR_EN) { USBTxData = (pbBuf[3] << 24) | (pbBuf[2] << 16) | (pbBuf[1] << 8) | pbBuf[0]; @@ -339,18 +339,18 @@ int USBHwEPWrite(U8 bEP, U8 *pbBuf, int iLen) // select endpoint and validate buffer USBHwCmd(CMD_EP_SELECT | idx); USBHwCmd(CMD_EP_VALIDATE_BUFFER); - + return iLen; } /** Reads data from an endpoint buffer - + @param [in] bEP Endpoint number @param [in] pbBuf Endpoint data @param [in] iMaxLen Maximum number of bytes to read - + @return the number of bytes available in the EP (possibly more than iMaxLen), or <0 in case of error. */ @@ -358,25 +358,25 @@ int USBHwEPRead(U8 bEP, U8 *pbBuf, int iMaxLen) { int i, idx; U32 dwData, dwLen; - + idx = EP2IDX(bEP); - + // set read enable bit for specific endpoint USBCtrl = RD_EN | ((bEP & 0xF) << 2); - + // wait for PKT_RDY do { dwLen = USBRxPLen; } while ((dwLen & PKT_RDY) == 0); - + // packet valid? if ((dwLen & DV) == 0) { return -1; } - + // get length dwLen &= PKT_LNGTH_MASK; - + // get data while (USBCtrl & RD_EN) { dwData = USBRxData; @@ -393,7 +393,7 @@ int USBHwEPRead(U8 bEP, U8 *pbBuf, int iMaxLen) // select endpoint and clear buffer USBHwCmd(CMD_EP_SELECT | idx); USBHwCmd(CMD_EP_CLEAR_BUFFER); - + // DBG(">%d", dwLen); // DBG(">"); @@ -403,10 +403,10 @@ int USBHwEPRead(U8 bEP, U8 *pbBuf, int iMaxLen) /** Sets the 'configured' state. - + All registered endpoints are 'realised' and enabled, and the 'configured' bit is set in the device status register. - + @param [in] fConfigured If TRUE, configure device, else unconfigure */ void USBHwConfigDevice(BOOL fConfigured) @@ -418,7 +418,7 @@ void USBHwConfigDevice(BOOL fConfigured) /** USB interrupt handler - + @todo Get all 11 bits of frame number instead of just 8 Endpoint interrupts are mapped to the slow interrupt @@ -436,7 +436,7 @@ DEBUG_LED_ON(9); // handle device interrupts dwStatus = USBDevIntSt; - + // frame interrupt if (dwStatus & FRAME) { // clear int @@ -447,7 +447,7 @@ DEBUG_LED_ON(9); _pfnFrameHandler(wFrame); } } - + // device status interrupt if (dwStatus & DEV_STAT) { /* Clear DEV_STAT interrupt before reading DEV_STAT register. @@ -463,13 +463,13 @@ DEBUG_LED_ON(9); ((bDevStat & RST) ? DEV_STATUS_RESET : 0); // call handler if (_pfnDevIntHandler != NULL) { -DEBUG_LED_ON(8); +DEBUG_LED_ON(8); _pfnDevIntHandler(bStat); -DEBUG_LED_OFF(8); +DEBUG_LED_OFF(8); } } } - + // endpoint interrupt if (dwStatus & EP_SLOW) { // clear EP_SLOW @@ -490,30 +490,30 @@ DEBUG_LED_OFF(8); ((bEPStat & EPSTAT_PO) ? EP_STATUS_ERROR : 0); // call handler if (_apfnEPIntHandlers[i / 2] != NULL) { -DEBUG_LED_ON(10); +DEBUG_LED_ON(10); _apfnEPIntHandlers[i / 2](IDX2EP(i), bStat); DEBUG_LED_OFF(10); } } } } - -DEBUG_LED_OFF(9); + +DEBUG_LED_OFF(9); } /** Initialises the USB hardware - + This function assumes that the hardware is connected as shown in section 10.1 of the LPC2148 data sheet: * P0.31 controls a switch to connect a 1.5k pull-up to D+ if low. * P0.23 is connected to USB VCC. - + Embedded artists board: make sure to disconnect P0.23 LED as it acts as a pull-up and so prevents detection of USB disconnect. - + @return TRUE if the hardware was successfully initialised */ BOOL USBHwInit(void) @@ -525,8 +525,8 @@ BOOL USBHwInit(void) PINSEL1 = (PINSEL1 & ~(3 << 30)) | (2 << 30); // P0.31 // enable PUSB - PCONP |= (1 << 31); - + PCONP |= (1 << 31); + // initialise PLL PLL1CON = 1; // enable PLL PLL1CFG = (1 << 5) | 3; // P = 2, M = 4 @@ -537,7 +537,7 @@ BOOL USBHwInit(void) PLL1CON = 3; // enable and connect PLL1FEED = 0xAA; PLL1FEED = 0x55; - + // disable/clear all interrupts for now USBDevIntEn = 0; USBDevIntClr = 0xFFFFFFFF; @@ -549,7 +549,7 @@ BOOL USBHwInit(void) // by default, only ACKs generate interrupts USBHwNakIntEnable(0); - + // init debug leds DEBUG_LED_INIT(8); DEBUG_LED_INIT(9); diff --git a/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.h b/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.h index d040c4a222..026f70e12f 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.h +++ b/sw/airborne/arch/lpc21/lpcusb/usbhw_lpc.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/lpcusb/usbinit.c b/sw/airborne/arch/lpc21/lpcusb/usbinit.c index 245e8679e4..c29abdfbdb 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbinit.c +++ b/sw/airborne/arch/lpc21/lpcusb/usbinit.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -41,7 +41,7 @@ static U8 abStdReqData[8]; /** USB reset handler - + @param [in] bDevStatus Device status */ static void HandleUsbReset(U8 bDevStatus) @@ -55,25 +55,25 @@ static void HandleUsbReset(U8 bDevStatus) /** Initialises the USB hardware and sets up the USB stack by installing default callbacks. - + @return TRUE if initialisation was successful */ BOOL USBInit(void) { // init hardware USBHwInit(); - + // register bus reset handler USBHwRegisterDevIntHandler(HandleUsbReset); - + // register control transfer handler on EP0 USBHwRegisterEPIntHandler(0x00, USBHandleControlTransfer); USBHwRegisterEPIntHandler(0x80, USBHandleControlTransfer); - + // setup control endpoints USBHwEPConfig(0x00, MAX_PACKET_SIZE0); USBHwEPConfig(0x80, MAX_PACKET_SIZE0); - + // register standard request handler USBRegisterRequestHandler(REQTYPE_TYPE_STANDARD, USBHandleStandardRequest, abStdReqData); diff --git a/sw/airborne/arch/lpc21/lpcusb/usbstdreq.c b/sw/airborne/arch/lpc21/lpcusb/usbstdreq.c index 4d8dc4d3fd..874d594c10 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbstdreq.c +++ b/sw/airborne/arch/lpc21/lpcusb/usbstdreq.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -28,11 +28,11 @@ /** @file Standard request handler. - + This modules handles the 'chapter 9' processing, specifically the standard device requests in table 9-3 from the universal serial bus specification revision 2.0 - + Specific types of devices may specify additional requests (for example HID devices add a GET_DESCRIPTOR request for interfaces), but they will not be part of this module. @@ -40,7 +40,7 @@ @todo some requests have to return a request error if device not configured: @todo GET_INTERFACE, GET_STATUS, SET_INTERFACE, SYNCH_FRAME @todo this applies to the following if endpoint != 0: - @todo SET_FEATURE, GET_FEATURE + @todo SET_FEATURE, GET_FEATURE */ #include "type.h" @@ -53,11 +53,11 @@ /* general descriptor field offsets */ #define DESC_bLength 0 /**< length offset */ -#define DESC_bDescriptorType 1 /**< descriptor type offset */ +#define DESC_bDescriptorType 1 /**< descriptor type offset */ /* config descriptor field offsets */ #define CONF_DESC_wTotalLength 2 /**< total length offset */ -#define CONF_DESC_bConfigurationValue 5 /**< configuration value offset */ +#define CONF_DESC_bConfigurationValue 5 /**< configuration value offset */ #define CONF_DESC_bmAttributes 7 /**< configuration characteristics */ /* interface descriptor field offsets */ @@ -91,12 +91,12 @@ void USBRegisterDescriptors(const U8 *pabDescriptors) /** Parses the list of installed USB descriptors and attempts to find the specified USB descriptor. - + @param [in] wTypeIndex Type and index of the descriptor @param [in] wLangID Language ID of the descriptor (currently unused) @param [out] *piLen Descriptor length @param [out] *ppbData Descriptor data - + @return TRUE if the descriptor was found, FALSE otherwise */ BOOL USBGetDescriptor(U16 wTypeIndex, U16 wLangID __attribute__ ((unused)), int *piLen, U8 **ppbData) @@ -104,15 +104,15 @@ BOOL USBGetDescriptor(U16 wTypeIndex, U16 wLangID __attribute__ ((unused)), int U8 bType, bIndex; const U8 *pab; int iCurIndex; - + ASSERT(pabDescrip != NULL); bType = GET_DESC_TYPE(wTypeIndex); bIndex = GET_DESC_INDEX(wTypeIndex); - + pab = pabDescrip; iCurIndex = 0; - + while (pab[DESC_bLength] != 0) { if (pab[DESC_bDescriptorType] == bType) { if (iCurIndex == bIndex) { @@ -145,12 +145,12 @@ BOOL USBGetDescriptor(U16 wTypeIndex, U16 wLangID __attribute__ ((unused)), int Configures the device according to the specified configuration index and alternate setting by parsing the installed USB descriptor list. A configuration index of 0 unconfigures the device. - + @param [in] bConfigIndex Configuration index @param [in] bAltSetting Alternate setting number - + @todo function always returns TRUE, add stricter checking? - + @return TRUE if successfully configured, FALSE otherwise */ static BOOL USBSetConfiguration(U8 bConfigIndex, U8 bAltSetting) @@ -159,7 +159,7 @@ static BOOL USBSetConfiguration(U8 bConfigIndex, U8 bAltSetting) U8 bCurConfig, bCurAltSetting; U8 bEP; U16 wMaxPktSize; - + ASSERT(pabDescrip != NULL); if (bConfigIndex == 0) { @@ -204,7 +204,7 @@ static BOOL USBSetConfiguration(U8 bConfigIndex, U8 bAltSetting) // skip to next descriptor pab += pab[DESC_bLength]; } - + // configure device USBHwConfigDevice(TRUE); } @@ -215,7 +215,7 @@ static BOOL USBSetConfiguration(U8 bConfigIndex, U8 bAltSetting) /** Local function to handle a standard device request - + @param [in] pSetup The setup packet @param [in,out] *piLen Pointer to data length @param [in,out] ppbData Data buffer. @@ -227,7 +227,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) U8 *pbData = *ppbData; switch (pSetup->bRequest) { - + case REQ_GET_STATUS: // bit 0: self-powered // bit 1: remote wakeup = not supported @@ -235,7 +235,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) pbData[1] = 0; *piLen = 2; break; - + case REQ_SET_ADDRESS: USBHwSetAddress(pSetup->wValue); break; @@ -256,7 +256,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) return FALSE; } // configuration successful, update current configuration - bConfiguration = pSetup->wValue & 0xFF; + bConfiguration = pSetup->wValue & 0xFF; break; case REQ_CLEAR_FEATURE: @@ -277,14 +277,14 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) DBG("Illegal device req %d\n", pSetup->bRequest); return FALSE; } - + return TRUE; } /** Local function to handle a standard interface request - + @param [in] pSetup The setup packet @param [in,out] *piLen Pointer to data length @param [in] ppbData Data buffer. @@ -308,13 +308,13 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData case REQ_SET_FEATURE: // not defined for interface return FALSE; - + case REQ_GET_INTERFACE: // TODO use bNumInterfaces // there is only one interface, return n-1 (= 0) pbData[0] = 0; *piLen = 1; break; - + case REQ_SET_INTERFACE: // TODO use bNumInterfaces // there is only one interface (= 0) if (pSetup->wValue != 0) { @@ -334,7 +334,7 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData /** Local function to handle a standard endpoint request - + @param [in] pSetup The setup packet @param [in,out] *piLen Pointer to data length @param [in] ppbData Data buffer. @@ -352,7 +352,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) pbData[1] = 0; *piLen = 2; break; - + case REQ_CLEAR_FEATURE: if (pSetup->wValue == FEA_ENDPOINT_HALT) { // clear HALT by unstalling @@ -361,7 +361,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) } // only ENDPOINT_HALT defined for endpoints return FALSE; - + case REQ_SET_FEATURE: if (pSetup->wValue == FEA_ENDPOINT_HALT) { // set HALT by stalling @@ -379,16 +379,16 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) DBG("Illegal EP req %d\n", pSetup->bRequest); return FALSE; } - + return TRUE; } /** Default handler for standard ('chapter 9') requests - + If a custom request handler was installed, this handler is called first. - + @param [in] pSetup The setup packet @param [in,out] *piLen Pointer to data length @param [in] ppbData Data buffer. @@ -401,7 +401,7 @@ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) if ((pfnHandleCustomReq != NULL) && pfnHandleCustomReq(pSetup, piLen, ppbData)) { return TRUE; } - + switch (REQTYPE_GET_RECIP(pSetup->bmRequestType)) { case REQTYPE_RECIP_DEVICE: return HandleStdDeviceReq(pSetup, piLen, ppbData); case REQTYPE_RECIP_INTERFACE: return HandleStdInterfaceReq(pSetup, piLen, ppbData); @@ -413,15 +413,15 @@ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) /** Registers a callback for custom device requests - + In USBHandleStandardRequest, the custom request handler gets a first chance at handling the request before it is handed over to the 'chapter 9' request handler. - + This can be used for example in HID devices, where a REQ_GET_DESCRIPTOR request is sent to an interface, which is not covered by the 'chapter 9' specification. - + @param [in] pfnHandler Callback function pointer */ void USBRegisterCustomReqHandler(TFnHandleRequest *pfnHandler) diff --git a/sw/airborne/arch/lpc21/lpcusb/usbstruct.h b/sw/airborne/arch/lpc21/lpcusb/usbstruct.h index b84373b0a1..b4fddd050f 100644 --- a/sw/airborne/arch/lpc21/lpcusb/usbstruct.h +++ b/sw/airborne/arch/lpc21/lpcusb/usbstruct.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) Redistribution and use in source and binary forms, with or without @@ -16,7 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/max1167_hw.c b/sw/airborne/arch/lpc21/max1167_hw.c index 0bd6a35cfa..1344786c07 100644 --- a/sw/airborne/arch/lpc21/max1167_hw.c +++ b/sw/airborne/arch/lpc21/max1167_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -29,7 +29,7 @@ static void EXTINT0_ISR(void) __attribute__((naked)); extern void max1167_hw_init( void ) { - + /* SS pin is output */ SetBit(MAX1167_SS_IODIR, MAX1167_SS_PIN); /* unselected max1167 */ @@ -48,14 +48,14 @@ extern void max1167_hw_init( void ) { VICIntSelect &= ~VIC_BIT( VIC_EINT0 ); // EXTINT0 selected as IRQ VICIntEnable = VIC_BIT( VIC_EINT0 ); // EXTINT0 interrupt enabled _VIC_CNTL(MAX1167_EOC_VIC_SLOT) = VIC_ENABLE | VIC_EINT0; - _VIC_ADDR(MAX1167_EOC_VIC_SLOT) = (uint32_t)EXTINT0_ISR; // address of the ISR + _VIC_ADDR(MAX1167_EOC_VIC_SLOT) = (uint32_t)EXTINT0_ISR; // address of the ISR } void max1167_read( void ) { //ASSERT((max1167_status == STA_MAX1167_IDLE), \ // DEBUG_MAX_1117, MAX1167_ERR_READ_OVERUN); - /* select max1167 */ + /* select max1167 */ Max1167Select(); /* enable SPI */ SpiClearRti(); @@ -82,7 +82,7 @@ void EXTINT0_ISR(void) { SpiClearRti(); SpiEnableRti(); max1167_status = STA_MAX1167_READING_RES; - + SetBit(EXTINT, MAX1167_EOC_EINT); /* clear extint0 */ VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */ diff --git a/sw/airborne/arch/lpc21/max1167_hw.h b/sw/airborne/arch/lpc21/max1167_hw.h index 8b36be4e22..0aaba0901f 100644 --- a/sw/airborne/arch/lpc21/max1167_hw.h +++ b/sw/airborne/arch/lpc21/max1167_hw.h @@ -2,14 +2,14 @@ #define MAX1167_HW_H /* - MAX1167 SPI ADC connected on SPI1 + MAX1167 SPI ADC connected on SPI1 SS on P1.29 EOC on P0.16 ( EINT0 ) */ #include "std.h" #include "LPC21xx.h" -#include "interrupt_hw.h" +#include "interrupt_hw.h" #include "spi_hw.h" //#include "pprz_debug.h" diff --git a/sw/airborne/arch/lpc21/micromag_hw.c b/sw/airborne/arch/lpc21/micromag_hw.c index 84db53f1d9..0e8b97b068 100644 --- a/sw/airborne/arch/lpc21/micromag_hw.c +++ b/sw/airborne/arch/lpc21/micromag_hw.c @@ -1,12 +1,12 @@ /* PNI micromag3 connected on SPI1 */ -/* +/* Twisted Logic SS on P0.20 - RESET on P0.29 + RESET on P0.29 DRDY on P0.30 ( EINT3 ) */ -/* +/* IMU v3 SS on P0.20 RESET on P1.21 @@ -37,17 +37,17 @@ void micromag_hw_init( void ) { MmReset(); /* pin idles low */ /* configure DRDY pin */ - /* connected pin to EXINT */ + /* connected pin to EXINT */ MM_DRDY_PINSEL |= MM_DRDY_PINSEL_VAL << MM_DRDY_PINSEL_BIT; SetBit(EXTMODE, MM_DRDY_EINT); /* EINT is edge trigered */ SetBit(EXTPOLAR,MM_DRDY_EINT); /* EINT is trigered on rising edge */ SetBit(EXTINT,MM_DRDY_EINT); /* clear pending EINT */ - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( MM_DRDY_VIC_IT ); /* select EINT as IRQ source */ VICIntEnable = VIC_BIT( MM_DRDY_VIC_IT ); /* enable it */ _VIC_CNTL(MICROMAG_DRDY_VIC_SLOT) = VIC_ENABLE | MM_DRDY_VIC_IT; - _VIC_ADDR(MICROMAG_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; // address of the ISR + _VIC_ADDR(MICROMAG_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; // address of the ISR } diff --git a/sw/airborne/arch/lpc21/micromag_hw.h b/sw/airborne/arch/lpc21/micromag_hw.h index 6112e529bf..edbb7fdb36 100644 --- a/sw/airborne/arch/lpc21/micromag_hw.h +++ b/sw/airborne/arch/lpc21/micromag_hw.h @@ -5,7 +5,7 @@ #include "std.h" #include "LPC21xx.h" -#include "interrupt_hw.h" +#include "interrupt_hw.h" #include "ssp_hw.h" #include BOARD_CONFIG diff --git a/sw/airborne/arch/lpc21/modem_hw.c b/sw/airborne/arch/lpc21/modem_hw.c index de85848e5b..3063b132a8 100644 --- a/sw/airborne/arch/lpc21/modem_hw.c +++ b/sw/airborne/arch/lpc21/modem_hw.c @@ -14,7 +14,7 @@ uint8_t tx_bit_idx; #define NB_STATE 2 #define NB_PHASE 2 -static const uint16_t modem_sample[NB_STATE][NB_PHASE][SAMPLES_PER_PERIOD] = +static const uint16_t modem_sample[NB_STATE][NB_PHASE][SAMPLES_PER_PERIOD] = { {{512, 1023, 512, 1}, {512 ,1 , 512 , 1023}}, @@ -41,7 +41,7 @@ static inline uint8_t get_next_bit( void ) { ret = 1; } tx_bit_idx++; - + if (tx_bit_idx >= 10) { /* if we have nothing left to transmit */ if( tx_head == tx_tail ) { @@ -49,11 +49,11 @@ static inline uint8_t get_next_bit( void ) { tx_bit_idx--; } else { /* else load next byte */ - tx_byte = tx_buf[tx_tail]; - tx_bit_idx = 0; - tx_tail++; + tx_byte = tx_buf[tx_tail]; + tx_bit_idx = 0; + tx_tail++; if( tx_tail >= TX_BUF_SIZE ) - tx_tail = 0; + tx_tail = 0; } } return ret; @@ -62,7 +62,7 @@ static inline uint8_t get_next_bit( void ) { void TIMER1_ISR ( void ) { ISR_ENTRY(); static uint8_t modem_bit; - + DACR = modem_sample[modem_bit][modem_phase][modem_sample_idx] << 6; modem_sample_idx++; if (modem_sample_idx == SAMPLES_PER_PERIOD) { diff --git a/sw/airborne/arch/lpc21/modem_hw.h b/sw/airborne/arch/lpc21/modem_hw.h index 711c5c1556..2c44d3e863 100644 --- a/sw/airborne/arch/lpc21/modem_hw.h +++ b/sw/airborne/arch/lpc21/modem_hw.h @@ -49,7 +49,7 @@ static inline void modem_init ( void ) { /* enable interrupt on match register 0 */ T1MCR |= TMCR_MR0_I | TMCR_MR0_R; /* enable timer 1 */ - T1TCR = TCR_ENABLE; + T1TCR = TCR_ENABLE; } diff --git a/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c b/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c index 21a788cc4c..68c8555d8d 100644 --- a/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c +++ b/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -197,7 +197,7 @@ static void SSP_ISR(void) { max11040_values[max11040_buf_in][max11040_count] = SSPDR << 16; max11040_values[max11040_buf_in][max11040_count] |= SSPDR << 8; max11040_values[max11040_buf_in][max11040_count] |= SSPDR; - if (max11040_values[max11040_buf_in][max11040_count] & 0x800000) + if (max11040_values[max11040_buf_in][max11040_count] & 0x800000) max11040_values[max11040_buf_in][max11040_count] |= 0xFF000000; max11040_count++; @@ -205,7 +205,7 @@ static void SSP_ISR(void) { max11040_values[max11040_buf_in][max11040_count] = SSPDR << 16; max11040_values[max11040_buf_in][max11040_count] |= SSPDR << 8; max11040_values[max11040_buf_in][max11040_count] |= SSPDR; - if (max11040_values[max11040_buf_in][max11040_count] & 0x800000) + if (max11040_values[max11040_buf_in][max11040_count] & 0x800000) max11040_values[max11040_buf_in][max11040_count] |= 0xFF000000; max11040_count++; @@ -234,7 +234,7 @@ static void SSP_ISR(void) { void EXTINT_ISR(void) { ISR_ENTRY(); - if (num_irqs++ == 5) + if (num_irqs++ == 5) { /* switch SSEL P0.20 to be used as GPIO */ PINSEL1 &= ~(3 << 8); @@ -272,37 +272,37 @@ void EXTINT_ISR(void) { void max11040_hw_init( void ) { int i; - + /* *** configure SPI *** */ /* setup pins for SSP (SCK, MISO, MOSI, SSEL) */ PINSEL1 |= SSP_PINSEL1_SCK | SSP_PINSEL1_MISO | SSP_PINSEL1_MOSI | SSP_PINSEL1_SSEL; - + /* setup SSP */ SSPCR0 = SSPCR0_VAL;; SSPCR1 = SSPCR1_VAL; SSPCPSR = 0x02; - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( VIC_SPI1 ); /* SPI1 selected as IRQ */ VICIntEnable = VIC_BIT( VIC_SPI1 ); /* enable it */ _VIC_CNTL(SSP_VIC_SLOT) = VIC_ENABLE | VIC_SPI1; _VIC_ADDR(SSP_VIC_SLOT) = (uint32_t)SSP_ISR; /* address of the ISR */ - + /* *** configure DRDY pin*** */ - /* connected pin to EXINT */ + /* connected pin to EXINT */ MAXM_DRDY_PINSEL |= MAXM_DRDY_PINSEL_VAL << MAXM_DRDY_PINSEL_BIT; SetBit(EXTMODE, MAXM_DRDY_EINT); /* EINT is edge trigered */ ClearBit(EXTPOLAR, MAXM_DRDY_EINT); /* EINT is trigered on falling edge */ SetBit(EXTINT, MAXM_DRDY_EINT); /* clear pending EINT */ - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( MAXM_DRDY_VIC_IT ); /* select EINT as IRQ source */ VICIntEnable = VIC_BIT( MAXM_DRDY_VIC_IT ); /* enable it */ _VIC_CNTL(MAX11040_DRDY_VIC_SLOT) = VIC_ENABLE | MAXM_DRDY_VIC_IT; _VIC_ADDR(MAX11040_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; /* address of the ISR */ - - + + /* write configuration register */ SSP_Send(0x60); /* wr conf */ for (i=0; ihigh */ #define SSP_SCR 0x1F << 8 /* serial clock rate : 29.3kHz, SSP input clock / 16 */ @@ -88,7 +88,7 @@ void SPI1_ISR(void) { foo = SSPDR; } SpiClearRti(); /* clear interrupt */ - SpiDisableRti(); + SpiDisableRti(); SpiDisable (); lcddogmUnselect(); diff --git a/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.c b/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.c index 5b6954cf0a..ee707a0668 100644 --- a/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.c +++ b/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.c @@ -1,5 +1,5 @@ /* PNI micromag3 connected on SPI1 */ -/* +/* Tiny2 (fixed wing) SS on P0.20 (SSEL) RESET on P0.29 (ADC5) @@ -27,7 +27,7 @@ static void SSP_ISR(void) { void EXTINT_ISR(void) { ISR_ENTRY(); -//LED_TOGGLE(3); +//LED_TOGGLE(3); /* no, we won't do anything asynchronously, so just notify */ micromag_status = MM_GOT_EOC; @@ -41,12 +41,12 @@ void EXTINT_ISR(void) { void micromag_hw_init( void ) { /* setup pins for SSP (SCK, MISO, MOSI, SSEL) */ PINSEL1 |= SSP_PINSEL1_SCK | SSP_PINSEL1_MISO | SSP_PINSEL1_MOSI; - + /* setup SSP */ SSPCR0 = SSPCR0_VAL;; SSPCR1 = SSPCR1_VAL; SSPCPSR = 0x02; - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( VIC_SPI1 ); /* SPI1 selected as IRQ */ VICIntEnable = VIC_BIT( VIC_SPI1 ); /* enable it */ @@ -62,17 +62,17 @@ void micromag_hw_init( void ) { MmReset(); /* pin idles low */ /* configure DRDY pin */ - /* connected pin to EXINT */ + /* connected pin to EXINT */ MM_DRDY_PINSEL |= MM_DRDY_PINSEL_VAL << MM_DRDY_PINSEL_BIT; SetBit(EXTMODE, MM_DRDY_EINT); /* EINT is edge trigered */ SetBit(EXTPOLAR,MM_DRDY_EINT); /* EINT is trigered on rising edge */ SetBit(EXTINT,MM_DRDY_EINT); /* clear pending EINT */ - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( MM_DRDY_VIC_IT ); /* select EINT as IRQ source */ VICIntEnable = VIC_BIT( MM_DRDY_VIC_IT ); /* enable it */ _VIC_CNTL(MICROMAG_DRDY_VIC_SLOT) = VIC_ENABLE | MM_DRDY_VIC_IT; - _VIC_ADDR(MICROMAG_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; // address of the ISR + _VIC_ADDR(MICROMAG_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; // address of the ISR } diff --git a/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.h b/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.h index 5d2ea95b49..5ab746fb06 100644 --- a/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.h +++ b/sw/airborne/arch/lpc21/modules/sensors/mag_micromag_fw_hw.h @@ -5,7 +5,7 @@ #include "std.h" #include "LPC21xx.h" -#include "interrupt_hw.h" +#include "interrupt_hw.h" #include "spi_hw.h" #include BOARD_CONFIG diff --git a/sw/airborne/arch/lpc21/servos_4015_MAT_hw.c b/sw/airborne/arch/lpc21/servos_4015_MAT_hw.c index 680e529e6e..a528f014c1 100644 --- a/sw/airborne/arch/lpc21/servos_4015_MAT_hw.c +++ b/sw/airborne/arch/lpc21/servos_4015_MAT_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -52,9 +52,9 @@ void actuators_init ( void ) { /* enable match 1 interrupt */ T0MCR |= TMCR_MR1_I; - + /* lower clock */ - T0EMR &= ~TEMR_EM1; + T0EMR &= ~TEMR_EM1; /* set high on match 1 */ T0EMR |= TEMR_EMC1_2; diff --git a/sw/airborne/arch/lpc21/servos_4015_MAT_hw.h b/sw/airborne/arch/lpc21/servos_4015_MAT_hw.h index 129af96e80..4b68c59739 100644 --- a/sw/airborne/arch/lpc21/servos_4015_MAT_hw.h +++ b/sw/airborne/arch/lpc21/servos_4015_MAT_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/lpc21/servos_4015_hw.c b/sw/airborne/arch/lpc21/servos_4015_hw.c index 1e00e1e2b4..b52704f162 100644 --- a/sw/airborne/arch/lpc21/servos_4015_hw.c +++ b/sw/airborne/arch/lpc21/servos_4015_hw.c @@ -21,9 +21,9 @@ uint16_t servos_values[_4015_NB_CHANNELS]; void actuators_init ( void ) { /* PWM selected as IRQ */ - VICIntSelect &= ~VIC_BIT(VIC_PWM); + VICIntSelect &= ~VIC_BIT(VIC_PWM); /* PWM interrupt enabled */ - VICIntEnable = VIC_BIT(VIC_PWM); + VICIntEnable = VIC_BIT(VIC_PWM); VICVectCntl3 = VIC_ENABLE | VIC_PWM; /* address of the ISR */ VICVectAddr3 = (uint32_t)PWM_ISR; @@ -33,8 +33,8 @@ void actuators_init ( void ) { SERV1_CLOCK_PINSEL |= SERV1_CLOCK_PINSEL_VAL << SERV1_CLOCK_PINSEL_BIT; /* set match5 to go of a long time from now */ - PWMMR0 = 0XFFFFFF; - PWMMR_SERV1 = 0XFFF; + PWMMR0 = 0XFFFFFF; + PWMMR_SERV1 = 0XFFF; /* commit above change */ PWMLER = PWMLER_LATCH0 | PWMLER_LATCH_SERV1; /* interrupt on PWMMR5 match */ @@ -46,7 +46,7 @@ void actuators_init ( void ) { PWMPR = PWM_PRESCALER-1; /* enable PWM timer counter and PWM mode */ - PWMTCR = PWMTCR_COUNTER_ENABLE | PWMTCR_PWM_ENABLE; + PWMTCR = PWMTCR_COUNTER_ENABLE | PWMTCR_PWM_ENABLE; /* Load failsafe values */ /* Set all servos at their midpoints */ /* compulsory for unaffected servos */ @@ -102,5 +102,5 @@ void PWM_ISR ( void ) { /* clear the interrupt */ PWMIR = PWMIR_MRI_SERV1; VICVectAddr = 0x00000000; - ISR_EXIT(); + ISR_EXIT(); } diff --git a/sw/airborne/arch/lpc21/servos_4015_hw_new.c b/sw/airborne/arch/lpc21/servos_4015_hw_new.c index c3944c2da5..4dbd241838 100644 --- a/sw/airborne/arch/lpc21/servos_4015_hw_new.c +++ b/sw/airborne/arch/lpc21/servos_4015_hw_new.c @@ -21,9 +21,9 @@ uint16_t servos_values[_4015_NB_CHANNELS]; void actuators_init ( void ) { /* PWM selected as IRQ */ - VICIntSelect &= ~VIC_BIT(VIC_PWM); + VICIntSelect &= ~VIC_BIT(VIC_PWM); /* PWM interrupt enabled */ - VICIntEnable = VIC_BIT(VIC_PWM); + VICIntEnable = VIC_BIT(VIC_PWM); VICVectCntl3 = VIC_ENABLE | VIC_PWM; /* address of the ISR */ VICVectAddr3 = (uint32_t)PWM_ISR; @@ -37,9 +37,9 @@ void actuators_init ( void ) { SERV1_CLOCK_PINSEL |= SERV1_CLOCK_PINSEL_VAL << SERV1_CLOCK_PINSEL_BIT; /* set first pulse to be very long */ - PWMMR0 = 0XFFFFFF; - PWMMR_SERV1 = 0XFFF; - PWMMR_SERV0 = 0X0; + PWMMR0 = 0XFFFFFF; + PWMMR_SERV1 = 0XFFF; + PWMMR_SERV0 = 0X0; /* commit above changes */ PWMLER = PWMLER_LATCH0 | PWMLER_LATCH_SERV0 | PWMLER_LATCH_SERV1; /* enable interrupt on serv1 PWM match */ @@ -51,7 +51,7 @@ void actuators_init ( void ) { PWMPR = PWM_PRESCALER-1; /* enable PWM timer counter and PWM mode */ - PWMTCR = PWMTCR_COUNTER_ENABLE | PWMTCR_PWM_ENABLE; + PWMTCR = PWMTCR_COUNTER_ENABLE | PWMTCR_PWM_ENABLE; /* Load failsafe values */ /* Set all servos at their midpoints */ /* compulsory for unaffected servos */ @@ -79,9 +79,9 @@ void PWM_ISR ( void ) { /* raise serv0 data */ IO1SET = _BV(SERV0_DATA_PIN); /* start pulsing serv0 */ - PWMMR_SERV0 = 0XFFF; + PWMMR_SERV0 = 0XFFF; /* stop pulsing serv1 */ - PWMMR_SERV1 = 0X0; + PWMMR_SERV1 = 0X0; PWMMR0 = servos_values[servos_idx]; servos_delay = SERVO_REFRESH_TICS - servos_values[servos_idx]; PWMLER = PWMLER_LATCH0 | PWMLER_LATCH_SERV0 | PWMLER_LATCH_SERV1; @@ -107,7 +107,7 @@ void PWM_ISR ( void ) { /* stop pulsing serv0 */ PWMMR_SERV0 = 0; /* start pulsing serv1 */ - PWMMR_SERV1 = 0XFFF; + PWMMR_SERV1 = 0XFFF; /* disable serv0 interrupt, enable serv1 match interrupt */ PWMMCR = PWMMCR_MR0R | PWMMCR_MRI_SERV1; /* fill next servo value */ @@ -137,5 +137,5 @@ void PWM_ISR ( void ) { PWMIR = PWMIR_MRI_SERV1; PWMIR = PWMIR_MRI_SERV0; VICVectAddr = 0x00000000; - ISR_EXIT(); + ISR_EXIT(); } diff --git a/sw/airborne/arch/lpc21/servos_4017_hw.c b/sw/airborne/arch/lpc21/servos_4017_hw.c index 251e98a05b..01574e3437 100644 --- a/sw/airborne/arch/lpc21/servos_4017_hw.c +++ b/sw/airborne/arch/lpc21/servos_4017_hw.c @@ -21,15 +21,15 @@ void actuators_init ( void ) { /* enable match 1 interrupt */ T0MCR |= TMCR_MR1_I; - + #ifndef SERVOS_4017_CLOCK_FALLING /* lower clock */ - T0EMR &= ~TEMR_EM1; + T0EMR &= ~TEMR_EM1; /* set high on match 1 */ T0EMR |= TEMR_EMC1_2; #else /* assert clock */ - T0EMR |= TEMR_EM1; + T0EMR |= TEMR_EM1; /* set low on match 1 */ T0EMR |= TEMR_EMC1_1; #endif diff --git a/sw/airborne/arch/lpc21/servos_4017_hw.h b/sw/airborne/arch/lpc21/servos_4017_hw.h index 539b96495a..e2e980c44b 100644 --- a/sw/airborne/arch/lpc21/servos_4017_hw.h +++ b/sw/airborne/arch/lpc21/servos_4017_hw.h @@ -27,7 +27,7 @@ extern uint8_t servos_4017_idx; #define ACTUATORS_IT TIR_MR1I -#ifndef SERVOS_4017_CLOCK_FALLING +#ifndef SERVOS_4017_CLOCK_FALLING #define SERVOS_4017_ISR() { \ if (servos_4017_idx >= _4017_NB_CHANNELS) { \ SetBit(IO1SET, SERVO_RESET_PIN); \ @@ -74,6 +74,6 @@ extern uint8_t servos_4017_idx; servos_4017_idx++; \ } \ } -#endif /* SERVOS_4017_CLOCK_ON_RESET */ +#endif /* SERVOS_4017_CLOCK_ON_RESET */ #endif /* SERVOS_4017_HW_H */ diff --git a/sw/airborne/arch/lpc21/servos_direct_hw.c b/sw/airborne/arch/lpc21/servos_direct_hw.c index 1498c59171..f3cfa36b71 100644 --- a/sw/airborne/arch/lpc21/servos_direct_hw.c +++ b/sw/airborne/arch/lpc21/servos_direct_hw.c @@ -9,22 +9,22 @@ const uint8_t pwm_latch_value = 0 #if defined PWM_SERVO_0 - | PWM_SERVO_0_LATCH + | PWM_SERVO_0_LATCH #endif #if defined PWM_SERVO_1 - | PWM_SERVO_1_LATCH + | PWM_SERVO_1_LATCH #endif #if defined PWM_SERVO_2 - | PWM_SERVO_2_LATCH + | PWM_SERVO_2_LATCH #endif #if defined PWM_SERVO_3 - | PWM_SERVO_3_LATCH + | PWM_SERVO_3_LATCH #endif #if defined PWM_SERVO_4 - | PWM_SERVO_4_LATCH + | PWM_SERVO_4_LATCH #endif #if defined PWM_SERVO_5 - | PWM_SERVO_5_LATCH + | PWM_SERVO_5_LATCH #endif ; @@ -60,22 +60,22 @@ void actuators_init ( void ) { /* enable all 6 PWM outputs in single edge mode*/ PWMPCR = 0 #if defined PWM_SERVO_0 - | PWM_SERVO_0_ENA + | PWM_SERVO_0_ENA #endif #if defined PWM_SERVO_1 - | PWM_SERVO_1_ENA + | PWM_SERVO_1_ENA #endif #if defined PWM_SERVO_2 - | PWM_SERVO_2_ENA + | PWM_SERVO_2_ENA #endif #if defined PWM_SERVO_3 - | PWM_SERVO_3_ENA + | PWM_SERVO_3_ENA #endif #if defined PWM_SERVO_4 - | PWM_SERVO_4_ENA + | PWM_SERVO_4_ENA #endif #if defined PWM_SERVO_5 - | PWM_SERVO_5_ENA + | PWM_SERVO_5_ENA #endif ; diff --git a/sw/airborne/arch/lpc21/servos_direct_hw.h b/sw/airborne/arch/lpc21/servos_direct_hw.h index 71be715411..67c27be9a3 100644 --- a/sw/airborne/arch/lpc21/servos_direct_hw.h +++ b/sw/airborne/arch/lpc21/servos_direct_hw.h @@ -18,7 +18,7 @@ #define Actuator(i) COMMAND_(i) -/* +/* wiring on classix PWM connector connector LPC shared port PWM1 PWM5 AD1_6 CAP1_3 P0.21 @@ -32,42 +32,42 @@ PWM6 PWM2 SSEL0 EINT2 P0.7 #define PWM_PINSEL_MASK_VAL 3 -#define PWM_SERVO_0_PINSEL PINSEL1 +#define PWM_SERVO_0_PINSEL PINSEL1 #define PWM_SERVO_0_PINSEL_VAL 1 #define PWM_SERVO_0_PINSEL_BIT 10 #define PWM_SERVO_0_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_0_PINSEL_BIT) #define PWM_SERVO_0_ENA PWMPCR_ENA5 #define PWM_SERVO_0_LATCH PWMLER_LATCH5 -#define PWM_SERVO_1_PINSEL PINSEL0 +#define PWM_SERVO_1_PINSEL PINSEL0 #define PWM_SERVO_1_PINSEL_VAL 2 #define PWM_SERVO_1_PINSEL_BIT 2 #define PWM_SERVO_1_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_1_PINSEL_BIT) #define PWM_SERVO_1_ENA PWMPCR_ENA3 #define PWM_SERVO_1_LATCH PWMLER_LATCH3 -#define PWM_SERVO_2_PINSEL PINSEL0 +#define PWM_SERVO_2_PINSEL PINSEL0 #define PWM_SERVO_2_PINSEL_VAL 2 #define PWM_SERVO_2_PINSEL_BIT 0 #define PWM_SERVO_2_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_2_PINSEL_BIT) #define PWM_SERVO_2_ENA PWMPCR_ENA1 #define PWM_SERVO_2_LATCH PWMLER_LATCH1 -#define PWM_SERVO_3_PINSEL PINSEL0 +#define PWM_SERVO_3_PINSEL PINSEL0 #define PWM_SERVO_3_PINSEL_VAL 2 #define PWM_SERVO_3_PINSEL_BIT 18 #define PWM_SERVO_3_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_3_PINSEL_BIT) #define PWM_SERVO_3_ENA PWMPCR_ENA6 #define PWM_SERVO_3_LATCH PWMLER_LATCH6 -#define PWM_SERVO_4_PINSEL PINSEL0 +#define PWM_SERVO_4_PINSEL PINSEL0 #define PWM_SERVO_4_PINSEL_VAL 2 #define PWM_SERVO_4_PINSEL_BIT 16 #define PWM_SERVO_4_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_4_PINSEL_BIT) #define PWM_SERVO_4_ENA PWMPCR_ENA4 #define PWM_SERVO_4_LATCH PWMLER_LATCH4 -#define PWM_SERVO_5_PINSEL PINSEL0 +#define PWM_SERVO_5_PINSEL PINSEL0 #define PWM_SERVO_5_PINSEL_VAL 2 #define PWM_SERVO_5_PINSEL_BIT 14 #define PWM_SERVO_5_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_5_PINSEL_BIT) diff --git a/sw/airborne/arch/lpc21/servos_ppm_hw.c b/sw/airborne/arch/lpc21/servos_ppm_hw.c index b18d435896..5ed58e3460 100644 --- a/sw/airborne/arch/lpc21/servos_ppm_hw.c +++ b/sw/airborne/arch/lpc21/servos_ppm_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Mark Griffin * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file servos_ppm_out.c - * \Efficient driving of MAT0.1 (SERVO_CLOCK_PIN) using TIMER0 to produce PPM + * \Efficient driving of MAT0.1 (SERVO_CLOCK_PIN) using TIMER0 to produce PPM * \ for a R/C receiver which has a microcontroller to drive the servos * \(not a 4015 or 4017 decade counter chip). */ @@ -42,9 +42,9 @@ void actuators_init ( void ) { /* enable match 1 interrupt */ T0MCR |= TMCR_MR1_I; - + /* lower clock */ - T0EMR &= ~TEMR_EM1; + T0EMR &= ~TEMR_EM1; /* set high on match 1 */ T0EMR |= TEMR_EMC1_2; diff --git a/sw/airborne/arch/lpc21/servos_ppm_hw.h b/sw/airborne/arch/lpc21/servos_ppm_hw.h index b93460d933..b11b5169ae 100644 --- a/sw/airborne/arch/lpc21/servos_ppm_hw.h +++ b/sw/airborne/arch/lpc21/servos_ppm_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Mark Griffin * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file servos_ppm_out.h - * \Efficient driving of the MAT0.1 pin (SERVO_CLOCK_PIN) using TIMER0 to produce + * \Efficient driving of the MAT0.1 pin (SERVO_CLOCK_PIN) using TIMER0 to produce * \PPM for a R/C receiver which has a microcontroller to drive the servos * \(not a 4015 or 4017 decade counter chip). */ diff --git a/sw/airborne/arch/lpc21/test/bootloader/bootloader.c b/sw/airborne/arch/lpc21/test/bootloader/bootloader.c index aee2c50bba..95183f3889 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/bootloader.c +++ b/sw/airborne/arch/lpc21/test/bootloader/bootloader.c @@ -58,9 +58,9 @@ static unsigned int start_adr; static const U8 abDescriptors[] = { -// device descriptor +// device descriptor 0x12, - DESC_DEVICE, + DESC_DEVICE, LE_WORD(0x0110), // bcdUSB 0x00, // bDeviceClass 0x00, // bDeviceSubClass @@ -468,7 +468,7 @@ int main(void) start_app = 0; // call USB interrupt handler continuously - while (1) + while (1) { USBHwISR(); diff --git a/sw/airborne/arch/lpc21/test/bootloader/console.c b/sw/airborne/arch/lpc21/test/bootloader/console.c index 1336ed4e0f..9779dc6e39 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/console.c +++ b/sw/airborne/arch/lpc21/test/bootloader/console.c @@ -18,29 +18,29 @@ /* Initialize Serial Interface */ -void ConsoleInit(int iDivider) -{ +void ConsoleInit(int iDivider) +{ PINSEL0 = (PINSEL0 & ~0x0000000F) | 0x00000005; /* Enable RxD0 and TxD0 */ U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U0DLL = iDivider & 0xFF; /* set divider / baud rate */ U0DLM = iDivider >> 8; U0LCR = 0x03; /* DLAB = 0 */ - + // enable FIFO U0FCR = 1; } /* Write character to Serial Port */ -int putchar(int ch) -{ +int putchar(int ch) +{ if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = '\r'; } while (!(U0LSR & 0x20)); U0THR = ch; - + return ch; } diff --git a/sw/airborne/arch/lpc21/test/bootloader/lpc21iap.h b/sw/airborne/arch/lpc21/test/bootloader/lpc21iap.h index 86b5c6a03f..52178cd8d3 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/lpc21iap.h +++ b/sw/airborne/arch/lpc21/test/bootloader/lpc21iap.h @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -41,7 +41,7 @@ #define ADDR_NOT_MAPPED 14 #define CMD_LOCKED 15 #define INVALID_CODE 16 -#define INVALID_BAUD_RATE 17 +#define INVALID_BAUD_RATE 17 #define INVALID_STOP_BIT 18 #define CODE_READ_PROTECTION_ENABLED 19 diff --git a/sw/airborne/arch/lpc21/test/bootloader/printf.c b/sw/airborne/arch/lpc21/test/bootloader/printf.c index 768d4c1151..2ec4ef47f8 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/printf.c +++ b/sw/airborne/arch/lpc21/test/bootloader/printf.c @@ -187,7 +187,7 @@ static int print(char **out, const char *format, va_list args ) int printf(const char *format, ...) { va_list args; - + va_start( args, format ); return print( 0, format, args ); } @@ -195,7 +195,7 @@ int printf(const char *format, ...) int sprintf(char *out, const char *format, ...) { va_list args; - + va_start( args, format ); return print( &out, format, args ); } diff --git a/sw/airborne/arch/lpc21/test/bootloader/startup.c b/sw/airborne/arch/lpc21/test/bootloader/startup.c index aa702d255a..6d4146dfa3 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/startup.c +++ b/sw/airborne/arch/lpc21/test/bootloader/startup.c @@ -1,6 +1,6 @@ /* Initialisation functions for exception handlers, PLL and MAM - + Partially copied from Jim Lynch's tutorial */ @@ -31,21 +31,21 @@ void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF"))); /* ---------------------------------------------------- */ void IRQ_Routine (void) { - while (1) ; + while (1) ; } void FIQ_Routine (void) { - while (1) ; + while (1) ; } void SWI_Routine (void) { - while (1) ; + while (1) ; } void UNDEF_Routine (void) { - while (1) ; + while (1) ; } @@ -62,29 +62,29 @@ static void feed(void) } -void Initialize(void) +void Initialize(void) { - - + + // Setting the Phased Lock Loop (PLL) // ---------------------------------- // // Olimex LPC-P2148 has a 12.0000 mhz crystal // // We'd like the LPC2148 to run at 60 mhz (has to be an even multiple of crystal) - // + // // According to the Philips LPC2148 manual: M = cclk / Fosc where: M = PLL multiplier (bits 0-4 of PLLCFG) // cclk = 60000000 hz // Fosc = 12000000 hz // - // Solving: M = 60000000 / 12000000 = 5 + // Solving: M = 60000000 / 12000000 = 5 // // Note: M - 1 must be entered into bits 0-4 of PLLCFG (assign 4 to these bits) // // // The Current Controlled Oscilator (CCO) must operate in the range 156 mhz to 320 mhz // - // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency + // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency // cclk = 60000000 hz // P = PLL divisor (bits 5-6 of PLLCFG) // @@ -100,26 +100,26 @@ void Initialize(void) // Final note: to load PLLCFG register, we must use the 0xAA followed 0x55 write sequence to the PLLFEED register // this is done in the short function feed() below // - + // Setting Multiplier and Divider values PLLCFG = 0x24; feed(); - - // Enabling the PLL */ + + // Enabling the PLL */ PLLCON = 0x1; feed(); - + // Wait for the PLL to lock to set frequency while(!(PLLSTAT & PLOCK)) ; - + // Connect the PLL as the clock source PLLCON = 0x3; feed(); - + // Enabling MAM and setting number of clocks used for Flash memory fetch (4 cclks in this case) MAMTIM = 0x3; MAMCR = 0x2; - + // Setting peripheral Clock (pclk) to System Clock (cclk) VPBDIV = 0x1; } diff --git a/sw/airborne/arch/lpc21/test/bootloader/usbcontrol.c b/sw/airborne/arch/lpc21/test/bootloader/usbcontrol.c index de4dd4b3a1..ba3966f147 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/usbcontrol.c +++ b/sw/airborne/arch/lpc21/test/bootloader/usbcontrol.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) This library is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ stage, status stage). We simply follow the host: if it sends data, we store it in the control data buffer and if it asks for data, we just send the next block. - + */ #include "type.h" @@ -67,10 +67,10 @@ static TFnHandleRequest *apfnPreReqHandler = NULL; ================= Local function to handle a request before data arrived by calling a special installed request handler. - - Called in case of data going from host to device, the handler can + + Called in case of data going from host to device, the handler can update the data pointer *ppbData. - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -80,7 +80,7 @@ static TFnHandleRequest *apfnPreReqHandler = NULL; static BOOL _PreHandleRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) { TFnHandleRequest *pfnHandler; - + pfnHandler = apfnPreReqHandler; if (pfnHandler == NULL) { // no pre-handler installed @@ -96,11 +96,11 @@ static BOOL _PreHandleRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) ============== Local function to handle a request by calling one of the installed request handlers. - + In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *ppbData or update the data pointer. - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -111,7 +111,7 @@ static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) { TFnHandleRequest *pfnHandler; int iType; - + iType = REQTYPE_GET_TYPE(pSetup->bmRequestType); pfnHandler = apfnReqHandlers[iType]; if (pfnHandler == NULL) { @@ -210,7 +210,7 @@ void USBHandleControlTransfer(U8 bEP, U8 bEPStat) } } } - else { + else { if (iResidue > 0) { // store data iChunk = 0; @@ -252,7 +252,7 @@ void USBHandleControlTransfer(U8 bEP, U8 bEPStat) USBRegisterPreRequestHandler ============================ Registers a callback for pre-handling requests - + IN *pfnHandler Callback function pointer **************************************************************************/ @@ -266,7 +266,7 @@ void USBRegisterPreRequestHandler(TFnHandleRequest *pfnHandler) USBRegisterRequestHandler ========================= Registers a callback for handling requests - + IN iType Type of request, e.g. REQTYPE_TYPE_STANDARD *pfnHandler Callback function pointer diff --git a/sw/airborne/arch/lpc21/test/bootloader/usbdescrip.c b/sw/airborne/arch/lpc21/test/bootloader/usbdescrip.c index 2ad49e81fe..a66c26be1c 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/usbdescrip.c +++ b/sw/airborne/arch/lpc21/test/bootloader/usbdescrip.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) This library is free software; you can redistribute it and/or @@ -50,7 +50,7 @@ void USBRegisterDescriptors(const U8 *pabDescriptors) =================== Parses a previously installed descriptor block and attempts to find the specified USB descriptor. - + IN wTypeIndex Type and index of the descriptor wLangID Language ID of the descriptor (currently unused) OUT *piLen Descriptor length @@ -62,15 +62,15 @@ BOOL USBHandleDescriptor(U16 wTypeIndex, U16 wLangID, int *piLen, U8 **ppbData) U8 bType, bIndex; U8 *pab; int iCurIndex; - + ASSERT(pabDescrip != NULL); bType = GET_DESC_TYPE(wTypeIndex); bIndex = GET_DESC_INDEX(wTypeIndex); - + pab = (U8 *)pabDescrip; iCurIndex = 0; - + while (pab[0] != 0) { if (pab[1] == bType) { if (iCurIndex == bIndex) { diff --git a/sw/airborne/arch/lpc21/test/bootloader/usbhw_lpc.c b/sw/airborne/arch/lpc21/test/bootloader/usbhw_lpc.c index 07dfb23c98..96edd8e842 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/usbhw_lpc.c +++ b/sw/airborne/arch/lpc21/test/bootloader/usbhw_lpc.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) This library is free software; you can redistribute it and/or @@ -54,8 +54,8 @@ static TFnFrameHandler *_pfnFrameHandler = NULL; Wait4DevInt =========== Local function to wait for a device interrupt (and clear it) - - IN dwIntr Interrupts to wait for + + IN dwIntr Interrupts to wait for **************************************************************************/ static void Wait4DevInt(U32 dwIntr) @@ -69,7 +69,7 @@ static void Wait4DevInt(U32 dwIntr) USBHwCmd ======== Local function to send a command to the USB protocol engine - + IN bCmd Command to send **************************************************************************/ @@ -87,7 +87,7 @@ static void USBHwCmd(U8 bCmd) USBHwCmdWrite ============= Local function to send a command + data to the USB protocol engine - + IN bCmd Command to send bData Data to send @@ -108,7 +108,7 @@ static void USBHwCmdWrite(U8 bCmd, U16 bData) ============ Local function to send a command to the USB protocol engine and read data - + IN bCmd Command to send Returns the data @@ -117,7 +117,7 @@ static U8 USBHwCmdRead(U8 bCmd) { // write command code USBHwCmd(bCmd); - + // get data USBCmdCode = 0x00000200 | (bCmd << 16); Wait4DevInt(CDFULL); @@ -130,11 +130,11 @@ static U8 USBHwCmdRead(U8 bCmd) ============== 'Realizes' an endpoint, meaning that buffer space is reserved for it. An endpoint needs to be realised before it can be used. - + From experiments, it appears that a USB reset causes USBReEP to re-initialise to 3 (= just the control endpoints). However, a USB bus reset does not disturb the USBMaxPSize settings. - + IN bEP Endpoint number **************************************************************************/ @@ -151,7 +151,7 @@ static void USBHwEPRealize(int idx, U16 wMaxPSize) USBHwEPEnable ============= Enables or disables an endpoint - + IN bEP Endpoint number fEnable TRUE to enable, FALSE to disable @@ -166,7 +166,7 @@ static void USBHwEPEnable(int idx, BOOL fEnable) USBHwRegisterEPIntHandler ========================= Registers an endpoint event callback - + IN bEP Endpoint number wMaxPacketSize Maximum packet size for this endpoint pfnHandler Callback function @@ -175,18 +175,18 @@ static void USBHwEPEnable(int idx, BOOL fEnable) void USBHwRegisterEPIntHandler(U8 bEP, U16 wMaxPacketSize, TFnEPIntHandler *pfnHandler) { int idx; - + idx = EP2IDX(bEP); ASSERT(idx<32); /* add handler to list of EP handlers */ _apfnEPIntHandlers[idx / 2] = pfnHandler; - + /* enable EP interrupt*/ USBEpIntEn |= (1 << idx); USBDevIntEn |= EP_SLOW; - + // realise endpoint USBHwEPRealize(idx, wMaxPacketSize); @@ -198,14 +198,14 @@ void USBHwRegisterEPIntHandler(U8 bEP, U16 wMaxPacketSize, TFnEPIntHandler *pfnH USBHwRegisterDevIntHandler ========================== Registers an device status callback - + IN pfnHandler Callback function **************************************************************************/ void USBHwRegisterDevIntHandler(TFnDevIntHandler *pfnHandler) { _pfnDevIntHandler = pfnHandler; - + // enable device interrupt USBDevIntEn |= DEV_STAT; @@ -217,14 +217,14 @@ void USBHwRegisterDevIntHandler(TFnDevIntHandler *pfnHandler) USBHwRegisterFrameHandler ========================= Registers the frame callback - + IN pfnHandler Callback function **************************************************************************/ void USBHwRegisterFrameHandler(TFnFrameHandler *pfnHandler) { _pfnFrameHandler = pfnHandler; - + // enable device interrupt USBDevIntEn |= FRAME; @@ -236,7 +236,7 @@ void USBHwRegisterFrameHandler(TFnFrameHandler *pfnHandler) USBHwSetAddress =============== Sets the USB address. - + IN bAddr Device address to set **************************************************************************/ @@ -261,10 +261,10 @@ void USBHwConnect(BOOL fConnect) USBHwGetEPStall ============ Gets the stalled property of an endpoint - + IN bEP Endpoint number - - Returns TRUE if stalled, FALSE if unstalled + + Returns TRUE if stalled, FALSE if unstalled **************************************************************************/ BOOL USBHwGetEPStall(U8 bEP) { @@ -278,10 +278,10 @@ BOOL USBHwGetEPStall(U8 bEP) USBHwEPStall ============ Sets the stalled property of an endpoint - + IN bEP Endpoint number fStall TRUE to stall, FALSE to unstall - + **************************************************************************/ void USBHwEPStall(U8 bEP, BOOL fStall) { @@ -295,28 +295,28 @@ void USBHwEPStall(U8 bEP, BOOL fStall) USBHwEPWrite ============ Writes data to an endpoint buffer - + IN bEP Endpoint number pbBuf Endpoint data iLen Number of bytes to write - + Returns TRUE if the data was successfully written **************************************************************************/ BOOL USBHwEPWrite(U8 bEP, U8 *pbBuf, int iLen) { int idx; - + idx = EP2IDX(bEP); - + // DBG("<%d", iLen); DBG("<"); // set write enable for specific endpoint USBCtrl = WR_EN | ((bEP & 0xF) << 2); - + // set packet length USBTxPLen = iLen; - + // write data while (USBCtrl & WR_EN) { USBTxData = (pbBuf[3] << 24) | (pbBuf[2] << 16) | (pbBuf[1] << 8) | pbBuf[0]; @@ -326,7 +326,7 @@ BOOL USBHwEPWrite(U8 bEP, U8 *pbBuf, int iLen) // select endpoint and validate buffer USBHwCmd(CMD_EP_SELECT | idx); USBHwCmd(CMD_EP_VALIDATE_BUFFER); - + return TRUE; } @@ -335,37 +335,37 @@ BOOL USBHwEPWrite(U8 bEP, U8 *pbBuf, int iLen) USBHwEPRead ============ Reads data from an endpoint buffer - + IN bEP Endpoint number pbBuf Endpoint data iLen Number of bytes to write - + Returns TRUE if the data was successfully read **************************************************************************/ BOOL USBHwEPRead(U8 bEP, U8 *pbBuf, int *piLen) { int idx; U32 dwData, dwLen; - + idx = EP2IDX(bEP); - + // set read enable bit for specific endpoint USBCtrl = RD_EN | ((bEP & 0xF) << 2); - + // wait for PKT_RDY do { dwLen = USBRxPLen; } while ((dwLen & PKT_RDY) == 0); - + // packet valid? if ((dwLen & DV) == 0) { *piLen = 0; return FALSE; } - + // get length dwLen &= PKT_LNGTH_MASK; - + // get data in 4-byte units while (USBCtrl & RD_EN) { dwData = USBRxData; @@ -380,7 +380,7 @@ BOOL USBHwEPRead(U8 bEP, U8 *pbBuf, int *piLen) // select endpoint and clear buffer USBHwCmd(CMD_EP_SELECT | idx); USBHwCmd(CMD_EP_CLEAR_BUFFER); - + *piLen = dwLen; // DBG(">%d", dwLen); @@ -394,10 +394,10 @@ BOOL USBHwEPRead(U8 bEP, U8 *pbBuf, int *piLen) USBHwConfigDevice ================= Sets the 'configured' state. - + All registered endpoints are 'realised' and enabled, and the 'configured' bit is set in the device status register. - + IN fConfigure If TRUE, configure device, else unconfigure **************************************************************************/ @@ -424,10 +424,10 @@ void USBHwConfigDevice(BOOL fConfigured) USBHwISR ======== USB interrupt handler - + Interrupt mapping: * endpoint interrupts are mapped to the slow interrupt - + TODO: should we cause interrupt on NAK? **************************************************************************/ @@ -437,12 +437,12 @@ void USBHwISR(void) U32 dwIntBit; U8 bEPStat, bDevStat, bStat; int i; - + dwStatus = USBDevIntSt; // handle device dwStatus interrupts if (dwStatus & DEV_STAT) { -DEBUG_LED_ON(8); +DEBUG_LED_ON(8); bDevStat = USBHwCmdRead(CMD_DEV_STATUS); if (bDevStat & (CON_CH | SUS_CH | RST)) { // convert device status into something HW independent @@ -456,12 +456,12 @@ DEBUG_LED_ON(8); } // clear DEV_STAT; USBDevIntClr = DEV_STAT; -DEBUG_LED_OFF(8); +DEBUG_LED_OFF(8); } - + // check endpoint interrupts if (dwStatus & EP_SLOW) { -DEBUG_LED_ON(9); +DEBUG_LED_ON(9); dwEPIntStat = USBEpIntSt; for (i = 0; i < 32; i++) { dwIntBit = (1 << i); @@ -486,7 +486,7 @@ DEBUG_LED_ON(9); USBDevIntClr = EP_SLOW; DEBUG_LED_OFF(9); } - + // handle frame interrupt if (dwStatus & FRAME) { DEBUG_LED_ON(10); @@ -505,15 +505,15 @@ DEBUG_LED_OFF(10); USBHwInit ========= Initialises the USB hardware - + This function assumes that the hardware is connected as shown in section 10.1 of the LPC2148 data sheet: * P0.31 controls a switch to connect a 1.5k pull-up to D+ if low. * P0.23 is connected to USB VCC. - + Embedded artists board: make sure to disconnect P0.23 LED as it acts as a pull-up and so prevents detection of USB disconnect. - + Returns TRUE if the hardware was successfully initialised **************************************************************************/ BOOL USBHwInit(void) @@ -545,7 +545,7 @@ BOOL USBHwInit(void) PINSEL1 = (PINSEL1 & ~(3 << 30)) | (2 << 30); // P0.31 // enable PUSB - PCONP |= (1 << 31); + PCONP |= (1 << 31); // initialise USB PLL PLL1CON = 1; // enable USB PLL @@ -571,7 +571,7 @@ BOOL USBHwInit(void) // enable/clear control endpoints USBHwEPEnable(0, TRUE); USBHwEPEnable(1, TRUE); - + // init debug leds DEBUG_LED_INIT(8); DEBUG_LED_INIT(9); diff --git a/sw/airborne/arch/lpc21/test/bootloader/usbinit.c b/sw/airborne/arch/lpc21/test/bootloader/usbinit.c index 323c9d0ea5..036385a05c 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/usbinit.c +++ b/sw/airborne/arch/lpc21/test/bootloader/usbinit.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) This library is free software; you can redistribute it and/or @@ -40,20 +40,20 @@ static void HandleUsbReset(U8 bDevStatus) ======= Initialises the USB hardware and sets up the USB stack by installing default callbacks. - + **************************************************************************/ BOOL USBInit(void) { // init hardware USBHwInit(); - + // register bus reset handler USBHwRegisterDevIntHandler(HandleUsbReset); - + // register control transfer handler on EP0 USBHwRegisterEPIntHandler(0x00, MAX_PACKET_SIZE0, USBHandleControlTransfer); USBHwRegisterEPIntHandler(0x80, MAX_PACKET_SIZE0, USBHandleControlTransfer); - + // register standard request handler USBRegisterRequestHandler(REQTYPE_TYPE_STANDARD, USBHandleStandardRequest); diff --git a/sw/airborne/arch/lpc21/test/bootloader/usbstdreq.c b/sw/airborne/arch/lpc21/test/bootloader/usbstdreq.c index d58ea9feda..60d7d58812 100644 --- a/sw/airborne/arch/lpc21/test/bootloader/usbstdreq.c +++ b/sw/airborne/arch/lpc21/test/bootloader/usbstdreq.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) This library is free software; you can redistribute it and/or @@ -19,11 +19,11 @@ /* Standard request handler. - + This modules handles the 'chapter 9' processing, specifically the standard device requests in table 9-3 from the universal serial bus specification revision 2.0 - + Specific types of devices may specify additional requests (for example HID devices add a GET_DESCRIPTOR request for interfaces), but they will not be part of this module. @@ -32,7 +32,7 @@ // TODO some requests have to return a request error if device not configured: // TODO GET_INTERFACE, GET_STATUS, SET_INTERFACE, SYNCH_FRAME // TODO this applies to the following if endpoint != 0: -// TODO SET_FEATURE, GET_FEATURE +// TODO SET_FEATURE, GET_FEATURE #include "type.h" #include "usbdebug.h" @@ -49,7 +49,7 @@ static TFnGetDescriptor *pfnGetDescriptor = NULL; HandleStdDeviceReq ================== Local function to handle a standard device request - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -61,7 +61,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) U8 *pbData = *ppbData; switch (pSetup->bRequest) { - + case REQ_GET_STATUS: // bit 0: self-powered // bit 1: remote wakeup @@ -69,7 +69,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) pbData[1] = 0; *piLen = 2; break; - + case REQ_SET_ADDRESS: USBHwSetAddress(pSetup->wValue); break; @@ -110,7 +110,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) DBG("Illegal device req %d\n", pSetup->bRequest); return FALSE; } - + return TRUE; } @@ -119,7 +119,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) HandleStdInterfaceReq ===================== Local function to handle a standard interface request - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -143,13 +143,13 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData case REQ_SET_FEATURE: // not defined for interface return FALSE; - + case REQ_GET_INTERFACE: // TODO use bNumInterfaces // there is only one interface, return n-1 (= 0) pbData[0] = 0; *piLen = 1; break; - + case REQ_SET_INTERFACE: // TODO use bNumInterfaces // there is only one interface (= 0) if (pSetup->wValue == 0) { @@ -173,7 +173,7 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData HandleStdEndPointReq ==================== Local function to handle a standard endpoint request - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -191,7 +191,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) pbData[1] = 0; *piLen = 2; break; - + case REQ_CLEAR_FEATURE: if (pSetup->wValue == FEA_ENDPOINT_HALT) { // clear HALT by unstalling @@ -200,7 +200,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) } // only ENDPOINT_HALT defined for endpoints return FALSE; - + case REQ_SET_FEATURE: if (pSetup->wValue == FEA_ENDPOINT_HALT) { // set HALT by stalling @@ -218,7 +218,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) DBG("Illegal EP req %d\n", pSetup->bRequest); return FALSE; } - + return TRUE; } @@ -227,7 +227,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, U8 **ppbData) USBHandleStandardRequest =================== Local function to handle a standard request - + IN pSetup The setup packet IN/OUT *piLen Pointer to data length ppbData Data buffer. @@ -249,7 +249,7 @@ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) USBRegisterDescriptorHandler ========================= Registers a callback for handling descriptors - + IN pfnGetDesc Callback function pointer **************************************************************************/ diff --git a/sw/airborne/arch/lpc21/test/dev_board.h b/sw/airborne/arch/lpc21/test/dev_board.h index 2eb2502592..e7d342af0b 100644 --- a/sw/airborne/arch/lpc21/test/dev_board.h +++ b/sw/airborne/arch/lpc21/test/dev_board.h @@ -8,28 +8,28 @@ #if 1 // DEV_BOARD_TYPE // OLIMEX - + // LEDs on P0.12/P0.13 (active low) #define LED1PIN 12 #define LED2PIN 13 // define LED-Pins as outputs #define LED_INIT() { IODIR0 |= (1<> 8) & 0xFF; U0LCR &= ~0x80; - + PINSEL0 = PINSEL0 & ~0xF | 0x5; } diff --git a/sw/airborne/arch/lpc21/uart_hw.c b/sw/airborne/arch/lpc21/uart_hw.c index 2616a5c6a7..722dbf411e 100644 --- a/sw/airborne/arch/lpc21/uart_hw.c +++ b/sw/airborne/arch/lpc21/uart_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -62,12 +62,12 @@ void uart0_init_param( uint16_t baud, uint8_t mode, uint8_t fmode) { U0IIR; // clear interrupt ID U0RBR; // clear receive register U0LSR; // clear line status register - + // set the baudrate - U0LCR = ULCR_DLAB_ENABLE; // select divisor latches + U0LCR = ULCR_DLAB_ENABLE; // select divisor latches U0DLL = (uint8_t)baud; // set for baud low byte U0DLM = (uint8_t)(baud >> 8); // set for baud high byte - + // set the number of characters and other // user specified operating parameters U0LCR = (mode & ~ULCR_DLAB_ENABLE); @@ -96,7 +96,7 @@ bool_t uart0_check_free_space( uint8_t len) { int16_t space = uart0_tx_extract_idx - uart0_tx_insert_idx; if (space <= 0) space += UART0_TX_BUFFER_SIZE; - + return (uint16_t)(space - 1) >= len; } @@ -234,7 +234,7 @@ bool_t uart1_check_free_space( uint8_t len) { int16_t space = uart1_tx_extract_idx - uart1_tx_insert_idx; if (space <= 0) space += UART1_TX_BUFFER_SIZE; - + return (uint16_t)(space - 1) >= len; } @@ -252,12 +252,12 @@ void uart1_init_param( uint16_t baud, uint8_t mode, uint8_t fmode) { U1IIR; // clear interrupt ID U1RBR; // clear receive register U1LSR; // clear line status register - + // set the baudrate - U1LCR = ULCR_DLAB_ENABLE; // select divisor latches + U1LCR = ULCR_DLAB_ENABLE; // select divisor latches U1DLL = (uint8_t)baud; // set for baud low byte U1DLM = (uint8_t)(baud >> 8); // set for baud high byte - + // set the number of characters and other // user specified operating parameters U1LCR = (mode & ~ULCR_DLAB_ENABLE); diff --git a/sw/airborne/arch/lpc21/uart_hw.h b/sw/airborne/arch/lpc21/uart_hw.h index 0721263af4..06ac5ff7f0 100644 --- a/sw/airborne/arch/lpc21/uart_hw.h +++ b/sw/airborne/arch/lpc21/uart_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/lpc21/uart_tunnel.c b/sw/airborne/arch/lpc21/uart_tunnel.c index f4b97a5966..04fd72dce1 100644 --- a/sw/airborne/arch/lpc21/uart_tunnel.c +++ b/sw/airborne/arch/lpc21/uart_tunnel.c @@ -30,7 +30,7 @@ int main (int argc, char** argv) { while(1) { tx = bit_is_set(IO0PIN, RXD0_PIN); if (tx != tx_shadow) { - if (tx) { + if (tx) { SetBit(IO0SET, TXD1_PIN); } else { SetBit(IO0CLR, TXD1_PIN); diff --git a/sw/airborne/arch/lpc21/usb_msc_hw.c b/sw/airborne/arch/lpc21/usb_msc_hw.c index 041f52f77e..c0e67168d1 100644 --- a/sw/airborne/arch/lpc21/usb_msc_hw.c +++ b/sw/airborne/arch/lpc21/usb_msc_hw.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) adapted to pprz Martin Mueller (martinmm@pfump.org) @@ -17,7 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -26,12 +26,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* Connects a microSD card to the SPI port of the Paparazzi Tiny. Keep cables short, microSD card can be directly soldered to Molex cable. For now only non SDHC SD cards (<= 2GB) are supported. martinmm@pfump.org - microSD TinyV2 SPI J3 + microSD TinyV2 SPI J3 8 nc 7 DO 5 MISO 6 GND 1 GND @@ -44,7 +44,7 @@ Looking onto the gold plated connector side of the microSD card: --------------- - I 8 + I 8 I 7 I 6 I 5 @@ -83,9 +83,9 @@ static U8 abClassReqData[4]; static const U8 abDescriptors[] = { -// device descriptor +// device descriptor 0x12, - DESC_DEVICE, + DESC_DEVICE, LE_WORD(0x0200), // bcdUSB 0x00, // bDeviceClass 0x00, // bDeviceSubClass @@ -161,7 +161,7 @@ static const U8 abDescriptors[] = { HandleClassRequest ================== Handle mass storage class request - + **************************************************************************/ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) { @@ -187,7 +187,7 @@ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) } MSCBotReset(); break; - + default: return FALSE; } @@ -204,14 +204,14 @@ int main_mass_storage(void) unsigned cpsr; // disable global interrupts, do it polling - cpsr = disableIRQ(); + cpsr = disableIRQ(); // initialise the SD card BlockDevInit(); // initialise stack USBInit(); - + // enable bulk-in interrupts on NAKs // these are required to get the BOT protocol going again after a STALL USBHwNakIntEnable(INACK_BI); @@ -221,7 +221,7 @@ int main_mass_storage(void) // register class request handler USBRegisterRequestHandler(REQTYPE_TYPE_CLASS, HandleClassRequest, abClassReqData); - + // register endpoint handlers USBHwRegisterEPIntHandler(MSC_BULK_IN_EP, MSCBotBulkIn); USBHwRegisterEPIntHandler(MSC_BULK_OUT_EP, MSCBotBulkOut); @@ -233,10 +233,10 @@ int main_mass_storage(void) while (1) { USBHwISR(); } - + // possibly restore global interrupts (never happens) - restoreIRQ(cpsr); - + restoreIRQ(cpsr); + return 0; } diff --git a/sw/airborne/arch/lpc21/usb_msc_hw.h b/sw/airborne/arch/lpc21/usb_msc_hw.h index 8848aa6d2f..76f92d82dc 100644 --- a/sw/airborne/arch/lpc21/usb_msc_hw.h +++ b/sw/airborne/arch/lpc21/usb_msc_hw.h @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) adapted to pprz Martin Mueller (martinmm@pfump.org) @@ -17,7 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY diff --git a/sw/airborne/arch/lpc21/usb_ser_hw.c b/sw/airborne/arch/lpc21/usb_ser_hw.c index c2894cdb76..d372aec8a0 100644 --- a/sw/airborne/arch/lpc21/usb_ser_hw.c +++ b/sw/airborne/arch/lpc21/usb_ser_hw.c @@ -1,5 +1,5 @@ /* - LPCUSB, an USB device driver for LPC microcontrollers + LPCUSB, an USB device driver for LPC microcontrollers Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) adapted to pprz Martin Mueller (martinmm@pfump.org) @@ -17,7 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -81,7 +81,7 @@ #define VCOM_FIFO_SIZE 128 #define EOF (-1) -#define ASSERT(x) +#define ASSERT(x) typedef struct { int head; @@ -216,7 +216,7 @@ static const uint8_t abDescriptors[] = { 0x02, // bmAttributes = bulk LE_WORD(MAX_PACKET_SIZE), // wMaxPacketSize 0x00, // bInterval - + // string descriptors 0x04, DESC_STRING, @@ -251,31 +251,31 @@ void fifo_init(fifo_t *fifo, U8 *buf) BOOL fifo_put(fifo_t *fifo, U8 c) { int next; - + // check if FIFO has room next = (fifo->head + 1) % VCOM_FIFO_SIZE; if (next == fifo->tail) { // full return FALSE; } - + fifo->buf[fifo->head] = c; fifo->head = next; - + return TRUE; } BOOL fifo_get(fifo_t *fifo, U8 *pc) { int next; - + // check if FIFO has data if (fifo->head == fifo->tail) { return FALSE; } - + next = (fifo->tail + 1) % VCOM_FIFO_SIZE; - + *pc = fifo->buf[fifo->tail]; fifo->tail = next; @@ -297,10 +297,10 @@ void set_linecoding(TLineCoding linecoding) { uint16_t baud; uint8_t mode; - + // set the baudrate baud = (uint16_t)((PCLK / ((linecoding.dwDTERate) * 16.0)) + 0.5); - + // set the number of characters and other // user specified operating parameters switch (linecoding.bCharFormat) @@ -341,25 +341,25 @@ void set_linecoding(TLineCoding linecoding) break; case 8: mode += ULCR_CHAR_8; break; - case 16: + case 16: default: mode += ULCR_CHAR_8; break; } - + #ifdef USE_UART0 - U0LCR = ULCR_DLAB_ENABLE; // select divisor latches + U0LCR = ULCR_DLAB_ENABLE; // select divisor latches U0DLL = (uint8_t)baud; // set for baud low byte U0DLM = (uint8_t)(baud >> 8); // set for baud high byte U0LCR = (mode & ~ULCR_DLAB_ENABLE); #endif #ifdef USE_UART1 - U1LCR = ULCR_DLAB_ENABLE; // select divisor latches + U1LCR = ULCR_DLAB_ENABLE; // select divisor latches U1DLL = (uint8_t)baud; // set for baud low byte U1DLM = (uint8_t)(baud >> 8); // set for baud high byte U1LCR = (mode & ~ULCR_DLAB_ENABLE); #endif } -#endif +#endif #ifdef USE_USB_LINE_CODING void VCOM_allow_linecoding(uint8_t mode) @@ -370,7 +370,7 @@ void VCOM_allow_linecoding(uint8_t mode) /** Writes one character to VCOM port - + @param [in] c character to write @returns character written, or EOF if character could not be written */ @@ -381,16 +381,16 @@ int VCOM_putchar(int c) /** Reads one character from VCOM port - + @returns character read, or EOF if character could not be read */ int VCOM_getchar(void) { int result; U8 c; - + result = fifo_get(&rxfifo, &c) ? c : EOF; - + if (BulkOut_is_blocked && fifo_free(&rxfifo) >= MAX_PACKET_SIZE) { disableIRQ(); // get more data from usb bus @@ -404,7 +404,7 @@ int VCOM_getchar(void) /** Checks if buffer free in VCOM buffer - + @returns TRUE if len bytes are free */ bool_t VCOM_check_free_space(uint8_t len) @@ -415,7 +415,7 @@ bool_t VCOM_check_free_space(uint8_t len) /** Checks if data available in VCOM buffer - + @returns character read, or EOF if character could not be read */ int VCOM_check_available(void) @@ -426,7 +426,7 @@ int VCOM_check_available(void) /** Local function to handle incoming bulk data - + @param [in] bEP @param [in] bEPStatus */ @@ -455,7 +455,7 @@ static void BulkOut(U8 bEP, U8 bEPStatus) /** Local function to handle outgoing bulk data - + @param [in] bEP @param [in] bEPStatus */ @@ -476,7 +476,7 @@ static void BulkIn(U8 bEP, U8 bEPStatus) } } iLen = i; - + // send over USB if (iLen > 0) { USBHwEPWrite(bEP, abBulkBuf, iLen); @@ -486,7 +486,7 @@ static void BulkIn(U8 bEP, U8 bEPStatus) /** Local function to handle the USB-CDC class requests - + @param [in] pSetup @param [out] piLen @param [out] ppbData @@ -504,7 +504,7 @@ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) { set_linecoding(LineCoding); } -#endif +#endif break; // get line coding @@ -527,13 +527,13 @@ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData) /** Interrupt handler - + Simply calls the USB ISR, then signals end of interrupt to VIC */ static void USBIntHandler(void) { USBHwISR(); - VICVectAddr = 0x00; // dummy write to VIC to signal end of ISR + VICVectAddr = 0x00; // dummy write to VIC to signal end of ISR } @@ -552,7 +552,7 @@ void VCOM_init(void) { #ifdef USE_USB_LINE_CODING // set default line coding set_linecoding(LineCoding); -#endif +#endif // register descriptors USBRegisterDescriptors(abDescriptors); @@ -564,7 +564,7 @@ void VCOM_init(void) { USBHwRegisterEPIntHandler(INT_IN_EP, NULL); USBHwRegisterEPIntHandler(BULK_IN_EP, BulkIn); USBHwRegisterEPIntHandler(BULK_OUT_EP, BulkOut); - + // register frame handler USBHwRegisterFrameHandler(USBFrameHandler); @@ -581,7 +581,7 @@ void VCOM_init(void) { VICVectCntl10 = VIC_ENABLE | VIC_USB; VICVectAddr10 = (uint32_t)USBIntHandler; - + // connect to bus USBHwConnect(TRUE); } diff --git a/sw/airborne/arch/lpc21/usb_tunnel.c b/sw/airborne/arch/lpc21/usb_tunnel.c index b3c63d05d8..869caeabd3 100644 --- a/sw/airborne/arch/lpc21/usb_tunnel.c +++ b/sw/airborne/arch/lpc21/usb_tunnel.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Martin Mueller * * This file is part of paparazzi. @@ -18,14 +18,14 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file usb_tunnel.c * \brief USB tunnel application * - * This creates a USB serial port that connects to UART0 or UART1 + * This creates a USB serial port that connects to UART0 or UART1 * port of the LPC processor. This enables you to configure the gps * receiver or the modem without removing it. */ @@ -42,10 +42,10 @@ /* minimum LED blink on time 10Hz = 100ms */ #define BLINK_MIN 10 -int main( void ) { +int main( void ) { unsigned char inc; unsigned int rx_time=0, tx_time=0; - + hw_init(); sys_time_init(); led_init(); @@ -60,11 +60,11 @@ int main( void ) { #error no serial port defined #endif #endif - + #ifdef USE_USB_SERIAL VCOM_init(); #endif - + int_enable(); LED_ON(3); @@ -104,7 +104,7 @@ int main( void ) { } } #endif - + return 0; } diff --git a/sw/airborne/arch/sim/baro_MS5534A.h b/sw/airborne/arch/sim/baro_MS5534A.h index df9bdb470d..e2330decda 100644 --- a/sw/airborne/arch/sim/baro_MS5534A.h +++ b/sw/airborne/arch/sim/baro_MS5534A.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/ivy_transport.h b/sw/airborne/arch/sim/ivy_transport.h index e80ace7e73..1926187d9e 100644 --- a/sw/airborne/arch/sim/ivy_transport.h +++ b/sw/airborne/arch/sim/ivy_transport.h @@ -45,4 +45,4 @@ extern char* ivy_p; #define IvyTransportPutUint16Array(_n, _x) IvyTransportPutArray(IvyTransportPutUintByAddr, _n, _x) #define IvyTransportPutUint32Array(_n, _x) IvyTransportPutArray(IvyTransportPutUintByAddr, _n, _x) #define IvyTransportPutFloatArray(_n, _x) IvyTransportPutArray(IvyTransportPutOneFloatByAddr, _n, _x) -#define IvyTransportPutDoubleArray(_n, _x) IvyTransportPutFloatArray(_n, _x) +#define IvyTransportPutDoubleArray(_n, _x) IvyTransportPutFloatArray(_n, _x) diff --git a/sw/airborne/arch/sim/jsbsim_gps.c b/sw/airborne/arch/sim/jsbsim_gps.c index 60bcdb658f..9c857588db 100644 --- a/sw/airborne/arch/sim/jsbsim_gps.c +++ b/sw/airborne/arch/sim/jsbsim_gps.c @@ -32,7 +32,7 @@ uint16_t gps_reset; void sim_use_gps_pos(double lat, double lon, double alt, double course, double gspeed, double climb, double time) { - + gps_mode = 3; // Mode 3D gps_course = DegOfRad(course) * 10.; gps_alt = alt * 100.; @@ -67,7 +67,7 @@ void sim_update_sv(void) { } gps_PDOP = gps_Sacc = gps_Pacc = 500+200*sin(time/100.); gps_numSV = 7; - + gps_verbose_downlink = !launch; UseGpsPosNoSend(estimator_update_state_gps); gps_downlink(); diff --git a/sw/airborne/arch/sim/jsbsim_ir.c b/sw/airborne/arch/sim/jsbsim_ir.c index 579caf645c..cfa02235ab 100644 --- a/sw/airborne/arch/sim/jsbsim_ir.c +++ b/sw/airborne/arch/sim/jsbsim_ir.c @@ -1,4 +1,4 @@ -/** +/** * \brief Regroup functions to simulate autopilot/infrared.c * * Infrared soft simulation. diff --git a/sw/airborne/arch/sim/led_hw.h b/sw/airborne/arch/sim/led_hw.h index e29c532247..58411afdff 100644 --- a/sw/airborne/arch/sim/led_hw.h +++ b/sw/airborne/arch/sim/led_hw.h @@ -9,4 +9,4 @@ extern value * leds_closure; #define LED_ON(i) { if (leds_closure) callback2(*leds_closure, Val_int(i), Val_int(1)); } #define LED_OFF(i) { if (leds_closure) callback2(*leds_closure, Val_int(i), Val_int(0)); } #define LED_TOGGLE(i) { if (leds_closure) callback2(*leds_closure, Val_int(i), Val_int(2)); } - + diff --git a/sw/airborne/arch/sim/max1167_hw.c b/sw/airborne/arch/sim/max1167_hw.c index 5f96aa3d00..9ad0832ed9 100644 --- a/sw/airborne/arch/sim/max1167_hw.c +++ b/sw/airborne/arch/sim/max1167_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/max1167_hw.h b/sw/airborne/arch/sim/max1167_hw.h index 886b13eb36..809e0b7f66 100644 --- a/sw/airborne/arch/sim/max1167_hw.h +++ b/sw/airborne/arch/sim/max1167_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/micromag_hw.c b/sw/airborne/arch/sim/micromag_hw.c index e264ac4f9f..bb867b7156 100644 --- a/sw/airborne/arch/sim/micromag_hw.c +++ b/sw/airborne/arch/sim/micromag_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/micromag_hw.h b/sw/airborne/arch/sim/micromag_hw.h index 736e25110e..a24a5992f3 100644 --- a/sw/airborne/arch/sim/micromag_hw.h +++ b/sw/airborne/arch/sim/micromag_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/modules/core/trigger_ext_hw.c b/sw/airborne/arch/sim/modules/core/trigger_ext_hw.c index 2fde62dbdb..2e4c8ebee5 100644 --- a/sw/airborne/arch/sim/modules/core/trigger_ext_hw.c +++ b/sw/airborne/arch/sim/modules/core/trigger_ext_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/modules/core/trigger_ext_hw.h b/sw/airborne/arch/sim/modules/core/trigger_ext_hw.h index eea57822b0..eb80e59dbd 100644 --- a/sw/airborne/arch/sim/modules/core/trigger_ext_hw.h +++ b/sw/airborne/arch/sim/modules/core/trigger_ext_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/arch/sim/modules/enose/sim_enose.c b/sw/airborne/arch/sim/modules/enose/sim_enose.c index 0a1f6b030d..c3e7802128 100644 --- a/sw/airborne/arch/sim/modules/enose/sim_enose.c +++ b/sw/airborne/arch/sim/modules/enose/sim_enose.c @@ -10,11 +10,11 @@ uint16_t min_val[ENOSE_NB_SENSOR] = {1100, 1200, 2500}; void enose_init( void ) { int i; - for(i = 0; i < ENOSE_NB_SENSOR; i++) + for(i = 0; i < ENOSE_NB_SENSOR; i++) enose_val[i] = nominal_val[i]; } void enose_set_heat(uint8_t no_sensor, uint8_t value) { } -void enose_periodic( void ) { +void enose_periodic( void ) { int i; for(i = 0; i < ENOSE_NB_SENSOR; i++) { if (enose_val[i] < min_val[i]) diff --git a/sw/airborne/arch/sim/sim_ap.c b/sw/airborne/arch/sim/sim_ap.c index 79d00ec62b..40321954f7 100644 --- a/sw/airborne/arch/sim/sim_ap.c +++ b/sw/airborne/arch/sim/sim_ap.c @@ -80,7 +80,7 @@ value sim_init(value unit) { perror("make pipe"); exit (10); } - } + } if ( !(pipe_stream = fopen(link_pipe_name, "w")) ) { perror("open pipe"); exit (10); @@ -91,7 +91,7 @@ value sim_init(value unit) { } value update_bat(value bat) { - fbw_vsupply_decivolt = Int_val(bat); + fbw_vsupply_decivolt = Int_val(bat); return Val_unit; } @@ -111,7 +111,7 @@ value set_datalink_message(value s) { assert(n <= MSG_SIZE); int i; - for(i = 0; i < n; i++) + for(i = 0; i < n; i++) dl_buffer[i] = ss[i]; dl_parse_msg(); diff --git a/sw/airborne/arch/sim/sim_gps.c b/sw/airborne/arch/sim/sim_gps.c index 0887176e2d..ed1fd2ed5e 100644 --- a/sw/airborne/arch/sim/sim_gps.c +++ b/sw/airborne/arch/sim/sim_gps.c @@ -73,7 +73,7 @@ value sim_use_gps_pos(value x, value y, value z, value c, value a, value s, valu } gps_PDOP = gps_Sacc = gps_Pacc = 500+200*sin(time/100.); gps_numSV = 7; - + gps_verbose_downlink = !launch; UseGpsPosNoSend(estimator_update_state_gps); gps_downlink(); diff --git a/sw/airborne/arch/stm32/i2c_hw.h b/sw/airborne/arch/stm32/i2c_hw.h index a8603d2f60..2d41241471 100644 --- a/sw/airborne/arch/stm32/i2c_hw.h +++ b/sw/airborne/arch/stm32/i2c_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* diff --git a/sw/airborne/arch/stm32/interrupt_hw.h b/sw/airborne/arch/stm32/interrupt_hw.h index f34ad28bfc..04e70375fe 100644 --- a/sw/airborne/arch/stm32/interrupt_hw.h +++ b/sw/airborne/arch/stm32/interrupt_hw.h @@ -1,6 +1,6 @@ /* * $Id: interrupt_hw.h 859 2006-05-03 21:32:23Z poine $ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file interrupt_hw.h diff --git a/sw/airborne/arch/stm32/link_mcu_hw.h b/sw/airborne/arch/stm32/link_mcu_hw.h index eb1d0bf0ab..2a997b361c 100644 --- a/sw/airborne/arch/stm32/link_mcu_hw.h +++ b/sw/airborne/arch/stm32/link_mcu_hw.h @@ -17,26 +17,26 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \brief handling of arm7 inter mcu link - * + * */ #ifndef LINK_MCU_HW_H #define LINK_MCU_HW_H -#define CRC_INIT 0x0 -#define CrcLow(x) ((x)&0xff) -#define CrcHigh(x) ((x)>>8) +#define CRC_INIT 0x0 +#define CrcLow(x) ((x)&0xff) +#define CrcHigh(x) ((x)>>8) -static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) { - uint8_t a = ((uint8_t)CrcHigh(crc)) + data; - uint8_t b = ((uint8_t)CrcLow(crc)) + a; - crc = b | a << 8; - return crc; +static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) { + uint8_t a = ((uint8_t)CrcHigh(crc)) + data; + uint8_t b = ((uint8_t)CrcLow(crc)) + a; + crc = b | a << 8; + return crc; } #endif /* LINK_MCU_HW_H */ diff --git a/sw/airborne/arch/stm32/stm32_exceptions.c b/sw/airborne/arch/stm32/stm32_exceptions.c index a563a741a9..7b22a2f505 100644 --- a/sw/airborne/arch/stm32/stm32_exceptions.c +++ b/sw/airborne/arch/stm32/stm32_exceptions.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of Paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "stm32_exceptions.h" diff --git a/sw/airborne/arch/stm32/stm32_exceptions.h b/sw/airborne/arch/stm32/stm32_exceptions.h index fbd1e9c6c3..9d9be8f518 100644 --- a/sw/airborne/arch/stm32/stm32_exceptions.h +++ b/sw/airborne/arch/stm32/stm32_exceptions.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of Paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ diff --git a/sw/airborne/arch/stm32/stm32_vector_table.c b/sw/airborne/arch/stm32/stm32_vector_table.c index edc3677e0a..40b187d87f 100644 --- a/sw/airborne/arch/stm32/stm32_vector_table.c +++ b/sw/airborne/arch/stm32/stm32_vector_table.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of Paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "stm32_vector_table.h" @@ -310,7 +310,7 @@ void null_handler(void){ } /* FIXME: look deeper into what that is doing - * + * */ void assert_param(void); diff --git a/sw/airborne/arch/stm32/stm32_vector_table.h b/sw/airborne/arch/stm32/stm32_vector_table.h index 4214456815..8287ae74ca 100644 --- a/sw/airborne/arch/stm32/stm32_vector_table.h +++ b/sw/airborne/arch/stm32/stm32_vector_table.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of Paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef STM32_VECTOR_TABLE_H diff --git a/sw/airborne/arch/stm32/sys_time_hw.h b/sw/airborne/arch/stm32/sys_time_hw.h index 26fd8de2ba..34971db123 100644 --- a/sw/airborne/arch/stm32/sys_time_hw.h +++ b/sw/airborne/arch/stm32/sys_time_hw.h @@ -23,7 +23,7 @@ */ /* - *\brief STM32 timing functions + *\brief STM32 timing functions * */ @@ -39,7 +39,7 @@ #include "led.h" #endif -#define InitSysTimePeriodic() +#define InitSysTimePeriodic() extern void sys_time_init( void ); extern void sys_tick_irq_handler(void); diff --git a/sw/airborne/arch/stm32/uart_hw.c b/sw/airborne/arch/stm32/uart_hw.c index aa03768084..f1c1fd4743 100644 --- a/sw/airborne/arch/stm32/uart_hw.c +++ b/sw/airborne/arch/stm32/uart_hw.c @@ -29,7 +29,7 @@ #include #include "std.h" -#ifdef USE_UART1 +#ifdef USE_UART1 volatile uint16_t uart1_rx_insert_idx, uart1_rx_extract_idx; uint8_t uart1_rx_buffer[UART1_RX_BUFFER_SIZE]; @@ -119,7 +119,7 @@ bool_t uart1_check_free_space( uint8_t len) { } void usart1_irq_handler(void) { - + if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET){ // check if more data to send if (uart1_tx_insert_idx != uart1_tx_extract_idx) { @@ -152,7 +152,7 @@ void usart1_irq_handler(void) { -#ifdef USE_UART2 +#ifdef USE_UART2 volatile uint16_t uart2_rx_insert_idx, uart2_rx_extract_idx; uint8_t uart2_rx_buffer[UART2_RX_BUFFER_SIZE]; @@ -273,7 +273,7 @@ void usart2_irq_handler(void) { -#ifdef USE_UART3 +#ifdef USE_UART3 volatile uint16_t uart3_rx_insert_idx, uart3_rx_extract_idx; uint8_t uart3_rx_buffer[UART3_RX_BUFFER_SIZE]; @@ -303,12 +303,12 @@ void uart3_init( void ) { GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); GPIO_InitTypeDef gpio; /* GPIOC: GPIO_Pin_10 USART3 Tx push-pull */ - gpio.GPIO_Pin = UART3_TxPin; + gpio.GPIO_Pin = UART3_TxPin; gpio.GPIO_Mode = GPIO_Mode_AF_PP; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(UART3_TxPort, &gpio); /* GPIOC: GPIO_Pin_11 USART3 Rx pin as floating input */ - gpio.GPIO_Pin = UART3_RxPin; + gpio.GPIO_Pin = UART3_RxPin; gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(UART3_RxPort, &gpio); @@ -368,7 +368,7 @@ bool_t uart3_check_free_space( uint8_t len) { void usart3_irq_handler(void) { - + if(USART_GetITStatus(USART3, USART_IT_TXE) != RESET){ // check if more data to send if (uart3_tx_insert_idx != uart3_tx_extract_idx) { @@ -397,13 +397,13 @@ void usart3_irq_handler(void) { void uart_init( void ) { -#ifdef USE_UART1 +#ifdef USE_UART1 uart1_init(); #endif -#ifdef USE_UART2 +#ifdef USE_UART2 uart2_init(); #endif -#ifdef USE_UART3 +#ifdef USE_UART3 uart3_init(); #endif } diff --git a/sw/airborne/arch/stm32/uart_hw.h b/sw/airborne/arch/stm32/uart_hw.h index ce9ea6a04c..8679622711 100644 --- a/sw/airborne/arch/stm32/uart_hw.h +++ b/sw/airborne/arch/stm32/uart_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* - *\brief STM32 usart functions + *\brief STM32 usart functions * */ @@ -78,7 +78,7 @@ #define UART1_clk(_periph, _val) RCC_APB2PeriphClockCmd(_periph, _val) #define UART2_clk(_periph, _val) RCC_APB1PeriphClockCmd(_periph, _val) #define UART3_clk(_periph, _val) RCC_APB1PeriphClockCmd(_periph, _val); -#define UART5_clk(_periph, _val) RCC_APB1PeriphClockCmd(_periph, _val) +#define UART5_clk(_periph, _val) RCC_APB1PeriphClockCmd(_periph, _val) #define Uart1_init uart1_init() #define Uart2_init uart2_init() @@ -88,16 +88,16 @@ #define UART1_irq_handler usart1_irq_handler #define UART2_irq_handler usart2_irq_handler #define UART3_irq_handler usart3_irq_handler -#define UART5_irq_handler usart5_irq_handler +#define UART5_irq_handler usart5_irq_handler #define UART1_IRQn USART1_IRQn -#define UART2_IRQn USART2_IRQn +#define UART2_IRQn USART2_IRQn #define UART3_IRQn USART3_IRQn #define UART1_reg USART1 #define UART2_reg USART2 #define UART3_reg USART3 -#define UART5_reg USART5 +#define UART5_reg USART5 #if defined USE_UART1 || OVERRIDE_UART1_IRQ_HANDLER diff --git a/sw/airborne/boards/beth.h b/sw/airborne/boards/beth.h index dc444dba01..008dd9edb8 100644 --- a/sw/airborne/boards/beth.h +++ b/sw/airborne/boards/beth.h @@ -7,27 +7,27 @@ //#define HSE_TYPE RCC_HSE_ON /* Onboard LEDs */ -#define LED_1_BANK +#define LED_1_BANK #define LED_1_GPIO GPIOC #define LED_1_GPIO_CLK RCC_APB2Periph_GPIOC #define LED_1_GPIO_PIN GPIO_Pin_12 -#define LED_4_BANK +#define LED_4_BANK #define LED_4_GPIO GPIOA #define LED_4_GPIO_CLK RCC_APB2Periph_GPIOA #define LED_4_GPIO_PIN GPIO_Pin_6 -#define LED_5_BANK +#define LED_5_BANK #define LED_5_GPIO GPIOA #define LED_5_GPIO_CLK RCC_APB2Periph_GPIOA #define LED_5_GPIO_PIN GPIO_Pin_7 -#define LED_6_BANK +#define LED_6_BANK #define LED_6_GPIO GPIOB #define LED_6_GPIO_CLK RCC_APB2Periph_GPIOB #define LED_6_GPIO_PIN GPIO_Pin_0 -#define LED_7_BANK +#define LED_7_BANK #define LED_7_GPIO GPIOB #define LED_7_GPIO_CLK RCC_APB2Periph_GPIOB #define LED_7_GPIO_PIN GPIO_Pin_1 diff --git a/sw/airborne/boards/booz/baro_board.c b/sw/airborne/boards/booz/baro_board.c index 133353dfef..84bb346c0f 100644 --- a/sw/airborne/boards/booz/baro_board.c +++ b/sw/airborne/boards/booz/baro_board.c @@ -1,5 +1,5 @@ /* $Id$ - * + * * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. @@ -17,7 +17,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ diff --git a/sw/airborne/boards/booz/test_baro.c b/sw/airborne/boards/booz/test_baro.c index 53148e2cbf..05b81ae065 100644 --- a/sw/airborne/boards/booz/test_baro.c +++ b/sw/airborne/boards/booz/test_baro.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* @@ -67,7 +67,7 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { - + RunOnceEvery(2, {baro_periodic();}); RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);}); LED_PERIODIC(); diff --git a/sw/airborne/boards/lisa_l/baro_board.c b/sw/airborne/boards/lisa_l/baro_board.c index 2dd944f909..0f30dbd2e9 100644 --- a/sw/airborne/boards/lisa_l/baro_board.c +++ b/sw/airborne/boards/lisa_l/baro_board.c @@ -12,7 +12,7 @@ static inline void baro_board_set_current_register(uint8_t baro_addr, uint8_t re static inline void baro_board_read_from_current_register(uint8_t baro_addr); // absolute -#define BARO_ABS_ADDR 0x90 +#define BARO_ABS_ADDR 0x90 // differential #define BARO_DIFF_ADDR 0x92 diff --git a/sw/airborne/boards/lisa_l/baro_board.h b/sw/airborne/boards/lisa_l/baro_board.h index e56af805a5..017d41a99b 100644 --- a/sw/airborne/boards/lisa_l/baro_board.h +++ b/sw/airborne/boards/lisa_l/baro_board.h @@ -11,12 +11,12 @@ #include "i2c.h" enum LisaBaroStatus { - LBS_UNINITIALIZED, - LBS_RESETED, - LBS_INITIALIZING_ABS, - LBS_INITIALIZING_ABS_1, - LBS_INITIALIZING_DIFF, - LBS_INITIALIZING_DIFF_1, + LBS_UNINITIALIZED, + LBS_RESETED, + LBS_INITIALIZING_ABS, + LBS_INITIALIZING_ABS_1, + LBS_INITIALIZING_DIFF, + LBS_INITIALIZING_DIFF_1, LBS_IDLE, LBS_READING_ABS, LBS_READ_ABS, diff --git a/sw/airborne/boards/lisa_l/test_baro.c b/sw/airborne/boards/lisa_l/test_baro.c index 21162f1724..dcd8122dd6 100644 --- a/sw/airborne/boards/lisa_l/test_baro.c +++ b/sw/airborne/boards/lisa_l/test_baro.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* @@ -71,13 +71,13 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { - + RunOnceEvery(2, {baro_periodic();}); LED_PERIODIC(); RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);}); - RunOnceEvery(256, + RunOnceEvery(256, { - DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, + DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, &i2c2_errors.ack_fail_cnt, &i2c2_errors.miss_start_stop_cnt, &i2c2_errors.arb_lost_cnt, diff --git a/sw/airborne/boards/lisa_l_1.0.h b/sw/airborne/boards/lisa_l_1.0.h index 286a8dec92..417fd309f0 100644 --- a/sw/airborne/boards/lisa_l_1.0.h +++ b/sw/airborne/boards/lisa_l_1.0.h @@ -8,7 +8,7 @@ #define HSE_TYPE_EXT_CLK /* Onboard LEDs */ -#define LED_1_BANK +#define LED_1_BANK #define LED_STP08 // FIXME, this is just to make it compile diff --git a/sw/airborne/boards/lisa_m_1.0.h b/sw/airborne/boards/lisa_m_1.0.h index 8f1eb9e2dc..e87613b155 100644 --- a/sw/airborne/boards/lisa_m_1.0.h +++ b/sw/airborne/boards/lisa_m_1.0.h @@ -5,12 +5,12 @@ #define AHB_CLK 72000000 /* Onboard LEDs */ -#define LED_1_BANK +#define LED_1_BANK #define LED_1_GPIO GPIOB #define LED_1_GPIO_CLK RCC_APB2Periph_GPIOB #define LED_1_GPIO_PIN GPIO_Pin_4 -#define LED_2_BANK +#define LED_2_BANK #define LED_2_GPIO GPIOC #define LED_2_GPIO_CLK RCC_APB2Periph_GPIOC #define LED_2_GPIO_PIN GPIO_Pin_13 diff --git a/sw/airborne/boards/olimex_lpc_h2148.h b/sw/airborne/boards/olimex_lpc_h2148.h index e3f535bb33..1af49983a6 100644 --- a/sw/airborne/boards/olimex_lpc_h2148.h +++ b/sw/airborne/boards/olimex_lpc_h2148.h @@ -2,16 +2,16 @@ #define CONFIG_OLIMEX_H2148_H /* Master oscillator freq. */ -#define FOSC (12000000) +#define FOSC (12000000) /* PLL multiplier */ -#define PLL_MUL (5) +#define PLL_MUL (5) /* CPU clock freq. */ -#define CCLK (FOSC * PLL_MUL) +#define CCLK (FOSC * PLL_MUL) /* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */ -#define PBSD_BITS 0x02 +#define PBSD_BITS 0x02 #define PBSD_VAL 2 /* Peripheral bus clock freq. */ -#define PCLK (CCLK / PBSD_VAL) +#define PCLK (CCLK / PBSD_VAL) #define LED_1_BANK 1 #define LED_1_PIN 24 diff --git a/sw/airborne/boards/olimex_stm32-h103.h b/sw/airborne/boards/olimex_stm32-h103.h index 57d81d4d50..f134c747f6 100644 --- a/sw/airborne/boards/olimex_stm32-h103.h +++ b/sw/airborne/boards/olimex_stm32-h103.h @@ -8,7 +8,7 @@ //#define HSE_TYPE RCC_HSE_ON /* Onboard LEDs */ -#define LED_1_BANK +#define LED_1_BANK #define LED_1_GPIO GPIOC #define LED_1_GPIO_CLK RCC_APB2Periph_GPIOC #define LED_1_GPIO_PIN GPIO_Pin_12 diff --git a/sw/airborne/bomb.c b/sw/airborne/bomb.c index 991320dcd3..edfc2dae2b 100644 --- a/sw/airborne/bomb.c +++ b/sw/airborne/bomb.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -58,8 +58,8 @@ static void integrate( uint8_t wp_target ) { int i = 0; while (bomb_z > 0. && i < MAX_STEPS) { /* relative wind experienced by the ball */ - float airx = -bomb_vx + wind_east; - float airy = -bomb_vy + wind_north; + float airx = -bomb_vx + wind_east; + float airy = -bomb_vy + wind_north; float airz = -bomb_vz; /* alpha / m * air */ @@ -129,7 +129,7 @@ unit_t bomb_compute_approach( uint8_t wp_target, uint8_t wp_start, float bomb_ra waypoints[WP_BASELEG].y = waypoints[wp_start].y - x1 * bomb_radius; waypoints[WP_BASELEG].a = waypoints[wp_start].a; bomb_start_qdr = M_PI - atan2(-y_1, -x1); - if (bomb_radius < 0) + if (bomb_radius < 0) bomb_start_qdr += M_PI; bomb_vx = x1 * airspeed + wind_east; diff --git a/sw/airborne/booz/arch/sim/booz2_analog_hw.c b/sw/airborne/booz/arch/sim/booz2_analog_hw.c index 774f0d94d9..25404f6ec4 100644 --- a/sw/airborne/booz/arch/sim/booz2_analog_hw.c +++ b/sw/airborne/booz/arch/sim/booz2_analog_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "booz2_analog.h" diff --git a/sw/airborne/booz/arch/sim/booz2_analog_hw.h b/sw/airborne/booz/arch/sim/booz2_analog_hw.h index f47930c640..7e2c3231d9 100644 --- a/sw/airborne/booz/arch/sim/booz2_analog_hw.h +++ b/sw/airborne/booz/arch/sim/booz2_analog_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef BOOZ2_ANALOG_HW_H diff --git a/sw/airborne/booz/arch/sim/booz2_pwm_hw.c b/sw/airborne/booz/arch/sim/booz2_pwm_hw.c index d0c581cc73..1ff53d6faa 100644 --- a/sw/airborne/booz/arch/sim/booz2_pwm_hw.c +++ b/sw/airborne/booz/arch/sim/booz2_pwm_hw.c @@ -1,6 +1,6 @@ /* * $Id: $ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/booz/arch/sim/booz2_pwm_hw.h b/sw/airborne/booz/arch/sim/booz2_pwm_hw.h index 1172292f4c..3c8f3d00e1 100644 --- a/sw/airborne/booz/arch/sim/booz2_pwm_hw.h +++ b/sw/airborne/booz/arch/sim/booz2_pwm_hw.h @@ -1,6 +1,6 @@ /* * $Id: $ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/booz/arch/sim/booz2_unsimulated_peripherals.c b/sw/airborne/booz/arch/sim/booz2_unsimulated_peripherals.c index 530c757a84..93912efe1d 100644 --- a/sw/airborne/booz/arch/sim/booz2_unsimulated_peripherals.c +++ b/sw/airborne/booz/arch/sim/booz2_unsimulated_peripherals.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "uart.h" diff --git a/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c index 03db70cb75..b20c2ccef4 100644 --- a/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c +++ b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c @@ -1,6 +1,6 @@ /* * $Id: booz2_test_mc.c 3701 2009-07-13 09:57:55Z poine $ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -33,8 +33,8 @@ #define NB_MOTORS 6 static const uint8_t motor_addr[] = {0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C}; -uint8_t motor = 0; -uint8_t thrust = 10; +uint8_t motor = 0; +uint8_t thrust = 10; static bool_t i2c_done; //static uint8_t addr = 0x52; /* 1 : back right */ diff --git a/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.h b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.h index 261de58bdb..ba0a5964f5 100644 --- a/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.h +++ b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.h @@ -1,7 +1,7 @@ #ifndef BOOZ2_TEST_BUSS_BLDC_HEXA_H #define BOOZ2_TEST_BUSS_BLDC_HEXA_H -extern uint8_t motor; +extern uint8_t motor; extern uint8_t thrust; #endif /* BOOZ2_TEST_BUSS_BLDC_HEXA_H */ diff --git a/sw/airborne/booz/test/booz2_test_gps.c b/sw/airborne/booz/test/booz2_test_gps.c index 84710b3887..0c67b7886a 100644 --- a/sw/airborne/booz/test/booz2_test_gps.c +++ b/sw/airborne/booz/test/booz2_test_gps.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -62,12 +62,12 @@ static inline void main_periodic_task( void ) { static inline void main_event_task( void ) { BoozGpsEvent(on_gps_sol); - + } static void on_gps_sol(void) { - - DOWNLINK_SEND_BOOZ2_GPS( DefaultChannel, + + DOWNLINK_SEND_BOOZ2_GPS( DefaultChannel, &booz_gps_state.ecef_pos.x, &booz_gps_state.ecef_pos.y, &booz_gps_state.ecef_pos.z, diff --git a/sw/airborne/booz/test/booz2_test_led.c b/sw/airborne/booz/test/booz2_test_led.c index 42333e1eb0..126358b6b4 100644 --- a/sw/airborne/booz/test/booz2_test_led.c +++ b/sw/airborne/booz/test/booz2_test_led.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/booz/test/booz2_test_max1168.c b/sw/airborne/booz/test/booz2_test_max1168.c index 2d5831cd77..12c858a824 100644 --- a/sw/airborne/booz/test/booz2_test_max1168.c +++ b/sw/airborne/booz/test/booz2_test_max1168.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -83,7 +83,7 @@ static inline void main_event_task( void ) { /* SSPCR0 settings */ #define SSP_DDS 0x0F << 0 /* data size : 16 bits */ #define SSP_FRF 0x00 << 4 /* frame format : SPI */ -#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ +#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ #define SSP_CPHA 0x00 << 7 /* clock phase : SCK idles low */ #define SSP_SCR 0x0F << 8 /* serial clock rate : divide by 16 */ @@ -115,12 +115,12 @@ static void main_init_ssp(void) { /* setup pins for SSP (SCK, MISO, MOSI, SSEL) */ PINSEL1 |= SSP_PINSEL1_SCK | SSP_PINSEL1_MISO | SSP_PINSEL1_MOSI; - + /* setup SSP */ SSPCR0 = SSPCR0_VAL;; SSPCR1 = SSPCR1_VAL; SSPCPSR = 0x02; - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( VIC_SPI1 ); /* SPI1 selected as IRQ */ VICIntEnable = VIC_BIT( VIC_SPI1 ); /* enable it */ @@ -134,7 +134,7 @@ static void main_init_ssp(void) { static void SSP_ISR(void) { ISR_ENTRY(); - + Max1168OnSpiInt(); VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */ diff --git a/sw/airborne/booz/test/booz2_test_micromag.c b/sw/airborne/booz/test/booz2_test_micromag.c index c9fc8a5ae4..68377fb5ef 100644 --- a/sw/airborne/booz/test/booz2_test_micromag.c +++ b/sw/airborne/booz/test/booz2_test_micromag.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -113,7 +113,7 @@ static inline void main_event_task( void ) { /* SSPCR0 settings */ #define SSP_DDS 0x07 << 0 /* data size : 8 bits */ #define SSP_FRF 0x00 << 4 /* frame format : SPI */ -#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ +#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ #define SSP_CPHA 0x00 << 7 /* clock phase : SCK idles low */ #define SSP_SCR 0x0F << 8 /* serial clock rate : divide by 16 */ @@ -145,12 +145,12 @@ static void main_init_ssp(void) { /* setup pins for SSP (SCK, MISO, MOSI, SSEL) */ PINSEL1 |= SSP_PINSEL1_SCK | SSP_PINSEL1_MISO | SSP_PINSEL1_MOSI; - + /* setup SSP */ SSPCR0 = SSPCR0_VAL;; SSPCR1 = SSPCR1_VAL; SSPCPSR = 0x02; - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT( VIC_SPI1 ); /* SPI1 selected as IRQ */ VICIntEnable = VIC_BIT( VIC_SPI1 ); /* enable it */ @@ -164,7 +164,7 @@ static void main_init_ssp(void) { static void SSP_ISR(void) { ISR_ENTRY(); - + MmOnSpiIt(); VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */ diff --git a/sw/airborne/booz/test/booz2_test_modem.c b/sw/airborne/booz/test/booz2_test_modem.c index 4807e91208..1b5fb38628 100644 --- a/sw/airborne/booz/test/booz2_test_modem.c +++ b/sw/airborne/booz/test/booz2_test_modem.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/booz/test/booz2_test_radio_control.c b/sw/airborne/booz/test/booz2_test_radio_control.c index a1b21a409b..f5b93da7a4 100644 --- a/sw/airborne/booz/test/booz2_test_radio_control.c +++ b/sw/airborne/booz/test/booz2_test_radio_control.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2010 The Paparazzi Team * * This file is part of Paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -57,17 +57,17 @@ static inline void main_init( void ) { extern uint32_t debug_len; static inline void main_periodic_task( void ) { - + RunOnceEvery(51, { - /*LED_TOGGLE(2);*/ - uint32_t blaaa= cpu_time_sec; + /*LED_TOGGLE(2);*/ + uint32_t blaaa= cpu_time_sec; DOWNLINK_SEND_TIME(DefaultChannel, &blaaa); - }); + }); RunOnceEvery(10, {radio_control_periodic();}); int16_t foo = 0;//RC_PPM_SIGNED_TICS_OF_USEC(2050-1500); - RunOnceEvery(10, + RunOnceEvery(10, {DOWNLINK_SEND_BOOZ2_RADIO_CONTROL(DefaultChannel, \ &radio_control.values[RADIO_ROLL], \ &radio_control.values[RADIO_PITCH], \ @@ -77,7 +77,7 @@ static inline void main_periodic_task( void ) { &foo, \ &radio_control.status);}); #ifdef RADIO_CONTROL_TYPE_PPM - RunOnceEvery(10, + RunOnceEvery(10, {uint8_t blaa = 0; DOWNLINK_SEND_PPM(DefaultChannel,&blaa, 8, booz_radio_control_ppm_pulses);}); #endif @@ -85,9 +85,9 @@ static inline void main_periodic_task( void ) { } static inline void main_event_task( void ) { - + RadioControlEvent(main_on_radio_control_frame); - + } static void main_on_radio_control_frame( void ) { diff --git a/sw/airborne/booz/test/booz2_test_rc.c b/sw/airborne/booz/test/booz2_test_rc.c index 4aaca6d932..d88f5e9e75 100644 --- a/sw/airborne/booz/test/booz2_test_rc.c +++ b/sw/airborne/booz/test/booz2_test_rc.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/booz/test/booz2_test_usb.c b/sw/airborne/booz/test/booz2_test_usb.c index af5a86d652..f05f9d0787 100644 --- a/sw/airborne/booz/test/booz2_test_usb.c +++ b/sw/airborne/booz/test/booz2_test_usb.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/booz/test/booz2_tunnel.c b/sw/airborne/booz/test/booz2_tunnel.c index dbdd38e8cc..9229ae1aef 100644 --- a/sw/airborne/booz/test/booz2_tunnel.c +++ b/sw/airborne/booz/test/booz2_tunnel.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -67,5 +67,5 @@ static inline void main_event_task( void ) { while (Uart0ChAvailable()) uart1_transmit(Uart0Getch()); - + } diff --git a/sw/airborne/booz/test/booz2_tunnel_bb.c b/sw/airborne/booz/test/booz2_tunnel_bb.c index 442e0fe9cf..33f8b7ff65 100644 --- a/sw/airborne/booz/test/booz2_tunnel_bb.c +++ b/sw/airborne/booz/test/booz2_tunnel_bb.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "LPC21xx.h" diff --git a/sw/airborne/booz/test/booz_test_telemetry.c b/sw/airborne/booz/test/booz_test_telemetry.c index 9569c9c93c..940952d9fd 100644 --- a/sw/airborne/booz/test/booz_test_telemetry.c +++ b/sw/airborne/booz/test/booz_test_telemetry.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/booz/test/test_mlkf.c b/sw/airborne/booz/test/test_mlkf.c index c74e6842e0..1a21700261 100644 --- a/sw/airborne/booz/test/test_mlkf.c +++ b/sw/airborne/booz/test/test_mlkf.c @@ -36,7 +36,7 @@ static struct test_output output[MAX_SAMPLE]; int main(int argc, char** argv) { - + read_data(IN_FILE); imu_init(); @@ -91,7 +91,7 @@ static void feed_imu(int i) { static void store_filter_output(int i) { - + QUAT_COPY(output[i].quat_est, ahrs_float.ltp_to_imu_quat); RATES_COPY(output[i].bias_est, ahrs_mlkf.gyro_bias); RATES_COPY(output[i].rate_est, ahrs_float.imu_rate); @@ -103,9 +103,9 @@ static void dump_output(const char* filename) { FILE* fd = fopen(filename, "w"); int i; for (i=0; i * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -51,17 +51,17 @@ void test_1(void) { double neutral_f = (double)IMU_ACCEL_X_NEUTRAL; double sensitivity_f = 1./IMU_ACCEL_X_SENS; - + double sensor_raw_f = ACCEL_BFP_OF_REAL(value_f) * sensitivity_f + neutral_f; int32_t sensor_raw_i = rint(sensor_raw_f); - + double scaled_sensor_f = ACCEL_BFP_OF_REAL(value_f); #if 1 int32_t scaled_sensor_i = ((sensor_raw_i - IMU_ACCEL_X_NEUTRAL) * IMU_ACCEL_X_SENS_NUM) / IMU_ACCEL_X_SENS_DEN; #endif #if 0 - int32_t scaled_sensor_i = (sensor_raw_i * IMU_ACCEL_X_SENS_NUM / IMU_ACCEL_X_SENS_DEN) - + int32_t scaled_sensor_i = (sensor_raw_i * IMU_ACCEL_X_SENS_NUM / IMU_ACCEL_X_SENS_DEN) - (IMU_ACCEL_X_NEUTRAL * IMU_ACCEL_X_SENS_NUM / IMU_ACCEL_X_SENS_DEN); #endif @@ -82,15 +82,15 @@ void test_1(void) { } void test_2(void) { - - int a; + + int a; for (a=-7; a<7; a++) { int b = a/-2; int c = (a>0 ? a+1 : a-1)/-2; double d = rint((double)a/-2.); printf("%- d %- d %- d %- .1f\n", a, b, c, d); } - + } #define OFFSET_AND_ROUND(_a, _b) (((_a)+(1<<((_b)-1)))>>(_b)) @@ -98,7 +98,7 @@ void test_2(void) { #define N_OFFSET 2 void test_3(void) { - int a; + int a; for (a=-(1<>N_OFFSET); int32_t c; @@ -114,6 +114,6 @@ void test_3(void) { double e; e = (double)a/(double)(1<= NB_BLOCK) nav_block=NB_BLOCK-1; nav_stage = 0; diff --git a/sw/airborne/common_nav.h b/sw/airborne/common_nav.h index 038678aec5..9c9dbcc526 100644 --- a/sw/airborne/common_nav.h +++ b/sw/airborne/common_nav.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -47,7 +47,7 @@ extern void nav_move_waypoint(uint8_t wp_id, float utm_east, float utm_north, fl extern const uint8_t nb_waypoint; extern struct point waypoints[]; -/** size == nb_waypoint, waypoint 0 is a dummy waypoint */ +/** size == nb_waypoint, waypoint 0 is a dummy waypoint */ /** In s */ extern uint16_t stage_time, block_time; diff --git a/sw/airborne/csc/arm7/buss_twi_blmc_hw.c b/sw/airborne/csc/arm7/buss_twi_blmc_hw.c index 0f2819f9db..11c5fd4d9d 100644 --- a/sw/airborne/csc/arm7/buss_twi_blmc_hw.c +++ b/sw/airborne/csc/arm7/buss_twi_blmc_hw.c @@ -42,17 +42,17 @@ void motors_set_motor(uint8_t id, int16_t value) static void buss_twi_blmc_send_next() { - i2c0_buf[0] = motor_power[buss_twi_blmc_idx]; - i2c0_transmit(buss_twi_blmc_addr[buss_twi_blmc_idx], 1, &buss_twi_blmc_i2c_done); + i2c0_buf[0] = motor_power[buss_twi_blmc_idx]; + i2c0_transmit(buss_twi_blmc_addr[buss_twi_blmc_idx], 1, &buss_twi_blmc_i2c_done); } void motors_commit_next( void ) { - buss_twi_blmc_idx++; + buss_twi_blmc_idx++; if (buss_twi_blmc_idx < BUSS_TWI_BLMC_NB_SEND) buss_twi_blmc_send_next(); - else - buss_twi_blmc_status = BUSS_TWI_BLMC_STATUS_IDLE; + else + buss_twi_blmc_status = BUSS_TWI_BLMC_STATUS_IDLE; } void motors_commit(int force) @@ -60,8 +60,8 @@ void motors_commit(int force) if (force || buss_twi_blmc_status == BUSS_TWI_BLMC_STATUS_IDLE) { I2c0SendStop(); - buss_twi_blmc_idx = 0; - buss_twi_blmc_status = BUSS_TWI_BLMC_STATUS_BUSY; + buss_twi_blmc_idx = 0; + buss_twi_blmc_status = BUSS_TWI_BLMC_STATUS_BUSY; buss_twi_blmc_send_next(); commit_start_time = T0TC; diff --git a/sw/airborne/csc/csc_adc.c b/sw/airborne/csc/csc_adc.c index d421b0e3c1..be8f0197cf 100644 --- a/sw/airborne/csc/csc_adc.c +++ b/sw/airborne/csc/csc_adc.c @@ -34,7 +34,7 @@ uint16_t adc_values[ADC_NB_CSC]; void csc_adc_init(void) { - adc_init(); + adc_init(); for (int i = 0; i < ADC_NB_CSC; i++) { adc_buf_channel(i, &adc_bufs[i], ADC_AV_NB); } diff --git a/sw/airborne/csc/csc_ap_link.c b/sw/airborne/csc/csc_ap_link.c index e5b13a8815..b5365483d7 100644 --- a/sw/airborne/csc/csc_ap_link.c +++ b/sw/airborne/csc/csc_ap_link.c @@ -90,7 +90,7 @@ void csc_ap_link_send_bat(uint16_t volts, uint16_t amps, uint8_t msgctr) struct CscBatMsg msg; msg.volts = volts; - msg.amps = amps; + msg.amps = amps; msg.msgctr = msgctr; csc_ap_send_msg(CSC_BAT_MSG_ID, (const uint8_t *) &msg, sizeof(msg)); @@ -110,7 +110,7 @@ void can_write_csc(uint8_t board_id, uint8_t msg_id, const uint8_t *buf, uint8_t out_msg.id = ((board_id & CSC_BOARD_MASK) << 7) | (msg_id & CSC_MSGID_MASK); // copy msg payload in host order memcpy((char *)&out_msg.dat_a, buf, len); - // send via CAN + // send via CAN csc_can1_send(&out_msg); } diff --git a/sw/airborne/csc/csc_ap_main.c b/sw/airborne/csc/csc_ap_main.c index bbac33513c..6ad125ded3 100644 --- a/sw/airborne/csc/csc_ap_main.c +++ b/sw/airborne/csc/csc_ap_main.c @@ -1,6 +1,6 @@ /* * $Id: booz2_main.c 3049 2009-02-24 16:51:25Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -92,9 +92,9 @@ static void on_rc_cmd(struct CscRCMsg *msg) rc_values[RADIO_PITCH] = -CSC_RC_SCALE*(msg->right_stick_vertical - CSC_RC_OFFSET); rc_values[RADIO_YAW] = CSC_RC_SCALE*((msg->left_stick_horizontal_and_aux2 & ~(3 << 13)) - CSC_RC_OFFSET); uint8_t mode = (msg->left_stick_vertical_and_flap_mix & (3 << 13)) >> 13; - rc_values[RADIO_MODE] = mode ? -7000 : ( (mode == 1) ? 0 : 7000); + rc_values[RADIO_MODE] = mode ? -7000 : ( (mode == 1) ? 0 : 7000); aux2_flag = (msg->left_stick_horizontal_and_aux2 >> 13) & 0x1; - rc_values[RADIO_MODE2] = (aux2_flag == 0) ? -7000 : ( (aux2_flag == 1) ? 0 : 7000); + rc_values[RADIO_MODE2] = (aux2_flag == 0) ? -7000 : ( (aux2_flag == 1) ? 0 : 7000); rc_values[RADIO_THROTTLE] = -CSC_RC_SCALE*((msg->left_stick_vertical_and_flap_mix & ~(3 << 13)) - CSC_RC_OFFSET); time_since_last_ppm = 0; @@ -134,9 +134,9 @@ static void on_gpspos_cmd( struct CscGPSPosMsg *msg ) booz_ins_gps_pos_cm_ned.z = msg->val; break; default: - // Invalid msg + // Invalid msg break; - } + } } static void csc_main_init( void ) { @@ -175,7 +175,7 @@ static void csc_main_init( void ) { static void csc_main_periodic( void ) { static uint32_t csc_loops = 0; - + PeriodicSendAp(DefaultChannel); radio_control_periodic_task(); diff --git a/sw/airborne/csc/csc_autopilot.c b/sw/airborne/csc/csc_autopilot.c index 72ffc953a6..5300708d9b 100644 --- a/sw/airborne/csc/csc_autopilot.c +++ b/sw/airborne/csc/csc_autopilot.c @@ -16,7 +16,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -187,11 +187,11 @@ static void calculate_errors(struct control_reference *errors) errors->eulers.phi = xsens_eulers.phi - csc_reference.eulers.phi; errors->eulers.theta = xsens_eulers.theta - csc_reference.eulers.theta; // The following mess mixes in the wind vane and the GPS errors in - // an arbitrary fashion. - errors->eulers.psi = (csc_vane_angle*csc_vane_weight) - + (xsens_eulers.psi - csc_reference.eulers.psi)*(1 - csc_vane_weight); + // an arbitrary fashion. + errors->eulers.psi = (csc_vane_angle*csc_vane_weight) + + (xsens_eulers.psi - csc_reference.eulers.psi)*(1 - csc_vane_weight); errors->eulers.psi = (1 - csc_gps_weight)*errors->eulers.psi - + csc_gps_weight*(cos(xsens_eulers.psi)*csc_gps_errors.pos.x + + csc_gps_weight*(cos(xsens_eulers.psi)*csc_gps_errors.pos.x + sin(xsens_eulers.psi)*csc_gps_errors.pos.y); errors->rates.p = xsens_rates.p - csc_reference.rates.p; @@ -210,10 +210,10 @@ static void calculate_errors(struct control_reference *errors) } else if (errors->eulers.psi <= yaw_deadband*2 && errors->eulers.psi >= -yaw_deadband*2) { if (errors->eulers.psi < 0) { errors->eulers.psi = (errors->eulers.psi + yaw_deadband)*2; - } else + } else errors->eulers.psi = (errors->eulers.psi - yaw_deadband)*2; } - + bound_ierror(csc_gains.roll_ki, &errors->eulers_i.phi); bound_ierror(csc_gains.pitch_ki, &errors->eulers_i.theta); bound_ierror(csc_gains.yaw_ki, &errors->eulers_i.psi); diff --git a/sw/airborne/csc/csc_autopilot.h b/sw/airborne/csc/csc_autopilot.h index 52f4d0df3f..c41cd7bcff 100644 --- a/sw/airborne/csc/csc_autopilot.h +++ b/sw/airborne/csc/csc_autopilot.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Joby Energy - * + * * * paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -93,4 +93,4 @@ void csc_ap_update_gains(struct control_reference *errors, struct control_gains #define PERIODIC_SEND_VANE_SENSOR(_chan) DOWNLINK_SEND_VANE_SENSOR(_chan, &csc_vane_angle) -#endif +#endif diff --git a/sw/airborne/csc/csc_baro.c b/sw/airborne/csc/csc_baro.c index 351a855caa..e51835f845 100755 --- a/sw/airborne/csc/csc_baro.c +++ b/sw/airborne/csc/csc_baro.c @@ -124,13 +124,13 @@ static uint16_t baro_scp_read_reg_16(uint8_t regno) void baro_scp_init( void ) { - + SSP1_SCK_PINSEL(); SSP1_MISO_PINSEL(); SSP1_MOSI_PINSEL(); SSP1_SSEL_PINSEL(); DRDY1_PINSEL(); - + S1SPCR = _BV(3) | _BV(4) | _BV(5); S1SPCCR = 0x80; @@ -153,7 +153,7 @@ void spi1_isr() //} baro_scp_temperature = baro_scp_temperature & (0xFFFF >> 2); baro_scp_temperature *= 5; - + baro_scp_pressure = lsb; baro_scp_pressure |= (msb << 16); baro_scp_pressure *= 25; diff --git a/sw/airborne/csc/csc_can.c b/sw/airborne/csc/csc_can.c index 02050e0e4f..3ca2d2dcb9 100644 --- a/sw/airborne/csc/csc_can.c +++ b/sw/airborne/csc/csc_can.c @@ -67,13 +67,13 @@ static void can1_hw_init(void) AFMR = 0x00000002; // Go into Reset mode - C1MOD = 1; + C1MOD = 1; // Clear Status register (including error counters) C1GSR = 0; // Set bit timing C1BTR = CAN1_BTR; - + // Disable All Interrupts C1IER = 0; @@ -81,9 +81,9 @@ static void can1_hw_init(void) #ifdef CAN1_ERR_VIC_SLOT C1IER = (1<<0) | /* RIE */ (1<<2) | /* EIE */ - (1<<6) | /* ALIE */ - (1<<7) | /* BEIE */ - (1<<7) /* BEIE */ + (1<<6) | /* ALIE */ + (1<<7) | /* BEIE */ + (1<<7) /* BEIE */ ; #endif @@ -105,7 +105,7 @@ void csc_can1_init(void(* callback)(struct CscCanMsg *msg)) VICIntSelect &= ~VIC_BIT(VIC_CAN); // VIC_CAN selected as IRQ VICIntEnable = VIC_BIT(VIC_CAN); // VIC_CAN interrupt enabled _VIC_CNTL(CAN1_ERR_VIC_SLOT) = VIC_ENABLE | VIC_CAN; // - _VIC_ADDR(CAN1_ERR_VIC_SLOT) = (uint32_t)CAN1_Err_ISR; + _VIC_ADDR(CAN1_ERR_VIC_SLOT) = (uint32_t)CAN1_Err_ISR; #endif // Set bit 18 @@ -148,25 +148,25 @@ void csc_can1_send(struct CscCanMsg* msg) { return; } // LED_OFF(2); - + // Write DLC, RTR and FF C1TFI1 = (msg->frame & 0xC00F0000L); // Write CAN ID C1TID1 = msg->id; - // Write first 4 data bytes + // Write first 4 data bytes C1TDA1 = msg->dat_a; - // Write second 4 data bytes + // Write second 4 data bytes C1TDB1 = msg->dat_b; // Write self reception request // C1CMR = 0x30; // write transmission request C1CMR = 0x21; - + } void CAN1_Rx_ISR ( void ) { ISR_ENTRY(); - + can1_rx_msg.id = C1RID; if (BOARDID_OF_CANMSG_ID(can1_rx_msg.id) == CSC_BOARD_ID) { can1_rx_msg.frame = C1RFS; @@ -175,7 +175,7 @@ void CAN1_Rx_ISR ( void ) { can1_msg_received = TRUE; if (! msg_queue_full(&can1_rx_queue)) { msg_enqueue(&can1_rx_queue, &can1_rx_msg); - } + } } diff --git a/sw/airborne/csc/csc_datalink.c b/sw/airborne/csc/csc_datalink.c index 4605119dd2..d4fd108bcd 100644 --- a/sw/airborne/csc/csc_datalink.c +++ b/sw/airborne/csc/csc_datalink.c @@ -12,13 +12,13 @@ void dl_parse_msg(void) { uint8_t msg_id = IdOfMsg(dl_buffer); switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(DefaultChannel); } break; - + case DL_SETTING : { uint8_t i = DL_SETTING_index(dl_buffer); diff --git a/sw/airborne/csc/csc_main.c b/sw/airborne/csc/csc_main.c index e9801608de..3036b32c27 100644 --- a/sw/airborne/csc/csc_main.c +++ b/sw/airborne/csc/csc_main.c @@ -1,6 +1,6 @@ /* * $Id: booz2_main.c 3049 2009-02-24 16:51:25Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -101,7 +101,7 @@ static void csc_main_init( void ) { csc_throttle_init(); #endif int_enable(); - + } @@ -120,7 +120,7 @@ static void csc_main_periodic( void ) { } else { servo_cmd_timeout++; } - + if ((++csc_loops % CSC_STATUS_TIMEOUT) == 0) { csc_ap_link_send_status(csc_loops, can_msg_count); } diff --git a/sw/airborne/csc/csc_me4_link.c b/sw/airborne/csc/csc_me4_link.c index e3a8a9660b..35d9af5bf1 100644 --- a/sw/airborne/csc/csc_me4_link.c +++ b/sw/airborne/csc/csc_me4_link.c @@ -22,7 +22,7 @@ void SPI1_ISR(void) __attribute__((naked)); #define S1SPCR_LSBF (0<<6) /* lsb first */ #define S1SPCR_SPIE (1<<7) /* interrupt enable */ -#define S1SPCR_VAL (S1SPCR_CPHA|S1SPCR_CPOL|S1SPCR_MSTR|S1SPCR_LSBF|S1SPCR_SPIE) +#define S1SPCR_VAL (S1SPCR_CPHA|S1SPCR_CPOL|S1SPCR_MSTR|S1SPCR_LSBF|S1SPCR_SPIE) #define S1SPCCR_VAL 0x64 @@ -58,13 +58,13 @@ void SPI1_ISR(void) { static uint8_t cnt = 0; LED_TOGGLE(2); - /* transfer complete */ - if ( bit_is_set(S1SPSR, SPIF)) { + /* transfer complete */ + if ( bit_is_set(S1SPSR, SPIF)) { uint8_t foo __attribute__ ((unused)) = S1SPDR; S1SPDR = cnt; cnt++; } - + /* clear_it */ S1SPINT = 1< -/* +/* lpc2129 pwm pinout LPC shared port csc servo -PWM1 TXD0 P0.0 4 +PWM1 TXD0 P0.0 4 PWM2 SSEL0 EINT2 P0.7 0 -PWM3 RXD0 EINT0 P0.1 5 +PWM3 RXD0 EINT0 P0.1 5 PWM4 TXD1 AD1_1 P0.8 1 PWM5 AD1_6 CAP1_3 P0.21 2 PWM6 RXD1 EINT3 P0.9 3 diff --git a/sw/airborne/csc/csc_telemetry.c b/sw/airborne/csc/csc_telemetry.c index adfe3ce9c6..70dc6a7166 100644 --- a/sw/airborne/csc/csc_telemetry.c +++ b/sw/airborne/csc/csc_telemetry.c @@ -1,6 +1,6 @@ /* * $Id: booz2_telemetry.c 3002 2009-02-10 11:36:07Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/csc/csc_throttle.c b/sw/airborne/csc/csc_throttle.c index 5f37eee2e3..20cbfcb3cf 100644 --- a/sw/airborne/csc/csc_throttle.c +++ b/sw/airborne/csc/csc_throttle.c @@ -16,7 +16,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -39,7 +39,7 @@ #define THROTTLE_START1 0xAC #define THROTTLE_START2 0xBE -#define THROTTLE_ID 0 +#define THROTTLE_ID 0 uint32_t throttle_err_count; uint32_t throttle_recv_count; @@ -103,7 +103,7 @@ static uint16_t calculate_checksum(struct throttle_msg *send) return send->throttle_id + send->cmd_id + send->arg1 + send->arg2; } -void csc_throttle_event_task( void ) +void csc_throttle_event_task( void ) { while (!uart_msg_received && ThrottleLink(ChAvailable())) { parse_uart_msg(ThrottleLink(Getch())); @@ -175,7 +175,7 @@ static void parse_uart_msg( uint8_t c ) { // Look for throttle start byte 1 if (c != THROTTLE_START1) goto error; - throttle_status++; + throttle_status++; break; case GOT_START1: // Look for throttle start byte 2 @@ -226,7 +226,7 @@ static void parse_uart_msg( uint8_t c ) { break; } return; - error: + error: restart: // Start over (Reset parser state) throttle_status = UNINIT; diff --git a/sw/airborne/csc/csc_throttle.h b/sw/airborne/csc/csc_throttle.h index e5ca0651e4..08d32e5ba6 100644 --- a/sw/airborne/csc/csc_throttle.h +++ b/sw/airborne/csc/csc_throttle.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Joby Energy - * + * * * paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -34,4 +34,4 @@ void csc_throttle_event_task( void ); void csc_throttle_send_msg(uint8_t throttle_id, uint8_t cmd_id, uint16_t arg1, uint16_t arg2); -#endif +#endif diff --git a/sw/airborne/csc/csc_vane.c b/sw/airborne/csc/csc_vane.c index 0fd2975e4d..d47efab785 100644 --- a/sw/airborne/csc/csc_vane.c +++ b/sw/airborne/csc/csc_vane.c @@ -22,8 +22,8 @@ void csc_vane_periodic(void) static uint8_t prescale = 0; for (int i = 0; i < VANE_NB; i++) { - angle[i] = avg_factor * angle[i] + - ((1. - avg_factor) * + angle[i] = avg_factor * angle[i] + + ((1. - avg_factor) * RadOfDeg(360. * pwm_input_duration[i] / PWM_INPUT_COUNTS_PER_REV)); } diff --git a/sw/airborne/csc/csc_xsens.c b/sw/airborne/csc/csc_xsens.c index 0fcf28637a..e71569cbe5 100644 --- a/sw/airborne/csc/csc_xsens.c +++ b/sw/airborne/csc/csc_xsens.c @@ -1,6 +1,6 @@ /* * Paparazzi mcu0 $Id: quad_xsens.c,v 1.2 2008/05/07 12:54:23 gautier Exp $ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -98,10 +98,10 @@ void parse_xsens_msg(uint8_t xsens_id, uint8_t c ); #define Xsens1Trailer() { uint8_t i8=0x100-send_ck[0]; Xsens1UartSend1(i8); } -/** Includes macros generated from xsens_MTi.xml */ +/** Includes macros generated from xsens_MTi.xml */ #include "xsens_protocol.h" -uint8_t xsens_mode[XSENS_COUNT]; // Receiver status +uint8_t xsens_mode[XSENS_COUNT]; // Receiver status volatile uint8_t xsens_msg_received[XSENS_COUNT]; float xsens_phi[XSENS_COUNT]; @@ -251,7 +251,7 @@ void xsens_periodic_task ( void ) xsens_setzero = 0; } -void xsens_event_task( void ) +void xsens_event_task( void ) { while (Xsens1Link(ChAvailable()) && !xsens_msg_received[0]) { parse_xsens_msg(0, Xsens1Link(Getch())); @@ -281,7 +281,7 @@ void xsens_event_task( void ) } } -// Called after receipt of valid message to +// Called after receipt of valid message to void xsens_parse_msg( uint8_t xsens_id ) { uint8_t buf_slot = xsens_msg_buf_ci[xsens_id]; @@ -293,7 +293,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { } else if (msg_id[xsens_id][buf_slot] == XSENS_MTData_ID) { uint8_t offset = 0; - // test RAW modes else calibrated modes + // test RAW modes else calibrated modes if (XSENS_MASK_RAWInertial(xsens_output_mode[xsens_id])){// || (XSENS_MASK_RAWGPS(xsens2_output_mode))) { xsens_raw_accel_x[xsens_id] = XSENS_DATA_RAWInertial_accX(xsens_msg_buf[xsens_id][buf_slot],offset); xsens_raw_accel_y[xsens_id] = XSENS_DATA_RAWInertial_accY(xsens_msg_buf[xsens_id][buf_slot],offset); @@ -328,7 +328,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { float tilt_comp_x = xsens_mag_x[xsens_id] * cos(pitch) + xsens_mag_y[xsens_id] * sin(roll) * sin(pitch) - xsens_mag_z[xsens_id] * cos(roll) * sin(pitch); - float tilt_comp_y = xsens_mag_y[xsens_id] * cos(roll) + float tilt_comp_y = xsens_mag_y[xsens_id] * cos(roll) + xsens_mag_z[xsens_id] * sin(roll); xsens_mag_heading[xsens_id] = -atan2( tilt_comp_y, tilt_comp_x); } @@ -354,11 +354,11 @@ void xsens_parse_msg( uint8_t xsens_id ) { xsens_rmat[xsens_id].m[6] = XSENS_DATA_Matrix_g(xsens_msg_buf[xsens_id][buf_slot],offset); xsens_rmat[xsens_id].m[7] = XSENS_DATA_Matrix_h(xsens_msg_buf[xsens_id][buf_slot],offset); xsens_rmat[xsens_id].m[8] = XSENS_DATA_Matrix_i(xsens_msg_buf[xsens_id][buf_slot],offset); - + /* // FLOAT_RMAT_COMP_INV(xsens_rmat_adj[xsens_id], xsens_rmat_neutral[xsens_id], xsens_rmat[xsens_id]); */ - struct FloatRMat xsens_rmat_temp[XSENS_COUNT]; + struct FloatRMat xsens_rmat_temp[XSENS_COUNT]; FLOAT_RMAT_INV(xsens_rmat_temp[xsens_id], xsens_rmat[xsens_id]); - + FLOAT_RMAT_COMP(xsens_rmat_adj[xsens_id], xsens_rmat_temp[xsens_id], xsens_rmat_neutral[xsens_id]); xsens_phi[xsens_id] = -atan2(xsens_rmat_adj[xsens_id].m[7], xsens_rmat_adj[xsens_id].m[8]); @@ -374,7 +374,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { /* xsens_theta[xsens_id] = asin (xsens_rmat_adj[xsens_id].m[6]); */ /* xsens_psi[xsens_id] = atan2 (xsens_rmat_adj[xsens_id].m[3], xsens_rmat_adj[xsens_id].m[0]); */ - + offset += XSENS_DATA_Matrix_LENGTH; } @@ -406,10 +406,10 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { ck[xsens_id] += c; switch (xsens_status[xsens_id]) { case UNINIT: - // Look for xsens start byte + // Look for xsens start byte if (c != XSENS_START) goto error; - xsens_status[xsens_id]++; + xsens_status[xsens_id]++; ck[xsens_id] = 0; // Reset checksum break; case GOT_START: @@ -426,7 +426,7 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { case GOT_MID: // Save message length xsens_len[xsens_id][buf_slot] = c; - // check for valid message length + // check for valid message length if (xsens_len[xsens_id][buf_slot] > XSENS_MAX_PAYLOAD) goto error; xsens_msg_idx[xsens_id] = 0; // Reset buffer index @@ -453,7 +453,7 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { break; } return; - error: + error: restart: // Start over (Reset parser state) xsens_status[xsens_id] = UNINIT; diff --git a/sw/airborne/csc/csc_xsens.h b/sw/airborne/csc/csc_xsens.h index f786965c08..312fe5a7ef 100644 --- a/sw/airborne/csc/csc_xsens.h +++ b/sw/airborne/csc/csc_xsens.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Joby Energy - * + * * * paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -30,7 +30,7 @@ #define XSENS_COUNT 1 -extern uint8_t xsens_mode[XSENS_COUNT]; // Receiver status +extern uint8_t xsens_mode[XSENS_COUNT]; // Receiver status extern volatile uint8_t xsens_msg_received[XSENS_COUNT]; extern float xsens_phi[XSENS_COUNT]; @@ -103,4 +103,4 @@ void xsens_parse_msg(uint8_t xsens_id); void xsens_event_task(void); void xsens_periodic_task(void); -#endif +#endif diff --git a/sw/airborne/csc/mercury_ap.h b/sw/airborne/csc/mercury_ap.h index da89b3f3d7..324fbb5025 100644 --- a/sw/airborne/csc/mercury_ap.h +++ b/sw/airborne/csc/mercury_ap.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Joby Energy - * + * * * paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -35,4 +35,4 @@ void csc_ap_init( void ); void csc_ap_periodic (uint8_t _in_flight, uint8_t kill); -#endif +#endif diff --git a/sw/airborne/csc/mercury_csc_main.c b/sw/airborne/csc/mercury_csc_main.c index c41b484a94..ea1fcd70bb 100644 --- a/sw/airborne/csc/mercury_csc_main.c +++ b/sw/airborne/csc/mercury_csc_main.c @@ -1,6 +1,6 @@ /* * $Id: booz2_main.c 3049 2009-02-24 16:51:25Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -83,14 +83,14 @@ static void csc_main_init( void ) { hw_init(); sys_time_init(); led_init(); - + actuators_init(); - + #ifdef USE_UART0 Uart0Init(); #endif - + #ifdef USE_UART1 Uart1Init(); #endif @@ -121,8 +121,8 @@ static void csc_main_init( void ) { #ifdef ADC csc_adc_init(); #endif - - + + #ifdef USE_I2C0 i2c0_init(); #endif @@ -142,10 +142,10 @@ static void csc_main_init( void ) { #endif #ifdef USE_BAT_MONITOR - csc_bat_monitor_init(); + csc_bat_monitor_init(); #endif - - int_enable(); + + int_enable(); } @@ -167,13 +167,13 @@ static void csc_main_periodic( void ) } else { servo_cmd_timeout++; } - + if ((++csc_loops % CSC_STATUS_TIMEOUT) == 0) { csc_ap_link_send_status(csc_loops, can_msg_count); } - + csc_adc_periodic(); - + if ((csc_loops % AIRSPEED_TIMEOUT) == 0) { } else if ((csc_loops % AIRSPEED_TIMEOUT) == 1) { #ifdef USE_BARO_ETS @@ -198,7 +198,7 @@ static void csc_main_periodic( void ) #endif #ifdef USE_BAT_MONITOR - csc_bat_monitor_periodic(); + csc_bat_monitor_periodic(); #endif } @@ -227,7 +227,7 @@ static void on_prop_cmd(struct CscPropCmd *cmd, int idx) motors_commit(idx == 1); ++can_msg_count; -} +} #else static void on_prop_cmd(struct CscPropCmd *cmd, int idx) {} #endif @@ -238,7 +238,7 @@ static void on_servo_cmd(struct CscServoCmd *cmd) uint8_t i; // uint32_t servos_checked[4]; - for(i = 0; i < 4; i++) { + for(i = 0; i < 4; i++) { csc_servo_normalized_set(i,servos[i]); } csc_servos_commit(); diff --git a/sw/airborne/csc/mercury_main.c b/sw/airborne/csc/mercury_main.c index 876c61cf65..8325a4c81f 100644 --- a/sw/airborne/csc/mercury_main.c +++ b/sw/airborne/csc/mercury_main.c @@ -1,6 +1,6 @@ /* * $Id: booz2_main.c 3049 2009-02-24 16:51:25Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -95,8 +95,8 @@ static void on_rc_cmd(struct CscRCMsg *msg) radio_control.values[RADIO_YAW] = CSC_RC_SCALE*((msg->left_stick_horizontal_and_aux2 & ~(3 << 13)) - CSC_RC_OFFSET); pprz_mode = (msg->left_stick_vertical_and_flap_mix & (3 << 13)) >> 13; aux2_flag = (msg->left_stick_horizontal_and_aux2 >> 13) & 0x1; - radio_control.values[RADIO_MODE2] = (aux2_flag == 0) ? -7000 : ( (aux2_flag == 1) ? 0 : 7000); - radio_control.values[RADIO_MODE] = (pprz_mode == 0) ? -7000 : ( (pprz_mode == 1) ? 0 : 7000); + radio_control.values[RADIO_MODE2] = (aux2_flag == 0) ? -7000 : ( (aux2_flag == 1) ? 0 : 7000); + radio_control.values[RADIO_MODE] = (pprz_mode == 0) ? -7000 : ( (pprz_mode == 1) ? 0 : 7000); radio_control.values[RADIO_THROTTLE] = -CSC_RC_SCALE*((msg->left_stick_vertical_and_flap_mix & ~(3 << 13)) - CSC_RC_OFFSET); radio_control.time_since_last_frame = 0; @@ -111,12 +111,12 @@ static inline void csc_main_init( void ) { Uart0Init(); Uart1Init(); - + imu_init(); ahrs_aligner_init(); ahrs_init(); - + xsens_init(); stabilization_attitude_init(); @@ -145,7 +145,7 @@ static inline void csc_main_init( void ) { static inline void csc_main_periodic( void ) { static uint32_t csc_loops = 0; - + PeriodicSendAp(); radio_control_periodic(); diff --git a/sw/airborne/csc/mercury_xsens.c b/sw/airborne/csc/mercury_xsens.c index a42582568d..d8a3692132 100644 --- a/sw/airborne/csc/mercury_xsens.c +++ b/sw/airborne/csc/mercury_xsens.c @@ -1,6 +1,6 @@ /* * Paparazzi mcu0 $Id: quad_xsens.c,v 1.2 2008/05/07 12:54:23 gautier Exp $ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -103,10 +103,10 @@ void parse_xsens_msg(uint8_t xsens_id, uint8_t c ); #define Xsens1Trailer() { uint8_t i8=0x100-send_ck[0]; Xsens1UartSend1(i8); } -/** Includes macros generated from xsens_MTi.xml */ +/** Includes macros generated from xsens_MTi.xml */ #include "xsens_protocol.h" -uint8_t xsens_mode[XSENS_COUNT]; // Receiver status +uint8_t xsens_mode[XSENS_COUNT]; // Receiver status volatile uint8_t xsens_msg_received[XSENS_COUNT]; float xsens_phi[XSENS_COUNT]; @@ -257,7 +257,7 @@ void xsens_periodic_task ( void ) xsens_setzero = 0; } -void xsens_event_task( void ) +void xsens_event_task( void ) { while (Xsens1Link(ChAvailable()) && !xsens_msg_received[0]) { parse_xsens_msg(0, Xsens1Link(Getch())); @@ -287,7 +287,7 @@ void xsens_event_task( void ) } } -// Called after receipt of valid message to +// Called after receipt of valid message to void xsens_parse_msg( uint8_t xsens_id ) { uint8_t buf_slot = xsens_msg_buf_ci[xsens_id]; @@ -299,7 +299,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { } else if (msg_id[xsens_id][buf_slot] == XSENS_MTData_ID) { uint8_t offset = 0; - // test RAW modes else calibrated modes + // test RAW modes else calibrated modes if (XSENS_MASK_RAWInertial(xsens_output_mode[xsens_id])){// || (XSENS_MASK_RAWGPS(xsens2_output_mode))) { imu.accel_unscaled.x = XSENS_DATA_RAWInertial_accZ(xsens_msg_buf[xsens_id][buf_slot],offset); imu.accel_unscaled.y = XSENS_DATA_RAWInertial_accY(xsens_msg_buf[xsens_id][buf_slot],offset); @@ -313,7 +313,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { ImuScaleGyro(imu); ImuScaleAccel(imu); ImuScaleMag(imu); - + // Copied from booz2_main -- 5143134f060fcc57ce657e17d8b7fc2e72119fd7 // mmt 6/15/09 if (ahrs.status == AHRS_UNINIT) { @@ -350,7 +350,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { float tilt_comp_x = xsens_mag_x[xsens_id] * cos(pitch) + xsens_mag_y[xsens_id] * sin(roll) * sin(pitch) - xsens_mag_z[xsens_id] * cos(roll) * sin(pitch); - float tilt_comp_y = xsens_mag_y[xsens_id] * cos(roll) + float tilt_comp_y = xsens_mag_y[xsens_id] * cos(roll) + xsens_mag_z[xsens_id] * sin(roll); xsens_mag_heading[xsens_id] = -atan2( tilt_comp_y, tilt_comp_x); } @@ -376,7 +376,7 @@ void xsens_parse_msg( uint8_t xsens_id ) { xsens_rmat[xsens_id].m[6] = XSENS_DATA_Matrix_g(xsens_msg_buf[xsens_id][buf_slot],offset); xsens_rmat[xsens_id].m[7] = XSENS_DATA_Matrix_h(xsens_msg_buf[xsens_id][buf_slot],offset); xsens_rmat[xsens_id].m[8] = XSENS_DATA_Matrix_i(xsens_msg_buf[xsens_id][buf_slot],offset); - + FLOAT_RMAT_COMP_INV(xsens_rmat_adj[xsens_id], xsens_rmat_neutral[xsens_id], xsens_rmat[xsens_id]); // Calculate roll, pitch, yaw from rotation matrix ( p 31-33 MTi-G USer Man and Tech Doc) @@ -414,10 +414,10 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { ck[xsens_id] += c; switch (xsens_status[xsens_id]) { case UNINIT: - // Look for xsens start byte + // Look for xsens start byte if (c != XSENS_START) goto error; - xsens_status[xsens_id]++; + xsens_status[xsens_id]++; ck[xsens_id] = 0; // Reset checksum break; case GOT_START: @@ -434,7 +434,7 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { case GOT_MID: // Save message length xsens_len[xsens_id][buf_slot] = c; - // check for valid message length + // check for valid message length if (xsens_len[xsens_id][buf_slot] > XSENS_MAX_PAYLOAD) goto error; xsens_msg_idx[xsens_id] = 0; // Reset buffer index @@ -461,7 +461,7 @@ void parse_xsens_msg( uint8_t xsens_id, uint8_t c ) { break; } return; - error: + error: restart: // Start over (Reset parser state) xsens_status[xsens_id] = UNINIT; diff --git a/sw/airborne/csc/mercury_xsens.h b/sw/airborne/csc/mercury_xsens.h index 743336a100..9b04d79737 100644 --- a/sw/airborne/csc/mercury_xsens.h +++ b/sw/airborne/csc/mercury_xsens.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Joby Energy - * + * * * paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -29,7 +29,7 @@ #define XSENS_COUNT 1 -extern uint8_t xsens_mode[XSENS_COUNT]; // Receiver status +extern uint8_t xsens_mode[XSENS_COUNT]; // Receiver status extern volatile uint8_t xsens_msg_received[XSENS_COUNT]; extern float xsens_phi[XSENS_COUNT]; @@ -100,4 +100,4 @@ void xsens_parse_msg(uint8_t xsens_id); void xsens_event_task(void); void xsens_periodic_task(void); -#endif +#endif diff --git a/sw/airborne/csc/ppm_bridge_main.c b/sw/airborne/csc/ppm_bridge_main.c index 161a95a39f..01e829a75b 100644 --- a/sw/airborne/csc/ppm_bridge_main.c +++ b/sw/airborne/csc/ppm_bridge_main.c @@ -1,6 +1,6 @@ /* * $Id: booz2_main.c 3049 2009-02-24 16:51:25Z poine $ - * + * * Copyright (C) 2008 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/datalink.c b/sw/airborne/datalink.c index fd64b4e7c1..610d94bb4d 100644 --- a/sw/airborne/datalink.c +++ b/sw/airborne/datalink.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file datalink.c diff --git a/sw/airborne/datalink.h b/sw/airborne/datalink.h index 95e519c6f6..690b06462a 100644 --- a/sw/airborne/datalink.h +++ b/sw/airborne/datalink.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file datalink.h @@ -36,11 +36,11 @@ #endif #ifdef __IEEE_BIG_ENDIAN /* From machine/ieeefp.h */ -#define Swap32IfBigEndian(_u) { _u = (_u << 32) | (_u >> 32); } +#define Swap32IfBigEndian(_u) { _u = (_u << 32) | (_u >> 32); } #else #define Swap32IfBigEndian(_) {} #endif - + #include "std.h" #include "dl_protocol.h" diff --git a/sw/airborne/discsurvey.c b/sw/airborne/discsurvey.c index b3a194ed57..e092566421 100644 --- a/sw/airborne/discsurvey.c +++ b/sw/airborne/discsurvey.c @@ -44,13 +44,13 @@ bool_t disc_survey( uint8_t center, float radius) { status = DOWNWIND; } else { float w = sqrt(radius*radius - d*d) - 1.5*grid; - + float crosswind_x = - upwind_y; float crosswind_y = upwind_x; - + c2.x = waypoints[center].x+d*upwind_x-w*sign*crosswind_x; c2.y = waypoints[center].y+d*upwind_y-w*sign*crosswind_y; - + status = SEGMENT; } nav_init_stage(); diff --git a/sw/airborne/downlink.c b/sw/airborne/downlink.c index 8a171905fc..dbd07749aa 100644 --- a/sw/airborne/downlink.c +++ b/sw/airborne/downlink.c @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/downlink.h b/sw/airborne/downlink.h index 6790eb368b..553bc84691 100644 --- a/sw/airborne/downlink.h +++ b/sw/airborne/downlink.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/downlink_transport.h b/sw/airborne/downlink_transport.h index 83b6022902..c2e57cd925 100644 --- a/sw/airborne/downlink_transport.h +++ b/sw/airborne/downlink_transport.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id: downlink_transport.h 4766 2010-03-30 10:00:29Z hecto $ - * + * * Copyright (C) 2003-2010 The Paparazzi Team * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/fbw_downlink.h b/sw/airborne/fbw_downlink.h index 49ab1ff416..1de2e23513 100644 --- a/sw/airborne/fbw_downlink.h +++ b/sw/airborne/fbw_downlink.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2006- Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/firmwares/beth/bench_sensors_can.c b/sw/airborne/firmwares/beth/bench_sensors_can.c index a263a14f62..597f798151 100644 --- a/sw/airborne/firmwares/beth/bench_sensors_can.c +++ b/sw/airborne/firmwares/beth/bench_sensors_can.c @@ -46,7 +46,7 @@ static void can_rx_callback(uint32_t id, uint8_t *buf, int len) { if ((tempangle == 0 )||(tempangle > 6000)) {can_err_flags = 0x20;} else {bench_sensors.angle_3 = tempangle;} rx_bd2 = 0; LED_TOGGLE(4); - } + } else { tempangle = (buf[3]<<8) | buf[2]; if ((tempangle == 0 )||(tempangle > 6000)) {can_err_flags = 0x10;} else {bench_sensors.angle_1 = tempangle;} diff --git a/sw/airborne/firmwares/beth/bench_sensors_i2c.c b/sw/airborne/firmwares/beth/bench_sensors_i2c.c index 500dda8f94..a3dbd415a6 100644 --- a/sw/airborne/firmwares/beth/bench_sensors_i2c.c +++ b/sw/airborne/firmwares/beth/bench_sensors_i2c.c @@ -20,7 +20,7 @@ void read_bench_sensors(void) { bench_sensors.status = BS_BUSY; bench_sensors.i2c_done = FALSE; i2c2_receive(bench_addr, 4, &bench_sensors.i2c_done); - + } @@ -30,5 +30,5 @@ void read_bench_sensors2(void) { bench_sensors2.status = BS_BUSY; bench_sensors2.i2c_done = FALSE; i2c2_receive(bench_addr2, 4, &bench_sensors2.i2c_done); - + } diff --git a/sw/airborne/firmwares/beth/main_beth.c b/sw/airborne/firmwares/beth/main_beth.c index afeacdd6b5..42da9633e3 100644 --- a/sw/airborne/firmwares/beth/main_beth.c +++ b/sw/airborne/firmwares/beth/main_beth.c @@ -46,10 +46,10 @@ static inline void main_event_task( void ) { static inline void main_on_bench_sensors( void ) { - + DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &bench_sensors_angle_1, &bench_sensors_angle_2); - + } diff --git a/sw/airborne/firmwares/beth/main_coders.c b/sw/airborne/firmwares/beth/main_coders.c index 078da21ad6..5b127f2b70 100644 --- a/sw/airborne/firmwares/beth/main_coders.c +++ b/sw/airborne/firmwares/beth/main_coders.c @@ -20,7 +20,7 @@ /* * * PC.01 (ADC Channel11) ext1-20 coder_values[1] -Paul : using channel 10 instead of 14 +Paul : using channel 10 instead of 14 * PC.04 (ADC Channel14) ext2-12 coder_values[0] * * PB.10 I2C2 SCL ext2-14 @@ -83,13 +83,13 @@ static inline void main_init( void ) { static inline void main_periodic( void ) { /*RunOnceEvery(10, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});*/ - + //RunOnceEvery(5, {DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &coder_values[0], &coder_values[1]);}); //RunOnceEvery(5, {DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &can1_status, &can1_pending);}); /*RunOnceEvery(5, {DOWNLINK_SEND_BETH(DefaultChannel, &bench_sensors.angle_1, &bench_sensors.angle_2,&bench_sensors.angle_3, &bench_sensors.current);});*/ - + servos[0]=coder_values[0]; servos[1]=coder_values[1]; //use id=1 for azimuth board @@ -104,7 +104,7 @@ static inline void main_event( void ) { /*static inline void main_on_bench_sensors( void ) { - + }*/ @@ -122,7 +122,7 @@ void i2c2_init(void) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE); /* Enable GPIOB clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); - + /* NVIC configuration ------------------------------------------------------*/ NVIC_InitTypeDef NVIC_InitStructure; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); @@ -132,12 +132,12 @@ void i2c2_init(void) { NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); - /* Configure and enable I2C2 error interrupt -------------------------------*/ + /* Configure and enable I2C2 error interrupt -------------------------------*/ NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; NVIC_Init(&NVIC_InitStructure); - + /* GPIO configuration ------------------------------------------------------*/ GPIO_InitTypeDef GPIO_InitStructure; /* Configure I2C2 pins: SCL and SDA ----------------------------------------*/ @@ -145,7 +145,7 @@ void i2c2_init(void) { GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; GPIO_Init(GPIOB, &GPIO_InitStructure); - + /* Enable I2C2 -------------------------------------------------------------*/ I2C_Cmd(I2C2, ENABLE); /* I2C2 configuration ------------------------------------------------------*/ @@ -170,9 +170,9 @@ void i2c2_ev_irq_handler(void) { { /* Slave Transmitter ---------------------------------------------------*/ case I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED: /* EV1 */ - memcpy(i2c2_buf, coder_values, MY_I2C2_BUF_LEN); + memcpy(i2c2_buf, coder_values, MY_I2C2_BUF_LEN); i2c2_idx = 0; - + case I2C_EVENT_SLAVE_BYTE_TRANSMITTED: /* EV3 */ /* Transmit I2C2 data */ if (i2c2_idx < MY_I2C2_BUF_LEN) { @@ -180,7 +180,7 @@ void i2c2_ev_irq_handler(void) { i2c2_idx++; } break; - + case I2C_EVENT_SLAVE_STOP_DETECTED: /* EV4 */ LED_ON(1); @@ -216,17 +216,17 @@ static inline void main_init_adc(void) { /* Enable DMA1 clock */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); - + /* Enable ADC1 and GPIOC clock */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | + RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_GPIOC, ENABLE); - + /* Configure PC.01 (ADC Channel11) and PC.04 (ADC Channel14) as analog input-*/ GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOC, &GPIO_InitStructure); - + /* DMA1 channel1 configuration ----------------------------------------------*/ DMA_InitTypeDef DMA_InitStructure; DMA_DeInit(DMA1_Channel1); @@ -242,10 +242,10 @@ static inline void main_init_adc(void) { DMA_InitStructure.DMA_Priority = DMA_Priority_High; DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; DMA_Init(DMA1_Channel1, &DMA_InitStructure); - + /* Enable DMA1 channel1 */ DMA_Cmd(DMA1_Channel1, ENABLE); - + /* ADC1 configuration ------------------------------------------------------*/ ADC_InitTypeDef ADC_InitStructure; ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult; @@ -256,15 +256,15 @@ static inline void main_init_adc(void) { ADC_InitStructure.ADC_NbrOfChannel = 1; ADC_Init(ADC1, &ADC_InitStructure); - /* ADC1 regular channel14 configuration */ + /* ADC1 regular channel14 configuration */ //ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_239Cycles5); //Paul: Changing to use chan 10 instead ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_239Cycles5); /* Enable ADC1 DMA */ ADC_DMACmd(ADC1, ENABLE); - - + + /* ADC2 configuration ------------------------------------------------------*/ ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult; ADC_InitStructure.ADC_ScanConvMode = ENABLE; @@ -273,16 +273,16 @@ static inline void main_init_adc(void) { ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 1; ADC_Init(ADC2, &ADC_InitStructure); - /* ADC2 regular channels configuration */ + /* ADC2 regular channels configuration */ ADC_RegularChannelConfig(ADC2, ADC_Channel_11, 1, ADC_SampleTime_239Cycles5); /* Enable ADC2 external trigger conversion */ ADC_ExternalTrigConvCmd(ADC2, ENABLE); - + /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE); - /* Enable ADC1 reset calibaration register */ + /* Enable ADC1 reset calibaration register */ ADC_ResetCalibration(ADC1); /* Check the end of ADC1 reset calibration register */ while(ADC_GetResetCalibrationStatus(ADC1)); @@ -295,7 +295,7 @@ static inline void main_init_adc(void) { /* Enable ADC2 */ ADC_Cmd(ADC2, ENABLE); - /* Enable ADC2 reset calibaration register */ + /* Enable ADC2 reset calibaration register */ ADC_ResetCalibration(ADC2); /* Check the end of ADC2 reset calibration register */ while(ADC_GetResetCalibrationStatus(ADC2)); @@ -306,8 +306,8 @@ static inline void main_init_adc(void) { while(ADC_GetCalibrationStatus(ADC2)); - /* Start ADC1 Software Conversion */ - ADC_SoftwareStartConvCmd(ADC1, ENABLE); + /* Start ADC1 Software Conversion */ + ADC_SoftwareStartConvCmd(ADC1, ENABLE); } diff --git a/sw/airborne/firmwares/beth/main_overo.c b/sw/airborne/firmwares/beth/main_overo.c index 6850e2ce09..82758ef092 100644 --- a/sw/airborne/firmwares/beth/main_overo.c +++ b/sw/airborne/firmwares/beth/main_overo.c @@ -62,38 +62,38 @@ struct ImuFloat imu_float; static uint32_t foo = 0; static uint8_t spi_crc_ok = 1; static uint8_t last_state = 1; - + int main(int argc, char *argv[]) { - + (void) signal(SIGINT, main_exit); //set IMU neutrals RATES_ASSIGN(imu.gyro_neutral, IMU_GYRO_P_NEUTRAL, IMU_GYRO_Q_NEUTRAL, IMU_GYRO_R_NEUTRAL); VECT3_ASSIGN(imu.accel_neutral, IMU_ACCEL_X_NEUTRAL, IMU_ACCEL_Y_NEUTRAL, IMU_ACCEL_Z_NEUTRAL); VECT3_ASSIGN(imu.mag_neutral, IMU_MAG_X_NEUTRAL, IMU_MAG_Y_NEUTRAL, IMU_MAG_Z_NEUTRAL); - + if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return -1; } - + /* Initalize the event library */ event_init(); control_init(); estimator_init(); - + // file_logger_init("my_log.data"); gcs_com_init(); if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return -1; + return -1; } //main_parse_cmd_line(argc, argv); - + event_dispatch(); //should never occur! printf("goodbye! (%d)\n",foo); @@ -109,7 +109,7 @@ static void main_periodic(int my_sig_num) { if (!(foo%2000)) { if (bar) { controller.tilt_sp = -0.4; bar=0; - }else{ + }else{ controller.tilt_sp = 0.4; bar=1; } } @@ -117,7 +117,7 @@ static void main_periodic(int my_sig_num) { //if (foo >2000 ) { controller.armed=1;} RunOnceEvery(50, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM);}); - + main_talk_with_stm32(); ImuScaleGyro(imu); @@ -127,10 +127,10 @@ static void main_periodic(int my_sig_num) { &msg_in.payload.msg_up.bench_sensor.z,&msg_in.payload.msg_up.cnt, &msg_in.payload.msg_up.can_errs,&msg_in.payload.msg_up.spi_errs, &msg_in.payload.msg_up.thrust_out,&msg_in.payload.msg_up.pitch_out);}); - + estimator_run(msg_in.payload.msg_up.bench_sensor.z,msg_in.payload.msg_up.bench_sensor.y, msg_in.payload.msg_up.bench_sensor.x); - + if ( msg_in.payload.msg_up.cnt == 0) printf("STM indicates overo link is lost! %d %d\n", msg_in.payload.msg_up.cnt,msg_in.payload.msg_up.can_errs); if ( msg_in.payload.msg_up.cnt == 1) printf("STM indicates overo link is regained. %d %d\n", diff --git a/sw/airborne/firmwares/beth/overo_controller.c b/sw/airborne/firmwares/beth/overo_controller.c index 3e4548f0a6..61e70f0216 100644 --- a/sw/airborne/firmwares/beth/overo_controller.c +++ b/sw/airborne/firmwares/beth/overo_controller.c @@ -72,21 +72,21 @@ void control_run(void) { */ const float dt_ctl = 1./512.; const float thrust_constant = 40.; - + controller.tilt_ref = controller.tilt_ref + controller.tilt_dot_ref * dt_ctl; controller.tilt_dot_ref = controller.tilt_dot_ref + controller.tilt_ddot_ref * dt_ctl; - controller.tilt_ddot_ref = -2*controller.omega_tilt_ref*controller.xi_ref*controller.tilt_dot_ref - - controller.omega_tilt_ref*controller.omega_tilt_ref*(controller.tilt_ref - controller.tilt_sp); + controller.tilt_ddot_ref = -2*controller.omega_tilt_ref*controller.xi_ref*controller.tilt_dot_ref + - controller.omega_tilt_ref*controller.omega_tilt_ref*(controller.tilt_ref - controller.tilt_sp); controller.elevation_ref = controller.elevation_ref + controller.elevation_dot_ref * dt_ctl; controller.elevation_dot_ref = controller.elevation_dot_ref + controller.elevation_ddot_ref * dt_ctl; - controller.elevation_ddot_ref = -2*controller.omega_elevation_ref*controller.xi_ref*controller.elevation_dot_ref - - controller.omega_elevation_ref*controller.omega_elevation_ref*(controller.elevation_ref - controller.elevation_sp); + controller.elevation_ddot_ref = -2*controller.omega_elevation_ref*controller.xi_ref*controller.elevation_dot_ref + - controller.omega_elevation_ref*controller.omega_elevation_ref*(controller.elevation_ref - controller.elevation_sp); controller.azimuth_ref = controller.azimuth_ref + controller.azimuth_dot_ref * dt_ctl; controller.azimuth_dot_ref = controller.azimuth_dot_ref + controller.azimuth_ddot_ref * dt_ctl; - controller.azimuth_ddot_ref = -2*controller.omega_azimuth_ref*controller.xi_ref*controller.azimuth_dot_ref - - controller.omega_azimuth_ref*controller.omega_azimuth_ref*(controller.azimuth_ref - controller.azimuth_sp); + controller.azimuth_ddot_ref = -2*controller.omega_azimuth_ref*controller.xi_ref*controller.azimuth_dot_ref + - controller.omega_azimuth_ref*controller.omega_azimuth_ref*(controller.azimuth_ref - controller.azimuth_sp); static int foo=0; @@ -119,9 +119,9 @@ void control_run(void) { controller.cmd_azimuth_fb = controller.one_over_J * (2 * controller.xi_cl * controller.omega_cl * err_azimuth_dot) + controller.one_over_J * (controller.omega_cl * controller.omega_cl * err_azimuth); - controller.cmd_pitch = controller.cmd_pitch_ff + controller.cmd_pitch_fb;// + - controller.tilt_sp = - controller.azim_gain * (-controller.cmd_azimuth_fb );//+ controller.cmd_azimuth_ff); + controller.cmd_pitch = controller.cmd_pitch_ff + controller.cmd_pitch_fb;// + + controller.tilt_sp = + controller.azim_gain * (-controller.cmd_azimuth_fb );//+ controller.cmd_azimuth_ff); controller.cmd_thrust = controller.cmd_thrust_ff + controller.cmd_thrust_fb + thrust_constant; controller.cmd_thrust = controller.cmd_thrust*(1/cos(estimator.elevation)); @@ -134,7 +134,7 @@ void control_run(void) { //printf("thrust: ff:%f fb:%f (%f %f)\n",controller.cmd_thrust_ff, controller.cmd_thrust_fb,estimator.elevation,estimator.elevation_dot); //printf("%f %f %f\n",controller.tilt_ref,controller.tilt_dot_ref,controller.tilt_ddot_ref); } - foo++; + foo++; } diff --git a/sw/airborne/firmwares/beth/overo_controller.h b/sw/airborne/firmwares/beth/overo_controller.h index dcf27e756d..2aae1ffd77 100644 --- a/sw/airborne/firmwares/beth/overo_controller.h +++ b/sw/airborne/firmwares/beth/overo_controller.h @@ -4,11 +4,11 @@ struct OveroController { // float kp; // float kd; - + float tilt_sp; float elevation_sp; float azimuth_sp; - + /* modele de reference */ float tilt_ref; float tilt_dot_ref; diff --git a/sw/airborne/firmwares/beth/overo_estimator.c b/sw/airborne/firmwares/beth/overo_estimator.c index b74f96735d..432df316b7 100644 --- a/sw/airborne/firmwares/beth/overo_estimator.c +++ b/sw/airborne/firmwares/beth/overo_estimator.c @@ -24,7 +24,7 @@ void estimator_send_messages(void) { //bench sensors z,y,x values passed in void estimator_run(uint16_t tilt_measure, uint16_t elevation_measure, uint16_t azimuth_measure) { - + const int32_t tilt_neutral = 1970; const float tilt_scale = 1./580.; const int32_t azimuth_neutral = 2875; @@ -36,7 +36,7 @@ void estimator_run(uint16_t tilt_measure, uint16_t elevation_measure, uint16_t a estimator.tilt = -(tilt_neutral - (int32_t)tilt_measure ) * tilt_scale; Bound(estimator.tilt,-89,89); //low pass filter tilt gyro - estimator.tilt_dot = estimator.tilt_dot + + estimator.tilt_dot = estimator.tilt_dot + estimator.tilt_lp_coeff * (RATE_FLOAT_OF_BFP(imu.gyro.q) - estimator.tilt_dot); /* Second order filter yet to be tested estimator.tilt_dot = estimator.tilt_dot * (2 - estimator.tilt_lp_coeff1 - estimator.tilt_lp_coeff2) + @@ -52,14 +52,14 @@ void estimator_run(uint16_t tilt_measure, uint16_t elevation_measure, uint16_t a float rotated_elev_dot = RATE_FLOAT_OF_BFP(imu.gyro.p) * cos(estimator.tilt) + RATE_FLOAT_OF_BFP(imu.gyro.r) * sin(estimator.tilt); //low pass filter -- should probably increase order and maybe move filtering to measured values. - estimator.elevation_dot = estimator.elevation_dot + + estimator.elevation_dot = estimator.elevation_dot + estimator.elevation_lp_coeff * (rotated_elev_dot - estimator.elevation_dot); estimator.azimuth = (azimuth_neutral - (int32_t)azimuth_measure ) * azimuth_scale; //low pass filter azimuth gyro //TODO: compensate rotation and increase order - estimator.azimuth_dot = estimator.azimuth_dot + + estimator.azimuth_dot = estimator.azimuth_dot + estimator.azimuth_lp_coeff * (RATE_FLOAT_OF_BFP(imu.gyro.r) - estimator.azimuth_dot); } diff --git a/sw/airborne/firmwares/beth/overo_estimator.h b/sw/airborne/firmwares/beth/overo_estimator.h index 5150083c7a..dd93763179 100644 --- a/sw/airborne/firmwares/beth/overo_estimator.h +++ b/sw/airborne/firmwares/beth/overo_estimator.h @@ -8,7 +8,7 @@ struct OveroEstimator { float azimuth; float elevation; float tilt; - + float azimuth_dot; float elevation_dot; float tilt_dot; diff --git a/sw/airborne/firmwares/beth/overo_gcs_com.c b/sw/airborne/firmwares/beth/overo_gcs_com.c index db1f7da99a..d2a74517fc 100644 --- a/sw/airborne/firmwares/beth/overo_gcs_com.c +++ b/sw/airborne/firmwares/beth/overo_gcs_com.c @@ -28,14 +28,14 @@ void gcs_com_init(void) { gcs_com.network = network_new(GCS_HOST,GCS_PORT,DATALINK_PORT,FALSE); gcs_com.udp_transport = udp_transport_new(gcs_com.network); - + event_set(&gcs_com.datalink_event, gcs_com.network->socket_in, EV_READ| EV_PERSIST, on_datalink_event, gcs_com.udp_transport); event_add(&gcs_com.datalink_event, NULL); - + } void gcs_com_periodic(void) { - if (gcs_com.udp_transport->Periodic) + if (gcs_com.udp_transport->Periodic) gcs_com.udp_transport->Periodic(gcs_com.udp_transport->impl); } @@ -58,7 +58,7 @@ static void on_datalink_event(int fd, short event __attribute__((unused)), void udp_impl->udp_dl_msg_received = FALSE; } } - + } #define IdOfMsg(x) (x[1]) @@ -66,11 +66,11 @@ static void on_datalink_event(int fd, short event __attribute__((unused)), void static void dl_handle_msg(struct DownlinkTransport *tp) { uint8_t msg_id = IdOfMsg(gcs_com.my_dl_buffer); switch (msg_id) { - + case DL_PING: DOWNLINK_SEND_PONG(tp); break; - + case DL_SETTING : { uint8_t i = DL_SETTING_index(gcs_com.my_dl_buffer); diff --git a/sw/airborne/firmwares/beth/overo_sfb_controller.c b/sw/airborne/firmwares/beth/overo_sfb_controller.c index 61c8335a79..e2ef819db0 100644 --- a/sw/airborne/firmwares/beth/overo_sfb_controller.c +++ b/sw/airborne/firmwares/beth/overo_sfb_controller.c @@ -43,16 +43,16 @@ void control_init(void) { _CO.cmd_df_pitch = 0.; _CO.cmd_df_thrust = 0.; - + _CO.cmd_pitch = 0.; _CO.cmd_thrust = 0.; - + _CO.a = 0.03;//theoretical=19.62 _CO.a = 0.06; //_CO.b = 0.27;//theoretical=157.21 _CO.b = 0.86; _CO.u_t_ref = 70; - + /*omegas - natural frequencies*/ _CO.o_tilt = RadOfDeg(300);//was 100 _CO.o_elev = RadOfDeg(100); @@ -61,7 +61,7 @@ void control_init(void) { /*zetas - damping ratios*/ _CO.z_tilt = 1.; _CO.z_elev = 1.; - _CO.z_azim = 1.; + _CO.z_azim = 1.; _CO.armed = 0; } @@ -71,28 +71,28 @@ void control_init(void) { void control_run(void) { static int foo=0; - + calc_df_cmd(); - + _CO.u_t_ref = _CO.cmd_df_thrust; calc_sfb_cmd(); - + _CO.cmd_pitch = _CO.cmd_sfb_pitch + _CO.cmd_df_pitch; _CO.cmd_thrust = _CO.cmd_sfb_thrust + _CO.cmd_df_thrust; if (!(foo%100)) { printf("P:%f T:%f \n",_CO.cmd_df_pitch,_CO.cmd_df_thrust); } - foo++; - + foo++; + Bound(_CO.cmd_thrust,0,100); - Bound(_CO.cmd_pitch,-100,100); + Bound(_CO.cmd_pitch,-100,100); } void calc_df_cmd(void) { - + static uint32_t timecnt = 0; static float time = 0; @@ -102,36 +102,36 @@ void calc_df_cmd(void) { const float freq2 = 1./(1. * 3.14159); const float const1 = 9.8/75.; const float const2 = 0.04; - + if (_CO.armed) time = timecnt++ * dt; - + /* x2 = x2 + x3*dt; x3 = x3 + x4*dt;*/ //x4 = GAIN*sin (2 * 3.14159 * freq2 * time); - x0 = GAIN*cos (2 * 3.14159 * freq2 * time); - x1 = -GAIN*sin (2 * 3.14159 * freq2 * time); - x2 = -GAIN*cos (2 * 3.14159 * freq2 * time); - x3 = GAIN*sin (2 * 3.14159 * freq2 * time); - x4 = GAIN*cos (2 * 3.14159 * freq2 * time); - + x0 = GAIN*cos (2 * 3.14159 * freq2 * time); + x1 = -GAIN*sin (2 * 3.14159 * freq2 * time); + x2 = -GAIN*cos (2 * 3.14159 * freq2 * time); + x3 = GAIN*sin (2 * 3.14159 * freq2 * time); + x4 = GAIN*cos (2 * 3.14159 * freq2 * time); + /* z0 = z0 + z1*dt ; z1 = z1 + z2*dt ; - z2 = z2 + z3*dt ; + z2 = z2 + z3*dt ; z3 = z3 + z4*dt ;*/ z0 = GAIN*sin (2 * 3.14159 * freq1 * time); z1 = GAIN*cos (2 * 3.14159 * freq1 * time); z2 = -GAIN*sin (2 * 3.14159 * freq1 * time); z3 = -GAIN*cos (2 * 3.14159 * freq1 * time); - z4 = GAIN*sin (2 * 3.14159 * freq1 * time); + z4 = GAIN*sin (2 * 3.14159 * freq1 * time); _CO.cmd_df_thrust = (1/const1) * sqrt( powf( x2,2) + powf( (z2 + g) ,2) ) ; - _CO.cmd_df_pitch = (1/const2) * + _CO.cmd_df_pitch = (1/const2) * ( ( x4*(z2+1) - z4*x2 )*( powf(z2 + g,2) + powf(x2,2) ) - ( 2 * (z2 + g) * z3 + 2*x2*x3 ) * ( x3*(z2+g)-z3*x2 ) ) / powf( ( powf(z2+g,2) + powf(x2,2) ) , 2); - + Bound(_CO.cmd_df_thrust,0,100); - Bound(_CO.cmd_df_pitch,-100,100); + Bound(_CO.cmd_df_pitch,-100,100); } void calc_sfb_cmd(void) { @@ -158,27 +158,27 @@ void calc_sfb_cmd(void) { */ _CO.cmd_sfb_pitch = -1*( -1* - err_azimuth - * ( _CO.o_tilt * _CO.o_tilt * _CO.o_azim * _CO.o_azim * cos(estimator.tilt) ) + err_azimuth + * ( _CO.o_tilt * _CO.o_tilt * _CO.o_azim * _CO.o_azim * cos(estimator.tilt) ) / ( _CO.b * _CO.a * _CO.u_t_ref) + - err_elevation - * ( _CO.o_tilt * _CO.o_tilt * _CO.o_elev * _CO.o_elev * sin(estimator.tilt) ) + err_elevation + * ( _CO.o_tilt * _CO.o_tilt * _CO.o_elev * _CO.o_elev * sin(estimator.tilt) ) / ( _CO.b * _CO.a * _CO.u_t_ref) - - err_tilt + err_tilt * ( _CO.o_tilt * _CO.o_tilt ) / ( _CO.b ) -//+ - err_azimuth_dot - * ( _CO.o_tilt * _CO.o_tilt * 2 * _CO.z_azim * _CO.o_azim * cos(estimator.tilt) ) + err_azimuth_dot + * ( _CO.o_tilt * _CO.o_tilt * 2 * _CO.z_azim * _CO.o_azim * cos(estimator.tilt) ) / ( _CO.b * _CO.a * _CO.u_t_ref) + - err_elevation_dot - * ( _CO.o_tilt * _CO.o_tilt * 2 * _CO.z_elev * _CO.o_elev * sin(estimator.tilt) ) + err_elevation_dot + * ( _CO.o_tilt * _CO.o_tilt * 2 * _CO.z_elev * _CO.o_elev * sin(estimator.tilt) ) / ( _CO.b * _CO.a * _CO.u_t_ref) - - err_tilt_dot - * ( 2 * _CO.o_tilt * _CO.z_tilt ) + err_tilt_dot + * ( 2 * _CO.o_tilt * _CO.z_tilt ) / ( _CO.b ) ); - - _CO.cmd_sfb_thrust = - err_azimuth * _CO.o_azim * _CO.o_azim * sin(estimator.tilt) / _CO.a - - err_elevation * _CO.o_elev * _CO.o_elev * cos(estimator.tilt) / _CO.a + + + _CO.cmd_sfb_thrust = + err_azimuth * _CO.o_azim * _CO.o_azim * sin(estimator.tilt) / _CO.a - + err_elevation * _CO.o_elev * _CO.o_elev * cos(estimator.tilt) / _CO.a + err_azimuth_dot * 2 * _CO.z_azim * _CO.o_azim * sin(estimator.tilt) / _CO.a - err_elevation_dot * 2 * _CO.z_elev * _CO.o_elev * cos(estimator.tilt) / _CO.a ; diff --git a/sw/airborne/firmwares/beth/overo_sfb_controller.h b/sw/airborne/firmwares/beth/overo_sfb_controller.h index 8558f355a8..f3e10129f3 100644 --- a/sw/airborne/firmwares/beth/overo_sfb_controller.h +++ b/sw/airborne/firmwares/beth/overo_sfb_controller.h @@ -2,11 +2,11 @@ #define OVERO_CONTROLLER_H struct OveroController { - + float tilt_sp; float elevation_sp; float azimuth_sp; - + float tilt_ref; float elevation_ref; float azimuth_ref; @@ -37,10 +37,10 @@ struct OveroController { float cmd_df_pitch; float cmd_df_thrust; - + float cmd_pitch; float cmd_thrust; - + int armed; }; diff --git a/sw/airborne/firmwares/beth/overo_test_uart.c b/sw/airborne/firmwares/beth/overo_test_uart.c index 5e34b7e264..b3c78bbdc2 100644 --- a/sw/airborne/firmwares/beth/overo_test_uart.c +++ b/sw/airborne/firmwares/beth/overo_test_uart.c @@ -95,13 +95,13 @@ int main(int argc, char *argv[]) { printf("Rebuild with GPS configure support.\n"); #endif } - + printf("Using /dev/ttyUSB%d for GPS\n",portnum); - + (void) signal(SIGINT, main_exit); - uart_init(); + uart_init(); gps_init(); /* Initalize the event library */ @@ -111,13 +111,13 @@ int main(int argc, char *argv[]) { if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return -1; + return -1; } -#ifdef GPS_CONFIGURE +#ifdef GPS_CONFIGURE //periodic task is launched so we are now ready to use uart to request gps baud change... if (configgps) gps_configure_uart(); -#endif +#endif event_dispatch(); //should never occur! printf("goodbye! (%d)\n",foo); @@ -128,11 +128,11 @@ int main(int argc, char *argv[]) { static void main_periodic(int my_sig_num) { - + RunOnceEvery(50, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM);}); RunOnceEvery(5, {DOWNLINK_SEND_ADC_GENERIC(gcs_com.udp_transport,&adc1,&adc2);}); -#ifdef USE_UART0 +#ifdef USE_UART0 uart0_handler(); #endif #ifdef USE_UART1 @@ -204,13 +204,13 @@ void check_gps(void){ if (gps_configuring) gps_configure(); else { - if (!donegpsconf) { + if (!donegpsconf) { printf("Finished GPS configuration.\n"); donegpsconf=1; - } - parse_gps_msg(); + } + parse_gps_msg(); } -#else +#else parse_gps_msg(); #endif printf("gps msg rx %x %x\n",ubx_class,ubx_id); diff --git a/sw/airborne/firmwares/beth/overo_twist_controller.c b/sw/airborne/firmwares/beth/overo_twist_controller.c index e55fcad81a..cd588f8d2c 100644 --- a/sw/airborne/firmwares/beth/overo_twist_controller.c +++ b/sw/airborne/firmwares/beth/overo_twist_controller.c @@ -86,7 +86,7 @@ void control_init(void) { controller.c = 4.5; controller.error = 0; - + printf("Vm=%f VM=%f satval1=%f satval2=%f c=%f\n",controller.Vm,controller.VM,controller.satval1,controller.satval2,controller.c); } @@ -100,24 +100,24 @@ void control_run(void) { const float dt_ctl = 1./512.; const float thrust_constant = 40.; - //make setpoint a cosine ; for testing + //make setpoint a cosine ; for testing float new_sp = controller.tilt_sp * cos(6.28/5.*foo/512.); - + controller.tilt_ref = controller.tilt_ref + controller.tilt_dot_ref * dt_ctl; controller.tilt_dot_ref = controller.tilt_dot_ref + controller.tilt_ddot_ref * dt_ctl; - controller.tilt_ddot_ref = -2*controller.omega_tilt_ref*controller.xi_ref*controller.tilt_dot_ref - - controller.omega_tilt_ref*controller.omega_tilt_ref*(controller.tilt_ref - new_sp); + controller.tilt_ddot_ref = -2*controller.omega_tilt_ref*controller.xi_ref*controller.tilt_dot_ref + - controller.omega_tilt_ref*controller.omega_tilt_ref*(controller.tilt_ref - new_sp); controller.elevation_ref = controller.elevation_ref + controller.elevation_dot_ref * dt_ctl; controller.elevation_dot_ref = controller.elevation_dot_ref + controller.elevation_ddot_ref * dt_ctl; - controller.elevation_ddot_ref = -2*controller.omega_elevation_ref*controller.xi_ref*controller.elevation_dot_ref - - controller.omega_elevation_ref*controller.omega_elevation_ref*(controller.elevation_ref - controller.elevation_sp); + controller.elevation_ddot_ref = -2*controller.omega_elevation_ref*controller.xi_ref*controller.elevation_dot_ref + - controller.omega_elevation_ref*controller.omega_elevation_ref*(controller.elevation_ref - controller.elevation_sp); #ifdef USE_AZIMUTH controller.azimuth_ref = controller.azimuth_ref + controller.azimuth_dot_ref * dt_ctl; controller.azimuth_dot_ref = controller.azimuth_dot_ref + controller.azimuth_ddot_ref * dt_ctl; - controller.azimuth_ddot_ref = -2*controller.omega_azimuth_ref*controller.xi_ref*controller.azimuth_dot_ref - - controller.omega_azimuth_ref*controller.omega_azimuth_ref*(controller.azimuth_ref - controller.azimuth_sp); + controller.azimuth_ddot_ref = -2*controller.omega_azimuth_ref*controller.xi_ref*controller.azimuth_dot_ref + - controller.omega_azimuth_ref*controller.omega_azimuth_ref*(controller.azimuth_ref - controller.azimuth_sp); #endif @@ -150,7 +150,7 @@ void control_run(void) { controller.cmd_thrust_ff = controller.mass * controller.elevation_ddot_ref; controller.cmd_thrust_fb = -controller.mass * (2 * controller.xi_cl * controller.omega_cl * err_elevation_dot) - controller.mass * (controller.omega_cl * controller.omega_cl * err_elevation); - + #ifdef USE_AZIMUTH controller.cmd_azimuth_ff = controller.one_over_J * controller.azimuth_ddot_ref; controller.cmd_azimuth_fb = controller.one_over_J * (2 * controller.xi_cl * controller.omega_cl * err_azimuth_dot) + @@ -178,7 +178,7 @@ void control_run(void) { //printf("%f %f %f\n",controller.tilt_ref,controller.tilt_dot_ref,controller.tilt_ddot_ref); //printf("t: %f\n",controller.cmd_thrust); } - foo++; + foo++; } @@ -186,7 +186,7 @@ void control_run(void) { /*Fonction qui obtient la commande twisiting à appliquer chaque periode*/ float get_U_twt() -{ +{ /**Definition des constantes du modèle**/ const float Gain = -65; @@ -194,13 +194,13 @@ float get_U_twt() /**Variables utilisés par la loi de commande**/ static volatile float yd[2] = {0.0,0.0}; - static volatile float y[2] = {0.,0.}; + static volatile float y[2] = {0.,0.}; //static float emax = 0.035; // en rad, initialement 2 /**Variables pour l'algorithme**/ float udot; float sens; - + //Acquisition consigne yd[1] = controller.tilt_ref; //Acquisition mesure @@ -218,17 +218,17 @@ float get_U_twt() controller.S[1] = (float)( controller.c * (y[1]-yd[1]) + estimator.tilt_dot - controller.tilt_dot_ref ); controller.S_dot = (controller.S[1] - controller.S[0]); /*************************************/ - + //On va dire que si l'erreur est d'un valeur inferieur a emax, on applique la commande anterieure -/* if ( abs(y[1] - yd[1]) < emax ) { - U_twt[1] = U_twt[0]; +/* if ( abs(y[1] - yd[1]) < emax ) { + U_twt[1] = U_twt[0]; } else {*/ /**Algorithme twisting**/ - if ( controller.S[1] < 0.0 ) + if ( controller.S[1] < 0.0 ) sens = -1.0; - else + else sens = 1.0; - + if ( abs(controller.U_twt[1]) < controller.ulim ) { if ( (controller.S[1] * controller.S_dot) > 0) { udot = -controller.VM * sens; @@ -240,12 +240,12 @@ float get_U_twt() else { udot = -controller.U_twt[1]; } - + // Integration de u, qu'avec 2 valeurs, penser à faire plus // u[1] new , u[0] old controller.U_twt[1] = controller.U_twt[0] + (Te * udot); //} - /**********************/ + /**********************/ /**Saturation de l'integrateur**/ @@ -254,14 +254,14 @@ float get_U_twt() } else { Bound(controller.U_twt[1],-controller.satval2,controller.satval2); - } + } /********************************/ - + /**Mises à jour**/ controller.U_twt[0] = controller.U_twt[1]; yd[0] = yd[1]; y[0] = y[1]; - + controller.S[0] = controller.S[1]; return Gain * controller.U_twt[1]; @@ -269,7 +269,7 @@ float get_U_twt() } float get_U_twt2() -{ +{ /**Definition des constantes du modèle**/ const float Gain = 800.; @@ -277,7 +277,7 @@ float get_U_twt2() /**Variables utilisés par la loi de commande**/ static volatile float yd2[2] = {0.0,0.0}; - static volatile float y2[2] = {0.,0.}; + static volatile float y2[2] = {0.,0.}; //static float emax = 0.035; // en rad, initialement 2 /**Variables pour l'algorithme**/ @@ -286,7 +286,7 @@ float get_U_twt2() static float S2[2]= {0.0,0.0}; static float S2_dot=0; static float U2_twt[2]= {0.0,0.0}; - + //Acquisition consigne yd2[1] = controller.elevation_ref; //Acquisition mesure @@ -304,17 +304,17 @@ float get_U_twt2() S2[1] = (float)( controller.c * (y2[1]-yd2[1]) + estimator.elevation_dot - controller.elevation_dot_ref ); S2_dot = (S2[1] - S2[0]); /*************************************/ - + //On va dire que si l'erreur est d'un valeur inferieur a emax, on applique la commande anterieure -/* if ( abs(y[1] - yd[1]) < emax ) { - U_twt[1] = U_twt[0]; +/* if ( abs(y[1] - yd[1]) < emax ) { + U_twt[1] = U_twt[0]; } else {*/ /**Algorithme twisting**/ - if ( S2[1] < 0.0 ) + if ( S2[1] < 0.0 ) sens2 = -1.0; - else + else sens2 = 1.0; - + if ( abs(U2_twt[1]) < controller.ulim ) { if ( (S2[1] * S2_dot) > 0) { udot2 = -controller.VM * sens2; @@ -326,12 +326,12 @@ float get_U_twt2() else { udot2 = -U2_twt[1]; } - + // Integration de u, qu'avec 2 valeurs, penser à faire plus // u[1] new , u[0] old U2_twt[1] = U2_twt[0] + (Te * udot2); //} - /**********************/ + /**********************/ /**Saturation de l'integrateur**/ @@ -340,24 +340,24 @@ float get_U_twt2() } else { Bound(U2_twt[1],-controller.satval2,controller.satval2); - } + } /********************************/ - + /**Mises à jour**/ U2_twt[0] = U2_twt[1]; yd2[0] = yd2[1]; y2[0] = y2[1]; - + S2[0] = S2[1]; - -#define NUMSAMPS (1000) + +#define NUMSAMPS (1000) float retval = Gain * U2_twt[1]; static int sum = 0; static int i = 0; sum = sum + retval; - + if (i == (NUMSAMPS-1)) { i = 0; printf("avg: %f\n",sum/(float)NUMSAMPS); @@ -365,7 +365,7 @@ float get_U_twt2() } else { i++; } - + return retval; } diff --git a/sw/airborne/firmwares/beth/overo_twist_controller.h b/sw/airborne/firmwares/beth/overo_twist_controller.h index b504f36c27..0a0ace3bda 100644 --- a/sw/airborne/firmwares/beth/overo_twist_controller.h +++ b/sw/airborne/firmwares/beth/overo_twist_controller.h @@ -4,11 +4,11 @@ struct OveroTwistController { // float kp; // float kd; - + float tilt_sp; float elevation_sp; float azimuth_sp; - + /* modele de reference */ float tilt_ref; float tilt_dot_ref; diff --git a/sw/airborne/firmwares/beth/rcv_telemetry.c b/sw/airborne/firmwares/beth/rcv_telemetry.c index ae5d40bfba..8184a61e51 100755 --- a/sw/airborne/firmwares/beth/rcv_telemetry.c +++ b/sw/airborne/firmwares/beth/rcv_telemetry.c @@ -1,6 +1,6 @@ /* * $Id: datalink.c 5626 2010-08-23 18:10:19Z flixr $ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file rcv_telemetry.c @@ -70,7 +70,7 @@ uint16_t adc2; 10 NAVIGATION 12 BAT 16 DESIRED -35 +35 36 37 ENERGY 42 ESTIMATOR @@ -97,8 +97,8 @@ void dl_parse_msg(void) { adc1 = DL_ADC_GENERIC_val1(dl_buffer); adc2 = DL_ADC_GENERIC_val2(dl_buffer); printf("ADC: %d %d\n",adc1,adc2); - } - + } + else { //printf("Tiny msg_id %d unknown\n",msg_id); } diff --git a/sw/airborne/firmwares/beth/uart_hw.c b/sw/airborne/firmwares/beth/uart_hw.c index 133236d4c8..6b0c583ace 100644 --- a/sw/airborne/firmwares/beth/uart_hw.c +++ b/sw/airborne/firmwares/beth/uart_hw.c @@ -32,7 +32,7 @@ #include "fms_serial_port.h" -#ifdef USE_UART0 +#ifdef USE_UART0 volatile uint16_t uart0_rx_insert_idx, uart0_rx_extract_idx; uint8_t uart0_rx_buffer[UART0_RX_BUFFER_SIZE]; @@ -49,22 +49,22 @@ extern uint8_t portnum; //This function will close our UART and reopen with the new baud rate #ifdef GPS_CONFIGURE void uart0_init_param( uint16_t baud, uint8_t mode, uint8_t fmode) { - + //serial_port_flush_output(fmssp0); serial_port_close(fmssp0); fmssp0 = serial_port_new(); if (portnum == 0) { - printf("opening ttyUSB0 on uart0 at %d\n",GPS_BAUD); + printf("opening ttyUSB0 on uart0 at %d\n",GPS_BAUD); serial_port_open_raw(fmssp0,"/dev/ttyUSB0",GPS_BAUD); } if (portnum == 1) { printf("opening ttyUSB1 on uart0 at %d\n",GPS_BAUD); serial_port_open_raw(fmssp0,"/dev/ttyUSB1",GPS_BAUD); } - + uart0_fd = (int)fmssp0->fd; - + // initialize the transmit data queue uart0_tx_extract_idx = 0; uart0_tx_insert_idx = 0; @@ -73,15 +73,15 @@ void uart0_init_param( uint16_t baud, uint8_t mode, uint8_t fmode) { // initialize the receive data queue uart0_rx_extract_idx = 0; uart0_rx_insert_idx = 0; - + } #endif void uart0_init( void ) { fmssp0 = serial_port_new(); - - + + //TODO: set device name in application and pass as argument if (portnum == 0) { printf("opening ttyUSB0 on uart0 at %d\n",UART0_BAUD); @@ -92,7 +92,7 @@ void uart0_init( void ) { serial_port_open_raw(fmssp0,"/dev/ttyUSB1",UART0_BAUD); } uart0_fd = (int)fmssp0->fd; - + // initialize the transmit data queue uart0_tx_extract_idx = 0; uart0_tx_insert_idx = 0; @@ -133,7 +133,7 @@ bool_t uart0_check_free_space( uint8_t len) { void uart0_handler(void) { unsigned char c='D'; - + // check if more data to send if (uart0_tx_insert_idx != uart0_tx_extract_idx) { write(uart0_fd,&uart0_tx_buffer[uart0_tx_extract_idx],1); @@ -148,7 +148,7 @@ void uart0_handler(void) { if(read(uart0_fd,&c,1) > 0){ //printf("r %x %c\n",c,c); uint16_t temp = (uart0_rx_insert_idx + 1) % UART0_RX_BUFFER_SIZE; - uart0_rx_buffer[uart0_rx_insert_idx] = c; + uart0_rx_buffer[uart0_rx_insert_idx] = c; // check for more room in queue if (temp != uart0_rx_extract_idx) uart0_rx_insert_idx = temp; // update insert index @@ -158,7 +158,7 @@ void uart0_handler(void) { #endif /* USE_UART0 */ -#ifdef USE_UART1 +#ifdef USE_UART1 volatile uint16_t uart1_rx_insert_idx, uart1_rx_extract_idx; uint8_t uart1_rx_buffer[UART1_RX_BUFFER_SIZE]; @@ -182,9 +182,9 @@ void uart1_init( void ) { printf("opening ttyUSB0 on uart1 at %d\n",UART1_BAUD); serial_port_open_raw(fmssp1,"/dev/ttyUSB0",UART1_BAUD); } - + uart1_fd = (int)fmssp1->fd; - + // initialize the transmit data queue uart1_tx_extract_idx = 0; uart1_tx_insert_idx = 0; @@ -225,7 +225,7 @@ bool_t uart1_check_free_space( uint8_t len) { void uart1_handler(void) { unsigned char c='D'; - + // check if more data to send if (uart1_tx_insert_idx != uart1_tx_extract_idx) { write(uart1_fd,&uart1_tx_buffer[uart1_tx_extract_idx],1); @@ -240,7 +240,7 @@ void uart1_handler(void) { if(read(uart1_fd,&c,1) > 0){ //printf("s %x %c\n",c,c); uint16_t temp = (uart1_rx_insert_idx + 1) % UART1_RX_BUFFER_SIZE;; - uart1_rx_buffer[uart1_rx_insert_idx] = c; + uart1_rx_buffer[uart1_rx_insert_idx] = c; // check for more room in queue if (temp != uart1_rx_extract_idx) uart1_rx_insert_idx = temp; // update insert index @@ -252,17 +252,17 @@ void uart1_handler(void) { void uart_init( void ) { -#ifdef USE_UART0 +#ifdef USE_UART0 uart0_init(); #endif -#ifdef USE_UART1 +#ifdef USE_UART1 uart1_init(); #endif //TODO: add uart2 and greater -#ifdef USE_UART2 +#ifdef USE_UART2 uart2_init(); #endif -#ifdef USE_UART3 +#ifdef USE_UART3 uart3_init(); #endif } diff --git a/sw/airborne/firmwares/beth/uart_hw.h b/sw/airborne/firmwares/beth/uart_hw.h index 9e77c20b6d..a38c4dd0b3 100644 --- a/sw/airborne/firmwares/beth/uart_hw.h +++ b/sw/airborne/firmwares/beth/uart_hw.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef UART_HW_H @@ -46,7 +46,7 @@ #define UART1_irq_handler usart1_irq_handler #define UART2_irq_handler usart2_irq_handler #define UART3_irq_handler usart3_irq_handler -#define UART5_irq_handler usart5_irq_handler +#define UART5_irq_handler usart5_irq_handler #if defined USE_UART0 || OVERRIDE_UART0_IRQ_HANDLER extern void uart0_handler(void); diff --git a/sw/airborne/firmwares/logger/main_logger.c b/sw/airborne/firmwares/logger/main_logger.c index 4ff0e89539..8f5adf2df1 100644 --- a/sw/airborne/firmwares/logger/main_logger.c +++ b/sw/airborne/firmwares/logger/main_logger.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -45,7 +45,7 @@ 2 MSG_PAYLOAD . DATA (messages.xml) E XBEE_CHECKSUM (sum[A->D]) - + ID is AC_ID for aircraft, 0x100 for ground station */ @@ -163,7 +163,7 @@ int do_log(void); DirList list; EmbeddedFileSystem efs; -EmbeddedFile filer; +EmbeddedFile filer; EmbeddedFile filew; unsigned char xbeel_payload[XBEE_PAYLOAD_LEN]; @@ -185,7 +185,7 @@ void set_filename(unsigned int local, char* name) { /* do not use sprintf or similar */ int i; - + for (i=7; i>=0; i--) { name[i] = (local % 10) + '0'; local /= 10; @@ -221,7 +221,7 @@ unsigned int getclock(void) void log_payload(int len, unsigned char source, unsigned int timestamp) { unsigned char chk; - + /* start delimiter */ log_buffer[0] = STX; @@ -230,7 +230,7 @@ void log_payload(int len, unsigned char source, unsigned int timestamp) /* source */ log_buffer[2] = source; - + /* add a 32bit timestamp */ log_buffer[3] = (timestamp) & 0xFF; // LSB first log_buffer[4] = (timestamp >> 8) & 0xFF; @@ -245,11 +245,11 @@ void log_payload(int len, unsigned char source, unsigned int timestamp) /* write data, start+length+timestamp+data+checksum */ chk = file_write(&filew, LOG_DATA_OFFSET+len+1, log_buffer); - if (len != chk) + if (len != chk) { nb_fail_write++; } - + bytes += chk; nb_messages++; // dl_parse_msg(); @@ -373,7 +373,7 @@ int do_log(void) unsigned int count; unsigned char name[13]; unsigned char inc; - int temp; + int temp; if(efs_init(&efs, 0) != 0) { return(-1); @@ -387,7 +387,7 @@ int do_log(void) file_fclose(&filer); } - if (file_fopen(&filew, &efs.myFs, name, 'w' ) != 0) + if (file_fopen(&filew, &efs.myFs, name, 'w' ) != 0) { return(-1); } @@ -426,12 +426,12 @@ int do_log(void) #ifdef USE_UART0 temp = 0; while (Uart0ChAvailable() && (temp++ < 128)) - { + { // LED_TOGGLE(3); inc = Uart0Getch(); #ifdef LOG_XBEE log_xbee(inc, LOG_SOURCE_UART0); -#else +#else #ifdef LOG_PPRZ log_pprz(inc, LOG_SOURCE_UART0); #else @@ -443,12 +443,12 @@ int do_log(void) #ifdef USE_UART1 temp = 0; while (Uart1ChAvailable() && (temp++ < 128)) - { + { // LED_TOGGLE(3); inc = Uart1Getch(); #ifdef LOG_XBEE log_xbee(inc, LOG_SOURCE_UART1); -#else +#else #ifdef LOG_PPRZ log_pprz(inc, LOG_SOURCE_UART1); #else @@ -491,9 +491,9 @@ int main(void) } else { LED_OFF(2); } - if (((IO0PIN & _BV(LOG_STOP_KEY))>>LOG_STOP_KEY) == 1) { + if (((IO0PIN & _BV(LOG_STOP_KEY))>>LOG_STOP_KEY) == 1) { waitloop=0; - } else { + } else { waitloop++; } } @@ -506,8 +506,8 @@ int main(void) } } LED_ON(2); - while (((IO0PIN & _BV(LOG_STOP_KEY))>>LOG_STOP_KEY) == 0); - } + while (((IO0PIN & _BV(LOG_STOP_KEY))>>LOG_STOP_KEY) == 0); + } return 0; } diff --git a/sw/airborne/firmwares/motor_bench/main_motor_bench.c b/sw/airborne/firmwares/motor_bench/main_motor_bench.c index 7c58132528..2e274a1a9d 100644 --- a/sw/airborne/firmwares/motor_bench/main_motor_bench.c +++ b/sw/airborne/firmwares/motor_bench/main_motor_bench.c @@ -73,7 +73,7 @@ static inline void main_periodic_task( void ) { float torque = 0.; mb_mode_periodic(rpm, thrust, amps); - + float throttle = mb_modes_throttle; #if defined USE_TWI_CONTROLLER @@ -124,5 +124,5 @@ static inline void main_dl_parse_msg(void) { float var = DL_SETTING_value(dl_buffer); DlSetting(i, var); DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &var); - } + } } diff --git a/sw/airborne/firmwares/motor_bench/mb_modes.c b/sw/airborne/firmwares/motor_bench/mb_modes.c index 45589f024e..920f07c763 100644 --- a/sw/airborne/firmwares/motor_bench/mb_modes.c +++ b/sw/airborne/firmwares/motor_bench/mb_modes.c @@ -48,7 +48,7 @@ void mb_mode_init(void) { } -void mb_mode_event(void) {} +void mb_mode_event(void) {} void mb_mode_periodic(float rpm, float thrust, float current) { switch (mb_modes_mode) { diff --git a/sw/airborne/firmwares/motor_bench/mb_servo.c b/sw/airborne/firmwares/motor_bench/mb_servo.c index a2dd213bd4..ed345495a9 100644 --- a/sw/airborne/firmwares/motor_bench/mb_servo.c +++ b/sw/airborne/firmwares/motor_bench/mb_servo.c @@ -9,11 +9,11 @@ void mb_servo_set_ns(uint32_t duration_ns); void mb_servo_init( void ) { /* set P0.21 as PWM5 output */ - PINSEL1 |= (0X01 << 10); + PINSEL1 |= (0X01 << 10); /* enable and select the type of PWM channel */ PWMPCR |= PWMPCR_ENA5; /* set Match0 value (refresh rate) */ - PWMMR0 = MY_NB_CLOCK_TIMER_PWM(5000); + PWMMR0 = MY_NB_CLOCK_TIMER_PWM(5000); /* commit PWMMRx changes */ PWMLER = PWMLER_LATCH0; /* enable PWM timer in PWM mode */ @@ -25,7 +25,7 @@ void mb_servo_init( void ) { void mb_servo_set_range( uint32_t min_pulse_ns, uint32_t max_pulse_ns ) { mb_servo_min_pulse_ns = min_pulse_ns; mb_servo_max_pulse_ns = max_pulse_ns; -} +} void mb_servo_set_us(uint32_t duration_us) { /* set Match5 value (pulse duration )*/ diff --git a/sw/airborne/firmwares/motor_bench/mb_servo.h b/sw/airborne/firmwares/motor_bench/mb_servo.h index 26a8f2ef2b..5f7bcc0249 100644 --- a/sw/airborne/firmwares/motor_bench/mb_servo.h +++ b/sw/airborne/firmwares/motor_bench/mb_servo.h @@ -8,7 +8,7 @@ #define MAX_SERVO_US 2000 #define MIN_SERVO_NS 1000000 #define MAX_SERVO_NS 2000000 -#define RANGE_SERVO_US (MAX_SERVO_US - MIN_SERVO_US) +#define RANGE_SERVO_US (MAX_SERVO_US - MIN_SERVO_US) void mb_servo_init( void ); void mb_servo_set_range( uint32_t min_pulse_ns, uint32_t max_pulse_ns ); diff --git a/sw/airborne/firmwares/motor_bench/mb_tacho.c b/sw/airborne/firmwares/motor_bench/mb_tacho.c index a2bba80892..7875b3c3b7 100644 --- a/sw/airborne/firmwares/motor_bench/mb_tacho.c +++ b/sw/airborne/firmwares/motor_bench/mb_tacho.c @@ -41,16 +41,16 @@ float mb_tacho_get_averaged( void ) { float ret; float tacho; const float tach_to_rpm = 15000000.*60./(float)MB_TACHO_NB_SLOT; - if (mb_tacho_nb_pulse) + if (mb_tacho_nb_pulse) tacho = mb_tacho_averaged / (float)mb_tacho_nb_pulse ; else tacho = 0.; - + if (tacho ==0) ret = 0; else ret = tach_to_rpm/tacho; - + mb_tacho_averaged = 0.; mb_tacho_nb_pulse = 0; int_enable(); diff --git a/sw/airborne/firmwares/motor_bench/mb_twi_controller.c b/sw/airborne/firmwares/motor_bench/mb_twi_controller.c index f693dc1978..19b0407151 100644 --- a/sw/airborne/firmwares/motor_bench/mb_twi_controller.c +++ b/sw/airborne/firmwares/motor_bench/mb_twi_controller.c @@ -16,7 +16,7 @@ void mb_twi_controller_init(void) { } void mb_twi_controller_set( float throttle ) { - + LED_TOGGLE(1); if (mb_twi_i2c_done) { diff --git a/sw/airborne/firmwares/motor_bench/mb_twi_controller.h b/sw/airborne/firmwares/motor_bench/mb_twi_controller.h index 7a55e373ff..4e49e027b7 100644 --- a/sw/airborne/firmwares/motor_bench/mb_twi_controller.h +++ b/sw/airborne/firmwares/motor_bench/mb_twi_controller.h @@ -9,7 +9,7 @@ extern void mb_twi_controller_set( float throttle ); #define MB_TWI_CONTROLLER_MAX_CMD 65535 /* - Slave address + Slave address front = 0x52 back = 0x54 right = 0x56 diff --git a/sw/airborne/firmwares/motor_bench/mb_twi_controller_asctech.c b/sw/airborne/firmwares/motor_bench/mb_twi_controller_asctech.c index 2720cd76d7..0b6f4c1fed 100644 --- a/sw/airborne/firmwares/motor_bench/mb_twi_controller_asctech.c +++ b/sw/airborne/firmwares/motor_bench/mb_twi_controller_asctech.c @@ -45,7 +45,7 @@ void mb_twi_controller_set( float throttle ) { // mb_twi_i2c_done = FALSE; i2c0_transmit(MB_TWI_CONTROLLER_ADDR, 4, &mb_twi_i2c_done); break; - + case MB_TWI_CONTROLLER_COMMAND_REVERSE : i2c0_buf[0] = 254; i2c0_buf[1] = mb_twi_controller_asctech_addr; @@ -54,12 +54,12 @@ void mb_twi_controller_set( float throttle ) { // mb_twi_i2c_done = FALSE; i2c0_transmit(MB_TWI_CONTROLLER_ADDR, 4, &mb_twi_i2c_done); break; - + case MB_TWI_CONTROLLER_COMMAND_SET_ADDR : i2c0_buf[0] = 250; i2c0_buf[1] = mb_twi_controller_asctech_addr; i2c0_buf[2] = mb_twi_controller_asctech_new_addr; - i2c0_buf[3] = 230 + mb_twi_controller_asctech_addr + + i2c0_buf[3] = 230 + mb_twi_controller_asctech_addr + mb_twi_controller_asctech_new_addr; mb_twi_controller_asctech_addr = mb_twi_controller_asctech_new_addr; // mb_twi_i2c_done = FALSE; diff --git a/sw/airborne/firmwares/motor_bench/mb_twi_controller_mkk.c b/sw/airborne/firmwares/motor_bench/mb_twi_controller_mkk.c index 6e6d099c6e..83cbc0b8cd 100644 --- a/sw/airborne/firmwares/motor_bench/mb_twi_controller_mkk.c +++ b/sw/airborne/firmwares/motor_bench/mb_twi_controller_mkk.c @@ -12,7 +12,7 @@ uint8_t mb_buss_twi_i2c_done; #define MB_BUSS_TWI_CONTROLLER_MAX_CMD 200 /* - Slave address + Slave address front = 0x52 back = 0x54 right = 0x56 diff --git a/sw/airborne/firmwares/non_ap/led_flasher/blitzer.c b/sw/airborne/firmwares/non_ap/led_flasher/blitzer.c index d7f0fe0091..ff78087b57 100644 --- a/sw/airborne/firmwares/non_ap/led_flasher/blitzer.c +++ b/sw/airborne/firmwares/non_ap/led_flasher/blitzer.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c index 5f43f2b18a..075314c2b8 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c @@ -102,7 +102,7 @@ void guidance_v_init(void) { void guidance_v_read_rc(void) { // used in RC_DIRECT directly and as saturation in CLIMB and HOVER -#ifndef USE_HELI +#ifndef USE_HELI guidance_v_rc_delta_t = (int32_t)radio_control.values[RADIO_THROTTLE] * 200 / MAX_PPRZ; #else guidance_v_rc_delta_t = (int32_t)radio_control.values[RADIO_THROTTLE] * 4 / 5; diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_euler_int.c b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_euler_int.c index 5b33b1ccc5..8a853551d8 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_euler_int.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_euler_int.c @@ -145,7 +145,7 @@ void stabilization_attitude_run(bool_t in_flight) { OFFSET_AND_ROUND2((stabilization_gains.i.z * stabilization_att_sum_err.psi), 10); /* sum feedforward and feedback */ -#ifdef USE_HELI +#ifdef USE_HELI stabilization_cmd[COMMAND_ROLL] = OFFSET_AND_ROUND((stabilization_att_fb_cmd[COMMAND_ROLL]+stabilization_att_ff_cmd[COMMAND_ROLL]), 12); @@ -163,6 +163,6 @@ void stabilization_attitude_run(bool_t in_flight) { stabilization_cmd[COMMAND_YAW] = OFFSET_AND_ROUND((stabilization_att_fb_cmd[COMMAND_YAW]+stabilization_att_ff_cmd[COMMAND_YAW]), 16); - #endif + #endif } diff --git a/sw/airborne/firmwares/tutorial/main_demo5.c b/sw/airborne/firmwares/tutorial/main_demo5.c index 82eb80f522..bb9b16fdb6 100644 --- a/sw/airborne/firmwares/tutorial/main_demo5.c +++ b/sw/airborne/firmwares/tutorial/main_demo5.c @@ -70,5 +70,5 @@ static inline void main_dl_parse_msg(void) { float var = DL_SETTING_value(dl_buffer); DlSetting(i, var); DOWNLINK_SEND_DL_VALUE(&i, &var); - } + } } diff --git a/sw/airborne/firmwares/vor/i86_vor_audio.h b/sw/airborne/firmwares/vor/i86_vor_audio.h index c5a41c0a98..7ef1c5be59 100644 --- a/sw/airborne/firmwares/vor/i86_vor_audio.h +++ b/sw/airborne/firmwares/vor/i86_vor_audio.h @@ -7,7 +7,7 @@ static short* wav_buf; static float* float_buf; -static uint16_t* adc_buf; +static uint16_t* adc_buf; unsigned nb_samples; static void vor_audio_read_wav(const char* filename) { diff --git a/sw/airborne/firmwares/vor/i86_vor_test_filters.c b/sw/airborne/firmwares/vor/i86_vor_test_filters.c index 60374a2930..eaed85ebc8 100644 --- a/sw/airborne/firmwares/vor/i86_vor_test_filters.c +++ b/sw/airborne/firmwares/vor/i86_vor_test_filters.c @@ -11,9 +11,9 @@ int main(int argc, char** argv) { - + vor_audio_read_wav("signal_VOR_BF_50_200dB.wav"); - + int i; float te = 1/29880.; @@ -26,7 +26,7 @@ int main(int argc, char** argv) { int32_t yi_i = vor_int_filter_bp_ref(adc_buf[i]); - printf("%f\t%f\t%f\t%d\t%d\t%f\n", + printf("%f\t%f\t%f\t%d\t%d\t%f\n", t, float_buf[i], yi_f, adc_buf[i], yi_i, (float)yi_i / (float)VIF_SFACT / (1<<5)); } diff --git a/sw/airborne/firmwares/vor/i86_vor_test_float_demod.c b/sw/airborne/firmwares/vor/i86_vor_test_float_demod.c index 6b925f528e..5f16ede5f1 100644 --- a/sw/airborne/firmwares/vor/i86_vor_test_float_demod.c +++ b/sw/airborne/firmwares/vor/i86_vor_test_float_demod.c @@ -7,15 +7,15 @@ int main(int argc, char** argv) { vor_audio_read_wav("signal_VOR_BF_50_200dB.wav"); vor_float_demod_init(); - + int i; for (i=0; i= vfd_DECIM) { decim = 0; - + vfd_var_phi -= vfd_var_alpha * vfd_var_err; const float vfd_var_phase = 2. * M_PI * vfd_var_freq * ti + vfd_var_phi; const float vfd_var_local_sig = -sin( vfd_var_phase); const float vfd_var_y = vfd_var_sig * vfd_var_local_sig; vfd_var_err = vor_float_filter_lp_var(vfd_var_y); - + vfd_fm_phi -= vfd_fm_alpha * vfd_fm_err; const float vfd_fm_phase = 2. * M_PI * vfd_fm_freq * ti + vfd_fm_phi; // const float vfd_fm_local_sig = -sin( vfd_fm_phase ); vfd_fm_local_sig = -sin( vfd_fm_phase ); const float vfd_fm_y = vfd_ref_err_decim * vfd_fm_local_sig; vfd_fm_err = vor_float_filter_lp_fm(vfd_fm_y); - + vfd_qdr = vfd_var_phi - vfd_fm_phi; } diff --git a/sw/airborne/firmwares/vor/vor_float_demod.h b/sw/airborne/firmwares/vor/vor_float_demod.h index d84075e2de..4e69fd8476 100644 --- a/sw/airborne/firmwares/vor/vor_float_demod.h +++ b/sw/airborne/firmwares/vor/vor_float_demod.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Blais, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/firmwares/vor/vor_float_filters.h b/sw/airborne/firmwares/vor/vor_float_filters.h index 9ceecbb219..19cb21ccac 100644 --- a/sw/airborne/firmwares/vor/vor_float_filters.h +++ b/sw/airborne/firmwares/vor/vor_float_filters.h @@ -29,7 +29,7 @@ inline float vor_float_filter_bp_var( float xn) { - b1 * y1 - b2 * y2 - b3 * y3; - + x3 = x2; x2 = x1; x1 = xn; @@ -85,7 +85,7 @@ inline float vor_float_filter_bp_ref( float xn) { - b4 * y4 - b5 * y5 - b6 * y6; - + x6 = x5; x5 = x4; x4 = x3; @@ -186,7 +186,7 @@ inline float vor_float_filter_lp_var( float xn) { - b4 * y4 - b5 * y5 - b6 * y6; - + x6 = x5; x5 = x4; x4 = x3; @@ -288,7 +288,7 @@ inline float vor_float_filter_lp_fm( float xn) { - b4 * y4 - b5 * y5 - b6 * y6; - + x6 = x5; x5 = x4; x4 = x3; diff --git a/sw/airborne/firmwares/vor/vor_int_demod.c b/sw/airborne/firmwares/vor/vor_int_demod.c index f4d3dd200f..1a5f3adf18 100644 --- a/sw/airborne/firmwares/vor/vor_int_demod.c +++ b/sw/airborne/firmwares/vor/vor_int_demod.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Blais, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -27,7 +27,7 @@ // 30khz 33 us // processing 30Kz with sine 100 us // processing 30Kz without sine 23-26 us -// +// // total processing : 270us // total processing without sine 54us // @@ -115,12 +115,12 @@ void vor_int_demod_run ( int16_t sample) { // test sign ? /// const int32_t vid_ref_local_sig = VID_ANGLE_INT_OF_PFLOAT(vid_ref_local_sig_float); vid_ref_local_sig = vid_ref_local_sig_float * (float)(1<<15); - // get REF signal by bandpassing input signal + // get REF signal by bandpassing input signal /// const int32_t vid_ref_sig = vor_int_filter_bp_ref(sample); vid_ref_sig = vor_int_filter_bp_ref(sample); // multiply input signal by local oscillator signal - // const int32_t vid_ref_y = vid_ref_sig * vid_ref_local_sig; - vid_ref_y = vid_ref_sig * vid_ref_local_sig; + // const int32_t vid_ref_y = vid_ref_sig * vid_ref_local_sig; + vid_ref_y = vid_ref_sig * vid_ref_local_sig; vid_ref_y = vid_ref_y >> 15; // get phase error by low passing the result of the multiplication. vid_ref_err = vor_int_filter_lp_ref(vid_ref_y); @@ -129,8 +129,8 @@ void vor_int_demod_run ( int16_t sample) { // const int32_t vid_ref_err_decim = vor_int_filter_lp_decim(vid_ref_err); vid_ref_err_decim = vor_int_filter_lp_decim(vid_ref_err<<3); vid_ref_err_decim = vid_ref_err_decim >> 3; - - // get VAR signal by bandpassing input signal + + // get VAR signal by bandpassing input signal vid_var_sig = vor_int_filter_bp_var(sample); if (1) { @@ -154,10 +154,10 @@ void vor_int_demod_run ( int16_t sample) { vid_var_local_sig_float = -sin(vid_var_phase_float); // FIXME - INT mult multiply input signal by local oscillator signal - const int32_t vid_var_y = vid_var_sig * vid_var_local_sig_float; + const int32_t vid_var_y = vid_var_sig * vid_var_local_sig_float; // get phase error by low passing the result of the multiplication. vid_var_err = vor_int_filter_lp_var(vid_var_y); - + // phase error re-injection int32_t dfm_phi = vid_fm_alpha * vid_fm_err; @@ -176,7 +176,7 @@ void vor_int_demod_run ( int16_t sample) { vid_fm_local_sig_float = -sin(vid_fm_phase_float); // FIXME - INT mult multiply input signal by local oscillator signal - const int32_t vid_fm_y = vid_ref_err_decim * vid_fm_local_sig_float; + const int32_t vid_fm_y = vid_ref_err_decim * vid_fm_local_sig_float; // get phase error by low passing the result of the multiplication. vid_fm_err = vor_int_filter_lp_fm(vid_fm_y); diff --git a/sw/airborne/firmwares/vor/vor_int_demod.h b/sw/airborne/firmwares/vor/vor_int_demod.h index 51bcbd8278..441959853c 100644 --- a/sw/airborne/firmwares/vor/vor_int_demod.h +++ b/sw/airborne/firmwares/vor/vor_int_demod.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008 Antoine Blais, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/firmwares/vor/vor_int_demod_decim.c b/sw/airborne/firmwares/vor/vor_int_demod_decim.c index cb0d424c4b..8112cc2013 100755 --- a/sw/airborne/firmwares/vor/vor_int_demod_decim.c +++ b/sw/airborne/firmwares/vor/vor_int_demod_decim.c @@ -136,10 +136,10 @@ void vor_int_demod_run ( int16_t sample) { // Le signal arrive sur 10 bits, on le met sur 16 bits sample = sample*(1<<6); - // get VAR signal by bandpassing input signal + // get VAR signal by bandpassing input signal vid_var_sig = vor_int_filter_bp_var(sample); - // get REF signal by bandpassing input signal + // get REF signal by bandpassing input signal vid_ref_sig = vor_int_filter_bp_ref(sample); //================================================================= @@ -149,12 +149,12 @@ void vor_int_demod_run ( int16_t sample) { case 1 : { decim2++; - + pllREF() // filter 30 REF before decimation 2 vid_ref_err_decim1 = vor_int_filter_lp_decim1r(vid_ref_err); - + fix_var_sig = vid_var_sig; break; @@ -164,7 +164,7 @@ void vor_int_demod_run ( int16_t sample) { //--------------------------------------------------------------- case vid_DECIM1 : { - decim1 = 0; + decim1 = 0; // filter 30 VAR before decimation 2 vid_var_err_decim1 = vor_int_filter_lp_decim1v(fix_var_sig); @@ -178,7 +178,7 @@ void vor_int_demod_run ( int16_t sample) { decim3++; // filter 30 REF before decimation 3 - vid_ref_err_decim2 = + vid_ref_err_decim2 = vor_int_filter_lp_decim2r(vid_ref_err_decim1); fix_var_err_decim1 = vid_var_err_decim1; @@ -191,7 +191,7 @@ void vor_int_demod_run ( int16_t sample) { case (vid_DECIM2-1) : { // filter 30 VAR before decimation 3 - vid_var_err_decim2 = + vid_var_err_decim2 = vor_int_filter_lp_decim2v(fix_var_err_decim1); break; @@ -238,7 +238,7 @@ void vor_int_demod_run ( int16_t sample) { break; } //------------------------------------------------------- - } + } //========================================================= break; diff --git a/sw/airborne/firmwares/vor/vor_int_demod_decim.h b/sw/airborne/firmwares/vor/vor_int_demod_decim.h index 8c0d97c712..010062be1d 100755 --- a/sw/airborne/firmwares/vor/vor_int_demod_decim.h +++ b/sw/airborne/firmwares/vor/vor_int_demod_decim.h @@ -19,7 +19,7 @@ extern int32_t vid_ref_err_decim2; extern int32_t vid_var_sig; extern int32_t vid_var_err_decim1; extern int32_t vid_var_err_decim2; - + extern int32_t vid_loVAR; extern int32_t vid_yVAR; extern int32_t vid_var_err; diff --git a/sw/airborne/firmwares/vor/vor_int_filters.h b/sw/airborne/firmwares/vor/vor_int_filters.h index 53694d011a..73b5c80790 100644 --- a/sw/airborne/firmwares/vor/vor_int_filters.h +++ b/sw/airborne/firmwares/vor/vor_int_filters.h @@ -46,7 +46,7 @@ inline int32_t vor_int_filter_bp_var( int16_t xn) { - b3 * y3; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x3 = x2; x2 = x1; x1 = xn; @@ -110,7 +110,7 @@ inline int32_t vor_int_filter_bp_ref( int16_t xn) { - b6 * y6; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x6 = x5; x5 = x4; x4 = x3; @@ -176,7 +176,7 @@ inline int32_t vor_int_filter_lp_decim( int16_t xn) { - b3 * y3; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x3 = x2; x2 = x1; x1 = xn; @@ -241,7 +241,7 @@ inline int32_t vor_int_filter_lp_var( int32_t xn) { - b6 * y6; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x6 = x5; x5 = x4; x4 = x3; @@ -293,7 +293,7 @@ inline int32_t vor_int_filter_lp_ref( int32_t xn) { - b3 * y3; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x3 = x2; x2 = x1; x1 = xn; @@ -357,7 +357,7 @@ inline int32_t vor_int_filter_lp_fm( int32_t xn) { - b6 * y6; // printf("%d\n", _yn); _yn = (_yn >> VIF_CRES); - + x6 = x5; x5 = x4; x4 = x3; diff --git a/sw/airborne/firmwares/vor/vor_int_filters_decim.h b/sw/airborne/firmwares/vor/vor_int_filters_decim.h index 287420f247..6f0c867701 100755 --- a/sw/airborne/firmwares/vor/vor_int_filters_decim.h +++ b/sw/airborne/firmwares/vor/vor_int_filters_decim.h @@ -74,7 +74,7 @@ inline int32_t vor_int_filter_bp_ref( int16_t xn) { int32_t ret = _yn; _yn = (_yn/VIF_FACT); - + x6 = x5; x5 = x4; x4 = x3; @@ -91,7 +91,7 @@ inline int32_t vor_int_filter_bp_ref( int16_t xn) { #undef VIF_RES #define VIF_RES 11 - + return (ret/VIF_FACT); } @@ -109,7 +109,7 @@ inline int32_t vor_int_filter_lp_ref( int16_t xn) { const int32_t b1 = VIF_NCOEF(-1.3532012520987992676424482851871289312840); const int32_t b2 = VIF_PCOEF(0.8279475542861756132140271802200004458427); const int32_t b3 = VIF_NCOEF(-0.1745393568578767484744673765817424282432); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -128,11 +128,11 @@ inline int32_t vor_int_filter_lp_ref( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + int32_t ret = _yn; _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -143,12 +143,12 @@ inline int32_t vor_int_filter_lp_ref( int16_t xn) { #undef VIF_RES #define VIF_RES 7 - + return (ret/VIF_FACT); } inline int32_t vor_int_filter_bp_var( int16_t xn) { - + #undef VIF_RES #define VIF_RES 13 @@ -161,7 +161,7 @@ inline int32_t vor_int_filter_bp_var( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.3715994101489439000000000000000000000000); const int32_t b2 = VIF_PCOEF(1.9257572822812750000000000000000000000000); const int32_t b3 = VIF_NCOEF(-0.5307171049756953500000000000000000000000); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -182,7 +182,7 @@ inline int32_t vor_int_filter_bp_var( int16_t xn) { - b3 * _y3; _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -208,7 +208,7 @@ inline int32_t vor_int_filter_lp_decim1v( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.3740947437093518068706998747074976563454); const int32_t b2 = VIF_PCOEF(1.9293556690912150308747641247464343905449); const int32_t b3 = VIF_NCOEF(-0.5320753683120916788240606365434359759092); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -227,7 +227,7 @@ inline int32_t vor_int_filter_lp_decim1v( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + _yn = (_yn/VIF_FACT); x3 = x2; @@ -274,9 +274,9 @@ inline int32_t vor_int_filter_lp_decim1r( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -302,7 +302,7 @@ inline int32_t vor_int_filter_lp_decim2v( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.3740947437093518068706998747074976563454); const int32_t b2 = VIF_PCOEF(1.9293556690912150308747641247464343905449); const int32_t b3 = VIF_NCOEF(-0.5320753683120916788240606365434359759092); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -321,11 +321,11 @@ inline int32_t vor_int_filter_lp_decim2v( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + int32_t ret = _yn; _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -336,7 +336,7 @@ inline int32_t vor_int_filter_lp_decim2v( int16_t xn) { #undef VIF_RES #define VIF_RES 12 - + return (ret/VIF_FACT); } @@ -354,7 +354,7 @@ inline int32_t vor_int_filter_lp_decim2r( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.3740947437093518068706998747074976563454); const int32_t b2 = VIF_PCOEF(1.9293556690912150308747641247464343905449); const int32_t b3 = VIF_NCOEF(-0.5320753683120916788240606365434359759092); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -373,9 +373,9 @@ inline int32_t vor_int_filter_lp_decim2r( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -403,7 +403,7 @@ inline int32_t vor_int_filter_lp_var3( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.2545578663321697021615364064928144216537); const int32_t b2 = VIF_PCOEF(1.7624338481987593674205072602489963173866); const int32_t b3 = VIF_NCOEF(-0.4704842938088966697307569120312109589577); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -422,9 +422,9 @@ inline int32_t vor_int_filter_lp_var3( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -450,7 +450,7 @@ inline int32_t vor_int_filter_lp_fm3( int16_t xn) { const int32_t b1 = VIF_NCOEF(-2.2545578663321697021615364064928144216537); const int32_t b2 = VIF_PCOEF(1.7624338481987593674205072602489963173866); const int32_t b3 = VIF_NCOEF(-0.4704842938088966697307569120312109589577); - + // printf("Num : %d %d %d %d\n",a0,a1,a2,a3); // printf("Den : %d %d %d %d\n",b0,b1,b2,b3); @@ -469,9 +469,9 @@ inline int32_t vor_int_filter_lp_fm3( int16_t xn) { - b1 * _y1 - b2 * _y2 - b3 * _y3; - + _yn = (_yn/VIF_FACT); - + x3 = x2; x2 = x1; x1 = xn; @@ -521,9 +521,9 @@ inline int32_t vor_int_filter_lp_var4( int16_t xn) { - b2 * _y2 - b3 * _y3 - b4 * _y4; - + _yn = (_yn/VIF_FACT); - + x4 = x3; x3 = x2; x2 = x1; @@ -573,9 +573,9 @@ inline int32_t vor_int_filter_lp_fm4( int16_t xn) { - b2 * _y2 - b3 * _y3 - b4 * _y4; - + _yn = (_yn/VIF_FACT); - + x4 = x3; x3 = x2; x2 = x1; diff --git a/sw/airborne/firmwares/wind_tunnel/main.c b/sw/airborne/firmwares/wind_tunnel/main.c index e06d553c44..319621e99c 100644 --- a/sw/airborne/firmwares/wind_tunnel/main.c +++ b/sw/airborne/firmwares/wind_tunnel/main.c @@ -84,12 +84,12 @@ void dl_parse_msg(void) { uint8_t msg_id = IdOfMsg(dl_buffer); switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(); break; } - + case DL_SETTING : { uint8_t i = DL_SETTING_index(dl_buffer); float var = DL_SETTING_value(dl_buffer); diff --git a/sw/airborne/firmwares/wind_tunnel/main_mb.c b/sw/airborne/firmwares/wind_tunnel/main_mb.c index f0be93b02b..2be7af41e2 100644 --- a/sw/airborne/firmwares/wind_tunnel/main_mb.c +++ b/sw/airborne/firmwares/wind_tunnel/main_mb.c @@ -59,7 +59,7 @@ static inline void main_periodic_task( void ) { float rpm = mb_tacho_get_averaged(); DOWNLINK_SEND_WT(&rpm); - + float throttle = (float)wt_servo_motor_power / 1000.; mb_twi_controller_set(throttle); @@ -81,12 +81,12 @@ void dl_parse_msg(void) { uint8_t msg_id = IdOfMsg(dl_buffer); switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(); break; } - + case DL_SETTING : { uint8_t i = DL_SETTING_index(dl_buffer); float var = DL_SETTING_value(dl_buffer); diff --git a/sw/airborne/firmwares/wind_tunnel/wt_baro.c b/sw/airborne/firmwares/wind_tunnel/wt_baro.c index 9c800b541f..4aa60c00be 100644 --- a/sw/airborne/firmwares/wind_tunnel/wt_baro.c +++ b/sw/airborne/firmwares/wind_tunnel/wt_baro.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file +/** \file * \brief * */ diff --git a/sw/airborne/firmwares/wind_tunnel/wt_baro.h b/sw/airborne/firmwares/wind_tunnel/wt_baro.h index 10712f8b07..8cc419935e 100644 --- a/sw/airborne/firmwares/wind_tunnel/wt_baro.h +++ b/sw/airborne/firmwares/wind_tunnel/wt_baro.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file +/** \file * \brief * */ diff --git a/sw/airborne/firmwares/wind_tunnel/wt_servo.c b/sw/airborne/firmwares/wind_tunnel/wt_servo.c index 753d937827..b6d6e7e9b7 100644 --- a/sw/airborne/firmwares/wind_tunnel/wt_servo.c +++ b/sw/airborne/firmwares/wind_tunnel/wt_servo.c @@ -13,11 +13,11 @@ void mb_servo_set_ns(uint32_t duration_ns); void wt_servo_init(void) { /* set P0.21 as PWM5 output */ - PINSEL1 |= (0X01 << 10); + PINSEL1 |= (0X01 << 10); /* enable and select the type of PWM channel */ PWMPCR |= PWMPCR_ENA5; /* set Match0 value (refresh rate) */ - PWMMR0 = MY_NB_CLOCK_TIMER_PWM(20000); + PWMMR0 = MY_NB_CLOCK_TIMER_PWM(20000); /* commit PWMMRx changes */ PWMLER = PWMLER_LATCH0; /* enable PWM timer in PWM mode */ diff --git a/sw/airborne/flightzone.c b/sw/airborne/flightzone.c index 657b2b95d1..ddb27d0c4e 100644 --- a/sw/airborne/flightzone.c +++ b/sw/airborne/flightzone.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 Arnold Schroeter * * This file is part of paparazzi. @@ -18,30 +18,30 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file flightzone.c - * \brief check whether a point is inside the polygon limiting the - * competition area - * +/** \file flightzone.c + * \brief check whether a point is inside the polygon limiting the + * competition area + * * filename: flightzone.c * project: MAV 2007 * description: check whether a point is inside the polygon limiting * the competition area - * - * + * + * * todo: - support concave/convex polygons * - sort points automatically * - minimize size of Orthogonal[] - * - * - * limitations: - boundary polygon has to be convex + * + * + * limitations: - boundary polygon has to be convex * - points have to be ordered clockwise - * + * * author: Arnold Schroeter - * history: + * history: * 2.9.07 initial version * */ @@ -57,17 +57,17 @@ POINT Corner[] = { 12, 25, 15, 29, 18, 25, - 18, 18, + 18, 18, 13.5, 16, - 0 , 0}; // last corner is a dummy, which must not be deleted!!! + 0 , 0}; // last corner is a dummy, which must not be deleted!!! POINT Orthogonal[20]; // Attention!!! array must be at least as long as Corner[] unsigned char bNumberOfCorners = 0; /******************************************************************* -; function name: vInitIsInsideBoundaries -; description: +; function name: vInitIsInsideBoundaries +; description: ;*******************************************************************/ void vInitIsInsideBoundaries(void) { @@ -84,9 +84,9 @@ void vInitIsInsideBoundaries(void) Orthogonal[i].y = - (Corner[i+1].x - Corner[i].x); #if 0 - printf("%d: corner (%f, %f), orthogonal (%f, %f)\n", - i, - Corner[i].x, Corner[i].y, + printf("%d: corner (%f, %f), orthogonal (%f, %f)\n", + i, + Corner[i].x, Corner[i].y, Orthogonal[i].x, Orthogonal[i].y); #endif } @@ -94,18 +94,18 @@ void vInitIsInsideBoundaries(void) } /******************************************************************* -; function name: iIsInsideBoundaries -; description: -; -; parameters: +; function name: iIsInsideBoundaries +; description: +; +; parameters: ; returns: 1 if point is inside boundaries -; 0 if point is outside boundaries +; 0 if point is outside boundaries ;*******************************************************************/ int iIsInsideBoundaries(COORD_TYPE x, COORD_TYPE y) { int r = 1; - static unsigned char i; + static unsigned char i; i = 0; @@ -113,7 +113,7 @@ int iIsInsideBoundaries(COORD_TYPE x, COORD_TYPE y) && (r == 1) ) { - if ( ( (x - Corner[i].x) * Orthogonal[i].x + if ( ( (x - Corner[i].x) * Orthogonal[i].x + (y - Corner[i].y) * Orthogonal[i].y ) < 0. ) { diff --git a/sw/airborne/flightzone.h b/sw/airborne/flightzone.h index 0396c07b75..3d87d3b862 100644 --- a/sw/airborne/flightzone.h +++ b/sw/airborne/flightzone.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 Arnold Schroeter * * This file is part of paparazzi. @@ -18,23 +18,23 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file flightzone.h - * \brief check whether a point is inside the polygon limiting the - * competition area - * +/** \file flightzone.h + * \brief check whether a point is inside the polygon limiting the + * competition area + * * filename: flightzone.h * project: MAV 2007 * description: check whether a point is inside the polygon limiting * the competition area - * - * - * + * + * + * * author: Arnold Schroeter - * history: + * history: * 2.9.07 initial version * */ @@ -42,4 +42,4 @@ #define COORD_TYPE float void vInitIsInsideBoundaries(void); -int iIsInsideBoundaries(COORD_TYPE x, COORD_TYPE y); +int iIsInsideBoundaries(COORD_TYPE x, COORD_TYPE y); diff --git a/sw/airborne/fms/fms_autopilot_msg.h b/sw/airborne/fms/fms_autopilot_msg.h index 8feab05638..b075926e43 100644 --- a/sw/airborne/fms/fms_autopilot_msg.h +++ b/sw/airborne/fms/fms_autopilot_msg.h @@ -71,7 +71,7 @@ struct __attribute__ ((packed)) AutopilotMessageTWDown * Passthrough, aka biplan */ -struct __attribute__ ((packed)) ADCMessage { +struct __attribute__ ((packed)) ADCMessage { uint16_t channels[NB_ADC]; }; @@ -83,7 +83,7 @@ struct __attribute__ ((packed)) PTUpValidFlags unsigned pressure_differential:1; unsigned vane:1; unsigned imu:1; - unsigned adc:1; + unsigned adc:1; }; struct __attribute__ ((packed)) AutopilotMessagePTUp @@ -104,9 +104,9 @@ struct __attribute__ ((packed)) AutopilotMessagePTUp int16_t rc_aux2; int16_t rc_aux3; uint8_t rc_status; - float vane_angle1; - float vane_angle2; - struct ADCMessage adc; + float vane_angle1; + float vane_angle2; + struct ADCMessage adc; struct PTUpValidFlags valid; uint32_t stm_msg_cnt; @@ -125,7 +125,7 @@ struct __attribute__ ((packed)) AutopilotMessagePTDown #define VI_GPS_DATA_VALID 2 #define VI_BARO_ABS_DATA_VALID 3 -struct __attribute__ ((packed)) AutopilotMessageVIUp +struct __attribute__ ((packed)) AutopilotMessageVIUp { struct Int16Rates gyro; struct Int16Vect3 accel; @@ -136,29 +136,29 @@ struct __attribute__ ((packed)) AutopilotMessageVIUp uint8_t valid_sensors; }; -struct __attribute__ ((packed)) AutopilotMessageVIDown +struct __attribute__ ((packed)) AutopilotMessageVIDown { }; -/* - * For messages of arbitrary length using fixed DMA - * buffer size. - * A message consists of any amount of packages and - * is recomposed to a raw byte array on application - * level. - * Advantage: Interleaving message exchange, constant +/* + * For messages of arbitrary length using fixed DMA + * buffer size. + * A message consists of any amount of packages and + * is recomposed to a raw byte array on application + * level. + * Advantage: Interleaving message exchange, constant * latency * Disadvantage: Overhead of message / package counters - * - * If there is no message to be transferred, an empty - * package with message_cnt = 0 is sent. - * The last package of a message has a negative - * package_cntd that indicates the number of padding - * (zero) bytes it contains at the end. - * Example for a 22-byte message transfer with packages - * of 8 bytes for one side: + * + * If there is no message to be transferred, an empty + * package with message_cnt = 0 is sent. + * The last package of a message has a negative + * package_cntd that indicates the number of padding + * (zero) bytes it contains at the end. + * Example for a 22-byte message transfer with packages + * of 8 bytes for one side: * * message_cnt: 0 message_cnt: 4 * package_cntd: x package_cntd: 6 @@ -178,9 +178,9 @@ struct __attribute__ ((packed)) AutopilotMessageVIDown * package_cntd: -5 package_cnt: 3 * data: uint8_t[8] data: uint8_t[8] * - * --> last package in message, padding in - * current message is 5 bytes (-5), so - * message length is (3*8)-5 = 22. + * --> last package in message, padding in + * current message is 5 bytes (-5), so + * message length is (3*8)-5 = 22. * * -- next message * @@ -189,13 +189,13 @@ struct __attribute__ ((packed)) AutopilotMessageVIDown * data: uint8_t[8] data: uint8_t[8] * ... */ -#ifndef SPISTREAM_PACKAGE_SIZE +#ifndef SPISTREAM_PACKAGE_SIZE #define SPISTREAM_PACKAGE_SIZE 32 #endif struct __attribute__ ((packed)) AutopilotMessagePTStream { - uint8_t message_cnt; - int8_t package_cntd; + uint8_t message_cnt; + int8_t package_cntd; uint8_t pkg_data[SPISTREAM_PACKAGE_SIZE]; }; @@ -207,8 +207,8 @@ union AutopilotMessage { struct __attribute__ ((packed)) AutopilotMessageCRCFrame { - union AutopilotMessage payload; - uint8_t crc; -}; + union AutopilotMessage payload; + uint8_t crc; +}; #endif /* FMS_AUTOPILOT_H */ diff --git a/sw/airborne/fms/fms_gs_com.c b/sw/airborne/fms/fms_gs_com.c index 30cfffa0c7..d3fca2ae57 100644 --- a/sw/airborne/fms/fms_gs_com.c +++ b/sw/airborne/fms/fms_gs_com.c @@ -23,15 +23,15 @@ uint8_t telemetry_mode_Main_DefaultChannel; static void on_datalink_event(int fd, short event __attribute__((unused)), void *arg); static void on_datalink_message(void); -uint8_t fms_gs_com_init(const char* gs_host, uint16_t gs_port, +uint8_t fms_gs_com_init(const char* gs_host, uint16_t gs_port, uint16_t datalink_port, uint8_t broadcast) { fms_gs_com.network = network_new(gs_host, gs_port, datalink_port, broadcast); fms_gs_com.udp_transport = udp_transport_new(fms_gs_com.network); - event_set(&fms_gs_com.datalink_event, fms_gs_com.network->socket_in, EV_READ | EV_PERSIST, + event_set(&fms_gs_com.datalink_event, fms_gs_com.network->socket_in, EV_READ | EV_PERSIST, on_datalink_event, fms_gs_com.udp_transport); event_add(&fms_gs_com.datalink_event, NULL); - + return 0; } @@ -57,13 +57,13 @@ static void on_datalink_event(int fd, short event __attribute__((unused)), void } i++; } - + } static void on_datalink_message(void) { struct udp_transport *tp = fms_gs_com.udp_transport->impl; - uint8_t msg_id = tp->udp_dl_payload[1]; + uint8_t msg_id = tp->udp_dl_payload[1]; switch (msg_id) { case DL_PING: diff --git a/sw/airborne/fms/fms_gs_com.h b/sw/airborne/fms/fms_gs_com.h index 73795a368e..ea7bab7840 100644 --- a/sw/airborne/fms/fms_gs_com.h +++ b/sw/airborne/fms/fms_gs_com.h @@ -1,6 +1,6 @@ /* * This module handles communications with ground segment - * + * * for now one channel of telemetry/datalink via wifi * */ @@ -27,7 +27,7 @@ extern struct FmsGsCom fms_gs_com; /* remove me */ extern uint8_t telemetry_mode_Main_DefaultChannel; -extern uint8_t fms_gs_com_init(const char* gs_host, uint16_t gs_port, +extern uint8_t fms_gs_com_init(const char* gs_host, uint16_t gs_port, uint16_t datalink_port, uint8_t broadcast); extern void fms_gs_com_periodic(void); diff --git a/sw/airborne/fms/fms_network.c b/sw/airborne/fms/fms_network.c index 7d69f30390..d61910aa21 100644 --- a/sw/airborne/fms/fms_network.c +++ b/sw/airborne/fms/fms_network.c @@ -9,38 +9,38 @@ struct FmsNetwork* network_new(const char* str_ip_out, const int port_out, const int port_in, const int broadcast) { struct FmsNetwork* me = malloc(sizeof(struct FmsNetwork)); - + int so_reuseaddr = 1; struct protoent * pte = getprotobyname("UDP"); me->socket_out = socket( PF_INET, SOCK_DGRAM, pte->p_proto); - setsockopt(me->socket_out, SOL_SOCKET, SO_REUSEADDR, + setsockopt(me->socket_out, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof(so_reuseaddr)); /* only set broadcast option if explicitly enabled */ if (broadcast) setsockopt(me->socket_out, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)); - + me->addr_out.sin_family = PF_INET; me->addr_out.sin_port = htons(port_out); me->addr_out.sin_addr.s_addr = inet_addr(str_ip_out); - + me->socket_in = socket( PF_INET, SOCK_DGRAM, pte->p_proto); - setsockopt(me->socket_in, SOL_SOCKET, SO_REUSEADDR, + setsockopt(me->socket_in, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof(so_reuseaddr)); - + me->addr_in.sin_family = PF_INET; me->addr_in.sin_port = htons(port_in); me->addr_in.sin_addr.s_addr = htonl(INADDR_ANY); - + bind(me->socket_in, (struct sockaddr *)&me->addr_in, sizeof(me->addr_in)); - + return me; } int network_write(struct FmsNetwork* me, char* buf, int len) { - ssize_t byte_written = sendto(me->socket_out, buf, len, MSG_DONTWAIT, + ssize_t byte_written = sendto(me->socket_out, buf, len, MSG_DONTWAIT, (struct sockaddr*)&me->addr_out, sizeof(me->addr_out)); if ( byte_written != len) { TRACE(TRACE_ERROR, "error sending to network %d\n", byte_written); diff --git a/sw/airborne/fms/fms_periodic.c b/sw/airborne/fms/fms_periodic.c index 1382511d17..7bf8ac8c0a 100644 --- a/sw/airborne/fms/fms_periodic.c +++ b/sw/airborne/fms/fms_periodic.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -45,7 +45,7 @@ struct FmsPeriodic { int fms_periodic_init(void(*periodic_handler)(int) ) { - + pid_t my_pid = fork(); if (my_pid == -1) { TRACE(TRACE_ERROR,"fms_periodic : unable to fork : %s (%d)\n", strerror(errno), errno); @@ -56,14 +56,14 @@ int fms_periodic_init(void(*periodic_handler)(int) ) { fms_periodic_run(); } /* succesful fork parent process */ - + /* install signal handler */ struct sigaction my_sigaction = {.sa_handler = periodic_handler }; if (sigaction(SIGUSR1, &my_sigaction, NULL)) { TRACE(TRACE_ERROR,"fms_periodic : unable to install signal handler : %s (%d)\n", strerror(errno), errno); return -1; } - + /* set main process priority */ struct sched_param param; param.sched_priority = 49; @@ -104,7 +104,7 @@ static void fms_periodic_run(void) { clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &periodic_next, NULL); kill(father_pid, SIGUSR1); } - + _exit(EXIT_SUCCESS); - + } diff --git a/sw/airborne/fms/fms_periodic.h b/sw/airborne/fms/fms_periodic.h index 64606e89ec..776cd7fb63 100644 --- a/sw/airborne/fms/fms_periodic.h +++ b/sw/airborne/fms/fms_periodic.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/fms/fms_serial_port.c b/sw/airborne/fms/fms_serial_port.c index a3286a2993..d42bedfd16 100644 --- a/sw/airborne/fms/fms_serial_port.c +++ b/sw/airborne/fms/fms_serial_port.c @@ -10,7 +10,7 @@ #include //#define TRACE(type,fmt,args...) fprintf(stderr, fmt, args) -#define TRACE(type,fmt,args...) +#define TRACE(type,fmt,args...) #define TRACE_ERROR 1 struct FmsSerialPort* serial_port_new(void) { @@ -52,7 +52,7 @@ int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t TRACE(TRACE_ERROR,"%s, get term settings failed: %s (%d)\n", device, strerror(errno), errno); close(me->fd); return -1; - } + } me->cur_termios = me->orig_termios; /* input modes */ me->cur_termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|INPCK|ISTRIP|INLCR|IGNCR @@ -80,7 +80,7 @@ int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t int serial_port_open(struct FmsSerialPort* me, const char* device, void(*term_conf_callback)(struct termios*, speed_t*)) { - + speed_t speed; if ((me->fd = open(device, O_RDWR | O_NONBLOCK)) < 0) { TRACE(TRACE_ERROR,"%s, open failed: %s (%d)\n", device, strerror(errno), errno); @@ -90,7 +90,7 @@ int serial_port_open(struct FmsSerialPort* me, const char* device, TRACE(TRACE_ERROR,"%s, get term settings failed: %s (%d)\n", device, strerror(errno), errno); close(me->fd); return -1; - } + } me->cur_termios = me->orig_termios; term_conf_callback(&me->cur_termios, &speed); if (cfsetispeed(&me->cur_termios, speed)) { @@ -105,7 +105,7 @@ int serial_port_open(struct FmsSerialPort* me, const char* device, } serial_port_flush(me); return 0; - + } void serial_port_close(struct FmsSerialPort* me) { @@ -116,16 +116,16 @@ void serial_port_close(struct FmsSerialPort* me) { if (tcflush(me->fd, TCIOFLUSH)) { TRACE(TRACE_ERROR,"flushing (%s) (%d)\n", strerror(errno), errno); close(me->fd); - return; + return; } if (tcsetattr(me->fd, TCSADRAIN, &me->orig_termios)) { // Restore modes. TRACE(TRACE_ERROR,"restoring term attributes (%s) (%d)\n", strerror(errno), errno); close(me->fd); - return; + return; } if (close(me->fd)) { TRACE(TRACE_ERROR,"closing %s (%d)\n", strerror(errno), errno); - return; + return; } return; diff --git a/sw/airborne/fms/fms_serial_port.h b/sw/airborne/fms/fms_serial_port.h index c030bfaf52..a2a16e61b6 100644 --- a/sw/airborne/fms/fms_serial_port.h +++ b/sw/airborne/fms/fms_serial_port.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -38,7 +38,7 @@ extern void serial_port_free(struct FmsSerialPort* me); extern void serial_port_flush(struct FmsSerialPort* me); extern void serial_port_flush_output(struct FmsSerialPort* me); extern int serial_port_open_raw(struct FmsSerialPort* me, const char* device, speed_t speed); -extern int serial_port_open(struct FmsSerialPort* me, const char* device, +extern int serial_port_open(struct FmsSerialPort* me, const char* device, void(*term_conf_callback)(struct termios*, speed_t*)); extern void serial_port_close(struct FmsSerialPort* me); diff --git a/sw/airborne/fms/fms_spi_autopilot_msg.c b/sw/airborne/fms/fms_spi_autopilot_msg.c index 1dec573cdf..e75900ec54 100644 --- a/sw/airborne/fms/fms_spi_autopilot_msg.c +++ b/sw/airborne/fms/fms_spi_autopilot_msg.c @@ -86,7 +86,7 @@ void spi_ap_link_set_radio_control_callback(void (* radio_control_cb)(void)) void spi_ap_link_set_adc_callback(void (* adc_callback_fun)(uint16_t * adc_channels)) { - adc_callback = adc_callback_fun; + adc_callback = adc_callback_fun; } int spi_ap_link_init() diff --git a/sw/airborne/fms/fms_spi_link.c b/sw/airborne/fms/fms_spi_link.c index 860062bcbb..d32296ab2e 100644 --- a/sw/airborne/fms/fms_spi_link.c +++ b/sw/airborne/fms/fms_spi_link.c @@ -43,7 +43,7 @@ int spi_link_init(void) { int spi_link_send(void *buf_out, size_t count, void *buf_in, uint8_t* crc_valid) { - int ret; + int ret; struct spi_ioc_transfer tr = { .tx_buf = (unsigned long)buf_out, @@ -75,7 +75,7 @@ int spi_link_send(void *buf_out, size_t count, void *buf_in, uint8_t* crc_valid) #define WIDTH (8 * sizeof(uint8_t)) #define TOPBIT (1 << (WIDTH - 1)) uint8_t crc_calc_block_crc8(const uint8_t buf[], uint32_t len) { - uint8_t _remainder = 0; + uint8_t _remainder = 0; for (uint32_t byte = 0; byte < len; ++byte) { _remainder ^= (buf[byte] << (WIDTH - 8)); for (uint8_t bit = 8; bit > 0; --bit) { @@ -86,7 +86,7 @@ uint8_t crc_calc_block_crc8(const uint8_t buf[], uint32_t len) { } } return (_remainder); -} +} #if 0 diff --git a/sw/airborne/fms/fms_spi_link.h b/sw/airborne/fms/fms_spi_link.h index 3f449a7bad..15a8523467 100644 --- a/sw/airborne/fms/fms_spi_link.h +++ b/sw/airborne/fms/fms_spi_link.h @@ -43,12 +43,12 @@ struct SpiLink { struct SpiLink spi_link; -/* - * initialize peripheral +/* + * initialize peripheral */ extern int spi_link_init(void); -/* +/* * exchange a data buffer * the last byte of buf_out will be overwiten with a crc * the last byte of buf_in will contain the received crc diff --git a/sw/airborne/fms/fms_spistream.h b/sw/airborne/fms/fms_spistream.h index f3a964bca7..132846ec41 100644 --- a/sw/airborne/fms/fms_spistream.h +++ b/sw/airborne/fms/fms_spistream.h @@ -6,29 +6,29 @@ #define min(a,b) ((a>b)? (b) : (a)) -void print_message(char prefix[], uint8_t msg_id, uint8_t * data, uint16_t num_bytes); +void print_message(char prefix[], uint8_t msg_id, uint8_t * data, uint16_t num_bytes); void print_message(char prefix[], uint8_t msg_id, uint8_t * data, uint16_t num_bytes) { /* - struct tm * timeinfo; + struct tm * timeinfo; time_t c_time; char time_str[30]; */ - uint8_t cnt; - uint8_t log_bytes = num_bytes; + uint8_t cnt; + uint8_t log_bytes = num_bytes; if(log_bytes > 16) { log_bytes = 16; } /* - time(&c_time); + time(&c_time); timeinfo = localtime(&c_time); - strftime(time_str, 30, " %X ", timeinfo); - - printf("%s %s bytes: %3d | id: %3d | UART%d | ", + strftime(time_str, 30, " %X ", timeinfo); + + printf("%s %s bytes: %3d | id: %3d | UART%d | ", prefix, time_str, num_bytes, msg_id, data[0]); */ - printf("%s bytes: %3d | id: %3d | UART%d | ", + printf("%s bytes: %3d | id: %3d | UART%d | ", prefix, num_bytes, msg_id, data[0]); - for(cnt = 1; cnt < log_bytes; cnt++) { + for(cnt = 1; cnt < log_bytes; cnt++) { printf("%02X ", data[cnt]); - if(cnt >= 24 && cnt % 24 == 0 && cnt+1 < log_bytes) { + if(cnt >= 24 && cnt % 24 == 0 && cnt+1 < log_bytes) { printf("\n "); } } diff --git a/sw/airborne/fms/fms_spistream_client.c b/sw/airborne/fms/fms_spistream_client.c index afa45a7e5e..8306905206 100644 --- a/sw/airborne/fms/fms_spistream_client.c +++ b/sw/airborne/fms/fms_spistream_client.c @@ -62,8 +62,8 @@ static int open_stream(void); static void on_kill(int signum); -static int dfifo[4]; -static int cfifo[4]; +static int dfifo[4]; +static int cfifo[4]; static char dfifo_files[4][40]; static char cfifo_files[4][40]; @@ -72,7 +72,7 @@ static char cfifo_files[4][40]; int main(int argc, char *argv[]) { parse_command_line(argc, argv); - + main_init(); TRACE(TRACE_DEBUG, "%s", "Entering mainloop\n"); @@ -81,8 +81,8 @@ int main(int argc, char *argv[]) { while(1) { sleep(100); } - - main_exit(); + + main_exit(); TRACE(TRACE_DEBUG, "%s", "leaving mainloop, goodbye!\n"); @@ -90,40 +90,40 @@ int main(int argc, char *argv[]) { } static void main_periodic(int my_sig_num) { - uint8_t fifo_idx; - uint8_t msg_id; - uint16_t num_bytes; - int16_t ret; + uint8_t fifo_idx; + uint8_t msg_id; + uint16_t num_bytes; + int16_t ret; static uint8_t buf[SPISTREAM_MAX_MESSAGE_LENGTH*10]; - for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { - // The periodic is triggered before fifo - // connections have been initialized, so - // check for a valid fd first: - if(dfifo[fifo_idx] > 0) { + for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { + // The periodic is triggered before fifo + // connections have been initialized, so + // check for a valid fd first: + if(dfifo[fifo_idx] > 0) { ret = read(dfifo[fifo_idx], (uint8_t *)(&num_bytes), 2); ret = read(dfifo[fifo_idx], (uint8_t *)(&msg_id), 1); - memset(&buf, 0, SPISTREAM_MAX_MESSAGE_LENGTH); - if(num_bytes > SPISTREAM_MAX_MESSAGE_LENGTH) { + memset(&buf, 0, SPISTREAM_MAX_MESSAGE_LENGTH); + if(num_bytes > SPISTREAM_MAX_MESSAGE_LENGTH) { fprintf(stderr, "Warning: Message has length %d, but limit " - "is %d\n", + "is %d\n", num_bytes, SPISTREAM_MAX_MESSAGE_LENGTH); num_bytes = SPISTREAM_MAX_MESSAGE_LENGTH; } ret = read(dfifo[fifo_idx], &buf, num_bytes); - if(ret > 0 && ret == num_bytes) { + if(ret > 0 && ret == num_bytes) { // Message received print_message(">> Client", msg_id, buf, num_bytes); } - else if(ret > 0 && ret < num_bytes) { - fprintf(stderr, "Tried to read %d bytes, but only got %d\n", - num_bytes, ret); + else if(ret > 0 && ret < num_bytes) { + fprintf(stderr, "Tried to read %d bytes, but only got %d\n", + num_bytes, ret); } } - else { - // FIFO file descriptor is invalid, - // retry to open it: + else { + // FIFO file descriptor is invalid, + // retry to open it: dfifo[fifo_idx] = open(dfifo_files[fifo_idx], O_RDONLY | O_NONBLOCK); } } @@ -136,11 +136,11 @@ static void main_init(void) { /* Initalize the event library */ event_init(); - + /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return; + return; } signal(SIGKILL, on_kill); @@ -151,7 +151,7 @@ static void main_init(void) { signal(SIGTERM, on_kill); signal(SIGSEGV, on_kill); - if(!open_stream()) { + if(!open_stream()) { fprintf(stderr, "Could not open stream, sorry\n"); exit(1); } @@ -160,56 +160,56 @@ static void main_init(void) { } /** - * For every FIFO, a non-blocking connection try is called - * via open(..., O_NONBLOCK). - * This immediately returns a file descriptor or 0 if - * the other end of the fifo is closed. - * In the transmission, we check the FIFO file descriptors - * and retry to open them, in case they are invalid. - * You can also just open() them without O_NONBLOCK in - * the client app, but the daemon should be running before - * starting the client then, otherwise open() would block. + * For every FIFO, a non-blocking connection try is called + * via open(..., O_NONBLOCK). + * This immediately returns a file descriptor or 0 if + * the other end of the fifo is closed. + * In the transmission, we check the FIFO file descriptors + * and retry to open them, in case they are invalid. + * You can also just open() them without O_NONBLOCK in + * the client app, but the daemon should be running before + * starting the client then, otherwise open() would block. * - * When using this strategy, we get connection - * recovery for free when either daemon or client die. + * When using this strategy, we get connection + * recovery for free when either daemon or client die. + * + * After the connections are established, you can use them + * for read() and write(), as well as register an event + * trigger on them, like select() or libevent. * - * After the connections are established, you can use them - * for read() and write(), as well as register an event - * trigger on them, like select() or libevent. - * */ -static int open_stream(void) { - uint8_t fifo_idx; +static int open_stream(void) { + uint8_t fifo_idx; strcpy(dfifo_files[0], "/tmp/spistream_d0.fifo"); // FIFOs for data strcpy(dfifo_files[1], "/tmp/spistream_d1.fifo"); // (STM -> daemon -> client) - strcpy(dfifo_files[2], "/tmp/spistream_d2.fifo"); + strcpy(dfifo_files[2], "/tmp/spistream_d2.fifo"); strcpy(dfifo_files[3], "/tmp/spistream_d3.fifo"); strcpy(cfifo_files[0], "/tmp/spistream_c0.fifo"); // FIFOs for commands strcpy(cfifo_files[1], "/tmp/spistream_c1.fifo"); // (client -> daemon -> STM) - strcpy(cfifo_files[2], "/tmp/spistream_c2.fifo"); + strcpy(cfifo_files[2], "/tmp/spistream_c2.fifo"); strcpy(cfifo_files[3], "/tmp/spistream_c3.fifo"); - - for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { + + for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { fprintf(stderr, "Open data stream %s ... \n", dfifo_files[fifo_idx]); dfifo[fifo_idx] = open(dfifo_files[fifo_idx], O_RDONLY | O_NONBLOCK); fprintf(stderr, " ...\n"); } - return 1; + return 1; - for(fifo_idx = 0; fifo_idx < 3; fifo_idx++) { + for(fifo_idx = 0; fifo_idx < 3; fifo_idx++) { fprintf(stderr, "Open command stream %s ... \n", cfifo_files[fifo_idx]); cfifo[fifo_idx] = open(cfifo_files[fifo_idx], O_WRONLY); - if(cfifo[fifo_idx] < 0) { + if(cfifo[fifo_idx] < 0) { fprintf(stderr, " failed\n"); - return 0; + return 0; } } - return 1; + return 1; } -static void main_exit(void) +static void main_exit(void) { fprintf(stderr, "Bye!\n"); } @@ -220,6 +220,6 @@ static void parse_command_line(int argc, char** argv) { static void on_kill(int signum) { fprintf(stderr, "Exiting, got signal %d\n", signum); - main_exit(); + main_exit(); exit(1); } diff --git a/sw/airborne/fms/fms_spistream_daemon.c b/sw/airborne/fms/fms_spistream_daemon.c index bc03f97a48..903a27d87d 100644 --- a/sw/airborne/fms/fms_spistream_daemon.c +++ b/sw/airborne/fms/fms_spistream_daemon.c @@ -77,8 +77,8 @@ static void send_to_client(uint8_t * data, uint16_t num_bytes, uint8_t fifo_idx) static uint8_t spistream_msg[123]; -static int dfifo[4]; -static int cfifo[4]; +static int dfifo[4]; +static int cfifo[4]; static char dfifo_files[4][40]; static char cfifo_files[4][40]; @@ -87,7 +87,7 @@ static char cfifo_files[4][40]; int main(int argc, char *argv[]) { parse_command_line(argc, argv); - + main_init(); TRACE(TRACE_DEBUG, "%s", "Entering mainloop\n"); @@ -96,8 +96,8 @@ int main(int argc, char *argv[]) { while(1) { sleep(100); } - - main_exit(); + + main_exit(); TRACE(TRACE_DEBUG, "%s", "leaving mainloop, goodbye!\n"); @@ -107,28 +107,28 @@ int main(int argc, char *argv[]) { static void main_periodic(int my_sig_num) { static int32_t every_100 = 1000; - if(every_100-- == 0) { + if(every_100-- == 0) { every_100 = 1000; spistream_send_msg(spistream_msg, 21, SPISTREAM_NO_WAIT); } - spistream_event(); + spistream_event(); } static void spistream_event() { static struct AutopilotMessagePTStream msg_in; static struct AutopilotMessagePTStream msg_out; - static uint8_t crc_valid; + static uint8_t crc_valid; - spistream_read_pkg(&msg_in); + spistream_read_pkg(&msg_in); /* - uint8_t cnt; + uint8_t cnt; static uint8_t pkg_size = sizeof(msg_in.pkg_data); - if(msg_out.message_cnt != 0) { - printf("Package out: Size: %3d MID: %3d PCNTD: %3d | ", + if(msg_out.message_cnt != 0) { + printf("Package out: Size: %3d MID: %3d PCNTD: %3d | ", pkg_size, msg_out.message_cnt, msg_out.package_cntd); - for(cnt = 0; cnt < pkg_size; cnt++) { + for(cnt = 0; cnt < pkg_size; cnt++) { printf("%3d ", msg_out.pkg_data[cnt]); } printf("\n"); @@ -136,70 +136,70 @@ static void spistream_event() { */ spi_link_send(&msg_out, sizeof(struct AutopilotMessageCRCFrame), &msg_in, &crc_valid); /* - if(msg_in.message_cnt != 0) { - printf("PKG in (spi trx: %d): Size: %3d MID: %3d PCNTD: %3d | ", SPISTREAM_PACKAGE_SIZE, + if(msg_in.message_cnt != 0) { + printf("PKG in (spi trx: %d): Size: %3d MID: %3d PCNTD: %3d | ", SPISTREAM_PACKAGE_SIZE, pkg_size, msg_in.message_cnt, msg_in.package_cntd); - for(cnt = 0; cnt < pkg_size; cnt++) { + for(cnt = 0; cnt < pkg_size; cnt++) { printf("%02X ", msg_in.pkg_data[cnt]); } printf("\n"); } */ - spistream_write_pkg(&msg_out); + spistream_write_pkg(&msg_out); } -static void on_spistream_msg_received(uint8_t msg_id, - uint8_t * data, +static void on_spistream_msg_received(uint8_t msg_id, + uint8_t * data, uint16_t num_bytes) { - uint8_t uart; + uint8_t uart; uint8_t buf[SPISTREAM_MAX_MESSAGE_LENGTH+3]; - print_message("<< Daemon", msg_id, data, num_bytes); + print_message("<< Daemon", msg_id, data, num_bytes); - uart = data[0]; + uart = data[0]; // Check for valid uart ID - if(uart >= 0 && uart <= 3) { + if(uart >= 0 && uart <= 3) { if(msg_id > 0) { buf[0] = (uint8_t)(num_bytes & 0x00ff); buf[1] = (uint8_t)((num_bytes << 8) & 0x00ff); - buf[2] = msg_id; - if(num_bytes > SPISTREAM_MAX_MESSAGE_LENGTH) { + buf[2] = msg_id; + if(num_bytes > SPISTREAM_MAX_MESSAGE_LENGTH) { fprintf(LOG_OUT, "Warning: Message has length %d, but limit " - "is %d - truncating message\n", + "is %d - truncating message\n", num_bytes, SPISTREAM_MAX_MESSAGE_LENGTH); num_bytes = SPISTREAM_MAX_MESSAGE_LENGTH; } - memcpy(buf+3, data, num_bytes); - send_to_client(buf, num_bytes+3, uart); + memcpy(buf+3, data, num_bytes); + send_to_client(buf, num_bytes+3, uart); } } } static void send_to_client(uint8_t * data, uint16_t num_bytes, uint8_t fifo_idx) { - if(dfifo[fifo_idx] <= 0) { + if(dfifo[fifo_idx] <= 0) { // No client connected to this fifo, yet dfifo[fifo_idx] = open(dfifo_files[fifo_idx], O_WRONLY | O_NONBLOCK); - if(dfifo[fifo_idx] <= 0) { - fprintf(LOG_OUT, "No client for data fifo %d (%s)\n", - fifo_idx, dfifo_files[fifo_idx]); + if(dfifo[fifo_idx] <= 0) { + fprintf(LOG_OUT, "No client for data fifo %d (%s)\n", + fifo_idx, dfifo_files[fifo_idx]); return; } } - else { + else { // Client connected to this fifo - if(write(dfifo[fifo_idx], data, num_bytes) == -1) { + if(write(dfifo[fifo_idx], data, num_bytes) == -1) { fprintf(LOG_OUT, "Write error on data fifo %d\n", fifo_idx); } - } + } } -static void on_spistream_msg_sent(uint8_t msg_id) { +static void on_spistream_msg_sent(uint8_t msg_id) { // TRACE(TRACE_DEBUG, "%s", "SPI message sent \n"); } static void main_init(void) { - uint8_t byte_idx; + uint8_t byte_idx; TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); @@ -209,19 +209,19 @@ static void main_init(void) { return; } - spistream_init(&on_spistream_msg_received, - &on_spistream_msg_sent); + spistream_init(&on_spistream_msg_received, + &on_spistream_msg_sent); - for(byte_idx=1; byte_idx < 123; byte_idx++) { - spistream_msg[byte_idx] = byte_idx; + for(byte_idx=1; byte_idx < 123; byte_idx++) { + spistream_msg[byte_idx] = byte_idx; } /* Initalize the event library */ event_init(); - + /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return; + return; } signal(SIGKILL, on_kill); @@ -233,7 +233,7 @@ static void main_init(void) { signal(SIGSEGV, on_kill); signal(SIGPIPE, on_dead_pipe); - if(!open_stream()) { + if(!open_stream()) { fprintf(LOG_OUT, "Could not open stream, sorry\n"); exit(1); } @@ -241,10 +241,10 @@ static void main_init(void) { TRACE(TRACE_DEBUG, "%s", "Initialization completed\n"); } -static void main_exit(void) +static void main_exit(void) { fprintf(LOG_OUT, "Closing socket\n"); - close_stream(); + close_stream(); } static void parse_command_line(int argc, char** argv) { @@ -259,68 +259,68 @@ static void parse_command_line(int argc, char** argv) { */ } -static int open_stream(void) { - uint8_t fifo_idx; - int ret; +static int open_stream(void) { + uint8_t fifo_idx; + int ret; strcpy(dfifo_files[0], "/tmp/spistream_d0.fifo"); // FIFOs for data strcpy(dfifo_files[1], "/tmp/spistream_d1.fifo"); // (STM -> daemon -> client) - strcpy(dfifo_files[2], "/tmp/spistream_d2.fifo"); + strcpy(dfifo_files[2], "/tmp/spistream_d2.fifo"); strcpy(dfifo_files[3], "/tmp/spistream_d3.fifo"); strcpy(cfifo_files[0], "/tmp/spistream_c0.fifo"); // FIFOs for commands strcpy(cfifo_files[1], "/tmp/spistream_c1.fifo"); // (client -> daemon -> STM) - strcpy(cfifo_files[2], "/tmp/spistream_c2.fifo"); + strcpy(cfifo_files[2], "/tmp/spistream_c2.fifo"); strcpy(cfifo_files[3], "/tmp/spistream_c3.fifo"); - - for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { + + for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { fprintf(LOG_OUT, "Creating data stream %s ...", dfifo_files[fifo_idx]); if((ret = mkfifo(dfifo_files[fifo_idx], 0777)) < 0) { fprintf(LOG_OUT, " failed\n"); - fprintf(LOG_OUT, "Could not create data fifo %d: %s\n", + fprintf(LOG_OUT, "Could not create data fifo %d: %s\n", fifo_idx, dfifo_files[fifo_idx]); - close_stream(); - return 0; + close_stream(); + return 0; } - else { + else { fprintf(LOG_OUT, " ok\n"); dfifo[fifo_idx] = open(dfifo_files[fifo_idx], O_WRONLY | O_NONBLOCK); } } - for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { + for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { fprintf(LOG_OUT, "Creating command stream %s ... ", cfifo_files[fifo_idx]); if((ret = mkfifo(cfifo_files[fifo_idx], 0777)) < 0) { fprintf(LOG_OUT, " failed\n"); - fprintf(LOG_OUT, "Could not create command fifo %d: %s\n", + fprintf(LOG_OUT, "Could not create command fifo %d: %s\n", fifo_idx, cfifo_files[fifo_idx]); - close_stream(); - return 0; + close_stream(); + return 0; } - else { + else { fprintf(LOG_OUT, " ok\n"); cfifo[fifo_idx] = open(cfifo_files[fifo_idx], O_RDONLY | O_NONBLOCK); } } - return 1; + return 1; } -static void close_stream(void) { - uint8_t fifo_idx; +static void close_stream(void) { + uint8_t fifo_idx; fprintf(LOG_OUT, "Closing streams\n"); - for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) - { - if(dfifo[fifo_idx] >= 0) { - close(dfifo[fifo_idx]); + for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) + { + if(dfifo[fifo_idx] >= 0) { + close(dfifo[fifo_idx]); } - unlink(dfifo_files[fifo_idx]); - if(cfifo[fifo_idx] >= 0) { - close(cfifo[fifo_idx]); + unlink(dfifo_files[fifo_idx]); + if(cfifo[fifo_idx] >= 0) { + close(cfifo[fifo_idx]); } - unlink(cfifo_files[fifo_idx]); + unlink(cfifo_files[fifo_idx]); } } -static void on_timeout(int signum) +static void on_timeout(int signum) { fprintf(LOG_OUT, "Timeout, stopping spistream daemon\n"); exit(6); @@ -329,19 +329,19 @@ static void on_timeout(int signum) static void on_kill(int signum) { fprintf(LOG_OUT, "Exiting, got signal %d\n", signum); - main_exit(); + main_exit(); exit(1); } static void on_dead_pipe(int signum) { - uint8_t fifo_idx; + uint8_t fifo_idx; fprintf(LOG_OUT, "Got SIGPIPE (signal %d)\n", signum); - // *Pop* goes the pipe. Looks like our client got AWOL. - // Let's be nice and invalidate the file descriptors: + // *Pop* goes the pipe. Looks like our client got AWOL. + // Let's be nice and invalidate the file descriptors: for(fifo_idx = 0; fifo_idx < 4; fifo_idx++) { - close(dfifo[fifo_idx]); - dfifo[fifo_idx] = -1; + close(dfifo[fifo_idx]); + dfifo[fifo_idx] = -1; } } diff --git a/sw/airborne/fms/fms_test_datalink.c b/sw/airborne/fms/fms_test_datalink.c index b3f51c3a60..13ff9f7e4f 100644 --- a/sw/airborne/fms/fms_test_datalink.c +++ b/sw/airborne/fms/fms_test_datalink.c @@ -104,7 +104,7 @@ int main(int argc , char** argv) { network = network_new(LINK_HOST, LINK_PORT, DATALINK_PORT, FMS_UNICAST); event_set(&datalink_event, network->socket_in, EV_READ, on_datalink_event, &datalink_event); event_add(&datalink_event, NULL); - + event_dispatch(); return 0; diff --git a/sw/airborne/fms/libeknav/estimate_attitude.c b/sw/airborne/fms/libeknav/estimate_attitude.c index 4a0abc4a33..b23f49e9c2 100644 --- a/sw/airborne/fms/libeknav/estimate_attitude.c +++ b/sw/airborne/fms/libeknav/estimate_attitude.c @@ -16,47 +16,47 @@ struct DoubleMat44 square_skaled(struct DoubleMat44 A){ } /* the following solver uses the Power Iteration - * + * * It is rather simple: * 1. You choose a starting vektor x_0 (shouldn't be zero) * 2. apply it on the Matrix * x_(k+1) = A * x_k * 3. Repeat this very often. - * + * * The vector converges to the dominat eigenvector, which belongs to the eigenvalue with the biggest absolute value. - * + * * But there is a problem: * With every step, the norm of vector grows. Therefore it's necessary to scale it with every step. - * + * * Important warnings: * I. This function does not converge if the Matrix is singular * II. Pay attention to the loop-condition! It does not end if it's close to the eigenvector! * It ends if the steps are getting too close to each other. - * - */ + * + */ DoubleVect4 dominant_Eigenvector(struct DoubleMat44 A, unsigned int maximum_iterations, double precision, struct DoubleMat44 sigma_A, DoubleVect4 *sigma_x){ unsigned int k; DoubleVect4 x_k, x_kp1; double delta = 1, scale; - + FLOAT_QUAT_ZERO(x_k); - + //for(k=0; (kprecision); k++){ for(k=0; k * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -93,10 +93,10 @@ static inline void main_event_task( void ) { static inline void main_spi_init(void) { /* setup pins for SPI0 (SCK, MISO, MOSI, SS) */ PINSEL0 |= PINSEL0_SCK | PINSEL0_MISO | PINSEL0_MOSI | PINSEL0_SSEL; - + S0SPCR = S0SPCR_LSF_VAL; S0SPCCR = CPSDVSR; - + /* initialize interrupt vector */ VICIntSelect &= ~VIC_BIT(VIC_SPI0); // SPI1 selected as IRQ VICIntEnable = VIC_BIT(VIC_SPI0); // SPI1 interrupt enabled @@ -110,11 +110,11 @@ static inline void main_spi_init(void) { static void SPI0_ISR(void) { ISR_ENTRY(); - + static uint8_t cnt = 0; LED_TOGGLE(1); - if ( bit_is_set(S0SPSR, SPIF)) { /* transfer complete */ + if ( bit_is_set(S0SPSR, SPIF)) { /* transfer complete */ uint8_t foo = S0SPDR; S0SPDR = cnt; cnt++; diff --git a/sw/airborne/fms/onboard_logger.c b/sw/airborne/fms/onboard_logger.c index 9370aa58e7..4ae3c207f1 100644 --- a/sw/airborne/fms/onboard_logger.c +++ b/sw/airborne/fms/onboard_logger.c @@ -35,7 +35,7 @@ static void got_pprz_message(const u_char *buf, const struct timeval *ts) printf("%i.%06i ", (unsigned) ts->tv_sec - start_secs, (unsigned) ts->tv_usec); printf("%d ", (uint32_t) buf[1]); // paparazzi timestamp; see udp_transport.h printf("%i %i ", buf[5], buf[6]); // AC_ID MSG_ID - for(i = 6; i < length - 3; i++) + for(i = 6; i < length - 3; i++) { printf("%02x ", buf[i]); } @@ -78,13 +78,13 @@ static void got_packet (u_char *args, const struct pcap_pkthdr *header, if (payload[i] != 0x98) { // printf("missing start byte\n"); break; - } + } i++; msg_length = payload[i]; if ((i + msg_length <= udp_length) && msg_length >= MIN_MSG_LENGTH) { got_pprz_message(payload + i, &header->ts); i += payload[i] - 1; - } + } } } @@ -112,7 +112,7 @@ static int init_capture(char *device, pcap_t **handle) if (pcap_compile(*handle, &fp, filter_exp, 0, net) == -1) { fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(*handle)); return 2; - } + } if (pcap_setfilter(*handle, &fp) == -1) { fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(*handle)); @@ -141,6 +141,6 @@ int main(int argc, char *argv[]) pcap_loop(handle, -1, got_packet, NULL); pcap_close(handle); - + return 0; } diff --git a/sw/airborne/fms/onboard_transport.c b/sw/airborne/fms/onboard_transport.c index 4387dd780e..5065dbd2e8 100644 --- a/sw/airborne/fms/onboard_transport.c +++ b/sw/airborne/fms/onboard_transport.c @@ -114,7 +114,7 @@ static void overrun(void *impl) static void count_bytes(void *onboard __attribute__((unused)), uint8_t bytes __attribute__((unused))) { - + } static int check_free_space(void *onboard __attribute__((unused)), uint8_t bytes __attribute__((unused))) @@ -150,7 +150,7 @@ static int open_piped(char *filepath) int retval; /* Lower our priority -- logging is not that important */ - if (setpriority(PRIO_PROCESS, 0, 10) < 0) + if (setpriority(PRIO_PROCESS, 0, 10) < 0) fprintf(stderr, "Couldn't renice logger for some reason!\n"); // copy from the read side of the pipe to the log diff --git a/sw/airborne/fms/overo_blmc_calibrate.c b/sw/airborne/fms/overo_blmc_calibrate.c index 27567af515..00ecc0e12f 100644 --- a/sw/airborne/fms/overo_blmc_calibrate.c +++ b/sw/airborne/fms/overo_blmc_calibrate.c @@ -56,7 +56,7 @@ static void dialog_with_io_proc() { struct AutopilotMessageCRCFrame msg_in; struct AutopilotMessageCRCFrame msg_out; - uint8_t crc_valid; + uint8_t crc_valid; for (uint8_t i=0; i 48) { log_bytes = 48; } + log_bytes = num_bytes; + if(log_bytes > 48) { log_bytes = 48; } printf("SPI message received: "); printf("%s | Length: %3d | id: %3d | UART%d | ", time_str, num_bytes, msg_id, data[0]); - for(cnt = 1; cnt < log_bytes; cnt++) { + for(cnt = 1; cnt < log_bytes; cnt++) { printf("%02X ", data[cnt]); } printf("\n"); } -static void on_spistream_msg_sent(void) { +static void on_spistream_msg_sent(void) { // TRACE(TRACE_DEBUG, "%s", "SPI message sent \n"); } static void main_init(void) { - uint8_t byte_idx; + uint8_t byte_idx; TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); @@ -162,29 +162,29 @@ static void main_init(void) { return; } - spistream_init(&on_spistream_msg_received, - &on_spistream_msg_sent); + spistream_init(&on_spistream_msg_received, + &on_spistream_msg_sent); /* - spistream_msg[0] = 0; - for(byte_idx=1; byte_idx < 123; byte_idx += 4) { + spistream_msg[0] = 0; + for(byte_idx=1; byte_idx < 123; byte_idx += 4) { spistream_msg[byte_idx] = 0xDE; spistream_msg[byte_idx+1] = 0xAD; spistream_msg[byte_idx+2] = 0xBE; spistream_msg[byte_idx+3] = 0xEF; } */ - for(byte_idx=1; byte_idx < 123; byte_idx++) { - spistream_msg[byte_idx] = byte_idx; + for(byte_idx=1; byte_idx < 123; byte_idx++) { + spistream_msg[byte_idx] = byte_idx; } /* Initalize the event library */ event_init(); - + /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return; + return; } - + TRACE(TRACE_DEBUG, "%s", "Initialization completed\n"); } diff --git a/sw/airborne/fms/overo_test_passthrough.c b/sw/airborne/fms/overo_test_passthrough.c index 4224b0267d..826975fd6c 100644 --- a/sw/airborne/fms/overo_test_passthrough.c +++ b/sw/airborne/fms/overo_test_passthrough.c @@ -54,13 +54,13 @@ static void dialog_with_io_proc(void); int main(int argc, char *argv[]) { parse_command_line(argc, argv); - + main_init(); TRACE(TRACE_DEBUG, "%s", "Entering mainloop\n"); /* Enter our mainloop */ event_dispatch(); - + TRACE(TRACE_DEBUG, "%s", "leaving mainloop... goodbye!\n"); return 0; @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { static void main_periodic(int my_sig_num) { dialog_with_io_proc(); - + fms_gs_com_periodic(); } @@ -81,17 +81,17 @@ static void dialog_with_io_proc() { struct AutopilotMessageCRCFrame msg_in; struct AutopilotMessageCRCFrame msg_out; - uint8_t crc_valid; + uint8_t crc_valid; for (uint8_t i=0; i<6; i++) msg_out.payload.msg_down.pwm_outputs_usecs[i] = otp.servos_outputs_usecs[i]; for (uint8_t i=0; i<4; i++) msg_out.payload.msg_down.csc_servo_cmd[i] = otp.csc_servo_outputs[i]; spi_link_send(&msg_out, sizeof(struct AutopilotMessageCRCFrame), &msg_in, &crc_valid); - struct AutopilotMessagePTUp *in = &msg_in.payload.msg_up; + struct AutopilotMessagePTUp *in = &msg_in.payload.msg_up; RATES_FLOAT_OF_BFP(otp.imu.gyro, in->gyro); - ACCELS_FLOAT_OF_BFP(otp.imu.accel, in->accel); - MAGS_FLOAT_OF_BFP(otp.imu.mag, in->mag); + ACCELS_FLOAT_OF_BFP(otp.imu.accel, in->accel); + MAGS_FLOAT_OF_BFP(otp.imu.mag, in->mag); otp.io_proc_msg_cnt = in->stm_msg_cnt; otp.io_proc_err_cnt = in->stm_crc_err_cnt; @@ -113,16 +113,16 @@ static void main_init(void) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return; } - + /* Initalize the event library */ event_init(); - + /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return; + return; } - + /* Initialize our communications with ground segment */ fms_gs_com_init(otp.gs_gw, 4242, 4243, FALSE); @@ -141,7 +141,7 @@ static void parse_command_line(int argc, char** argv) { otp.gs_gw = strdup(argv[1]); else otp.gs_gw = strdup("10.31.4.7"); - TRACE(TRACE_DEBUG, "%s", "Parsing command line:\n"); - TRACE(TRACE_DEBUG, " gw: %s\n", otp.gs_gw); + TRACE(TRACE_DEBUG, "%s", "Parsing command line:\n"); + TRACE(TRACE_DEBUG, " gw: %s\n", otp.gs_gw); } diff --git a/sw/airborne/fms/overo_test_periodic.c b/sw/airborne/fms/overo_test_periodic.c index 52425d7e24..7f71f00ed4 100644 --- a/sw/airborne/fms/overo_test_periodic.c +++ b/sw/airborne/fms/overo_test_periodic.c @@ -31,12 +31,12 @@ int main(int argc, char** argv) { /* Initalize event library */ event_init(); - + if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); - return -1; + return -1; } - + if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link\n"); return -1; @@ -47,7 +47,7 @@ int main(int argc, char** argv) { struct event datalink_event; event_set(&datalink_event, network->socket_in, EV_READ, on_datalink_event, &datalink_event); event_add(&datalink_event, NULL); - + event_dispatch(); return 0; diff --git a/sw/airborne/fms/overo_test_spi_link.c b/sw/airborne/fms/overo_test_spi_link.c index f36ebe1c7a..2ae2de5e45 100644 --- a/sw/airborne/fms/overo_test_spi_link.c +++ b/sw/airborne/fms/overo_test_spi_link.c @@ -41,25 +41,25 @@ static void print_down_msg(struct AutopilotMessageCRCFrame * msg); int main(int argc, char *argv[]) { - - uint32_t us_delay; - - if(argc > 1) { + + uint32_t us_delay; + + if(argc > 1) { us_delay = atoi(argv[1]); } - else { - us_delay = 1953; + else { + us_delay = 1953; } - printf("Delay: %dus\n", us_delay); - + printf("Delay: %dus\n", us_delay); + if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return -1; } - - uint8_t skip_buf_check = 0; - uint8_t skip_crc_check = 0; + + uint8_t skip_buf_check = 0; + uint8_t skip_crc_check = 0; uint32_t buf_check_errors = 0; @@ -68,14 +68,14 @@ int main(int argc, char *argv[]) { struct AutopilotMessageCRCFrame msg_out_prev; struct AutopilotMessageCRCFrame crc_msg_in; uint8_t crc_valid; - + /* backup message for later comparison */ memcpy(&msg_out_prev, &crc_msg_out, sizeof(struct AutopilotMessageCRCFrame)); - /* fill message with data */ + /* fill message with data */ fill_msg(&crc_msg_out); /* send it over spi */ spi_link_send(&crc_msg_out, sizeof(struct AutopilotMessageCRCFrame), &crc_msg_in, &crc_valid); - + /* check that received message is identical to the one previously sent */ if (!skip_buf_check && spi_link.msg_cnt > 1) { if (memcmp(&crc_msg_in.payload, &msg_out_prev.payload, sizeof(struct OVERO_LINK_MSG_DOWN))) { @@ -87,46 +87,46 @@ int main(int argc, char *argv[]) { } /* report crc error */ if (!skip_crc_check & !crc_valid) { - printf("CRC checksum failed: received %04X != computed %04X\n", - crc_msg_in.crc, + printf("CRC checksum failed: received %04X != computed %04X\n", + crc_msg_in.crc, crc_calc_block_crc8((uint8_t*)&crc_msg_in.payload, sizeof(struct OVERO_LINK_MSG_DOWN))); } /* report message count */ if (!(spi_link.msg_cnt % 1000)) - printf("msg %d, buf err %d, CRC errors: %d\n", spi_link.msg_cnt, + printf("msg %d, buf err %d, CRC errors: %d\n", spi_link.msg_cnt, buf_check_errors, spi_link.crc_err_cnt); /* give it some rest */ if(us_delay > 0) usleep(us_delay); } - + return 0; } static void print_up_msg(struct AutopilotMessageCRCFrame * msg) { - printf("UP: %08X %08X %08X %08X %08X %08X %08X %08X CRC: %08X\n", - msg->payload.msg_up.foo, - msg->payload.msg_up.bar, - msg->payload.msg_up.bla, - msg->payload.msg_up.ble, - msg->payload.msg_up.bli, - msg->payload.msg_up.blo, - msg->payload.msg_up.blu, - msg->payload.msg_up.bly, + printf("UP: %08X %08X %08X %08X %08X %08X %08X %08X CRC: %08X\n", + msg->payload.msg_up.foo, + msg->payload.msg_up.bar, + msg->payload.msg_up.bla, + msg->payload.msg_up.ble, + msg->payload.msg_up.bli, + msg->payload.msg_up.blo, + msg->payload.msg_up.blu, + msg->payload.msg_up.bly, msg->crc); } static void print_down_msg(struct AutopilotMessageCRCFrame * msg) { - printf("DW: %08X %08X %08X %08X %08X %08X %08X %08X CRC: %08X\n", - msg->payload.msg_down.foo, - msg->payload.msg_down.bar, - msg->payload.msg_down.bla, - msg->payload.msg_down.ble, - msg->payload.msg_down.bli, - msg->payload.msg_down.blo, - msg->payload.msg_up.blu, - msg->payload.msg_up.bly, + printf("DW: %08X %08X %08X %08X %08X %08X %08X %08X CRC: %08X\n", + msg->payload.msg_down.foo, + msg->payload.msg_down.bar, + msg->payload.msg_down.bla, + msg->payload.msg_down.ble, + msg->payload.msg_down.bli, + msg->payload.msg_down.blo, + msg->payload.msg_up.blu, + msg->payload.msg_up.bly, msg->crc); } @@ -141,9 +141,9 @@ static void fill_msg_counter(struct AutopilotMessageCRCFrame * msg) { msg->payload.msg_up.blo = 0xff; msg->payload.msg_up.blu = 0; msg->payload.msg_up.bly = 0; - - foo--; - if(foo == 0) { + + foo--; + if(foo == 0) { foo = 5000; } } diff --git a/sw/airborne/fms/overo_test_telemetry2.c b/sw/airborne/fms/overo_test_telemetry2.c index ef7a875952..a4a8cfb7a3 100644 --- a/sw/airborne/fms/overo_test_telemetry2.c +++ b/sw/airborne/fms/overo_test_telemetry2.c @@ -49,7 +49,7 @@ void timeout_cb(int fd, short event, void *arg) { float foof = 3.14159265358979323846; double food = 3.14159265358979323846; DOWNLINK_SEND_TEST_FORMAT(udp_transport, &food, &foof); - + if (udp_transport->Periodic) { udp_transport->Periodic(udp_transport->impl); } @@ -79,13 +79,13 @@ uint8_t my_dl_buffer[DL_MSG_SIZE] __attribute__ ((aligned)); static void dl_handle_msg(struct DownlinkTransport *tp) { uint8_t msg_id = IdOfMsg(my_dl_buffer); switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(tp); } break; - + case DL_SETTING : { uint8_t i = DL_SETTING_index(my_dl_buffer); diff --git a/sw/airborne/fms/test_telemetry.c b/sw/airborne/fms/test_telemetry.c index 947ae5e4cc..dca294c49f 100644 --- a/sw/airborne/fms/test_telemetry.c +++ b/sw/airborne/fms/test_telemetry.c @@ -3,10 +3,10 @@ #include int main(int argc, char** argv) { - - + + GMainLoop* ml = g_main_loop_new(NULL, FALSE); g_main_loop_run(ml); - + return 0; } diff --git a/sw/airborne/fms/udp_transport.h b/sw/airborne/fms/udp_transport.h index 392573477b..7c2ed36d96 100644 --- a/sw/airborne/fms/udp_transport.h +++ b/sw/airborne/fms/udp_transport.h @@ -14,7 +14,7 @@ #define STX_UDP_TX 0x99 #define STX_UDP_RX 0x99 #define PPRZ_PROTOCOL_OVERHEAD 4 -#define UdpTransportPutTimestamp(x) {} +#define UdpTransportPutTimestamp(x) {} #endif #ifndef MSG_TIMESTAMP diff --git a/sw/airborne/fms/udp_transport2.c b/sw/airborne/fms/udp_transport2.c index 4cd448157f..da5ae29e9a 100644 --- a/sw/airborne/fms/udp_transport2.c +++ b/sw/airborne/fms/udp_transport2.c @@ -63,12 +63,12 @@ static void end_message(void *impl) static void overrun(void *impl __attribute__((unused))) { - + } static void count_bytes(void *udp __attribute__((unused)), uint8_t bytes __attribute__((unused))) { - + } static int check_free_space(void *udp __attribute__((unused)), uint8_t bytes __attribute__((unused))) diff --git a/sw/airborne/fms/udp_transport2.h b/sw/airborne/fms/udp_transport2.h index be5a6a9a24..9500b6023a 100644 --- a/sw/airborne/fms/udp_transport2.h +++ b/sw/airborne/fms/udp_transport2.h @@ -27,7 +27,7 @@ struct udp_transport { char updt_tx_buf[UDPT_TX_BUF_LEN]; uint16_t udpt_tx_buf_idx; uint8_t udpt_ck_a, udpt_ck_b; - + /* * Uplink */ diff --git a/sw/airborne/gyro.c b/sw/airborne/gyro.c index fe81a18eed..3eff353cd1 100644 --- a/sw/airborne/gyro.c +++ b/sw/airborne/gyro.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -66,7 +66,7 @@ void gyro_init( void) { void gyro_update( void ) { #ifndef SITL float pitch_rate = 0.; - roll_rate_adc = (buf_roll.sum/buf_roll.av_nb_sample) - GYRO_ADC_ROLL_NEUTRAL; + roll_rate_adc = (buf_roll.sum/buf_roll.av_nb_sample) - GYRO_ADC_ROLL_NEUTRAL; #if defined ADC_CHANNEL_GYRO_TEMP temp_comp = buf_temp.sum/buf_temp.av_nb_sample - GYRO_ADC_TEMP_NEUTRAL; roll_rate_adc += GYRO_ADC_TEMP_SLOPE * temp_comp; diff --git a/sw/airborne/gyro.h b/sw/airborne/gyro.h index 0b29cf14f0..5fa68ba9bc 100644 --- a/sw/airborne/gyro.h +++ b/sw/airborne/gyro.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/infrared.h b/sw/airborne/infrared.h index c0a05413c6..80c4bb4d00 100644 --- a/sw/airborne/infrared.h +++ b/sw/airborne/infrared.h @@ -1,6 +1,6 @@ /* * Paparazzi mcu0 $Id$ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/inter_mcu.c b/sw/airborne/inter_mcu.c index 02a0d892e6..bc8217ce5f 100644 --- a/sw/airborne/inter_mcu.c +++ b/sw/airborne/inter_mcu.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/inter_mcu.h b/sw/airborne/inter_mcu.h index e00aeb9f5f..666f67a3d9 100644 --- a/sw/airborne/inter_mcu.h +++ b/sw/airborne/inter_mcu.h @@ -17,7 +17,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -52,7 +52,7 @@ /** Data structure shared by fbw and ap processes */ struct fbw_state { #if defined RADIO_CONTROL || RADIO_CONTROL_AUTO1 - pprz_t channels[RADIO_CONTROL_NB_CHANNEL]; + pprz_t channels[RADIO_CONTROL_NB_CHANNEL]; uint8_t ppm_cpt; #endif uint8_t status; @@ -62,7 +62,7 @@ struct fbw_state { }; struct ap_state { - pprz_t commands[COMMANDS_NB]; + pprz_t commands[COMMANDS_NB]; }; // Status bits from FBW to AUTOPILOT diff --git a/sw/airborne/latlong.c b/sw/airborne/latlong.c index 2d8da47ac0..f0f158ad48 100644 --- a/sw/airborne/latlong.c +++ b/sw/airborne/latlong.c @@ -18,7 +18,7 @@ float latlong_lat, latlong_lon; /* rad */ #define N (K0*A) static const float serie_coeff_proj_mercator[5] = { - 0.99832429842242842444, + 0.99832429842242842444, 0.00083632803657738403, 0.00000075957783563707, 0.00000000119563131778, @@ -72,7 +72,7 @@ static inline float inverse_isometric_latitude(float lat, float e, float epsilon /** us on arm7@60MHz, i.e. % of cputime at 4Hz specialize CSin: 951us i.e. One CSin: 120us - init: + init: iso_lat: 155, 172 for loop: 258 diff --git a/sw/airborne/led.h b/sw/airborne/led.h index 023759719b..98a943dbed 100644 --- a/sw/airborne/led.h +++ b/sw/airborne/led.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2005 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -38,7 +38,7 @@ static inline void led_init ( void ) { #ifdef LED_1_BANK - LED_INIT(1); + LED_INIT(1); LED_OFF(1); #endif /* LED_1_BANK */ diff --git a/sw/airborne/link_mcu.c b/sw/airborne/link_mcu.c index 01ad58e2bf..1bb27affce 100644 --- a/sw/airborne/link_mcu.c +++ b/sw/airborne/link_mcu.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -60,12 +60,12 @@ void link_mcu_event_task( void ) { /* A message has been received */ ComputeChecksum(link_mcu_from_ap_msg); link_mcu_received = TRUE; - if (link_mcu_from_ap_msg.checksum == crc) + if (link_mcu_from_ap_msg.checksum == crc) inter_mcu_received_ap = TRUE; else fbw_state->nb_err++; } - + #endif /* FBW */ @@ -86,7 +86,7 @@ void link_mcu_send(void) { SpiOverRun(); return; } - + ComputeChecksum(link_mcu_from_ap_msg); link_mcu_from_ap_msg.checksum = crc; spi_buffer_input = (uint8_t*)&link_mcu_from_fbw_msg; @@ -99,7 +99,7 @@ void link_mcu_send(void) { void link_mcu_event_task( void ) { /* A message has been received */ ComputeChecksum(link_mcu_from_fbw_msg); - if (link_mcu_from_fbw_msg.checksum == crc) + if (link_mcu_from_fbw_msg.checksum == crc) inter_mcu_received_fbw = TRUE; else link_mcu_nb_err++; diff --git a/sw/airborne/link_mcu.h b/sw/airborne/link_mcu.h index df527f550f..7c87a946a1 100644 --- a/sw/airborne/link_mcu.h +++ b/sw/airborne/link_mcu.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -37,8 +37,8 @@ #endif struct link_mcu_msg { - union { - struct fbw_state from_fbw; + union { + struct fbw_state from_fbw; struct ap_state from_ap; } payload; uint16_t checksum; diff --git a/sw/airborne/lisa/arch/stm32/lisa_overo_link_arch.c b/sw/airborne/lisa/arch/stm32/lisa_overo_link_arch.c index 8ee5d710a9..8b0c206b66 100644 --- a/sw/airborne/lisa/arch/stm32/lisa_overo_link_arch.c +++ b/sw/airborne/lisa/arch/stm32/lisa_overo_link_arch.c @@ -55,9 +55,9 @@ void overo_link_arch_init(void) { void overo_link_arch_prepare_next_transfert(void) { - + /* Disable SPI module */ - SPI_Cmd(SPI1, DISABLE); + SPI_Cmd(SPI1, DISABLE); /* Make sure RX register is empty */ uint8_t foo __attribute__ ((unused)) = SPI1->DR; @@ -99,7 +99,7 @@ void overo_link_arch_prepare_next_transfert(void) { .DMA_M2M = DMA_M2M_Disable }; DMA_Init(DMA1_Channel3, (DMA_InitTypeDef*)&DMA_InitStructure_tx); - + /* Enable SPI_1 Rx request */ SPI_I2S_DMACmd(SPI1, SPI_I2S_DMAReq_Rx, ENABLE); /* Enable DMA1 Channel2 */ @@ -111,10 +111,10 @@ void overo_link_arch_prepare_next_transfert(void) { /* Enable DMA1 Channel2 Transfer Complete interrupt */ DMA_ITConfig(DMA1_Channel2, DMA_IT_TC, ENABLE); - + /* resets CRC module */ - SPI_CalculateCRC(SPI1, DISABLE); - SPI_CalculateCRC(SPI1, ENABLE); + SPI_CalculateCRC(SPI1, DISABLE); + SPI_CalculateCRC(SPI1, ENABLE); /* enable SPI */ SPI_Cmd(SPI1, ENABLE); diff --git a/sw/airborne/lisa/lisa_overo_link.h b/sw/airborne/lisa/lisa_overo_link.h index b6d721d4d9..3673c4c0ae 100644 --- a/sw/airborne/lisa/lisa_overo_link.h +++ b/sw/airborne/lisa/lisa_overo_link.h @@ -79,7 +79,7 @@ extern void overo_link_arch_prepare_next_transfert(void); /* * * Passing telemetry through Overo Link - * + * */ #ifdef USE_OVERO_LINK_TELEMETRY diff --git a/sw/airborne/lisa/lisa_spistream.h b/sw/airborne/lisa/lisa_spistream.h index 20384e97d4..48716eabd1 100644 --- a/sw/airborne/lisa/lisa_spistream.h +++ b/sw/airborne/lisa/lisa_spistream.h @@ -27,19 +27,19 @@ SPISTREAM_MAX_TX_PARALLEL_TRANSACTIONS) #endif -#define SPISTREAM_INVALID_MESSAGE_ID 0 +#define SPISTREAM_INVALID_MESSAGE_ID 0 -struct spistream_state_t { +struct spistream_state_t { uint8_t tx_message_cnt; // message cnt of next message to be sent - uint8_t rx_package_cntd; + uint8_t rx_package_cntd; }; -struct spistream_message_range_t { - uint8_t index; - uint8_t size; +struct spistream_message_range_t { + uint8_t index; + uint8_t size; }; -struct spistream_buffers_t { +struct spistream_buffers_t { uint16_t rx_num_packages; // number of packages in buffer uint16_t tx_insert; // next index for package insertion @@ -47,25 +47,25 @@ struct spistream_buffers_t { uint16_t tx_num_packages; // number of packages in buffer // RX stores data as array - uint8_t rx[SPISTREAM_RX_BUFFER_SIZE]; + uint8_t rx[SPISTREAM_RX_BUFFER_SIZE]; // TX stores packages - struct AutopilotMessagePTStream tx[SPISTREAM_TX_MAX_BUFFER_PACKAGES]; + struct AutopilotMessagePTStream tx[SPISTREAM_TX_MAX_BUFFER_PACKAGES]; }; typedef void (*spistream_message_rx_handler_t)(uint8_t msg_id, uint8_t * data, uint16_t num_bytes); typedef void (*spistream_message_tx_handler_t)(uint8_t msg_id); -struct spistream_config_t { +struct spistream_config_t { // Handler to call for processing received message - spistream_message_rx_handler_t message_rx_handler; + spistream_message_rx_handler_t message_rx_handler; // Handler to call after message transmission - spistream_message_tx_handler_t message_tx_handler; + spistream_message_tx_handler_t message_tx_handler; }; enum spistream_flag { SPISTREAM_NO_WAIT=0, SPISTREAM_WAIT_FOR_READ }; /* Function declarations */ -static inline void spistream_init(spistream_message_rx_handler_t message_rx_handler, +static inline void spistream_init(spistream_message_rx_handler_t message_rx_handler, spistream_message_tx_handler_t message_tx_handler); static inline void spistream_read_pkg(struct AutopilotMessagePTStream * pkg_in); static inline void spistream_write_pkg(struct AutopilotMessagePTStream * pkg_out); @@ -73,196 +73,196 @@ static inline uint8_t spistream_send_msg(uint8_t * data, uint16_t num_bytes, enu /* Definitions */ -static struct spistream_state_t spistream_state; -static struct spistream_buffers_t spistream_buffers; -static struct spistream_config_t spistream; +static struct spistream_state_t spistream_state; +static struct spistream_buffers_t spistream_buffers; +static struct spistream_config_t spistream; -static inline void spistream_init(spistream_message_rx_handler_t message_rx_handler, +static inline void spistream_init(spistream_message_rx_handler_t message_rx_handler, spistream_message_tx_handler_t message_tx_handler) -{ - memset(&spistream_buffers, 0, sizeof(struct spistream_buffers_t)); - memset(&spistream_state, 0, sizeof(struct spistream_state_t)); - spistream.message_rx_handler = message_rx_handler; - spistream.message_tx_handler = message_tx_handler; - spistream_buffers.rx_num_packages = 0; - spistream_state.rx_package_cntd = 0; - spistream_buffers.tx_num_packages = 0; +{ + memset(&spistream_buffers, 0, sizeof(struct spistream_buffers_t)); + memset(&spistream_state, 0, sizeof(struct spistream_state_t)); + spistream.message_rx_handler = message_rx_handler; + spistream.message_tx_handler = message_tx_handler; + spistream_buffers.rx_num_packages = 0; + spistream_state.rx_package_cntd = 0; + spistream_buffers.tx_num_packages = 0; } /** - * Read a single package into internal RX buffer. - * Converts data from package domain to byte array. - * After receiving a full message, the registered spistream.message_rx_handler - * function is called. - * Called on every SPI event. + * Read a single package into internal RX buffer. + * Converts data from package domain to byte array. + * After receiving a full message, the registered spistream.message_rx_handler + * function is called. + * Called on every SPI event. */ -static inline void spistream_read_pkg(struct AutopilotMessagePTStream * pkg_in) -{ +static inline void spistream_read_pkg(struct AutopilotMessagePTStream * pkg_in) +{ uint8_t package_cntd; - if(pkg_in->message_cnt == SPISTREAM_INVALID_MESSAGE_ID) { - return; - } + if(pkg_in->message_cnt == SPISTREAM_INVALID_MESSAGE_ID) { + return; + } - // In the last package of every message, the package_cntd is expected to be - // negative or 0. It indicates the number of zero-bytes that are padded to - // the end of the message to fill a package. - if(pkg_in->package_cntd <= 0) { package_cntd = 1; } - else { package_cntd = pkg_in->package_cntd; } + // In the last package of every message, the package_cntd is expected to be + // negative or 0. It indicates the number of zero-bytes that are padded to + // the end of the message to fill a package. + if(pkg_in->package_cntd <= 0) { package_cntd = 1; } + else { package_cntd = pkg_in->package_cntd; } - if(pkg_in->package_cntd >= spistream_buffers.rx_num_packages) { + if(pkg_in->package_cntd >= spistream_buffers.rx_num_packages) { spistream_buffers.rx_num_packages = pkg_in->package_cntd; } - + if(spistream_state.rx_package_cntd == 0) { // Beginning of new message - // Message length is first value of package countdown: - spistream_buffers.rx_num_packages = package_cntd; + // Message length is first value of package countdown: + spistream_buffers.rx_num_packages = package_cntd; spistream_state.rx_package_cntd = package_cntd; } - memcpy(spistream_buffers.rx + - ((spistream_buffers.rx_num_packages - package_cntd) * - SPISTREAM_PACKAGE_SIZE), - pkg_in->pkg_data, + memcpy(spistream_buffers.rx + + ((spistream_buffers.rx_num_packages - package_cntd) * + SPISTREAM_PACKAGE_SIZE), + pkg_in->pkg_data, SPISTREAM_PACKAGE_SIZE); - if(pkg_in->package_cntd <= 0) { - // Message is ready, pass to handler: + if(pkg_in->package_cntd <= 0) { + // Message is ready, pass to handler: spistream.message_rx_handler(pkg_in->message_cnt, - (uint8_t *)(spistream_buffers.rx), - (spistream_buffers.rx_num_packages * - SPISTREAM_PACKAGE_SIZE) + + (uint8_t *)(spistream_buffers.rx), + (spistream_buffers.rx_num_packages * + SPISTREAM_PACKAGE_SIZE) + pkg_in->package_cntd); - spistream_state.rx_package_cntd = 0; - } + spistream_state.rx_package_cntd = 0; + } } /** - * Fill given SPI package with next package from TX buffer. - * Called on every SPI event. + * Fill given SPI package with next package from TX buffer. + * Called on every SPI event. */ -static inline void spistream_write_pkg(struct AutopilotMessagePTStream * pkg_out) -{ - if(spistream_buffers.tx_num_packages == 0) { +static inline void spistream_write_pkg(struct AutopilotMessagePTStream * pkg_out) +{ + if(spistream_buffers.tx_num_packages == 0) { memset(pkg_out, 0, sizeof(struct AutopilotMessagePTStream)); pkg_out->message_cnt = SPISTREAM_INVALID_MESSAGE_ID; - return; - } + return; + } - memcpy(pkg_out, - spistream_buffers.tx + spistream_buffers.tx_read, + memcpy(pkg_out, + spistream_buffers.tx + spistream_buffers.tx_read, sizeof(struct AutopilotMessagePTStream)); - if(pkg_out->package_cntd <= 0) { - spistream.message_tx_handler(pkg_out->message_cnt); + if(pkg_out->package_cntd <= 0) { + spistream.message_tx_handler(pkg_out->message_cnt); } - spistream_buffers.tx_read++; - if(spistream_buffers.tx_read >= SPISTREAM_TX_MAX_BUFFER_PACKAGES) { - spistream_buffers.tx_read = 0; + spistream_buffers.tx_read++; + if(spistream_buffers.tx_read >= SPISTREAM_TX_MAX_BUFFER_PACKAGES) { + spistream_buffers.tx_read = 0; } spistream_buffers.tx_num_packages--; } /** - * Enqueue given message in TX buffer. - * This function is directly wrapped by spistream_send_message - * at the moment. + * Enqueue given message in TX buffer. + * This function is directly wrapped by spistream_send_message + * at the moment. */ -static inline uint8_t spistream_enqueue_msg(uint8_t * data, - uint16_t num_bytes, - enum spistream_flag wait_for_read) -{ - uint16_t pkg_idx, num_packages, num_padding; - uint16_t idx; +static inline uint8_t spistream_enqueue_msg(uint8_t * data, + uint16_t num_bytes, + enum spistream_flag wait_for_read) +{ + uint16_t pkg_idx, num_packages, num_padding; + uint16_t idx; // Enough space in buffer? - if(wait_for_read == SPISTREAM_NO_WAIT || - spistream_buffers.tx_num_packages+1 < SPISTREAM_TX_MAX_BUFFER_PACKAGES) - { + if(wait_for_read == SPISTREAM_NO_WAIT || + spistream_buffers.tx_num_packages+1 < SPISTREAM_TX_MAX_BUFFER_PACKAGES) + { spistream_state.tx_message_cnt++; - // Message id 0 is reserved for invalid packages: - if(spistream_state.tx_message_cnt == SPISTREAM_INVALID_MESSAGE_ID) { - spistream_state.tx_message_cnt = 1; + // Message id 0 is reserved for invalid packages: + if(spistream_state.tx_message_cnt == SPISTREAM_INVALID_MESSAGE_ID) { + spistream_state.tx_message_cnt = 1; } - // How many packages we need for this message: - num_packages = (num_bytes / SPISTREAM_PACKAGE_SIZE); - if(num_bytes % SPISTREAM_PACKAGE_SIZE != 0) { - num_packages++; - } - // How many zero-bytes we will have at the end of the last package: - if(num_bytes > SPISTREAM_PACKAGE_SIZE) { + // How many packages we need for this message: + num_packages = (num_bytes / SPISTREAM_PACKAGE_SIZE); + if(num_bytes % SPISTREAM_PACKAGE_SIZE != 0) { + num_packages++; + } + // How many zero-bytes we will have at the end of the last package: + if(num_bytes > SPISTREAM_PACKAGE_SIZE) { num_padding = (num_packages * SPISTREAM_PACKAGE_SIZE) - num_bytes; } - else { - num_padding = SPISTREAM_PACKAGE_SIZE - num_bytes; + else { + num_padding = SPISTREAM_PACKAGE_SIZE - num_bytes; } - pkg_idx = spistream_buffers.tx_insert; + pkg_idx = spistream_buffers.tx_insert; - // Convert data to packages and add them to TX buffer: - for(idx = 0; num_packages > 0; idx++) { - if(idx < num_bytes) { + // Convert data to packages and add them to TX buffer: + for(idx = 0; num_packages > 0; idx++) { + if(idx < num_bytes) { spistream_buffers.tx[pkg_idx].pkg_data[idx % SPISTREAM_PACKAGE_SIZE] = data[idx]; } else { // padding - spistream_buffers.tx[pkg_idx].pkg_data[idx % SPISTREAM_PACKAGE_SIZE] = 0; + spistream_buffers.tx[pkg_idx].pkg_data[idx % SPISTREAM_PACKAGE_SIZE] = 0; } - // Last byte in current package: - if((idx % SPISTREAM_PACKAGE_SIZE) == SPISTREAM_PACKAGE_SIZE-1) { + // Last byte in current package: + if((idx % SPISTREAM_PACKAGE_SIZE) == SPISTREAM_PACKAGE_SIZE-1) { // Finish configuration of current package - // Last package uses field package_cntd to indicate the number - // of padding bytes it contains, as negative number: - if(num_packages == 1) { - spistream_buffers.tx[pkg_idx].package_cntd = -num_padding; + // Last package uses field package_cntd to indicate the number + // of padding bytes it contains, as negative number: + if(num_packages == 1) { + spistream_buffers.tx[pkg_idx].package_cntd = -num_padding; } - else { - spistream_buffers.tx[pkg_idx].package_cntd = num_packages; + else { + spistream_buffers.tx[pkg_idx].package_cntd = num_packages; } - spistream_buffers.tx[pkg_idx].message_cnt = spistream_state.tx_message_cnt; + spistream_buffers.tx[pkg_idx].message_cnt = spistream_state.tx_message_cnt; - // Prepare next package: - num_packages--; - // Increment insert pointer with ring buffer overflow: + // Prepare next package: + num_packages--; + // Increment insert pointer with ring buffer overflow: spistream_buffers.tx_insert++; - if(spistream_buffers.tx_insert >= SPISTREAM_TX_MAX_BUFFER_PACKAGES) { - spistream_buffers.tx_insert = 0; + if(spistream_buffers.tx_insert >= SPISTREAM_TX_MAX_BUFFER_PACKAGES) { + spistream_buffers.tx_insert = 0; } - // Continue with next package: - pkg_idx = spistream_buffers.tx_insert; + // Continue with next package: + pkg_idx = spistream_buffers.tx_insert; spistream_buffers.tx_num_packages++; } } #if 0 printf("Enqueue finished. Buffer: \n"); - for(pkg_idx = 0; pkg_idx < spistream_buffers.tx_num_packages; pkg_idx++) { - printf("Package %2d | %3d |: ", pkg_idx, spistream_buffers.tx[pkg_idx].package_cntd); - for(idx = 0; idx < SPISTREAM_PACKAGE_SIZE; idx++) { + for(pkg_idx = 0; pkg_idx < spistream_buffers.tx_num_packages; pkg_idx++) { + printf("Package %2d | %3d |: ", pkg_idx, spistream_buffers.tx[pkg_idx].package_cntd); + for(idx = 0; idx < SPISTREAM_PACKAGE_SIZE; idx++) { printf("%3d ", spistream_buffers.tx[pkg_idx].pkg_data[idx]); } printf("\n"); } #endif - return 1; + return 1; } - return 0; + return 0; } -static inline void spistream_dequeue_msg(uint8_t message_id) { +static inline void spistream_dequeue_msg(uint8_t message_id) { } /** - * Used from userland: Send num_bytes bytes from buffer over spistream. - * Flags are: + * Used from userland: Send num_bytes bytes from buffer over spistream. + * Flags are: * - SPISTREAM_WAIT_FOR_READ: Reject packages when TX buffer is full - * and return 0, otherwise enqueue message and return 1. - * - SPISTREAM_NO_WAIT: Overwrite data if TX buffer is full, enqueue - * message and always return 1. + * and return 0, otherwise enqueue message and return 1. + * - SPISTREAM_NO_WAIT: Overwrite data if TX buffer is full, enqueue + * message and always return 1. */ -static inline uint8_t spistream_send_msg(uint8_t * data, - uint16_t num_bytes, - enum spistream_flag wait_for_read) +static inline uint8_t spistream_send_msg(uint8_t * data, + uint16_t num_bytes, + enum spistream_flag wait_for_read) { return spistream_enqueue_msg(data, num_bytes, wait_for_read); } diff --git a/sw/airborne/lisa/lisa_stm_gps_passthrough_main.c b/sw/airborne/lisa/lisa_stm_gps_passthrough_main.c index c82e7f7331..c4398f7163 100644 --- a/sw/airborne/lisa/lisa_stm_gps_passthrough_main.c +++ b/sw/airborne/lisa/lisa_stm_gps_passthrough_main.c @@ -42,25 +42,25 @@ static inline void on_overo_link_lost(void); static inline void on_overo_link_crc_failed(void); #ifdef SPISTREAM_DEBUG -static inline void uart_debug_transfer_event(void); -static inline void uart_debug_transfer_init(void); +static inline void uart_debug_transfer_event(void); +static inline void uart_debug_transfer_init(void); #endif struct __attribute__ ((packed)) spistream_uart_msg { - uint8_t uart_id; + uint8_t uart_id; uint8_t uart_data[SPISTREAM_MAX_MESSAGE_LENGTH]; }; -// TODO -// Use 3 static instances of this struct in uart_transfer_event +// TODO +// Use 3 static instances of this struct in uart_transfer_event // instead of a myriad of repetitive static vars: -struct uart_state { - struct spistream_uart_msg * msg; - uint32_t timeout; - uint32_t num_rx_bytes; - uint8_t enabled; - uint8_t has_data; - uint8_t sent; +struct uart_state { + struct spistream_uart_msg * msg; + uint32_t timeout; + uint32_t num_rx_bytes; + uint8_t enabled; + uint8_t has_data; + uint8_t sent; }; static struct spistream_uart_msg spistream_uart1_msg; @@ -70,10 +70,10 @@ static struct spistream_uart_msg spistream_uart3_msg; static struct spistream_uart_msg spistream_debug_msg; #endif -// The number of current, unfinished spistream transfers. -// Incremented after sending an spistream message, decremented -// in spistream TX completion handler (here: on_spistream_msg_sent). -static uint8_t spistream_wait_for_num_transfers = 0; +// The number of current, unfinished spistream transfers. +// Incremented after sending an spistream message, decremented +// in spistream TX completion handler (here: on_spistream_msg_sent). +static uint8_t spistream_wait_for_num_transfers = 0; int main(void) { @@ -85,7 +85,7 @@ int main(void) { } main_event(); } - + return 0; } @@ -95,64 +95,64 @@ static inline void main_init(void) { sys_time_init(); overo_link_init(); - uart1_init(); - uart2_init(); - uart3_init(); + uart1_init(); + uart2_init(); + uart3_init(); - spistream_uart1_msg.uart_id = 1; - spistream_uart2_msg.uart_id = 2; - spistream_uart3_msg.uart_id = 3; + spistream_uart1_msg.uart_id = 1; + spistream_uart2_msg.uart_id = 2; + spistream_uart3_msg.uart_id = 3; #ifdef SPISTREAM_DEBUG - uart_debug_transfer_init(); + uart_debug_transfer_init(); #endif - spistream_init(&on_spistream_msg_received, + spistream_init(&on_spistream_msg_received, &on_spistream_msg_sent); } /** - * Handler for commands (messages from Overo->STM). - * Right now, it is just sending the command back for - * debugging purposes. + * Handler for commands (messages from Overo->STM). + * Right now, it is just sending the command back for + * debugging purposes. */ -static inline void on_spistream_msg_received(uint8_t msg_id, - uint8_t * data, - uint16_t num_bytes) -{ - spistream_send_msg(data, num_bytes, SPISTREAM_NO_WAIT); +static inline void on_spistream_msg_received(uint8_t msg_id, + uint8_t * data, + uint16_t num_bytes) +{ + spistream_send_msg(data, num_bytes, SPISTREAM_NO_WAIT); } -static inline void on_spistream_msg_sent(uint8_t msg_id) { - if(spistream_wait_for_num_transfers > 0) { +static inline void on_spistream_msg_sent(uint8_t msg_id) { + if(spistream_wait_for_num_transfers > 0) { spistream_wait_for_num_transfers--; } } -static inline void main_periodic(void) +static inline void main_periodic(void) { OveroLinkPeriodic(on_overo_link_lost); RunOnceEvery(1, { - LED_PERIODIC(); + LED_PERIODIC(); }); } /** - * Every SPI transfer contains exactly two packages of type - * AutopilotMessagePTStream, one for each direction - * (up: STM->Overo, down: Overo->STM). - * As we delegate SPI message handling to spistream, the SPI - * event just passes both packages to - * spistream_read_pkg(down_pkg) and spistream_write_pkg(up_pkg). - * Apart from that, we just don't care about the SPI driver - * itself. + * Every SPI transfer contains exactly two packages of type + * AutopilotMessagePTStream, one for each direction + * (up: STM->Overo, down: Overo->STM). + * As we delegate SPI message handling to spistream, the SPI + * event just passes both packages to + * spistream_read_pkg(down_pkg) and spistream_write_pkg(up_pkg). + * Apart from that, we just don't care about the SPI driver + * itself. */ -static inline void on_overo_link_msg_received(void) +static inline void on_overo_link_msg_received(void) { spistream_read_pkg(&overo_link.down.msg); - spistream_write_pkg(&overo_link.up.msg); + spistream_write_pkg(&overo_link.up.msg); } static inline void on_overo_link_lost(void) { @@ -161,189 +161,189 @@ static inline void on_overo_link_lost(void) { static inline void on_overo_link_crc_failed(void) { } -static inline void main_event(void) +static inline void main_event(void) { OveroLinkEvent(on_overo_link_msg_received, on_overo_link_crc_failed); #ifdef SPISTREAM_DEBUG - uart_debug_transfer_event(); + uart_debug_transfer_event(); #else - uart_transfer_event(); + uart_transfer_event(); #endif } #ifdef SPISTREAM_DEBUG -static inline void uart_debug_transfer_init(void) { - uint16_t idx; - for(idx = 1; idx < 700; idx++) { - spistream_debug_msg.uart_data[idx] = idx % 40; +static inline void uart_debug_transfer_init(void) { + uint16_t idx; + for(idx = 1; idx < 700; idx++) { + spistream_debug_msg.uart_data[idx] = idx % 40; } } #endif /** - * spistream stress test: Send big (500-700 bytes) messages - * with different message lengths for every channel and - * length varying in every message. - * Fool around with timeout to increase/decrease message - * rate to see when it can't keep up any more. + * spistream stress test: Send big (500-700 bytes) messages + * with different message lengths for every channel and + * length varying in every message. + * Fool around with timeout to increase/decrease message + * rate to see when it can't keep up any more. */ #ifdef SPISTREAM_DEBUG -static inline void uart_debug_transfer_event(void) { - static uint16_t len = 0; - static uint16_t timeout = 1; +static inline void uart_debug_transfer_event(void) { + static uint16_t len = 0; + static uint16_t timeout = 1; - if(timeout-- == 0) { - timeout = 8000; - if(spistream_wait_for_num_transfers == 0) - { + if(timeout-- == 0) { + timeout = 8000; + if(spistream_wait_for_num_transfers == 0) + { LED_OFF(6); - len++; - if(len > 700) { len = 500; } + len++; + if(len > 700) { len = 500; } - spistream_debug_msg.uart_id = 1; - if(spistream_send_msg((uint8_t *)&spistream_debug_msg, - len+1-20, + spistream_debug_msg.uart_id = 1; + if(spistream_send_msg((uint8_t *)&spistream_debug_msg, + len+1-20, SPISTREAM_WAIT_FOR_READ)) { // +1 for UART id byte - spistream_wait_for_num_transfers++; + spistream_wait_for_num_transfers++; } - spistream_debug_msg.uart_id = 2; - if(spistream_send_msg((uint8_t *)&spistream_debug_msg, - len+1, + spistream_debug_msg.uart_id = 2; + if(spistream_send_msg((uint8_t *)&spistream_debug_msg, + len+1, SPISTREAM_WAIT_FOR_READ)) { // +1 for UART id byte - spistream_wait_for_num_transfers++; + spistream_wait_for_num_transfers++; } - spistream_debug_msg.uart_id = 3; - if(spistream_send_msg((uint8_t *)&spistream_debug_msg, - len+1+20, + spistream_debug_msg.uart_id = 3; + if(spistream_send_msg((uint8_t *)&spistream_debug_msg, + len+1+20, SPISTREAM_WAIT_FOR_READ)) { // +1 for UART id byte - spistream_wait_for_num_transfers++; + spistream_wait_for_num_transfers++; } } - else { + else { LED_ON(6); } } } #endif -static inline void uart_transfer_event(void) { +static inline void uart_transfer_event(void) { - static uint16_t uart1_num_rx_bytes = 0; - static uint16_t uart2_num_rx_bytes = 0; - static uint16_t uart3_num_rx_bytes = 0; - static uint32_t timeout_trig = 2; - static uint32_t timeout_uart1 = 0; - static uint32_t timeout_uart2 = 0; - static uint32_t timeout_uart3 = 0; - static uint8_t uart1_sent = 0; - static uint8_t uart2_sent = 0; - static uint8_t uart3_sent = 0; - static uint8_t uart1_has_data = 0; - static uint8_t uart2_has_data = 0; - static uint8_t uart3_has_data = 0; - static uint8_t trigger_send = 0; + static uint16_t uart1_num_rx_bytes = 0; + static uint16_t uart2_num_rx_bytes = 0; + static uint16_t uart3_num_rx_bytes = 0; + static uint32_t timeout_trig = 2; + static uint32_t timeout_uart1 = 0; + static uint32_t timeout_uart2 = 0; + static uint32_t timeout_uart3 = 0; + static uint8_t uart1_sent = 0; + static uint8_t uart2_sent = 0; + static uint8_t uart3_sent = 0; + static uint8_t uart1_has_data = 0; + static uint8_t uart2_has_data = 0; + static uint8_t uart3_has_data = 0; + static uint8_t trigger_send = 0; - static uint8_t uart1_enabled = 1; - static uint8_t uart2_enabled = 1; - static uint8_t uart3_enabled = 1; + static uint8_t uart1_enabled = 1; + static uint8_t uart2_enabled = 1; + static uint8_t uart3_enabled = 1; - // We cache data availability, so it doesn't change between checks: + // We cache data availability, so it doesn't change between checks: uart1_has_data = Uart1ChAvailable(); uart2_has_data = Uart2ChAvailable(); uart3_has_data = Uart3ChAvailable(); - // Fill stage: Read data from UARTs into buffers, or increment - // their timeouts if no data is available: - if(!uart1_sent && uart1_has_data) { + // Fill stage: Read data from UARTs into buffers, or increment + // their timeouts if no data is available: + if(!uart1_sent && uart1_has_data) { spistream_uart1_msg.uart_data[uart1_num_rx_bytes] = Uart1Getch(); - timeout_uart1 = 0; - if(uart1_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) + timeout_uart1 = 0; + if(uart1_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) { uart1_num_rx_bytes++; } } else { if(timeout_uart1 < timeout_trig) { timeout_uart1++; } } - - if(!uart2_sent && uart2_has_data) { + + if(!uart2_sent && uart2_has_data) { spistream_uart2_msg.uart_data[uart2_num_rx_bytes] = Uart2Getch(); - timeout_uart2 = 0; - if(uart2_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) + timeout_uart2 = 0; + if(uart2_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) { uart2_num_rx_bytes++; } } else { if(timeout_uart2 < timeout_trig) { timeout_uart2++; } } - if(!uart3_sent && uart3_has_data) { + if(!uart3_sent && uart3_has_data) { spistream_uart3_msg.uart_data[uart3_num_rx_bytes] = Uart3Getch(); - timeout_uart3 = 0; - if(uart3_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) + timeout_uart3 = 0; + if(uart3_num_rx_bytes < SPISTREAM_MAX_MESSAGE_LENGTH) { uart3_num_rx_bytes++; } } else { if(timeout_uart3 < timeout_trig) { timeout_uart3++; } } - trigger_send = ((!uart1_enabled || + trigger_send = ((!uart1_enabled || (timeout_uart1 >= timeout_trig)) && - (!uart2_enabled || + (!uart2_enabled || (timeout_uart2 >= timeout_trig)) && - (!uart3_enabled || + (!uart3_enabled || (timeout_uart3 >= timeout_trig))); - // Send stage: If all UART timeouts reach the timeout + // Send stage: If all UART timeouts reach the timeout // trigger value and have accumulated data to send if(trigger_send) { - // If there was no new data on any UART for some time - // and there is data in every rx buffer: + // If there was no new data on any UART for some time + // and there is data in every rx buffer: - if(spistream_wait_for_num_transfers > 0) - { - // Warning LED: Could not finish all transactions - // from last call. - LED_ON(6); - } - else + if(spistream_wait_for_num_transfers > 0) + { + // Warning LED: Could not finish all transactions + // from last call. + LED_ON(6); + } + else { LED_OFF(6); - uart1_sent = !uart1_enabled; // If we set uartX_sent to 1 here, it + uart1_sent = !uart1_enabled; // If we set uartX_sent to 1 here, it uart2_sent = !uart2_enabled; // is just ignored for every read poll - uart3_sent = !uart3_enabled; // as it seems to have been read already. + uart3_sent = !uart3_enabled; // as it seems to have been read already. - if(!uart1_sent && uart1_num_rx_bytes > 0) { - if(spistream_send_msg((uint8_t *)&spistream_uart1_msg, + if(!uart1_sent && uart1_num_rx_bytes > 0) { + if(spistream_send_msg((uint8_t *)&spistream_uart1_msg, uart1_num_rx_bytes+1, // +1 for UART id - SPISTREAM_WAIT_FOR_READ)) { - uart1_sent = 1; - spistream_wait_for_num_transfers++; + SPISTREAM_WAIT_FOR_READ)) { + uart1_sent = 1; + spistream_wait_for_num_transfers++; } } - if(!uart2_sent && uart1_num_rx_bytes > 0) { - if(spistream_send_msg((uint8_t *)&spistream_uart2_msg, + if(!uart2_sent && uart1_num_rx_bytes > 0) { + if(spistream_send_msg((uint8_t *)&spistream_uart2_msg, uart1_num_rx_bytes+1, // +1 for UART id - SPISTREAM_WAIT_FOR_READ)) { - uart2_sent = 1; - spistream_wait_for_num_transfers++; + SPISTREAM_WAIT_FOR_READ)) { + uart2_sent = 1; + spistream_wait_for_num_transfers++; } } - if(!uart3_sent && uart3_num_rx_bytes > 0) { - if(spistream_send_msg((uint8_t *)&spistream_uart3_msg, + if(!uart3_sent && uart3_num_rx_bytes > 0) { + if(spistream_send_msg((uint8_t *)&spistream_uart3_msg, uart3_num_rx_bytes+1, // +1 for UART id - SPISTREAM_WAIT_FOR_READ)) { - uart3_sent = 1; - spistream_wait_for_num_transfers++; + SPISTREAM_WAIT_FOR_READ)) { + uart3_sent = 1; + spistream_wait_for_num_transfers++; } } - // Transaction completed, reset state. - // Note: Only reset when all uart buffers have been transmitted, - // otherwise the timeout would start from the beginning and the - // loop phase shifts (aka "you're in the deep"). - uart1_num_rx_bytes = 0; - uart2_num_rx_bytes = 0; - uart3_num_rx_bytes = 0; - timeout_uart1 = 0; - timeout_uart2 = 0; - timeout_uart3 = 0; - uart1_sent = 0; - uart2_sent = 0; - uart3_sent = 0; + // Transaction completed, reset state. + // Note: Only reset when all uart buffers have been transmitted, + // otherwise the timeout would start from the beginning and the + // loop phase shifts (aka "you're in the deep"). + uart1_num_rx_bytes = 0; + uart2_num_rx_bytes = 0; + uart3_num_rx_bytes = 0; + timeout_uart1 = 0; + timeout_uart2 = 0; + timeout_uart3 = 0; + uart1_sent = 0; + uart2_sent = 0; + uart3_sent = 0; } - } + } } diff --git a/sw/airborne/lisa/lisa_stm_passthrough_main.c b/sw/airborne/lisa/lisa_stm_passthrough_main.c index 1d82178293..e92f1ba5e3 100644 --- a/sw/airborne/lisa/lisa_stm_passthrough_main.c +++ b/sw/airborne/lisa/lisa_stm_passthrough_main.c @@ -267,7 +267,7 @@ static inline void on_overo_link_msg_received(void) { #else /* pwm acuators down */ if (radio_control.values[RADIO_MODE] <= 150) { - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { actuators_pwm_values[i] = overo_link.down.msg.pwm_outputs_usecs[i]; } if (radio_control.values[RADIO_KILL] > 150) { diff --git a/sw/airborne/lisa/stm_test_spi_link.c b/sw/airborne/lisa/stm_test_spi_link.c index 91fcb6a7a5..0f5ae21ae5 100644 --- a/sw/airborne/lisa/stm_test_spi_link.c +++ b/sw/airborne/lisa/stm_test_spi_link.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -52,7 +52,7 @@ int main(void) { main_periodic(); main_event(); } - + return 0; } @@ -77,14 +77,14 @@ static inline void on_overo_link_lost(void) { } static inline void on_overo_link_msg_received(void) { - + DEBUG_S1_TOGGLE(); - memcpy(&overo_link.up.msg, &overo_link.down.msg, + memcpy(&overo_link.up.msg, &overo_link.down.msg, sizeof(union AutopilotMessage)); - + } static inline void on_overo_link_crc_err(void) { - + } diff --git a/sw/airborne/lisa/test/hs_gyro.c b/sw/airborne/lisa/test/hs_gyro.c index 3b4b30451f..c95e033358 100644 --- a/sw/airborne/lisa/test/hs_gyro.c +++ b/sw/airborne/lisa/test/hs_gyro.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -87,9 +87,9 @@ static inline void main_event_task( void ) { static inline void on_gyro_accel_event(void) { ImuScaleGyro(); ImuScaleAccel(); - + LED_TOGGLE(2); - + static uint8_t cnt; static int32_t samples[NB_SAMPLES]; const uint8_t axis = MEASURED_SENSOR_NB; @@ -106,11 +106,11 @@ static inline void on_gyro_accel_event(void) { &imu.gyro_unscaled.q, &imu.gyro_unscaled.r); } - + } static inline void on_mag_event(void) { - + } diff --git a/sw/airborne/lisa/test/lisa_test_actuators_mkk.c b/sw/airborne/lisa/test/lisa_test_actuators_mkk.c index 96e3976335..2c5a646ebc 100644 --- a/sw/airborne/lisa/test/lisa_test_actuators_mkk.c +++ b/sw/airborne/lisa/test/lisa_test_actuators_mkk.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ @@ -64,7 +64,7 @@ static inline void main_periodic_task( void ) { LED_TOGGLE(3); DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); }); - + #if 0 if (i==1) { diff --git a/sw/airborne/lisa/test/lisa_test_adxl345.c b/sw/airborne/lisa/test/lisa_test_adxl345.c index bc057e2ffc..40f6bd8906 100644 --- a/sw/airborne/lisa/test/lisa_test_adxl345.c +++ b/sw/airborne/lisa/test/lisa_test_adxl345.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* lisa/L lisa/M @@ -117,7 +117,7 @@ static void read_data(void) { values[0] = SPI_I2S_ReceiveData(SPI2); SPI_I2S_SendData(SPI2, 0x00); while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET); - while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); + while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); values[1] = SPI_I2S_ReceiveData(SPI2); SPI_I2S_SendData(SPI2, 0x00); @@ -126,7 +126,7 @@ static void read_data(void) { values[2] = SPI_I2S_ReceiveData(SPI2); SPI_I2S_SendData(SPI2, 0x00); while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET); - while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); + while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); values[3] = SPI_I2S_ReceiveData(SPI2); SPI_I2S_SendData(SPI2, 0x00); @@ -135,7 +135,7 @@ static void read_data(void) { values[4] = SPI_I2S_ReceiveData(SPI2); SPI_I2S_SendData(SPI2, 0x00); while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET); - while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); + while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_BSY) == SET); values[5] = SPI_I2S_ReceiveData(SPI2); AccUnselect(); @@ -146,14 +146,14 @@ static void read_data(void) { static inline void main_periodic_task( void ) { - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); }); switch (acc_status) { - case 1: + case 1: { /* read data rate */ // uint8_t bar = read_fom_reg(ADXL345_REG_BW_RATE); @@ -183,7 +183,7 @@ static inline void main_periodic_task( void ) { default: break; } - + if (acc_status < CONFIGURED) acc_status++; } @@ -203,7 +203,7 @@ static inline void main_event_task( void ) { } static inline void main_init_hw( void ) { - + /* configure acc slave select */ /* set acc slave select as output and assert it ( on PB12) */ AccUnselect(); @@ -232,33 +232,33 @@ static inline void main_init_hw( void ) { NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); + NVIC_Init(&NVIC_InitStructure); /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); SPI_Cmd(SPI2, ENABLE); /* configure SPI */ - SPI_InitTypeDef SPI_InitStructure; - SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; - SPI_InitStructure.SPI_Mode = SPI_Mode_Master; - SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; - SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; - SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; - SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; - SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; - SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; - SPI_InitStructure.SPI_CRCPolynomial = 7; - SPI_Init(SPI2, &SPI_InitStructure); + SPI_InitTypeDef SPI_InitStructure; + SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; + SPI_InitStructure.SPI_Mode = SPI_Mode_Master; + SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; + SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; + SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; + SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; + SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; + SPI_InitStructure.SPI_CRCPolynomial = 7; + SPI_Init(SPI2, &SPI_InitStructure); DEBUG_SERVO2_INIT(); @@ -274,7 +274,7 @@ void exti2_irq_handler(void) { DEBUG_S4_TOGGLE(); acc_ready_for_read = TRUE; - + } diff --git a/sw/airborne/lisa/test/lisa_test_adxl345_dma.c b/sw/airborne/lisa/test/lisa_test_adxl345_dma.c index 56c135e211..20dfd6f70b 100644 --- a/sw/airborne/lisa/test/lisa_test_adxl345_dma.c +++ b/sw/airborne/lisa/test/lisa_test_adxl345_dma.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -103,28 +103,28 @@ static uint8_t read_fom_reg(uint8_t addr) { static void read_data(void) { AccSelect(); - + dma_tx_buf[0] = (1<<7|1<<6|ADXL345_REG_DATA_X0); - + /* SPI2_Rx_DMA_Channel configuration ------------------------------------*/ - DMA_DeInit(DMA1_Channel4); + DMA_DeInit(DMA1_Channel4); DMA_InitTypeDef DMA_initStructure_4 = { .DMA_PeripheralBaseAddr = (uint32_t)(SPI2_BASE+0x0C), .DMA_MemoryBaseAddr = (uint32_t)dma_rx_buf, - .DMA_DIR = DMA_DIR_PeripheralSRC, + .DMA_DIR = DMA_DIR_PeripheralSRC, .DMA_BufferSize = 7, - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, + .DMA_PeripheralInc = DMA_PeripheralInc_Disable, .DMA_MemoryInc = DMA_MemoryInc_Enable, .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte, - .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, + .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, .DMA_Mode = DMA_Mode_Normal, - .DMA_Priority = DMA_Priority_VeryHigh, + .DMA_Priority = DMA_Priority_VeryHigh, .DMA_M2M = DMA_M2M_Disable }; DMA_Init(DMA1_Channel4, &DMA_initStructure_4); /* SPI2_Tx_DMA_Channel configuration ------------------------------------*/ - DMA_DeInit(DMA1_Channel5); + DMA_DeInit(DMA1_Channel5); DMA_InitTypeDef DMA_initStructure_5 = { .DMA_PeripheralBaseAddr = (uint32_t)(SPI2_BASE+0x0C), .DMA_MemoryBaseAddr = (uint32_t)dma_tx_buf, @@ -133,23 +133,23 @@ static void read_data(void) { .DMA_PeripheralInc = DMA_PeripheralInc_Disable, .DMA_MemoryInc = DMA_MemoryInc_Enable, .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte, - .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, + .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, .DMA_Mode = DMA_Mode_Normal, .DMA_Priority = DMA_Priority_Medium, .DMA_M2M = DMA_M2M_Disable }; DMA_Init(DMA1_Channel5, &DMA_initStructure_5); - + /* Enable SPI_2 Rx request */ SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, ENABLE); /* Enable DMA1 Channel4 */ DMA_Cmd(DMA1_Channel4, ENABLE); - + /* Enable SPI_2 Tx request */ SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE); /* Enable DMA1 Channel5 */ DMA_Cmd(DMA1_Channel5, ENABLE); - + /* Enable DMA1 Channel4 Transfer Complete interrupt */ DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, ENABLE); @@ -159,7 +159,7 @@ static void read_data(void) { static inline void main_periodic_task( void ) { - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); @@ -203,7 +203,7 @@ static inline void main_event_task( void ) { } static inline void main_init_hw( void ) { - + /* configure acc slave select */ /* set acc slave select as output and assert it ( on PB12) */ AccUnselect(); @@ -232,40 +232,40 @@ static inline void main_init_hw( void ) { NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); + NVIC_Init(&NVIC_InitStructure); /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); SPI_Cmd(SPI2, ENABLE); /* configure SPI */ - SPI_InitTypeDef SPI_InitStructure; - SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; - SPI_InitStructure.SPI_Mode = SPI_Mode_Master; - SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; - SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; - SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; - SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; - SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; - SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; - SPI_InitStructure.SPI_CRCPolynomial = 7; - SPI_Init(SPI2, &SPI_InitStructure); - + SPI_InitTypeDef SPI_InitStructure; + SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; + SPI_InitStructure.SPI_Mode = SPI_Mode_Master; + SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; + SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; + SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; + SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; + SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; + SPI_InitStructure.SPI_CRCPolynomial = 7; + SPI_Init(SPI2, &SPI_InitStructure); + /* Enable DMA1 channel4 IRQ Channel ( SPI RX) */ NVIC_InitTypeDef NVIC_init_struct = { .NVIC_IRQChannel = DMA1_Channel4_IRQn, .NVIC_IRQChannelPreemptionPriority = 0, .NVIC_IRQChannelSubPriority = 0, - .NVIC_IRQChannelCmd = ENABLE + .NVIC_IRQChannelCmd = ENABLE }; NVIC_Init(&NVIC_init_struct); @@ -284,7 +284,7 @@ void exti2_irq_handler(void) { EXTI_ClearITPendingBit(EXTI_Line2); DEBUG_S4_TOGGLE(); - + read_data(); } @@ -292,12 +292,12 @@ void exti2_irq_handler(void) { void dma1_c4_irq_handler(void) { AccUnselect(); DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE); - /* Disable SPI_2 Rx and TX request */ - SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, DISABLE); - SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, DISABLE); - /* Disable DMA1 Channel4 and 5 */ - DMA_Cmd(DMA1_Channel4, DISABLE); - DMA_Cmd(DMA1_Channel5, DISABLE); - - acc_data_available = TRUE; + /* Disable SPI_2 Rx and TX request */ + SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, DISABLE); + SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, DISABLE); + /* Disable DMA1 Channel4 and 5 */ + DMA_Cmd(DMA1_Channel4, DISABLE); + DMA_Cmd(DMA1_Channel5, DISABLE); + + acc_data_available = TRUE; } diff --git a/sw/airborne/lisa/test/lisa_test_aspirin.c b/sw/airborne/lisa/test/lisa_test_aspirin.c index f60764d071..4f7cbecbb3 100644 --- a/sw/airborne/lisa/test/lisa_test_aspirin.c +++ b/sw/airborne/lisa/test/lisa_test_aspirin.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -78,7 +78,7 @@ static uint8_t foo=0; static inline void main_periodic_task( void ) { // LED_TOGGLE(6); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); @@ -118,7 +118,7 @@ static inline void main_periodic_task( void ) { break; case 7: /* set mag to continuous measurements */ - i2c2.buf[0] = HMC5843_REG_MODE; + i2c2.buf[0] = HMC5843_REG_MODE; i2c2.buf[1] = 0x00; i2c2_transmit(HMC5843_ADDR, 2, &i2c_done); break; @@ -135,7 +135,7 @@ static inline void main_periodic_task( void ) { // AccToggleSelect(); - + } @@ -145,7 +145,7 @@ static inline void main_event_task( void ) { } static inline void main_init_hw( void ) { - + /* set mag ss as output and assert it (on PC12) = sda ------------------------------*/ /* mag drdy (on PB5) = mag int */ /* set mag reset as output and assert it (on PC13) = scl ------------------------------*/ @@ -209,8 +209,8 @@ static inline void main_init_hw( void ) { NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - - NVIC_Init(&NVIC_InitStructure); + + NVIC_Init(&NVIC_InitStructure); @@ -220,46 +220,46 @@ static inline void main_init_hw( void ) { GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); - + GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource5); EXTI_InitStructure.EXTI_Line = EXTI_Line3; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); - + NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - - NVIC_Init(&NVIC_InitStructure); - + NVIC_Init(&NVIC_InitStructure); + + /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); SPI_Cmd(SPI2, ENABLE); /* configure SPI */ - SPI_InitTypeDef SPI_InitStructure; - SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; - SPI_InitStructure.SPI_Mode = SPI_Mode_Master; - SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b; - SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; - SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; - SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; - SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16; - SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; - SPI_InitStructure.SPI_CRCPolynomial = 7; - SPI_Init(SPI2, &SPI_InitStructure); + SPI_InitTypeDef SPI_InitStructure; + SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; + SPI_InitStructure.SPI_Mode = SPI_Mode_Master; + SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b; + SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; + SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; + SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16; + SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; + SPI_InitStructure.SPI_CRCPolynomial = 7; + SPI_Init(SPI2, &SPI_InitStructure); } diff --git a/sw/airborne/lisa/test/lisa_test_hmc5843.c b/sw/airborne/lisa/test/lisa_test_hmc5843.c index 1a0de7a5ad..64b786a367 100644 --- a/sw/airborne/lisa/test/lisa_test_hmc5843.c +++ b/sw/airborne/lisa/test/lisa_test_hmc5843.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -81,14 +81,14 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { // LED_TOGGLE(6); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); }); - RunOnceEvery(256, + RunOnceEvery(256, { - DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, + DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, &i2c2_errors.ack_fail_cnt, &i2c2_errors.miss_start_stop_cnt, &i2c2_errors.arb_lost_cnt, @@ -136,11 +136,11 @@ static inline void main_periodic_task( void ) { default: break; } -#endif +#endif // if (mag_state == 4) mag_state=1; - + if (mag_state < INITIALIZED) mag_state++; - + } @@ -185,7 +185,7 @@ static void send_config(void) { t1.buf[1] = 0x00 | (0x06 << 2); t1.len_w = 2; i2c_submit(&i2c2,&t1); - + t2.type = I2CTransTx; t2.slave_addr = HMC5843_ADDR; t2.buf[0] = HMC5843_REG_CFGB; // set to gain to 1 Gauss @@ -239,7 +239,7 @@ static inline void main_init_hw( void ) { NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); + NVIC_Init(&NVIC_InitStructure); DEBUG_SERVO1_INIT(); DEBUG_SERVO2_INIT(); diff --git a/sw/airborne/lisa/test/lisa_test_itg3200.c b/sw/airborne/lisa/test/lisa_test_itg3200.c index 3657aaf3c7..9e425cdad2 100644 --- a/sw/airborne/lisa/test/lisa_test_itg3200.c +++ b/sw/airborne/lisa/test/lisa_test_itg3200.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* lisa/L lisa/M - * gyro-drdy PC14 + * gyro-drdy PC14 * * */ @@ -78,13 +78,13 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { // LED_TOGGLE(6); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); }); RunOnceEvery(256, { - DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, + DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, &i2c2_errors.ack_fail_cnt, &i2c2_errors.miss_start_stop_cnt, &i2c2_errors.arb_lost_cnt, @@ -163,7 +163,7 @@ static inline void main_periodic_task( void ) { static inline void main_event_task( void ) { - if (gyro_state == INITIALIZED && gyro_ready_for_read && + if (gyro_state == INITIALIZED && gyro_ready_for_read && ( i2c_trans.status==I2CTransSuccess || i2c_trans.status==I2CTransFailed)) { /* reads 8 bytes from address 0x1b */ i2c_trans.type = I2CTransTxRx; @@ -177,12 +177,12 @@ static inline void main_event_task( void ) { reading_gyro = TRUE; } - if (reading_gyro && + if (reading_gyro && (i2c_trans.status==I2CTransSuccess || i2c_trans.status==I2CTransFailed)) { // DEBUG_S5_ON(); reading_gyro = FALSE; int16_t tgp, tgq, tgr; - + int16_t ttemp = i2c_trans.buf[0]<<8 | i2c_trans.buf[1]; #if 1 tgp = i2c_trans.buf[2]<<8 | i2c_trans.buf[3]; @@ -201,10 +201,10 @@ static inline void main_event_task( void ) { #endif struct Int32Rates g; RATES_ASSIGN(g, tgp, tgq, tgr); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &g.p, &g.q, &g.r); - + uint8_t tmp[8]; memcpy(tmp, i2c_trans.buf, 8); DOWNLINK_SEND_DEBUG(DefaultChannel, 8, tmp); @@ -252,7 +252,7 @@ static inline void main_init_hw( void ) { NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); + NVIC_Init(&NVIC_InitStructure); DEBUG_SERVO1_INIT(); DEBUG_SERVO2_INIT(); diff --git a/sw/airborne/lisa/test/lisa_test_max1168.c b/sw/airborne/lisa/test/lisa_test_max1168.c index 5e7d5e2192..af7bc514c9 100644 --- a/sw/airborne/lisa/test/lisa_test_max1168.c +++ b/sw/airborne/lisa/test/lisa_test_max1168.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -63,7 +63,7 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { // LED_TOGGLE(6); max1168_read(); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec); LED_PERIODIC(); @@ -84,7 +84,7 @@ static inline void main_event_task( void ) { static inline void main_spi2_init( void ) { - + /* set mag ss as output and assert it (on PC12) ------------------------------*/ /* set mag reset as output and assert it (on PC13) ------------------------------*/ GPIOC->BSRR = GPIO_Pin_12; @@ -96,20 +96,20 @@ static inline void main_spi2_init( void ) { GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); - + /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); Max1168ConfigureSPI(); - + /* Enable SPI */ SPI_Cmd(SPI2, ENABLE); diff --git a/sw/airborne/lisa/test/lisa_test_ms2001.c b/sw/airborne/lisa/test/lisa_test_ms2001.c index 6f835beba6..1eb0342e80 100644 --- a/sw/airborne/lisa/test/lisa_test_ms2001.c +++ b/sw/airborne/lisa/test/lisa_test_ms2001.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -61,7 +61,7 @@ static inline void main_init( void ) { } static inline void main_periodic_task( void ) { - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec); LED_PERIODIC(); @@ -82,7 +82,7 @@ static inline void main_periodic_task( void ) { static inline void main_event_task( void ) { if (ms2001_status == MS2001_DATA_AVAILABLE) { RunOnceEvery(10, { - DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, + DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, &ms2001_values[0], &ms2001_values[1], &ms2001_values[2]); @@ -92,7 +92,7 @@ static inline void main_event_task( void ) { } static inline void main_spi2_init( void ) { - + /* set max1168 slave select as output and assert it ( on PB12) */ GPIOB->BSRR = GPIO_Pin_12; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); @@ -101,23 +101,23 @@ static inline void main_spi2_init( void ) { GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); - + /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); /* Enable SPI_2 DMA clock ---------------------------------------------------*/ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); - - + + } diff --git a/sw/airborne/lisa/test/lisa_test_ms2100.c b/sw/airborne/lisa/test/lisa_test_ms2100.c index be518361fc..cedf7cacd2 100644 --- a/sw/airborne/lisa/test/lisa_test_ms2100.c +++ b/sw/airborne/lisa/test/lisa_test_ms2100.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -63,7 +63,7 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { // LED_TOGGLE(6); max1168_read(); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec); LED_PERIODIC(); @@ -84,7 +84,7 @@ static inline void main_event_task( void ) { static inline void main_spi2_init( void ) { - + /* set mag ss as output and assert it (on PC12) ------------------------------*/ /* set mag reset as output and assert it (on PC13) ------------------------------*/ GPIOC->BSRR = GPIO_Pin_12; @@ -96,16 +96,16 @@ static inline void main_spi2_init( void ) { GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); - + /* Enable SPI2 Periph clock -------------------------------------------------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI --------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); /* SPI Master configuration --------------------------------------------------*/ @@ -120,7 +120,7 @@ static inline void main_spi2_init( void ) { SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_Init(SPI2, &SPI_InitStructure); - + /* Enable SPI */ SPI_Cmd(SPI2, ENABLE); diff --git a/sw/airborne/lisa/test/lisa_test_sc18is600.c b/sw/airborne/lisa/test/lisa_test_sc18is600.c index a32fb127a5..044ba8cad3 100644 --- a/sw/airborne/lisa/test/lisa_test_sc18is600.c +++ b/sw/airborne/lisa/test/lisa_test_sc18is600.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -59,7 +59,7 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { // LED_TOGGLE(6); - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); LED_PERIODIC(); @@ -89,7 +89,7 @@ static inline void main_periodic_task( void ) { } if (foo< 5) foo++; - + } static inline void main_event_task( void ) { @@ -98,7 +98,7 @@ static inline void main_event_task( void ) { static inline void main_spi2_init( void ) { - + /* set mag ss as output and assert it (on PC12) ------------------------------*/ /* set mag reset as output and assert it (on PC13) ------------------------------*/ /* set eeprom ss as output and assert it (on PC14) ------------------------------*/ @@ -112,6 +112,6 @@ static inline void main_spi2_init( void ) { GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); - + } diff --git a/sw/airborne/lisa/test/lisa_tunnel.c b/sw/airborne/lisa/test/lisa_tunnel.c index 731ffb46e5..e35a86630d 100644 --- a/sw/airborne/lisa/test/lisa_tunnel.c +++ b/sw/airborne/lisa/test/lisa_tunnel.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -64,5 +64,5 @@ static inline void main_event_task( void ) { if (Uart1ChAvailable()) uart2_transmit(Uart1Getch()); - + } diff --git a/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c b/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c index cab0830015..be1a213223 100644 --- a/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c +++ b/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ /* @@ -58,12 +58,12 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { - + RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);}); - RunOnceEvery(256, + RunOnceEvery(256, { - DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, + DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, &i2c1_errors.ack_fail_cnt, &i2c1_errors.miss_start_stop_cnt, &i2c1_errors.arb_lost_cnt, diff --git a/sw/airborne/lisa/test_csc_servo.c b/sw/airborne/lisa/test_csc_servo.c index 8a5e07c21a..d0fe135f49 100644 --- a/sw/airborne/lisa/test_csc_servo.c +++ b/sw/airborne/lisa/test_csc_servo.c @@ -88,7 +88,7 @@ static inline void main_periodic_task( void ) { } else { LED_OFF(0); } - + cscp_transmit(0, 0, (uint8_t *)servos, 8); LED_PERIODIC(); @@ -99,32 +99,32 @@ static inline void main_periodic_task( void ) { static inline void main_event_task( void ) { cscp_event(); - + LED_OFF(0); LED_OFF(1); LED_OFF(2); LED_OFF(3); -// DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); +// DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); } void main_on_vane_msg(void *data) { int zero = 0; - + // DOWNLINK_SEND_PONG(DefaultChannel); -// RunOnceEvery(10, { - DOWNLINK_SEND_VANE_SENSOR(DefaultChannel, - &(csc_vane_msg.vane_angle1), - &zero, - &zero, - &zero, - &zero, - &csc_vane_msg.vane_angle2, - &zero, - &zero, - &zero, +// RunOnceEvery(10, { + DOWNLINK_SEND_VANE_SENSOR(DefaultChannel, + &(csc_vane_msg.vane_angle1), + &zero, + &zero, + &zero, + &zero, + &csc_vane_msg.vane_angle2, + &zero, + &zero, + &zero, &zero); // }); } diff --git a/sw/airborne/lisa/test_datalink.c b/sw/airborne/lisa/test_datalink.c index 0c00d81dd3..2315f1370f 100644 --- a/sw/airborne/lisa/test_datalink.c +++ b/sw/airborne/lisa/test_datalink.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #define DATALINK_C @@ -64,7 +64,7 @@ void dl_parse_msg(void) { datalink_time = 0; uint8_t msg_id = dl_buffer[1]; switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(DefaultChannel); diff --git a/sw/airborne/lisa/test_float.c b/sw/airborne/lisa/test_float.c index aa6b5ca388..0188012ca9 100644 --- a/sw/airborne/lisa/test_float.c +++ b/sw/airborne/lisa/test_float.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/lisa/test_led.c b/sw/airborne/lisa/test_led.c index 353908fe55..887d62e540 100644 --- a/sw/airborne/lisa/test_led.c +++ b/sw/airborne/lisa/test_led.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/lisa/test_mc.c b/sw/airborne/lisa/test_mc.c index 4daf101b05..fa6f1a3d3c 100644 --- a/sw/airborne/lisa/test_mc.c +++ b/sw/airborne/lisa/test_mc.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ // addr 4 @@ -107,7 +107,7 @@ static inline void main_i2c_init( void ) { /* I2C configuration ----------------------------------------------------------*/ - I2C_InitTypeDef I2C_InitStructure; + I2C_InitTypeDef I2C_InitStructure; I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; I2C_InitStructure.I2C_OwnAddress1 = 0x02; @@ -115,7 +115,7 @@ static inline void main_i2c_init( void ) { // I2C_InitStructure.I2C_Ack = I2C_Ack_Disable; I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; I2C_InitStructure.I2C_ClockSpeed = 200000; - + /* I2C Peripheral Enable */ I2C_Cmd(I2C1, ENABLE); /* Apply I2C configuration after enabling it */ @@ -137,14 +137,14 @@ static inline void main_test_send( void ) { /* Send address */ // I2C_Send7bitAddress(I2C1, 0x52, I2C_Direction_Transmitter); I2C_Send7bitAddress(I2C1, 0x58, I2C_Direction_Transmitter); - + // return; /* Test on EV6 and clear it */ while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)); // return; - + /* Snd data */ I2C_SendData(I2C1, 0x06); diff --git a/sw/airborne/lisa/test_periodic.c b/sw/airborne/lisa/test_periodic.c index 9d5b9bf4d8..40f8c1371f 100644 --- a/sw/airborne/lisa/test_periodic.c +++ b/sw/airborne/lisa/test_periodic.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -50,7 +50,7 @@ static inline void main_init( void ) { static inline void main_periodic( void ) { LED_PERIODIC(); - + } diff --git a/sw/airborne/lisa/test_servos.c b/sw/airborne/lisa/test_servos.c index d842749f9d..d095c00319 100644 --- a/sw/airborne/lisa/test_servos.c +++ b/sw/airborne/lisa/test_servos.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/lisa/test_spi_slave.c b/sw/airborne/lisa/test_spi_slave.c index 894110d816..001219a8e4 100644 --- a/sw/airborne/lisa/test_spi_slave.c +++ b/sw/airborne/lisa/test_spi_slave.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -78,7 +78,7 @@ static inline void main_spi_slave_init( void ) { /* Enable SPI1 Periph clock -------------------------------------------------*/ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); - + /* Configure GPIOs: SCK, MISO and MOSI -------------------------------------*/ GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; @@ -108,7 +108,7 @@ static inline void main_spi_slave_init( void ) { SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_Init(SPI1, &SPI_InitStructure); - + /* Enable SPI_SLAVE RXNE interrupt */ SPI_I2S_ITConfig(SPI1, SPI_I2S_IT_RXNE, ENABLE); /* Enable SPI_SLAVE */ diff --git a/sw/airborne/lisa/test_spi_slave2.c b/sw/airborne/lisa/test_spi_slave2.c index 748f2c6101..75c5e8ecc8 100644 --- a/sw/airborne/lisa/test_spi_slave2.c +++ b/sw/airborne/lisa/test_spi_slave2.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -65,7 +65,7 @@ static inline void main_init( void ) { } static inline void main_periodic_task( void ) { - RunOnceEvery(10, + RunOnceEvery(10, { DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec); LED_PERIODIC(); @@ -98,7 +98,7 @@ static inline void main_spi_slave_init( void ) { /* Enable SPI1 Periph clock -------------------------------------------------*/ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); - + /* Configure GPIOs: NSS, SCK, MISO and MOSI --------------------------------*/ GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; @@ -120,7 +120,7 @@ static inline void main_spi_slave_init( void ) { SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_Init(SPI1, &SPI_InitStructure); - + /* Enable SPI_SLAVE */ SPI_Cmd(SPI1, ENABLE); @@ -136,22 +136,22 @@ static inline void main_spi_slave_init( void ) { static void main_setup_dma(void) { /* SPI_SLAVE_Rx_DMA_Channel configuration ------------------------------------*/ - DMA_InitTypeDef DMA_InitStructure; - DMA_DeInit(DMA1_Channel2); - DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(SPI1_BASE+0x0C); + DMA_InitTypeDef DMA_InitStructure; + DMA_DeInit(DMA1_Channel2); + DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(SPI1_BASE+0x0C); DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)SPI_SLAVE_Buffer_Rx; - DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; - DMA_InitStructure.DMA_BufferSize = BufferSize; - DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; + DMA_InitStructure.DMA_BufferSize = BufferSize; + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; - DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; - DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; - DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; - DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; - DMA_Init(DMA1_Channel2, &DMA_InitStructure); + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; + DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; + DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; + DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; + DMA_Init(DMA1_Channel2, &DMA_InitStructure); /* SPI_SLAVE_Tx_DMA_Channel configuration ------------------------------------*/ - DMA_DeInit(DMA1_Channel3); + DMA_DeInit(DMA1_Channel3); DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(SPI1_BASE+0x0C); DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)SPI_SLAVE_Buffer_Tx; DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; diff --git a/sw/airborne/lisa/test_uart.c b/sw/airborne/lisa/test_uart.c index 6308593150..cd0a3314f5 100644 --- a/sw/airborne/lisa/test_uart.c +++ b/sw/airborne/lisa/test_uart.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include diff --git a/sw/airborne/lisa/tunnel_hw.c b/sw/airborne/lisa/tunnel_hw.c index e46913f132..0d9770e05b 100644 --- a/sw/airborne/lisa/tunnel_hw.c +++ b/sw/airborne/lisa/tunnel_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -124,6 +124,6 @@ static inline void main_event( void ) { GPIO_WriteBit(B_TX_PORT, B_TX_PIN, Bit_RESET); LED_OFF(2); } - - + + } diff --git a/sw/airborne/math/pprz_algebra_float.h b/sw/airborne/math/pprz_algebra_float.h index f5de0790bc..a534bbbea3 100644 --- a/sw/airborne/math/pprz_algebra_float.h +++ b/sw/airborne/math/pprz_algebra_float.h @@ -427,7 +427,7 @@ static inline float float_rmat_reorthogonalize(struct FloatRMat* rm) { #define FLOAT_QUAT_NORM(_q) (sqrtf(SQUARE(_q.qi) + SQUARE(_q.qx)+ \ SQUARE(_q.qy) + SQUARE(_q.qz))) \ - + #define FLOAT_QUAT_NORMALISE(q) { \ float norm = FLOAT_QUAT_NORM(q); \ if (norm > FLT_MIN) { \ diff --git a/sw/airborne/math/pprz_geodetic_double.c b/sw/airborne/math/pprz_geodetic_double.c index 4c2e1f64dd..d8570396b0 100644 --- a/sw/airborne/math/pprz_geodetic_double.c +++ b/sw/airborne/math/pprz_geodetic_double.c @@ -32,13 +32,13 @@ void lla_of_ecef_d(struct LlaCoor_d* lla, struct EcefCoor_d* ecef) { static const double a = 6378137.0; /* earth semimajor axis in meters */ static const double f = 1./298.257223563; /* reciprocal flattening */ const double b = a*(1.-f); /* semi-minor axis */ - const double b2 = b*b; - + const double b2 = b*b; + const double e2 = 2.*f-(f*f); /* first eccentricity squared */ const double ep2 = f*(2.-f)/((1.-f)*(1.-f)); /* second eccentricity squared */ const double E2 = a*a - b2; - - + + const double z2 = ecef->z*ecef->z; const double r2 = ecef->x*ecef->x+ecef->y*ecef->y; const double r = sqrt(r2); @@ -54,7 +54,7 @@ void lla_of_ecef_d(struct LlaCoor_d* lla, struct EcefCoor_d* ecef) { const double U = sqrt( tmp + z2 ); const double V = sqrt( tmp + (1-e2)*z2 ); const double zo = (b2*ecef->z)/(a*V); - + lla->alt = U*(1 - b2/(a*V)); lla->lat = atan((ecef->z + ep2*zo)/r); lla->lon = atan2(ecef->y,ecef->x); diff --git a/sw/airborne/math/pprz_geodetic_float.c b/sw/airborne/math/pprz_geodetic_float.c index 0df4c4f4a0..6fef1d0411 100644 --- a/sw/airborne/math/pprz_geodetic_float.c +++ b/sw/airborne/math/pprz_geodetic_float.c @@ -2,7 +2,7 @@ #include "pprz_algebra_float.h" #include - + void ltp_def_from_ecef_f(struct LtpDef_f* def, struct EcefCoor_f* ecef) { /* store the origin of the tangeant plane */ @@ -80,7 +80,7 @@ void ecef_of_ned_vect_f(struct EcefCoor_f* ecef, struct LtpDef_f* def, struct Ne ENU_OF_TO_NED(enu, *ned); ecef_of_enu_vect_f(ecef, def, &enu); } -#endif +#endif @@ -92,13 +92,13 @@ void lla_of_ecef_f(struct LlaCoor_f* out, struct EcefCoor_f* in) { static const float a = 6378137.0; /* earth semimajor axis in meters */ static const float f = 1./298.257223563; /* reciprocal flattening */ const float b = a*(1.-f); /* semi-minor axis */ - const float b2 = b*b; - + const float b2 = b*b; + const float e2 = 2.*f-(f*f); /* first eccentricity squared */ const float ep2 = f*(2.-f)/((1.-f)*(1.-f)); /* second eccentricity squared */ const float E2 = a*a - b2; - - + + const float z2 = in->z*in->z; const float r2 = in->x*in->x+in->y*in->y; const float r = sqrtf(r2); @@ -114,7 +114,7 @@ void lla_of_ecef_f(struct LlaCoor_f* out, struct EcefCoor_f* in) { const float U = sqrtf( tmp + z2 ); const float V = sqrtf( tmp + (1-e2)*z2 ); const float zo = (b2*in->z)/(a*V); - + out->alt = U*(1 - b2/(a*V)); out->lat = atanf((in->z + ep2*zo)/r); out->lon = atan2f(in->y,in->x); diff --git a/sw/airborne/math/pprz_geodetic_int.c b/sw/airborne/math/pprz_geodetic_int.c index 66b1d7f87d..e5675607c5 100644 --- a/sw/airborne/math/pprz_geodetic_int.c +++ b/sw/airborne/math/pprz_geodetic_int.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "pprz_geodetic_int.h" @@ -40,14 +40,14 @@ void ltp_def_from_ecef_i(struct LtpDef_i* def, struct EcefCoor_i* ecef) { #if 1 int32_t sin_lat = rint(BFP_OF_REAL(sinf(RAD_OF_EM7RAD((float)def->lla.lat)), HIGH_RES_TRIG_FRAC)); - int32_t cos_lat = rint(BFP_OF_REAL(cosf(RAD_OF_EM7RAD((float)def->lla.lat)), HIGH_RES_TRIG_FRAC)); + int32_t cos_lat = rint(BFP_OF_REAL(cosf(RAD_OF_EM7RAD((float)def->lla.lat)), HIGH_RES_TRIG_FRAC)); int32_t sin_lon = rint(BFP_OF_REAL(sinf(RAD_OF_EM7RAD((float)def->lla.lon)), HIGH_RES_TRIG_FRAC)); - int32_t cos_lon = rint(BFP_OF_REAL(cosf(RAD_OF_EM7RAD((float)def->lla.lon)), HIGH_RES_TRIG_FRAC)); + int32_t cos_lon = rint(BFP_OF_REAL(cosf(RAD_OF_EM7RAD((float)def->lla.lon)), HIGH_RES_TRIG_FRAC)); #else int32_t sin_lat = rint(BFP_OF_REAL(sin(RAD_OF_EM7RAD((double)def->lla.lat)), HIGH_RES_TRIG_FRAC)); - int32_t cos_lat = rint(BFP_OF_REAL(cos(RAD_OF_EM7RAD((double)def->lla.lat)), HIGH_RES_TRIG_FRAC)); + int32_t cos_lat = rint(BFP_OF_REAL(cos(RAD_OF_EM7RAD((double)def->lla.lat)), HIGH_RES_TRIG_FRAC)); int32_t sin_lon = rint(BFP_OF_REAL(sin(RAD_OF_EM7RAD((double)def->lla.lon)), HIGH_RES_TRIG_FRAC)); - int32_t cos_lon = rint(BFP_OF_REAL(cos(RAD_OF_EM7RAD((double)def->lla.lon)), HIGH_RES_TRIG_FRAC)); + int32_t cos_lon = rint(BFP_OF_REAL(cos(RAD_OF_EM7RAD((double)def->lla.lon)), HIGH_RES_TRIG_FRAC)); #endif @@ -73,7 +73,7 @@ void enu_of_ecef_point_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct Ece VECT3_DIFF(delta, *ecef, def->ecef); const int64_t tmpx = (int64_t)def->ltp_of_ecef.m[0]*delta.x + (int64_t)def->ltp_of_ecef.m[1]*delta.y + - 0; + 0; enu->x = (int32_t)(tmpx>>HIGH_RES_TRIG_FRAC); const int64_t tmpy = (int64_t)def->ltp_of_ecef.m[3]*delta.x + (int64_t)def->ltp_of_ecef.m[4]*delta.y + @@ -88,7 +88,7 @@ void enu_of_ecef_point_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct Ece void ned_of_ecef_point_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct EcefCoor_i* ecef) { - + struct EnuCoor_i enu; enu_of_ecef_point_i(&enu, def, ecef); ENU_OF_TO_NED(*ned, enu); @@ -99,7 +99,7 @@ void enu_of_ecef_vect_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct Ecef const int64_t tmpx = (int64_t)def->ltp_of_ecef.m[0]*ecef->x + (int64_t)def->ltp_of_ecef.m[1]*ecef->y + - 0; + 0; enu->x = (int32_t)(tmpx>>HIGH_RES_TRIG_FRAC); const int64_t tmpy = (int64_t)def->ltp_of_ecef.m[3]*ecef->x + (int64_t)def->ltp_of_ecef.m[4]*ecef->y + @@ -114,7 +114,7 @@ void enu_of_ecef_vect_i(struct EnuCoor_i* enu, struct LtpDef_i* def, struct Ecef void ned_of_ecef_vect_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct EcefCoor_i* ecef) { - + struct EnuCoor_i enu; enu_of_ecef_vect_i(&enu, def, ecef); ENU_OF_TO_NED(*ned, enu); @@ -124,9 +124,9 @@ void ned_of_ecef_vect_i(struct NedCoor_i* ned, struct LtpDef_i* def, struct Ecef -/* +/* For now we cheat and call the floating point version - Anyone up for writing it in fixed point ? + Anyone up for writing it in fixed point ? */ #include "pprz_geodetic_float.h" #include "pprz_geodetic_double.h" diff --git a/sw/airborne/math/pprz_geodetic_int.h b/sw/airborne/math/pprz_geodetic_int.h index fe52cc0f58..93a640387d 100644 --- a/sw/airborne/math/pprz_geodetic_int.h +++ b/sw/airborne/math/pprz_geodetic_int.h @@ -6,8 +6,8 @@ #include "std.h" #include "pprz_algebra_int.h" -/* - Earth Centered Earth Fixed in centimeters +/* + Earth Centered Earth Fixed in centimeters */ struct EcefCoor_i { int32_t x; diff --git a/sw/airborne/math/pprz_simple_matrix.h b/sw/airborne/math/pprz_simple_matrix.h index 83427de1f0..4b6fd9be8b 100644 --- a/sw/airborne/math/pprz_simple_matrix.h +++ b/sw/airborne/math/pprz_simple_matrix.h @@ -2,7 +2,7 @@ #define PPRZ_SIMPLE_MATRIX_H #include /* for FLT_EPSILON */ -#include +#include #ifdef HAVE_STDIO #include /* for printf'ing warnings */ #define warn_message printf diff --git a/sw/airborne/math/pprz_trig_int.c b/sw/airborne/math/pprz_trig_int.c index 015910194a..310690a66f 100644 --- a/sw/airborne/math/pprz_trig_int.c +++ b/sw/airborne/math/pprz_trig_int.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,412 +18,412 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "pprz_trig_int.h" -PPRZ_TRIG_CONST int16_t pprz_trig_int[6434] = { 0, - 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, - 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, - 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, 191, - 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255, - 259, 263, 267, 271, 275, 279, 283, 287, 291, 295, 299, 303, 307, 311, 315, 319, - 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 375, 379, 383, - 387, 391, 395, 399, 403, 407, 411, 415, 419, 423, 427, 431, 435, 439, 443, 447, - 451, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, 507, 511, - 515, 519, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, 563, 567, 571, 575, - 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 635, 639, - 643, 647, 651, 655, 659, 663, 667, 671, 675, 679, 683, 687, 691, 695, 699, 703, - 707, 711, 715, 719, 723, 727, 731, 735, 739, 743, 747, 751, 755, 759, 763, 767, - 771, 775, 779, 783, 787, 791, 795, 799, 803, 807, 811, 815, 819, 823, 827, 831, - 835, 839, 843, 847, 851, 855, 859, 863, 867, 871, 875, 879, 883, 887, 891, 895, - 899, 903, 907, 911, 915, 919, 923, 927, 931, 935, 939, 943, 947, 951, 955, 959, - 963, 967, 971, 975, 979, 983, 987, 991, 995, 999, 1003, 1007, 1011, 1015, 1019, 1023, - 1027, 1031, 1035, 1039, 1043, 1047, 1051, 1055, 1059, 1063, 1067, 1071, 1075, 1079, 1083, 1087, - 1091, 1095, 1099, 1103, 1107, 1111, 1115, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1147, 1151, - 1155, 1159, 1163, 1167, 1171, 1174, 1178, 1182, 1186, 1190, 1194, 1198, 1202, 1206, 1210, 1214, - 1218, 1222, 1226, 1230, 1234, 1238, 1242, 1246, 1250, 1254, 1258, 1262, 1266, 1270, 1274, 1278, - 1282, 1286, 1290, 1294, 1298, 1302, 1306, 1310, 1314, 1318, 1322, 1326, 1330, 1334, 1338, 1342, - 1346, 1350, 1354, 1358, 1362, 1366, 1370, 1374, 1378, 1382, 1386, 1390, 1394, 1398, 1402, 1406, - 1410, 1414, 1418, 1422, 1426, 1430, 1434, 1438, 1442, 1446, 1450, 1454, 1458, 1462, 1466, 1470, - 1474, 1477, 1481, 1485, 1489, 1493, 1497, 1501, 1505, 1509, 1513, 1517, 1521, 1525, 1529, 1533, - 1537, 1541, 1545, 1549, 1553, 1557, 1561, 1565, 1569, 1573, 1577, 1581, 1585, 1589, 1593, 1597, - 1601, 1605, 1609, 1613, 1617, 1621, 1625, 1629, 1633, 1637, 1641, 1645, 1649, 1653, 1657, 1661, - 1665, 1669, 1673, 1677, 1681, 1685, 1688, 1692, 1696, 1700, 1704, 1708, 1712, 1716, 1720, 1724, - 1728, 1732, 1736, 1740, 1744, 1748, 1752, 1756, 1760, 1764, 1768, 1772, 1776, 1780, 1784, 1788, - 1792, 1796, 1800, 1804, 1808, 1812, 1816, 1820, 1824, 1828, 1832, 1836, 1840, 1844, 1848, 1852, - 1856, 1859, 1863, 1867, 1871, 1875, 1879, 1883, 1887, 1891, 1895, 1899, 1903, 1907, 1911, 1915, - 1919, 1923, 1927, 1931, 1935, 1939, 1943, 1947, 1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, - 1983, 1987, 1991, 1995, 1999, 2002, 2006, 2010, 2014, 2018, 2022, 2026, 2030, 2034, 2038, 2042, - 2046, 2050, 2054, 2058, 2062, 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, 2098, 2102, 2106, - 2110, 2114, 2118, 2122, 2125, 2129, 2133, 2137, 2141, 2145, 2149, 2153, 2157, 2161, 2165, 2169, - 2173, 2177, 2181, 2185, 2189, 2193, 2197, 2201, 2205, 2209, 2213, 2217, 2221, 2225, 2229, 2233, - 2236, 2240, 2244, 2248, 2252, 2256, 2260, 2264, 2268, 2272, 2276, 2280, 2284, 2288, 2292, 2296, - 2300, 2304, 2308, 2312, 2316, 2320, 2324, 2328, 2332, 2336, 2339, 2343, 2347, 2351, 2355, 2359, - 2363, 2367, 2371, 2375, 2379, 2383, 2387, 2391, 2395, 2399, 2403, 2407, 2411, 2415, 2419, 2423, - 2427, 2430, 2434, 2438, 2442, 2446, 2450, 2454, 2458, 2462, 2466, 2470, 2474, 2478, 2482, 2486, - 2490, 2494, 2498, 2502, 2506, 2510, 2514, 2517, 2521, 2525, 2529, 2533, 2537, 2541, 2545, 2549, - 2553, 2557, 2561, 2565, 2569, 2573, 2577, 2581, 2585, 2589, 2593, 2597, 2600, 2604, 2608, 2612, - 2616, 2620, 2624, 2628, 2632, 2636, 2640, 2644, 2648, 2652, 2656, 2660, 2664, 2668, 2672, 2675, - 2679, 2683, 2687, 2691, 2695, 2699, 2703, 2707, 2711, 2715, 2719, 2723, 2727, 2731, 2735, 2739, - 2743, 2746, 2750, 2754, 2758, 2762, 2766, 2770, 2774, 2778, 2782, 2786, 2790, 2794, 2798, 2802, - 2806, 2810, 2813, 2817, 2821, 2825, 2829, 2833, 2837, 2841, 2845, 2849, 2853, 2857, 2861, 2865, - 2869, 2873, 2877, 2880, 2884, 2888, 2892, 2896, 2900, 2904, 2908, 2912, 2916, 2920, 2924, 2928, - 2932, 2936, 2939, 2943, 2947, 2951, 2955, 2959, 2963, 2967, 2971, 2975, 2979, 2983, 2987, 2991, - 2995, 2998, 3002, 3006, 3010, 3014, 3018, 3022, 3026, 3030, 3034, 3038, 3042, 3046, 3050, 3054, - 3057, 3061, 3065, 3069, 3073, 3077, 3081, 3085, 3089, 3093, 3097, 3101, 3105, 3109, 3112, 3116, - 3120, 3124, 3128, 3132, 3136, 3140, 3144, 3148, 3152, 3156, 3160, 3163, 3167, 3171, 3175, 3179, - 3183, 3187, 3191, 3195, 3199, 3203, 3207, 3211, 3215, 3218, 3222, 3226, 3230, 3234, 3238, 3242, - 3246, 3250, 3254, 3258, 3262, 3265, 3269, 3273, 3277, 3281, 3285, 3289, 3293, 3297, 3301, 3305, - 3309, 3312, 3316, 3320, 3324, 3328, 3332, 3336, 3340, 3344, 3348, 3352, 3356, 3359, 3363, 3367, - 3371, 3375, 3379, 3383, 3387, 3391, 3395, 3399, 3403, 3406, 3410, 3414, 3418, 3422, 3426, 3430, - 3434, 3438, 3442, 3446, 3449, 3453, 3457, 3461, 3465, 3469, 3473, 3477, 3481, 3485, 3489, 3492, - 3496, 3500, 3504, 3508, 3512, 3516, 3520, 3524, 3528, 3532, 3535, 3539, 3543, 3547, 3551, 3555, - 3559, 3563, 3567, 3571, 3575, 3578, 3582, 3586, 3590, 3594, 3598, 3602, 3606, 3610, 3614, 3617, - 3621, 3625, 3629, 3633, 3637, 3641, 3645, 3649, 3653, 3656, 3660, 3664, 3668, 3672, 3676, 3680, - 3684, 3688, 3692, 3695, 3699, 3703, 3707, 3711, 3715, 3719, 3723, 3727, 3730, 3734, 3738, 3742, - 3746, 3750, 3754, 3758, 3762, 3766, 3769, 3773, 3777, 3781, 3785, 3789, 3793, 3797, 3801, 3804, - 3808, 3812, 3816, 3820, 3824, 3828, 3832, 3836, 3839, 3843, 3847, 3851, 3855, 3859, 3863, 3867, - 3871, 3874, 3878, 3882, 3886, 3890, 3894, 3898, 3902, 3906, 3909, 3913, 3917, 3921, 3925, 3929, - 3933, 3937, 3940, 3944, 3948, 3952, 3956, 3960, 3964, 3968, 3972, 3975, 3979, 3983, 3987, 3991, - 3995, 3999, 4003, 4006, 4010, 4014, 4018, 4022, 4026, 4030, 4034, 4037, 4041, 4045, 4049, 4053, - 4057, 4061, 4065, 4068, 4072, 4076, 4080, 4084, 4088, 4092, 4096, 4099, 4103, 4107, 4111, 4115, - 4119, 4123, 4127, 4130, 4134, 4138, 4142, 4146, 4150, 4154, 4158, 4161, 4165, 4169, 4173, 4177, - 4181, 4185, 4188, 4192, 4196, 4200, 4204, 4208, 4212, 4216, 4219, 4223, 4227, 4231, 4235, 4239, - 4243, 4246, 4250, 4254, 4258, 4262, 4266, 4270, 4273, 4277, 4281, 4285, 4289, 4293, 4297, 4301, - 4304, 4308, 4312, 4316, 4320, 4324, 4328, 4331, 4335, 4339, 4343, 4347, 4351, 4355, 4358, 4362, - 4366, 4370, 4374, 4378, 4382, 4385, 4389, 4393, 4397, 4401, 4405, 4408, 4412, 4416, 4420, 4424, - 4428, 4432, 4435, 4439, 4443, 4447, 4451, 4455, 4459, 4462, 4466, 4470, 4474, 4478, 4482, 4485, - 4489, 4493, 4497, 4501, 4505, 4509, 4512, 4516, 4520, 4524, 4528, 4532, 4535, 4539, 4543, 4547, - 4551, 4555, 4559, 4562, 4566, 4570, 4574, 4578, 4582, 4585, 4589, 4593, 4597, 4601, 4605, 4608, - 4612, 4616, 4620, 4624, 4628, 4631, 4635, 4639, 4643, 4647, 4651, 4654, 4658, 4662, 4666, 4670, - 4674, 4677, 4681, 4685, 4689, 4693, 4697, 4700, 4704, 4708, 4712, 4716, 4720, 4723, 4727, 4731, - 4735, 4739, 4743, 4746, 4750, 4754, 4758, 4762, 4766, 4769, 4773, 4777, 4781, 4785, 4789, 4792, - 4796, 4800, 4804, 4808, 4811, 4815, 4819, 4823, 4827, 4831, 4834, 4838, 4842, 4846, 4850, 4854, - 4857, 4861, 4865, 4869, 4873, 4876, 4880, 4884, 4888, 4892, 4896, 4899, 4903, 4907, 4911, 4915, - 4918, 4922, 4926, 4930, 4934, 4938, 4941, 4945, 4949, 4953, 4957, 4960, 4964, 4968, 4972, 4976, - 4979, 4983, 4987, 4991, 4995, 4998, 5002, 5006, 5010, 5014, 5018, 5021, 5025, 5029, 5033, 5037, - 5040, 5044, 5048, 5052, 5056, 5059, 5063, 5067, 5071, 5075, 5078, 5082, 5086, 5090, 5094, 5097, - 5101, 5105, 5109, 5113, 5116, 5120, 5124, 5128, 5132, 5135, 5139, 5143, 5147, 5151, 5154, 5158, - 5162, 5166, 5170, 5173, 5177, 5181, 5185, 5189, 5192, 5196, 5200, 5204, 5208, 5211, 5215, 5219, - 5223, 5227, 5230, 5234, 5238, 5242, 5245, 5249, 5253, 5257, 5261, 5264, 5268, 5272, 5276, 5280, - 5283, 5287, 5291, 5295, 5298, 5302, 5306, 5310, 5314, 5317, 5321, 5325, 5329, 5333, 5336, 5340, - 5344, 5348, 5351, 5355, 5359, 5363, 5367, 5370, 5374, 5378, 5382, 5385, 5389, 5393, 5397, 5401, - 5404, 5408, 5412, 5416, 5419, 5423, 5427, 5431, 5435, 5438, 5442, 5446, 5450, 5453, 5457, 5461, - 5465, 5468, 5472, 5476, 5480, 5484, 5487, 5491, 5495, 5499, 5502, 5506, 5510, 5514, 5517, 5521, - 5525, 5529, 5533, 5536, 5540, 5544, 5548, 5551, 5555, 5559, 5563, 5566, 5570, 5574, 5578, 5581, - 5585, 5589, 5593, 5596, 5600, 5604, 5608, 5612, 5615, 5619, 5623, 5627, 5630, 5634, 5638, 5642, - 5645, 5649, 5653, 5657, 5660, 5664, 5668, 5672, 5675, 5679, 5683, 5687, 5690, 5694, 5698, 5702, - 5705, 5709, 5713, 5717, 5720, 5724, 5728, 5732, 5735, 5739, 5743, 5747, 5750, 5754, 5758, 5762, - 5765, 5769, 5773, 5777, 5780, 5784, 5788, 5792, 5795, 5799, 5803, 5806, 5810, 5814, 5818, 5821, - 5825, 5829, 5833, 5836, 5840, 5844, 5848, 5851, 5855, 5859, 5863, 5866, 5870, 5874, 5877, 5881, - 5885, 5889, 5892, 5896, 5900, 5904, 5907, 5911, 5915, 5919, 5922, 5926, 5930, 5933, 5937, 5941, - 5945, 5948, 5952, 5956, 5960, 5963, 5967, 5971, 5974, 5978, 5982, 5986, 5989, 5993, 5997, 6001, - 6004, 6008, 6012, 6015, 6019, 6023, 6027, 6030, 6034, 6038, 6041, 6045, 6049, 6053, 6056, 6060, - 6064, 6067, 6071, 6075, 6079, 6082, 6086, 6090, 6093, 6097, 6101, 6105, 6108, 6112, 6116, 6119, - 6123, 6127, 6131, 6134, 6138, 6142, 6145, 6149, 6153, 6157, 6160, 6164, 6168, 6171, 6175, 6179, - 6182, 6186, 6190, 6194, 6197, 6201, 6205, 6208, 6212, 6216, 6219, 6223, 6227, 6231, 6234, 6238, - 6242, 6245, 6249, 6253, 6256, 6260, 6264, 6268, 6271, 6275, 6279, 6282, 6286, 6290, 6293, 6297, - 6301, 6304, 6308, 6312, 6316, 6319, 6323, 6327, 6330, 6334, 6338, 6341, 6345, 6349, 6352, 6356, - 6360, 6364, 6367, 6371, 6375, 6378, 6382, 6386, 6389, 6393, 6397, 6400, 6404, 6408, 6411, 6415, - 6419, 6422, 6426, 6430, 6433, 6437, 6441, 6445, 6448, 6452, 6456, 6459, 6463, 6467, 6470, 6474, - 6478, 6481, 6485, 6489, 6492, 6496, 6500, 6503, 6507, 6511, 6514, 6518, 6522, 6525, 6529, 6533, - 6536, 6540, 6544, 6547, 6551, 6555, 6558, 6562, 6566, 6569, 6573, 6577, 6580, 6584, 6588, 6591, - 6595, 6599, 6602, 6606, 6610, 6613, 6617, 6621, 6624, 6628, 6632, 6635, 6639, 6643, 6646, 6650, - 6654, 6657, 6661, 6664, 6668, 6672, 6675, 6679, 6683, 6686, 6690, 6694, 6697, 6701, 6705, 6708, - 6712, 6716, 6719, 6723, 6727, 6730, 6734, 6737, 6741, 6745, 6748, 6752, 6756, 6759, 6763, 6767, - 6770, 6774, 6778, 6781, 6785, 6788, 6792, 6796, 6799, 6803, 6807, 6810, 6814, 6818, 6821, 6825, - 6828, 6832, 6836, 6839, 6843, 6847, 6850, 6854, 6858, 6861, 6865, 6868, 6872, 6876, 6879, 6883, - 6887, 6890, 6894, 6898, 6901, 6905, 6908, 6912, 6916, 6919, 6923, 6927, 6930, 6934, 6937, 6941, - 6945, 6948, 6952, 6956, 6959, 6963, 6966, 6970, 6974, 6977, 6981, 6984, 6988, 6992, 6995, 6999, - 7003, 7006, 7010, 7013, 7017, 7021, 7024, 7028, 7031, 7035, 7039, 7042, 7046, 7050, 7053, 7057, - 7060, 7064, 7068, 7071, 7075, 7078, 7082, 7086, 7089, 7093, 7096, 7100, 7104, 7107, 7111, 7114, - 7118, 7122, 7125, 7129, 7132, 7136, 7140, 7143, 7147, 7150, 7154, 7158, 7161, 7165, 7168, 7172, - 7176, 7179, 7183, 7186, 7190, 7194, 7197, 7201, 7204, 7208, 7212, 7215, 7219, 7222, 7226, 7230, - 7233, 7237, 7240, 7244, 7247, 7251, 7255, 7258, 7262, 7265, 7269, 7273, 7276, 7280, 7283, 7287, - 7290, 7294, 7298, 7301, 7305, 7308, 7312, 7316, 7319, 7323, 7326, 7330, 7333, 7337, 7341, 7344, - 7348, 7351, 7355, 7358, 7362, 7366, 7369, 7373, 7376, 7380, 7383, 7387, 7391, 7394, 7398, 7401, - 7405, 7408, 7412, 7416, 7419, 7423, 7426, 7430, 7433, 7437, 7441, 7444, 7448, 7451, 7455, 7458, - 7462, 7465, 7469, 7473, 7476, 7480, 7483, 7487, 7490, 7494, 7498, 7501, 7505, 7508, 7512, 7515, - 7519, 7522, 7526, 7530, 7533, 7537, 7540, 7544, 7547, 7551, 7554, 7558, 7561, 7565, 7569, 7572, - 7576, 7579, 7583, 7586, 7590, 7593, 7597, 7600, 7604, 7608, 7611, 7615, 7618, 7622, 7625, 7629, - 7632, 7636, 7639, 7643, 7646, 7650, 7654, 7657, 7661, 7664, 7668, 7671, 7675, 7678, 7682, 7685, - 7689, 7692, 7696, 7700, 7703, 7707, 7710, 7714, 7717, 7721, 7724, 7728, 7731, 7735, 7738, 7742, - 7745, 7749, 7752, 7756, 7759, 7763, 7767, 7770, 7774, 7777, 7781, 7784, 7788, 7791, 7795, 7798, - 7802, 7805, 7809, 7812, 7816, 7819, 7823, 7826, 7830, 7833, 7837, 7840, 7844, 7847, 7851, 7854, - 7858, 7861, 7865, 7868, 7872, 7875, 7879, 7882, 7886, 7889, 7893, 7896, 7900, 7904, 7907, 7911, - 7914, 7918, 7921, 7925, 7928, 7932, 7935, 7939, 7942, 7946, 7949, 7953, 7956, 7960, 7963, 7966, - 7970, 7973, 7977, 7980, 7984, 7987, 7991, 7994, 7998, 8001, 8005, 8008, 8012, 8015, 8019, 8022, - 8026, 8029, 8033, 8036, 8040, 8043, 8047, 8050, 8054, 8057, 8061, 8064, 8068, 8071, 8075, 8078, - 8082, 8085, 8089, 8092, 8095, 8099, 8102, 8106, 8109, 8113, 8116, 8120, 8123, 8127, 8130, 8134, - 8137, 8141, 8144, 8148, 8151, 8155, 8158, 8161, 8165, 8168, 8172, 8175, 8179, 8182, 8186, 8189, - 8193, 8196, 8200, 8203, 8207, 8210, 8213, 8217, 8220, 8224, 8227, 8231, 8234, 8238, 8241, 8245, - 8248, 8251, 8255, 8258, 8262, 8265, 8269, 8272, 8276, 8279, 8283, 8286, 8289, 8293, 8296, 8300, - 8303, 8307, 8310, 8314, 8317, 8321, 8324, 8327, 8331, 8334, 8338, 8341, 8345, 8348, 8351, 8355, - 8358, 8362, 8365, 8369, 8372, 8376, 8379, 8382, 8386, 8389, 8393, 8396, 8400, 8403, 8406, 8410, - 8413, 8417, 8420, 8424, 8427, 8431, 8434, 8437, 8441, 8444, 8448, 8451, 8455, 8458, 8461, 8465, - 8468, 8472, 8475, 8478, 8482, 8485, 8489, 8492, 8496, 8499, 8502, 8506, 8509, 8513, 8516, 8520, - 8523, 8526, 8530, 8533, 8537, 8540, 8543, 8547, 8550, 8554, 8557, 8560, 8564, 8567, 8571, 8574, - 8578, 8581, 8584, 8588, 8591, 8595, 8598, 8601, 8605, 8608, 8612, 8615, 8618, 8622, 8625, 8629, - 8632, 8635, 8639, 8642, 8646, 8649, 8652, 8656, 8659, 8663, 8666, 8669, 8673, 8676, 8680, 8683, - 8686, 8690, 8693, 8696, 8700, 8703, 8707, 8710, 8713, 8717, 8720, 8724, 8727, 8730, 8734, 8737, - 8741, 8744, 8747, 8751, 8754, 8757, 8761, 8764, 8768, 8771, 8774, 8778, 8781, 8784, 8788, 8791, - 8795, 8798, 8801, 8805, 8808, 8811, 8815, 8818, 8822, 8825, 8828, 8832, 8835, 8838, 8842, 8845, - 8849, 8852, 8855, 8859, 8862, 8865, 8869, 8872, 8875, 8879, 8882, 8886, 8889, 8892, 8896, 8899, - 8902, 8906, 8909, 8912, 8916, 8919, 8922, 8926, 8929, 8933, 8936, 8939, 8943, 8946, 8949, 8953, - 8956, 8959, 8963, 8966, 8969, 8973, 8976, 8979, 8983, 8986, 8989, 8993, 8996, 8999, 9003, 9006, - 9009, 9013, 9016, 9020, 9023, 9026, 9030, 9033, 9036, 9040, 9043, 9046, 9050, 9053, 9056, 9060, - 9063, 9066, 9070, 9073, 9076, 9080, 9083, 9086, 9090, 9093, 9096, 9099, 9103, 9106, 9109, 9113, - 9116, 9119, 9123, 9126, 9129, 9133, 9136, 9139, 9143, 9146, 9149, 9153, 9156, 9159, 9163, 9166, - 9169, 9173, 9176, 9179, 9182, 9186, 9189, 9192, 9196, 9199, 9202, 9206, 9209, 9212, 9216, 9219, - 9222, 9225, 9229, 9232, 9235, 9239, 9242, 9245, 9249, 9252, 9255, 9259, 9262, 9265, 9268, 9272, - 9275, 9278, 9282, 9285, 9288, 9291, 9295, 9298, 9301, 9305, 9308, 9311, 9315, 9318, 9321, 9324, - 9328, 9331, 9334, 9338, 9341, 9344, 9347, 9351, 9354, 9357, 9361, 9364, 9367, 9370, 9374, 9377, - 9380, 9384, 9387, 9390, 9393, 9397, 9400, 9403, 9406, 9410, 9413, 9416, 9420, 9423, 9426, 9429, - 9433, 9436, 9439, 9442, 9446, 9449, 9452, 9456, 9459, 9462, 9465, 9469, 9472, 9475, 9478, 9482, - 9485, 9488, 9491, 9495, 9498, 9501, 9504, 9508, 9511, 9514, 9517, 9521, 9524, 9527, 9531, 9534, - 9537, 9540, 9544, 9547, 9550, 9553, 9557, 9560, 9563, 9566, 9570, 9573, 9576, 9579, 9582, 9586, - 9589, 9592, 9595, 9599, 9602, 9605, 9608, 9612, 9615, 9618, 9621, 9625, 9628, 9631, 9634, 9638, - 9641, 9644, 9647, 9650, 9654, 9657, 9660, 9663, 9667, 9670, 9673, 9676, 9680, 9683, 9686, 9689, - 9692, 9696, 9699, 9702, 9705, 9709, 9712, 9715, 9718, 9721, 9725, 9728, 9731, 9734, 9738, 9741, - 9744, 9747, 9750, 9754, 9757, 9760, 9763, 9766, 9770, 9773, 9776, 9779, 9783, 9786, 9789, 9792, - 9795, 9799, 9802, 9805, 9808, 9811, 9815, 9818, 9821, 9824, 9827, 9831, 9834, 9837, 9840, 9843, - 9847, 9850, 9853, 9856, 9859, 9863, 9866, 9869, 9872, 9875, 9879, 9882, 9885, 9888, 9891, 9894, - 9898, 9901, 9904, 9907, 9910, 9914, 9917, 9920, 9923, 9926, 9930, 9933, 9936, 9939, 9942, 9945, - 9949, 9952, 9955, 9958, 9961, 9964, 9968, 9971, 9974, 9977, 9980, 9984, 9987, 9990, 9993, 9996, - 9999, 10003, 10006, 10009, 10012, 10015, 10018, 10022, 10025, 10028, 10031, 10034, 10037, 10041, 10044, 10047, - 10050, 10053, 10056, 10059, 10063, 10066, 10069, 10072, 10075, 10078, 10082, 10085, 10088, 10091, 10094, 10097, - 10100, 10104, 10107, 10110, 10113, 10116, 10119, 10122, 10126, 10129, 10132, 10135, 10138, 10141, 10144, 10148, - 10151, 10154, 10157, 10160, 10163, 10166, 10170, 10173, 10176, 10179, 10182, 10185, 10188, 10192, 10195, 10198, - 10201, 10204, 10207, 10210, 10213, 10217, 10220, 10223, 10226, 10229, 10232, 10235, 10238, 10242, 10245, 10248, - 10251, 10254, 10257, 10260, 10263, 10267, 10270, 10273, 10276, 10279, 10282, 10285, 10288, 10291, 10295, 10298, - 10301, 10304, 10307, 10310, 10313, 10316, 10319, 10323, 10326, 10329, 10332, 10335, 10338, 10341, 10344, 10347, - 10350, 10354, 10357, 10360, 10363, 10366, 10369, 10372, 10375, 10378, 10381, 10385, 10388, 10391, 10394, 10397, - 10400, 10403, 10406, 10409, 10412, 10415, 10419, 10422, 10425, 10428, 10431, 10434, 10437, 10440, 10443, 10446, - 10449, 10452, 10456, 10459, 10462, 10465, 10468, 10471, 10474, 10477, 10480, 10483, 10486, 10489, 10492, 10496, - 10499, 10502, 10505, 10508, 10511, 10514, 10517, 10520, 10523, 10526, 10529, 10532, 10535, 10538, 10542, 10545, - 10548, 10551, 10554, 10557, 10560, 10563, 10566, 10569, 10572, 10575, 10578, 10581, 10584, 10587, 10590, 10593, - 10597, 10600, 10603, 10606, 10609, 10612, 10615, 10618, 10621, 10624, 10627, 10630, 10633, 10636, 10639, 10642, - 10645, 10648, 10651, 10654, 10657, 10660, 10663, 10667, 10670, 10673, 10676, 10679, 10682, 10685, 10688, 10691, - 10694, 10697, 10700, 10703, 10706, 10709, 10712, 10715, 10718, 10721, 10724, 10727, 10730, 10733, 10736, 10739, - 10742, 10745, 10748, 10751, 10754, 10757, 10760, 10763, 10766, 10769, 10772, 10775, 10778, 10781, 10784, 10787, - 10790, 10793, 10796, 10799, 10802, 10806, 10809, 10812, 10815, 10818, 10821, 10824, 10827, 10830, 10833, 10836, - 10839, 10842, 10845, 10848, 10851, 10854, 10857, 10860, 10863, 10866, 10869, 10871, 10874, 10877, 10880, 10883, - 10886, 10889, 10892, 10895, 10898, 10901, 10904, 10907, 10910, 10913, 10916, 10919, 10922, 10925, 10928, 10931, - 10934, 10937, 10940, 10943, 10946, 10949, 10952, 10955, 10958, 10961, 10964, 10967, 10970, 10973, 10976, 10979, - 10982, 10985, 10988, 10991, 10994, 10997, 11000, 11003, 11005, 11008, 11011, 11014, 11017, 11020, 11023, 11026, - 11029, 11032, 11035, 11038, 11041, 11044, 11047, 11050, 11053, 11056, 11059, 11062, 11065, 11068, 11071, 11073, - 11076, 11079, 11082, 11085, 11088, 11091, 11094, 11097, 11100, 11103, 11106, 11109, 11112, 11115, 11118, 11121, - 11123, 11126, 11129, 11132, 11135, 11138, 11141, 11144, 11147, 11150, 11153, 11156, 11159, 11162, 11165, 11167, - 11170, 11173, 11176, 11179, 11182, 11185, 11188, 11191, 11194, 11197, 11200, 11203, 11205, 11208, 11211, 11214, - 11217, 11220, 11223, 11226, 11229, 11232, 11235, 11238, 11240, 11243, 11246, 11249, 11252, 11255, 11258, 11261, - 11264, 11267, 11269, 11272, 11275, 11278, 11281, 11284, 11287, 11290, 11293, 11296, 11298, 11301, 11304, 11307, - 11310, 11313, 11316, 11319, 11322, 11325, 11327, 11330, 11333, 11336, 11339, 11342, 11345, 11348, 11351, 11353, - 11356, 11359, 11362, 11365, 11368, 11371, 11374, 11376, 11379, 11382, 11385, 11388, 11391, 11394, 11397, 11399, - 11402, 11405, 11408, 11411, 11414, 11417, 11420, 11422, 11425, 11428, 11431, 11434, 11437, 11440, 11442, 11445, - 11448, 11451, 11454, 11457, 11460, 11463, 11465, 11468, 11471, 11474, 11477, 11480, 11482, 11485, 11488, 11491, - 11494, 11497, 11500, 11502, 11505, 11508, 11511, 11514, 11517, 11520, 11522, 11525, 11528, 11531, 11534, 11537, - 11539, 11542, 11545, 11548, 11551, 11554, 11556, 11559, 11562, 11565, 11568, 11571, 11573, 11576, 11579, 11582, - 11585, 11588, 11590, 11593, 11596, 11599, 11602, 11605, 11607, 11610, 11613, 11616, 11619, 11621, 11624, 11627, - 11630, 11633, 11636, 11638, 11641, 11644, 11647, 11650, 11652, 11655, 11658, 11661, 11664, 11666, 11669, 11672, - 11675, 11678, 11681, 11683, 11686, 11689, 11692, 11695, 11697, 11700, 11703, 11706, 11709, 11711, 11714, 11717, - 11720, 11723, 11725, 11728, 11731, 11734, 11736, 11739, 11742, 11745, 11748, 11750, 11753, 11756, 11759, 11762, - 11764, 11767, 11770, 11773, 11775, 11778, 11781, 11784, 11787, 11789, 11792, 11795, 11798, 11800, 11803, 11806, - 11809, 11812, 11814, 11817, 11820, 11823, 11825, 11828, 11831, 11834, 11837, 11839, 11842, 11845, 11848, 11850, - 11853, 11856, 11859, 11861, 11864, 11867, 11870, 11872, 11875, 11878, 11881, 11883, 11886, 11889, 11892, 11894, - 11897, 11900, 11903, 11905, 11908, 11911, 11914, 11916, 11919, 11922, 11925, 11927, 11930, 11933, 11936, 11938, - 11941, 11944, 11947, 11949, 11952, 11955, 11958, 11960, 11963, 11966, 11968, 11971, 11974, 11977, 11979, 11982, - 11985, 11988, 11990, 11993, 11996, 11998, 12001, 12004, 12007, 12009, 12012, 12015, 12017, 12020, 12023, 12026, - 12028, 12031, 12034, 12037, 12039, 12042, 12045, 12047, 12050, 12053, 12055, 12058, 12061, 12064, 12066, 12069, - 12072, 12074, 12077, 12080, 12083, 12085, 12088, 12091, 12093, 12096, 12099, 12101, 12104, 12107, 12110, 12112, - 12115, 12118, 12120, 12123, 12126, 12128, 12131, 12134, 12136, 12139, 12142, 12144, 12147, 12150, 12153, 12155, - 12158, 12161, 12163, 12166, 12169, 12171, 12174, 12177, 12179, 12182, 12185, 12187, 12190, 12193, 12195, 12198, - 12201, 12203, 12206, 12209, 12211, 12214, 12217, 12219, 12222, 12225, 12227, 12230, 12233, 12235, 12238, 12241, - 12243, 12246, 12249, 12251, 12254, 12257, 12259, 12262, 12265, 12267, 12270, 12273, 12275, 12278, 12280, 12283, - 12286, 12288, 12291, 12294, 12296, 12299, 12302, 12304, 12307, 12310, 12312, 12315, 12317, 12320, 12323, 12325, - 12328, 12331, 12333, 12336, 12339, 12341, 12344, 12346, 12349, 12352, 12354, 12357, 12360, 12362, 12365, 12367, - 12370, 12373, 12375, 12378, 12381, 12383, 12386, 12388, 12391, 12394, 12396, 12399, 12401, 12404, 12407, 12409, - 12412, 12415, 12417, 12420, 12422, 12425, 12428, 12430, 12433, 12435, 12438, 12441, 12443, 12446, 12448, 12451, - 12454, 12456, 12459, 12461, 12464, 12467, 12469, 12472, 12474, 12477, 12480, 12482, 12485, 12487, 12490, 12493, - 12495, 12498, 12500, 12503, 12505, 12508, 12511, 12513, 12516, 12518, 12521, 12524, 12526, 12529, 12531, 12534, - 12536, 12539, 12542, 12544, 12547, 12549, 12552, 12554, 12557, 12560, 12562, 12565, 12567, 12570, 12572, 12575, - 12577, 12580, 12583, 12585, 12588, 12590, 12593, 12595, 12598, 12601, 12603, 12606, 12608, 12611, 12613, 12616, - 12618, 12621, 12624, 12626, 12629, 12631, 12634, 12636, 12639, 12641, 12644, 12646, 12649, 12652, 12654, 12657, - 12659, 12662, 12664, 12667, 12669, 12672, 12674, 12677, 12679, 12682, 12684, 12687, 12690, 12692, 12695, 12697, - 12700, 12702, 12705, 12707, 12710, 12712, 12715, 12717, 12720, 12722, 12725, 12727, 12730, 12732, 12735, 12737, - 12740, 12743, 12745, 12748, 12750, 12753, 12755, 12758, 12760, 12763, 12765, 12768, 12770, 12773, 12775, 12778, - 12780, 12783, 12785, 12788, 12790, 12793, 12795, 12798, 12800, 12803, 12805, 12808, 12810, 12813, 12815, 12818, - 12820, 12823, 12825, 12828, 12830, 12833, 12835, 12838, 12840, 12842, 12845, 12847, 12850, 12852, 12855, 12857, - 12860, 12862, 12865, 12867, 12870, 12872, 12875, 12877, 12880, 12882, 12885, 12887, 12890, 12892, 12894, 12897, - 12899, 12902, 12904, 12907, 12909, 12912, 12914, 12917, 12919, 12922, 12924, 12926, 12929, 12931, 12934, 12936, - 12939, 12941, 12944, 12946, 12949, 12951, 12953, 12956, 12958, 12961, 12963, 12966, 12968, 12971, 12973, 12975, - 12978, 12980, 12983, 12985, 12988, 12990, 12993, 12995, 12997, 13000, 13002, 13005, 13007, 13010, 13012, 13014, - 13017, 13019, 13022, 13024, 13027, 13029, 13031, 13034, 13036, 13039, 13041, 13044, 13046, 13048, 13051, 13053, - 13056, 13058, 13060, 13063, 13065, 13068, 13070, 13073, 13075, 13077, 13080, 13082, 13085, 13087, 13089, 13092, - 13094, 13097, 13099, 13101, 13104, 13106, 13109, 13111, 13113, 13116, 13118, 13121, 13123, 13125, 13128, 13130, - 13133, 13135, 13137, 13140, 13142, 13145, 13147, 13149, 13152, 13154, 13156, 13159, 13161, 13164, 13166, 13168, - 13171, 13173, 13175, 13178, 13180, 13183, 13185, 13187, 13190, 13192, 13194, 13197, 13199, 13202, 13204, 13206, - 13209, 13211, 13213, 13216, 13218, 13221, 13223, 13225, 13228, 13230, 13232, 13235, 13237, 13239, 13242, 13244, - 13246, 13249, 13251, 13254, 13256, 13258, 13261, 13263, 13265, 13268, 13270, 13272, 13275, 13277, 13279, 13282, - 13284, 13286, 13289, 13291, 13293, 13296, 13298, 13300, 13303, 13305, 13307, 13310, 13312, 13314, 13317, 13319, - 13321, 13324, 13326, 13328, 13331, 13333, 13335, 13338, 13340, 13342, 13345, 13347, 13349, 13352, 13354, 13356, - 13359, 13361, 13363, 13365, 13368, 13370, 13372, 13375, 13377, 13379, 13382, 13384, 13386, 13389, 13391, 13393, - 13395, 13398, 13400, 13402, 13405, 13407, 13409, 13412, 13414, 13416, 13418, 13421, 13423, 13425, 13428, 13430, - 13432, 13435, 13437, 13439, 13441, 13444, 13446, 13448, 13451, 13453, 13455, 13457, 13460, 13462, 13464, 13466, - 13469, 13471, 13473, 13476, 13478, 13480, 13482, 13485, 13487, 13489, 13492, 13494, 13496, 13498, 13501, 13503, - 13505, 13507, 13510, 13512, 13514, 13516, 13519, 13521, 13523, 13525, 13528, 13530, 13532, 13534, 13537, 13539, - 13541, 13543, 13546, 13548, 13550, 13552, 13555, 13557, 13559, 13561, 13564, 13566, 13568, 13570, 13573, 13575, - 13577, 13579, 13582, 13584, 13586, 13588, 13591, 13593, 13595, 13597, 13600, 13602, 13604, 13606, 13608, 13611, - 13613, 13615, 13617, 13620, 13622, 13624, 13626, 13628, 13631, 13633, 13635, 13637, 13640, 13642, 13644, 13646, - 13648, 13651, 13653, 13655, 13657, 13659, 13662, 13664, 13666, 13668, 13670, 13673, 13675, 13677, 13679, 13681, - 13684, 13686, 13688, 13690, 13692, 13695, 13697, 13699, 13701, 13703, 13706, 13708, 13710, 13712, 13714, 13717, - 13719, 13721, 13723, 13725, 13728, 13730, 13732, 13734, 13736, 13738, 13741, 13743, 13745, 13747, 13749, 13751, - 13754, 13756, 13758, 13760, 13762, 13765, 13767, 13769, 13771, 13773, 13775, 13778, 13780, 13782, 13784, 13786, - 13788, 13790, 13793, 13795, 13797, 13799, 13801, 13803, 13806, 13808, 13810, 13812, 13814, 13816, 13818, 13821, - 13823, 13825, 13827, 13829, 13831, 13834, 13836, 13838, 13840, 13842, 13844, 13846, 13848, 13851, 13853, 13855, - 13857, 13859, 13861, 13863, 13866, 13868, 13870, 13872, 13874, 13876, 13878, 13880, 13883, 13885, 13887, 13889, - 13891, 13893, 13895, 13897, 13900, 13902, 13904, 13906, 13908, 13910, 13912, 13914, 13916, 13919, 13921, 13923, - 13925, 13927, 13929, 13931, 13933, 13935, 13938, 13940, 13942, 13944, 13946, 13948, 13950, 13952, 13954, 13956, - 13959, 13961, 13963, 13965, 13967, 13969, 13971, 13973, 13975, 13977, 13979, 13981, 13984, 13986, 13988, 13990, - 13992, 13994, 13996, 13998, 14000, 14002, 14004, 14006, 14009, 14011, 14013, 14015, 14017, 14019, 14021, 14023, - 14025, 14027, 14029, 14031, 14033, 14035, 14037, 14040, 14042, 14044, 14046, 14048, 14050, 14052, 14054, 14056, - 14058, 14060, 14062, 14064, 14066, 14068, 14070, 14072, 14074, 14077, 14079, 14081, 14083, 14085, 14087, 14089, - 14091, 14093, 14095, 14097, 14099, 14101, 14103, 14105, 14107, 14109, 14111, 14113, 14115, 14117, 14119, 14121, - 14123, 14125, 14127, 14129, 14131, 14134, 14136, 14138, 14140, 14142, 14144, 14146, 14148, 14150, 14152, 14154, - 14156, 14158, 14160, 14162, 14164, 14166, 14168, 14170, 14172, 14174, 14176, 14178, 14180, 14182, 14184, 14186, - 14188, 14190, 14192, 14194, 14196, 14198, 14200, 14202, 14204, 14206, 14208, 14210, 14212, 14214, 14216, 14218, - 14220, 14222, 14224, 14226, 14228, 14230, 14232, 14234, 14236, 14238, 14240, 14242, 14243, 14245, 14247, 14249, - 14251, 14253, 14255, 14257, 14259, 14261, 14263, 14265, 14267, 14269, 14271, 14273, 14275, 14277, 14279, 14281, - 14283, 14285, 14287, 14289, 14291, 14293, 14295, 14297, 14299, 14300, 14302, 14304, 14306, 14308, 14310, 14312, - 14314, 14316, 14318, 14320, 14322, 14324, 14326, 14328, 14330, 14332, 14334, 14335, 14337, 14339, 14341, 14343, - 14345, 14347, 14349, 14351, 14353, 14355, 14357, 14359, 14361, 14362, 14364, 14366, 14368, 14370, 14372, 14374, - 14376, 14378, 14380, 14382, 14384, 14386, 14387, 14389, 14391, 14393, 14395, 14397, 14399, 14401, 14403, 14405, - 14407, 14408, 14410, 14412, 14414, 14416, 14418, 14420, 14422, 14424, 14426, 14427, 14429, 14431, 14433, 14435, - 14437, 14439, 14441, 14443, 14444, 14446, 14448, 14450, 14452, 14454, 14456, 14458, 14460, 14461, 14463, 14465, - 14467, 14469, 14471, 14473, 14475, 14476, 14478, 14480, 14482, 14484, 14486, 14488, 14489, 14491, 14493, 14495, - 14497, 14499, 14501, 14503, 14504, 14506, 14508, 14510, 14512, 14514, 14516, 14517, 14519, 14521, 14523, 14525, - 14527, 14529, 14530, 14532, 14534, 14536, 14538, 14540, 14541, 14543, 14545, 14547, 14549, 14551, 14552, 14554, - 14556, 14558, 14560, 14562, 14563, 14565, 14567, 14569, 14571, 14573, 14574, 14576, 14578, 14580, 14582, 14584, - 14585, 14587, 14589, 14591, 14593, 14595, 14596, 14598, 14600, 14602, 14604, 14605, 14607, 14609, 14611, 14613, - 14614, 14616, 14618, 14620, 14622, 14623, 14625, 14627, 14629, 14631, 14632, 14634, 14636, 14638, 14640, 14641, - 14643, 14645, 14647, 14649, 14650, 14652, 14654, 14656, 14658, 14659, 14661, 14663, 14665, 14667, 14668, 14670, - 14672, 14674, 14675, 14677, 14679, 14681, 14683, 14684, 14686, 14688, 14690, 14691, 14693, 14695, 14697, 14698, - 14700, 14702, 14704, 14706, 14707, 14709, 14711, 14713, 14714, 14716, 14718, 14720, 14721, 14723, 14725, 14727, - 14728, 14730, 14732, 14734, 14735, 14737, 14739, 14741, 14742, 14744, 14746, 14748, 14749, 14751, 14753, 14755, - 14756, 14758, 14760, 14761, 14763, 14765, 14767, 14768, 14770, 14772, 14774, 14775, 14777, 14779, 14781, 14782, - 14784, 14786, 14787, 14789, 14791, 14793, 14794, 14796, 14798, 14799, 14801, 14803, 14805, 14806, 14808, 14810, - 14811, 14813, 14815, 14817, 14818, 14820, 14822, 14823, 14825, 14827, 14828, 14830, 14832, 14834, 14835, 14837, - 14839, 14840, 14842, 14844, 14845, 14847, 14849, 14851, 14852, 14854, 14856, 14857, 14859, 14861, 14862, 14864, - 14866, 14867, 14869, 14871, 14872, 14874, 14876, 14877, 14879, 14881, 14882, 14884, 14886, 14887, 14889, 14891, - 14892, 14894, 14896, 14897, 14899, 14901, 14902, 14904, 14906, 14907, 14909, 14911, 14912, 14914, 14916, 14917, - 14919, 14921, 14922, 14924, 14926, 14927, 14929, 14931, 14932, 14934, 14936, 14937, 14939, 14940, 14942, 14944, - 14945, 14947, 14949, 14950, 14952, 14954, 14955, 14957, 14958, 14960, 14962, 14963, 14965, 14967, 14968, 14970, - 14971, 14973, 14975, 14976, 14978, 14980, 14981, 14983, 14984, 14986, 14988, 14989, 14991, 14993, 14994, 14996, - 14997, 14999, 15001, 15002, 15004, 15005, 15007, 15009, 15010, 15012, 15013, 15015, 15017, 15018, 15020, 15021, - 15023, 15025, 15026, 15028, 15029, 15031, 15033, 15034, 15036, 15037, 15039, 15041, 15042, 15044, 15045, 15047, - 15048, 15050, 15052, 15053, 15055, 15056, 15058, 15059, 15061, 15063, 15064, 15066, 15067, 15069, 15070, 15072, - 15074, 15075, 15077, 15078, 15080, 15081, 15083, 15085, 15086, 15088, 15089, 15091, 15092, 15094, 15095, 15097, - 15099, 15100, 15102, 15103, 15105, 15106, 15108, 15109, 15111, 15113, 15114, 15116, 15117, 15119, 15120, 15122, - 15123, 15125, 15126, 15128, 15129, 15131, 15133, 15134, 15136, 15137, 15139, 15140, 15142, 15143, 15145, 15146, - 15148, 15149, 15151, 15152, 15154, 15155, 15157, 15158, 15160, 15161, 15163, 15165, 15166, 15168, 15169, 15171, - 15172, 15174, 15175, 15177, 15178, 15180, 15181, 15183, 15184, 15186, 15187, 15189, 15190, 15192, 15193, 15195, - 15196, 15198, 15199, 15201, 15202, 15204, 15205, 15207, 15208, 15210, 15211, 15213, 15214, 15215, 15217, 15218, - 15220, 15221, 15223, 15224, 15226, 15227, 15229, 15230, 15232, 15233, 15235, 15236, 15238, 15239, 15241, 15242, - 15243, 15245, 15246, 15248, 15249, 15251, 15252, 15254, 15255, 15257, 15258, 15260, 15261, 15262, 15264, 15265, - 15267, 15268, 15270, 15271, 15273, 15274, 15276, 15277, 15278, 15280, 15281, 15283, 15284, 15286, 15287, 15289, - 15290, 15291, 15293, 15294, 15296, 15297, 15299, 15300, 15301, 15303, 15304, 15306, 15307, 15309, 15310, 15311, - 15313, 15314, 15316, 15317, 15318, 15320, 15321, 15323, 15324, 15326, 15327, 15328, 15330, 15331, 15333, 15334, - 15335, 15337, 15338, 15340, 15341, 15342, 15344, 15345, 15347, 15348, 15349, 15351, 15352, 15354, 15355, 15356, - 15358, 15359, 15361, 15362, 15363, 15365, 15366, 15368, 15369, 15370, 15372, 15373, 15375, 15376, 15377, 15379, - 15380, 15381, 15383, 15384, 15386, 15387, 15388, 15390, 15391, 15392, 15394, 15395, 15397, 15398, 15399, 15401, - 15402, 15403, 15405, 15406, 15407, 15409, 15410, 15411, 15413, 15414, 15416, 15417, 15418, 15420, 15421, 15422, - 15424, 15425, 15426, 15428, 15429, 15430, 15432, 15433, 15434, 15436, 15437, 15438, 15440, 15441, 15442, 15444, - 15445, 15446, 15448, 15449, 15450, 15452, 15453, 15454, 15456, 15457, 15458, 15460, 15461, 15462, 15464, 15465, - 15466, 15468, 15469, 15470, 15472, 15473, 15474, 15476, 15477, 15478, 15480, 15481, 15482, 15483, 15485, 15486, - 15487, 15489, 15490, 15491, 15493, 15494, 15495, 15496, 15498, 15499, 15500, 15502, 15503, 15504, 15506, 15507, - 15508, 15509, 15511, 15512, 15513, 15515, 15516, 15517, 15518, 15520, 15521, 15522, 15524, 15525, 15526, 15527, - 15529, 15530, 15531, 15532, 15534, 15535, 15536, 15538, 15539, 15540, 15541, 15543, 15544, 15545, 15546, 15548, - 15549, 15550, 15551, 15553, 15554, 15555, 15556, 15558, 15559, 15560, 15561, 15563, 15564, 15565, 15566, 15568, - 15569, 15570, 15571, 15573, 15574, 15575, 15576, 15578, 15579, 15580, 15581, 15583, 15584, 15585, 15586, 15588, - 15589, 15590, 15591, 15592, 15594, 15595, 15596, 15597, 15599, 15600, 15601, 15602, 15603, 15605, 15606, 15607, - 15608, 15610, 15611, 15612, 15613, 15614, 15616, 15617, 15618, 15619, 15620, 15622, 15623, 15624, 15625, 15626, - 15628, 15629, 15630, 15631, 15632, 15634, 15635, 15636, 15637, 15638, 15640, 15641, 15642, 15643, 15644, 15646, - 15647, 15648, 15649, 15650, 15652, 15653, 15654, 15655, 15656, 15657, 15659, 15660, 15661, 15662, 15663, 15664, - 15666, 15667, 15668, 15669, 15670, 15671, 15673, 15674, 15675, 15676, 15677, 15678, 15680, 15681, 15682, 15683, - 15684, 15685, 15687, 15688, 15689, 15690, 15691, 15692, 15693, 15695, 15696, 15697, 15698, 15699, 15700, 15701, - 15703, 15704, 15705, 15706, 15707, 15708, 15709, 15711, 15712, 15713, 15714, 15715, 15716, 15717, 15719, 15720, - 15721, 15722, 15723, 15724, 15725, 15726, 15728, 15729, 15730, 15731, 15732, 15733, 15734, 15735, 15736, 15738, - 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15748, 15749, 15750, 15751, 15752, 15753, 15754, 15755, - 15756, 15757, 15759, 15760, 15761, 15762, 15763, 15764, 15765, 15766, 15767, 15768, 15769, 15770, 15772, 15773, - 15774, 15775, 15776, 15777, 15778, 15779, 15780, 15781, 15782, 15783, 15785, 15786, 15787, 15788, 15789, 15790, - 15791, 15792, 15793, 15794, 15795, 15796, 15797, 15798, 15799, 15800, 15802, 15803, 15804, 15805, 15806, 15807, - 15808, 15809, 15810, 15811, 15812, 15813, 15814, 15815, 15816, 15817, 15818, 15819, 15820, 15821, 15822, 15824, - 15825, 15826, 15827, 15828, 15829, 15830, 15831, 15832, 15833, 15834, 15835, 15836, 15837, 15838, 15839, 15840, - 15841, 15842, 15843, 15844, 15845, 15846, 15847, 15848, 15849, 15850, 15851, 15852, 15853, 15854, 15855, 15856, - 15857, 15858, 15859, 15860, 15861, 15862, 15863, 15864, 15865, 15866, 15867, 15868, 15869, 15870, 15871, 15872, - 15873, 15874, 15875, 15876, 15877, 15878, 15879, 15880, 15881, 15882, 15883, 15884, 15885, 15886, 15887, 15888, - 15889, 15890, 15891, 15892, 15893, 15894, 15895, 15896, 15897, 15898, 15899, 15900, 15901, 15902, 15902, 15903, - 15904, 15905, 15906, 15907, 15908, 15909, 15910, 15911, 15912, 15913, 15914, 15915, 15916, 15917, 15918, 15919, - 15920, 15921, 15922, 15922, 15923, 15924, 15925, 15926, 15927, 15928, 15929, 15930, 15931, 15932, 15933, 15934, - 15935, 15936, 15937, 15937, 15938, 15939, 15940, 15941, 15942, 15943, 15944, 15945, 15946, 15947, 15948, 15948, - 15949, 15950, 15951, 15952, 15953, 15954, 15955, 15956, 15957, 15958, 15958, 15959, 15960, 15961, 15962, 15963, - 15964, 15965, 15966, 15967, 15968, 15968, 15969, 15970, 15971, 15972, 15973, 15974, 15975, 15976, 15976, 15977, - 15978, 15979, 15980, 15981, 15982, 15983, 15983, 15984, 15985, 15986, 15987, 15988, 15989, 15990, 15990, 15991, - 15992, 15993, 15994, 15995, 15996, 15997, 15997, 15998, 15999, 16000, 16001, 16002, 16003, 16003, 16004, 16005, - 16006, 16007, 16008, 16009, 16009, 16010, 16011, 16012, 16013, 16014, 16014, 16015, 16016, 16017, 16018, 16019, - 16020, 16020, 16021, 16022, 16023, 16024, 16025, 16025, 16026, 16027, 16028, 16029, 16030, 16030, 16031, 16032, - 16033, 16034, 16034, 16035, 16036, 16037, 16038, 16039, 16039, 16040, 16041, 16042, 16043, 16043, 16044, 16045, - 16046, 16047, 16047, 16048, 16049, 16050, 16051, 16051, 16052, 16053, 16054, 16055, 16055, 16056, 16057, 16058, - 16059, 16059, 16060, 16061, 16062, 16063, 16063, 16064, 16065, 16066, 16067, 16067, 16068, 16069, 16070, 16070, - 16071, 16072, 16073, 16074, 16074, 16075, 16076, 16077, 16077, 16078, 16079, 16080, 16080, 16081, 16082, 16083, - 16084, 16084, 16085, 16086, 16087, 16087, 16088, 16089, 16090, 16090, 16091, 16092, 16093, 16093, 16094, 16095, - 16096, 16096, 16097, 16098, 16099, 16099, 16100, 16101, 16102, 16102, 16103, 16104, 16104, 16105, 16106, 16107, - 16107, 16108, 16109, 16110, 16110, 16111, 16112, 16113, 16113, 16114, 16115, 16115, 16116, 16117, 16118, 16118, - 16119, 16120, 16120, 16121, 16122, 16123, 16123, 16124, 16125, 16125, 16126, 16127, 16128, 16128, 16129, 16130, - 16130, 16131, 16132, 16132, 16133, 16134, 16135, 16135, 16136, 16137, 16137, 16138, 16139, 16139, 16140, 16141, - 16141, 16142, 16143, 16143, 16144, 16145, 16146, 16146, 16147, 16148, 16148, 16149, 16150, 16150, 16151, 16152, - 16152, 16153, 16154, 16154, 16155, 16156, 16156, 16157, 16158, 16158, 16159, 16160, 16160, 16161, 16162, 16162, - 16163, 16164, 16164, 16165, 16165, 16166, 16167, 16167, 16168, 16169, 16169, 16170, 16171, 16171, 16172, 16173, - 16173, 16174, 16174, 16175, 16176, 16176, 16177, 16178, 16178, 16179, 16180, 16180, 16181, 16181, 16182, 16183, - 16183, 16184, 16185, 16185, 16186, 16186, 16187, 16188, 16188, 16189, 16189, 16190, 16191, 16191, 16192, 16193, - 16193, 16194, 16194, 16195, 16196, 16196, 16197, 16197, 16198, 16199, 16199, 16200, 16200, 16201, 16202, 16202, - 16203, 16203, 16204, 16205, 16205, 16206, 16206, 16207, 16207, 16208, 16209, 16209, 16210, 16210, 16211, 16212, - 16212, 16213, 16213, 16214, 16214, 16215, 16216, 16216, 16217, 16217, 16218, 16218, 16219, 16220, 16220, 16221, - 16221, 16222, 16222, 16223, 16223, 16224, 16225, 16225, 16226, 16226, 16227, 16227, 16228, 16228, 16229, 16230, - 16230, 16231, 16231, 16232, 16232, 16233, 16233, 16234, 16234, 16235, 16235, 16236, 16237, 16237, 16238, 16238, - 16239, 16239, 16240, 16240, 16241, 16241, 16242, 16242, 16243, 16243, 16244, 16244, 16245, 16246, 16246, 16247, - 16247, 16248, 16248, 16249, 16249, 16250, 16250, 16251, 16251, 16252, 16252, 16253, 16253, 16254, 16254, 16255, - 16255, 16256, 16256, 16257, 16257, 16258, 16258, 16259, 16259, 16260, 16260, 16261, 16261, 16262, 16262, 16263, - 16263, 16264, 16264, 16264, 16265, 16265, 16266, 16266, 16267, 16267, 16268, 16268, 16269, 16269, 16270, 16270, - 16271, 16271, 16272, 16272, 16273, 16273, 16273, 16274, 16274, 16275, 16275, 16276, 16276, 16277, 16277, 16278, - 16278, 16278, 16279, 16279, 16280, 16280, 16281, 16281, 16282, 16282, 16283, 16283, 16283, 16284, 16284, 16285, - 16285, 16286, 16286, 16286, 16287, 16287, 16288, 16288, 16289, 16289, 16289, 16290, 16290, 16291, 16291, 16292, - 16292, 16292, 16293, 16293, 16294, 16294, 16295, 16295, 16295, 16296, 16296, 16297, 16297, 16297, 16298, 16298, - 16299, 16299, 16299, 16300, 16300, 16301, 16301, 16301, 16302, 16302, 16303, 16303, 16303, 16304, 16304, 16305, - 16305, 16305, 16306, 16306, 16307, 16307, 16307, 16308, 16308, 16309, 16309, 16309, 16310, 16310, 16310, 16311, - 16311, 16312, 16312, 16312, 16313, 16313, 16313, 16314, 16314, 16315, 16315, 16315, 16316, 16316, 16316, 16317, - 16317, 16317, 16318, 16318, 16318, 16319, 16319, 16320, 16320, 16320, 16321, 16321, 16321, 16322, 16322, 16322, - 16323, 16323, 16323, 16324, 16324, 16324, 16325, 16325, 16325, 16326, 16326, 16326, 16327, 16327, 16327, 16328, - 16328, 16328, 16329, 16329, 16329, 16330, 16330, 16330, 16331, 16331, 16331, 16332, 16332, 16332, 16333, 16333, - 16333, 16334, 16334, 16334, 16334, 16335, 16335, 16335, 16336, 16336, 16336, 16337, 16337, 16337, 16338, 16338, - 16338, 16338, 16339, 16339, 16339, 16340, 16340, 16340, 16340, 16341, 16341, 16341, 16342, 16342, 16342, 16342, - 16343, 16343, 16343, 16344, 16344, 16344, 16344, 16345, 16345, 16345, 16346, 16346, 16346, 16346, 16347, 16347, - 16347, 16347, 16348, 16348, 16348, 16348, 16349, 16349, 16349, 16349, 16350, 16350, 16350, 16351, 16351, 16351, - 16351, 16352, 16352, 16352, 16352, 16353, 16353, 16353, 16353, 16353, 16354, 16354, 16354, 16354, 16355, 16355, - 16355, 16355, 16356, 16356, 16356, 16356, 16357, 16357, 16357, 16357, 16357, 16358, 16358, 16358, 16358, 16359, - 16359, 16359, 16359, 16359, 16360, 16360, 16360, 16360, 16361, 16361, 16361, 16361, 16361, 16362, 16362, 16362, - 16362, 16362, 16363, 16363, 16363, 16363, 16363, 16364, 16364, 16364, 16364, 16364, 16365, 16365, 16365, 16365, - 16365, 16366, 16366, 16366, 16366, 16366, 16366, 16367, 16367, 16367, 16367, 16367, 16368, 16368, 16368, 16368, - 16368, 16368, 16369, 16369, 16369, 16369, 16369, 16369, 16370, 16370, 16370, 16370, 16370, 16370, 16371, 16371, - 16371, 16371, 16371, 16371, 16371, 16372, 16372, 16372, 16372, 16372, 16372, 16373, 16373, 16373, 16373, 16373, - 16373, 16373, 16374, 16374, 16374, 16374, 16374, 16374, 16374, 16374, 16375, 16375, 16375, 16375, 16375, 16375, - 16375, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16377, 16377, 16377, 16377, 16377, 16377, - 16377, 16377, 16377, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16379, 16379, 16379, 16379, - 16379, 16379, 16379, 16379, 16379, 16379, 16379, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, - 16380, 16380, 16380, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, - 16381, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, - 16382, 16382, 16382, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, - 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, - 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, +PPRZ_TRIG_CONST int16_t pprz_trig_int[6434] = { 0, + 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, + 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, + 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, 191, + 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255, + 259, 263, 267, 271, 275, 279, 283, 287, 291, 295, 299, 303, 307, 311, 315, 319, + 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 375, 379, 383, + 387, 391, 395, 399, 403, 407, 411, 415, 419, 423, 427, 431, 435, 439, 443, 447, + 451, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, 507, 511, + 515, 519, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, 563, 567, 571, 575, + 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 635, 639, + 643, 647, 651, 655, 659, 663, 667, 671, 675, 679, 683, 687, 691, 695, 699, 703, + 707, 711, 715, 719, 723, 727, 731, 735, 739, 743, 747, 751, 755, 759, 763, 767, + 771, 775, 779, 783, 787, 791, 795, 799, 803, 807, 811, 815, 819, 823, 827, 831, + 835, 839, 843, 847, 851, 855, 859, 863, 867, 871, 875, 879, 883, 887, 891, 895, + 899, 903, 907, 911, 915, 919, 923, 927, 931, 935, 939, 943, 947, 951, 955, 959, + 963, 967, 971, 975, 979, 983, 987, 991, 995, 999, 1003, 1007, 1011, 1015, 1019, 1023, + 1027, 1031, 1035, 1039, 1043, 1047, 1051, 1055, 1059, 1063, 1067, 1071, 1075, 1079, 1083, 1087, + 1091, 1095, 1099, 1103, 1107, 1111, 1115, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1147, 1151, + 1155, 1159, 1163, 1167, 1171, 1174, 1178, 1182, 1186, 1190, 1194, 1198, 1202, 1206, 1210, 1214, + 1218, 1222, 1226, 1230, 1234, 1238, 1242, 1246, 1250, 1254, 1258, 1262, 1266, 1270, 1274, 1278, + 1282, 1286, 1290, 1294, 1298, 1302, 1306, 1310, 1314, 1318, 1322, 1326, 1330, 1334, 1338, 1342, + 1346, 1350, 1354, 1358, 1362, 1366, 1370, 1374, 1378, 1382, 1386, 1390, 1394, 1398, 1402, 1406, + 1410, 1414, 1418, 1422, 1426, 1430, 1434, 1438, 1442, 1446, 1450, 1454, 1458, 1462, 1466, 1470, + 1474, 1477, 1481, 1485, 1489, 1493, 1497, 1501, 1505, 1509, 1513, 1517, 1521, 1525, 1529, 1533, + 1537, 1541, 1545, 1549, 1553, 1557, 1561, 1565, 1569, 1573, 1577, 1581, 1585, 1589, 1593, 1597, + 1601, 1605, 1609, 1613, 1617, 1621, 1625, 1629, 1633, 1637, 1641, 1645, 1649, 1653, 1657, 1661, + 1665, 1669, 1673, 1677, 1681, 1685, 1688, 1692, 1696, 1700, 1704, 1708, 1712, 1716, 1720, 1724, + 1728, 1732, 1736, 1740, 1744, 1748, 1752, 1756, 1760, 1764, 1768, 1772, 1776, 1780, 1784, 1788, + 1792, 1796, 1800, 1804, 1808, 1812, 1816, 1820, 1824, 1828, 1832, 1836, 1840, 1844, 1848, 1852, + 1856, 1859, 1863, 1867, 1871, 1875, 1879, 1883, 1887, 1891, 1895, 1899, 1903, 1907, 1911, 1915, + 1919, 1923, 1927, 1931, 1935, 1939, 1943, 1947, 1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, + 1983, 1987, 1991, 1995, 1999, 2002, 2006, 2010, 2014, 2018, 2022, 2026, 2030, 2034, 2038, 2042, + 2046, 2050, 2054, 2058, 2062, 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, 2098, 2102, 2106, + 2110, 2114, 2118, 2122, 2125, 2129, 2133, 2137, 2141, 2145, 2149, 2153, 2157, 2161, 2165, 2169, + 2173, 2177, 2181, 2185, 2189, 2193, 2197, 2201, 2205, 2209, 2213, 2217, 2221, 2225, 2229, 2233, + 2236, 2240, 2244, 2248, 2252, 2256, 2260, 2264, 2268, 2272, 2276, 2280, 2284, 2288, 2292, 2296, + 2300, 2304, 2308, 2312, 2316, 2320, 2324, 2328, 2332, 2336, 2339, 2343, 2347, 2351, 2355, 2359, + 2363, 2367, 2371, 2375, 2379, 2383, 2387, 2391, 2395, 2399, 2403, 2407, 2411, 2415, 2419, 2423, + 2427, 2430, 2434, 2438, 2442, 2446, 2450, 2454, 2458, 2462, 2466, 2470, 2474, 2478, 2482, 2486, + 2490, 2494, 2498, 2502, 2506, 2510, 2514, 2517, 2521, 2525, 2529, 2533, 2537, 2541, 2545, 2549, + 2553, 2557, 2561, 2565, 2569, 2573, 2577, 2581, 2585, 2589, 2593, 2597, 2600, 2604, 2608, 2612, + 2616, 2620, 2624, 2628, 2632, 2636, 2640, 2644, 2648, 2652, 2656, 2660, 2664, 2668, 2672, 2675, + 2679, 2683, 2687, 2691, 2695, 2699, 2703, 2707, 2711, 2715, 2719, 2723, 2727, 2731, 2735, 2739, + 2743, 2746, 2750, 2754, 2758, 2762, 2766, 2770, 2774, 2778, 2782, 2786, 2790, 2794, 2798, 2802, + 2806, 2810, 2813, 2817, 2821, 2825, 2829, 2833, 2837, 2841, 2845, 2849, 2853, 2857, 2861, 2865, + 2869, 2873, 2877, 2880, 2884, 2888, 2892, 2896, 2900, 2904, 2908, 2912, 2916, 2920, 2924, 2928, + 2932, 2936, 2939, 2943, 2947, 2951, 2955, 2959, 2963, 2967, 2971, 2975, 2979, 2983, 2987, 2991, + 2995, 2998, 3002, 3006, 3010, 3014, 3018, 3022, 3026, 3030, 3034, 3038, 3042, 3046, 3050, 3054, + 3057, 3061, 3065, 3069, 3073, 3077, 3081, 3085, 3089, 3093, 3097, 3101, 3105, 3109, 3112, 3116, + 3120, 3124, 3128, 3132, 3136, 3140, 3144, 3148, 3152, 3156, 3160, 3163, 3167, 3171, 3175, 3179, + 3183, 3187, 3191, 3195, 3199, 3203, 3207, 3211, 3215, 3218, 3222, 3226, 3230, 3234, 3238, 3242, + 3246, 3250, 3254, 3258, 3262, 3265, 3269, 3273, 3277, 3281, 3285, 3289, 3293, 3297, 3301, 3305, + 3309, 3312, 3316, 3320, 3324, 3328, 3332, 3336, 3340, 3344, 3348, 3352, 3356, 3359, 3363, 3367, + 3371, 3375, 3379, 3383, 3387, 3391, 3395, 3399, 3403, 3406, 3410, 3414, 3418, 3422, 3426, 3430, + 3434, 3438, 3442, 3446, 3449, 3453, 3457, 3461, 3465, 3469, 3473, 3477, 3481, 3485, 3489, 3492, + 3496, 3500, 3504, 3508, 3512, 3516, 3520, 3524, 3528, 3532, 3535, 3539, 3543, 3547, 3551, 3555, + 3559, 3563, 3567, 3571, 3575, 3578, 3582, 3586, 3590, 3594, 3598, 3602, 3606, 3610, 3614, 3617, + 3621, 3625, 3629, 3633, 3637, 3641, 3645, 3649, 3653, 3656, 3660, 3664, 3668, 3672, 3676, 3680, + 3684, 3688, 3692, 3695, 3699, 3703, 3707, 3711, 3715, 3719, 3723, 3727, 3730, 3734, 3738, 3742, + 3746, 3750, 3754, 3758, 3762, 3766, 3769, 3773, 3777, 3781, 3785, 3789, 3793, 3797, 3801, 3804, + 3808, 3812, 3816, 3820, 3824, 3828, 3832, 3836, 3839, 3843, 3847, 3851, 3855, 3859, 3863, 3867, + 3871, 3874, 3878, 3882, 3886, 3890, 3894, 3898, 3902, 3906, 3909, 3913, 3917, 3921, 3925, 3929, + 3933, 3937, 3940, 3944, 3948, 3952, 3956, 3960, 3964, 3968, 3972, 3975, 3979, 3983, 3987, 3991, + 3995, 3999, 4003, 4006, 4010, 4014, 4018, 4022, 4026, 4030, 4034, 4037, 4041, 4045, 4049, 4053, + 4057, 4061, 4065, 4068, 4072, 4076, 4080, 4084, 4088, 4092, 4096, 4099, 4103, 4107, 4111, 4115, + 4119, 4123, 4127, 4130, 4134, 4138, 4142, 4146, 4150, 4154, 4158, 4161, 4165, 4169, 4173, 4177, + 4181, 4185, 4188, 4192, 4196, 4200, 4204, 4208, 4212, 4216, 4219, 4223, 4227, 4231, 4235, 4239, + 4243, 4246, 4250, 4254, 4258, 4262, 4266, 4270, 4273, 4277, 4281, 4285, 4289, 4293, 4297, 4301, + 4304, 4308, 4312, 4316, 4320, 4324, 4328, 4331, 4335, 4339, 4343, 4347, 4351, 4355, 4358, 4362, + 4366, 4370, 4374, 4378, 4382, 4385, 4389, 4393, 4397, 4401, 4405, 4408, 4412, 4416, 4420, 4424, + 4428, 4432, 4435, 4439, 4443, 4447, 4451, 4455, 4459, 4462, 4466, 4470, 4474, 4478, 4482, 4485, + 4489, 4493, 4497, 4501, 4505, 4509, 4512, 4516, 4520, 4524, 4528, 4532, 4535, 4539, 4543, 4547, + 4551, 4555, 4559, 4562, 4566, 4570, 4574, 4578, 4582, 4585, 4589, 4593, 4597, 4601, 4605, 4608, + 4612, 4616, 4620, 4624, 4628, 4631, 4635, 4639, 4643, 4647, 4651, 4654, 4658, 4662, 4666, 4670, + 4674, 4677, 4681, 4685, 4689, 4693, 4697, 4700, 4704, 4708, 4712, 4716, 4720, 4723, 4727, 4731, + 4735, 4739, 4743, 4746, 4750, 4754, 4758, 4762, 4766, 4769, 4773, 4777, 4781, 4785, 4789, 4792, + 4796, 4800, 4804, 4808, 4811, 4815, 4819, 4823, 4827, 4831, 4834, 4838, 4842, 4846, 4850, 4854, + 4857, 4861, 4865, 4869, 4873, 4876, 4880, 4884, 4888, 4892, 4896, 4899, 4903, 4907, 4911, 4915, + 4918, 4922, 4926, 4930, 4934, 4938, 4941, 4945, 4949, 4953, 4957, 4960, 4964, 4968, 4972, 4976, + 4979, 4983, 4987, 4991, 4995, 4998, 5002, 5006, 5010, 5014, 5018, 5021, 5025, 5029, 5033, 5037, + 5040, 5044, 5048, 5052, 5056, 5059, 5063, 5067, 5071, 5075, 5078, 5082, 5086, 5090, 5094, 5097, + 5101, 5105, 5109, 5113, 5116, 5120, 5124, 5128, 5132, 5135, 5139, 5143, 5147, 5151, 5154, 5158, + 5162, 5166, 5170, 5173, 5177, 5181, 5185, 5189, 5192, 5196, 5200, 5204, 5208, 5211, 5215, 5219, + 5223, 5227, 5230, 5234, 5238, 5242, 5245, 5249, 5253, 5257, 5261, 5264, 5268, 5272, 5276, 5280, + 5283, 5287, 5291, 5295, 5298, 5302, 5306, 5310, 5314, 5317, 5321, 5325, 5329, 5333, 5336, 5340, + 5344, 5348, 5351, 5355, 5359, 5363, 5367, 5370, 5374, 5378, 5382, 5385, 5389, 5393, 5397, 5401, + 5404, 5408, 5412, 5416, 5419, 5423, 5427, 5431, 5435, 5438, 5442, 5446, 5450, 5453, 5457, 5461, + 5465, 5468, 5472, 5476, 5480, 5484, 5487, 5491, 5495, 5499, 5502, 5506, 5510, 5514, 5517, 5521, + 5525, 5529, 5533, 5536, 5540, 5544, 5548, 5551, 5555, 5559, 5563, 5566, 5570, 5574, 5578, 5581, + 5585, 5589, 5593, 5596, 5600, 5604, 5608, 5612, 5615, 5619, 5623, 5627, 5630, 5634, 5638, 5642, + 5645, 5649, 5653, 5657, 5660, 5664, 5668, 5672, 5675, 5679, 5683, 5687, 5690, 5694, 5698, 5702, + 5705, 5709, 5713, 5717, 5720, 5724, 5728, 5732, 5735, 5739, 5743, 5747, 5750, 5754, 5758, 5762, + 5765, 5769, 5773, 5777, 5780, 5784, 5788, 5792, 5795, 5799, 5803, 5806, 5810, 5814, 5818, 5821, + 5825, 5829, 5833, 5836, 5840, 5844, 5848, 5851, 5855, 5859, 5863, 5866, 5870, 5874, 5877, 5881, + 5885, 5889, 5892, 5896, 5900, 5904, 5907, 5911, 5915, 5919, 5922, 5926, 5930, 5933, 5937, 5941, + 5945, 5948, 5952, 5956, 5960, 5963, 5967, 5971, 5974, 5978, 5982, 5986, 5989, 5993, 5997, 6001, + 6004, 6008, 6012, 6015, 6019, 6023, 6027, 6030, 6034, 6038, 6041, 6045, 6049, 6053, 6056, 6060, + 6064, 6067, 6071, 6075, 6079, 6082, 6086, 6090, 6093, 6097, 6101, 6105, 6108, 6112, 6116, 6119, + 6123, 6127, 6131, 6134, 6138, 6142, 6145, 6149, 6153, 6157, 6160, 6164, 6168, 6171, 6175, 6179, + 6182, 6186, 6190, 6194, 6197, 6201, 6205, 6208, 6212, 6216, 6219, 6223, 6227, 6231, 6234, 6238, + 6242, 6245, 6249, 6253, 6256, 6260, 6264, 6268, 6271, 6275, 6279, 6282, 6286, 6290, 6293, 6297, + 6301, 6304, 6308, 6312, 6316, 6319, 6323, 6327, 6330, 6334, 6338, 6341, 6345, 6349, 6352, 6356, + 6360, 6364, 6367, 6371, 6375, 6378, 6382, 6386, 6389, 6393, 6397, 6400, 6404, 6408, 6411, 6415, + 6419, 6422, 6426, 6430, 6433, 6437, 6441, 6445, 6448, 6452, 6456, 6459, 6463, 6467, 6470, 6474, + 6478, 6481, 6485, 6489, 6492, 6496, 6500, 6503, 6507, 6511, 6514, 6518, 6522, 6525, 6529, 6533, + 6536, 6540, 6544, 6547, 6551, 6555, 6558, 6562, 6566, 6569, 6573, 6577, 6580, 6584, 6588, 6591, + 6595, 6599, 6602, 6606, 6610, 6613, 6617, 6621, 6624, 6628, 6632, 6635, 6639, 6643, 6646, 6650, + 6654, 6657, 6661, 6664, 6668, 6672, 6675, 6679, 6683, 6686, 6690, 6694, 6697, 6701, 6705, 6708, + 6712, 6716, 6719, 6723, 6727, 6730, 6734, 6737, 6741, 6745, 6748, 6752, 6756, 6759, 6763, 6767, + 6770, 6774, 6778, 6781, 6785, 6788, 6792, 6796, 6799, 6803, 6807, 6810, 6814, 6818, 6821, 6825, + 6828, 6832, 6836, 6839, 6843, 6847, 6850, 6854, 6858, 6861, 6865, 6868, 6872, 6876, 6879, 6883, + 6887, 6890, 6894, 6898, 6901, 6905, 6908, 6912, 6916, 6919, 6923, 6927, 6930, 6934, 6937, 6941, + 6945, 6948, 6952, 6956, 6959, 6963, 6966, 6970, 6974, 6977, 6981, 6984, 6988, 6992, 6995, 6999, + 7003, 7006, 7010, 7013, 7017, 7021, 7024, 7028, 7031, 7035, 7039, 7042, 7046, 7050, 7053, 7057, + 7060, 7064, 7068, 7071, 7075, 7078, 7082, 7086, 7089, 7093, 7096, 7100, 7104, 7107, 7111, 7114, + 7118, 7122, 7125, 7129, 7132, 7136, 7140, 7143, 7147, 7150, 7154, 7158, 7161, 7165, 7168, 7172, + 7176, 7179, 7183, 7186, 7190, 7194, 7197, 7201, 7204, 7208, 7212, 7215, 7219, 7222, 7226, 7230, + 7233, 7237, 7240, 7244, 7247, 7251, 7255, 7258, 7262, 7265, 7269, 7273, 7276, 7280, 7283, 7287, + 7290, 7294, 7298, 7301, 7305, 7308, 7312, 7316, 7319, 7323, 7326, 7330, 7333, 7337, 7341, 7344, + 7348, 7351, 7355, 7358, 7362, 7366, 7369, 7373, 7376, 7380, 7383, 7387, 7391, 7394, 7398, 7401, + 7405, 7408, 7412, 7416, 7419, 7423, 7426, 7430, 7433, 7437, 7441, 7444, 7448, 7451, 7455, 7458, + 7462, 7465, 7469, 7473, 7476, 7480, 7483, 7487, 7490, 7494, 7498, 7501, 7505, 7508, 7512, 7515, + 7519, 7522, 7526, 7530, 7533, 7537, 7540, 7544, 7547, 7551, 7554, 7558, 7561, 7565, 7569, 7572, + 7576, 7579, 7583, 7586, 7590, 7593, 7597, 7600, 7604, 7608, 7611, 7615, 7618, 7622, 7625, 7629, + 7632, 7636, 7639, 7643, 7646, 7650, 7654, 7657, 7661, 7664, 7668, 7671, 7675, 7678, 7682, 7685, + 7689, 7692, 7696, 7700, 7703, 7707, 7710, 7714, 7717, 7721, 7724, 7728, 7731, 7735, 7738, 7742, + 7745, 7749, 7752, 7756, 7759, 7763, 7767, 7770, 7774, 7777, 7781, 7784, 7788, 7791, 7795, 7798, + 7802, 7805, 7809, 7812, 7816, 7819, 7823, 7826, 7830, 7833, 7837, 7840, 7844, 7847, 7851, 7854, + 7858, 7861, 7865, 7868, 7872, 7875, 7879, 7882, 7886, 7889, 7893, 7896, 7900, 7904, 7907, 7911, + 7914, 7918, 7921, 7925, 7928, 7932, 7935, 7939, 7942, 7946, 7949, 7953, 7956, 7960, 7963, 7966, + 7970, 7973, 7977, 7980, 7984, 7987, 7991, 7994, 7998, 8001, 8005, 8008, 8012, 8015, 8019, 8022, + 8026, 8029, 8033, 8036, 8040, 8043, 8047, 8050, 8054, 8057, 8061, 8064, 8068, 8071, 8075, 8078, + 8082, 8085, 8089, 8092, 8095, 8099, 8102, 8106, 8109, 8113, 8116, 8120, 8123, 8127, 8130, 8134, + 8137, 8141, 8144, 8148, 8151, 8155, 8158, 8161, 8165, 8168, 8172, 8175, 8179, 8182, 8186, 8189, + 8193, 8196, 8200, 8203, 8207, 8210, 8213, 8217, 8220, 8224, 8227, 8231, 8234, 8238, 8241, 8245, + 8248, 8251, 8255, 8258, 8262, 8265, 8269, 8272, 8276, 8279, 8283, 8286, 8289, 8293, 8296, 8300, + 8303, 8307, 8310, 8314, 8317, 8321, 8324, 8327, 8331, 8334, 8338, 8341, 8345, 8348, 8351, 8355, + 8358, 8362, 8365, 8369, 8372, 8376, 8379, 8382, 8386, 8389, 8393, 8396, 8400, 8403, 8406, 8410, + 8413, 8417, 8420, 8424, 8427, 8431, 8434, 8437, 8441, 8444, 8448, 8451, 8455, 8458, 8461, 8465, + 8468, 8472, 8475, 8478, 8482, 8485, 8489, 8492, 8496, 8499, 8502, 8506, 8509, 8513, 8516, 8520, + 8523, 8526, 8530, 8533, 8537, 8540, 8543, 8547, 8550, 8554, 8557, 8560, 8564, 8567, 8571, 8574, + 8578, 8581, 8584, 8588, 8591, 8595, 8598, 8601, 8605, 8608, 8612, 8615, 8618, 8622, 8625, 8629, + 8632, 8635, 8639, 8642, 8646, 8649, 8652, 8656, 8659, 8663, 8666, 8669, 8673, 8676, 8680, 8683, + 8686, 8690, 8693, 8696, 8700, 8703, 8707, 8710, 8713, 8717, 8720, 8724, 8727, 8730, 8734, 8737, + 8741, 8744, 8747, 8751, 8754, 8757, 8761, 8764, 8768, 8771, 8774, 8778, 8781, 8784, 8788, 8791, + 8795, 8798, 8801, 8805, 8808, 8811, 8815, 8818, 8822, 8825, 8828, 8832, 8835, 8838, 8842, 8845, + 8849, 8852, 8855, 8859, 8862, 8865, 8869, 8872, 8875, 8879, 8882, 8886, 8889, 8892, 8896, 8899, + 8902, 8906, 8909, 8912, 8916, 8919, 8922, 8926, 8929, 8933, 8936, 8939, 8943, 8946, 8949, 8953, + 8956, 8959, 8963, 8966, 8969, 8973, 8976, 8979, 8983, 8986, 8989, 8993, 8996, 8999, 9003, 9006, + 9009, 9013, 9016, 9020, 9023, 9026, 9030, 9033, 9036, 9040, 9043, 9046, 9050, 9053, 9056, 9060, + 9063, 9066, 9070, 9073, 9076, 9080, 9083, 9086, 9090, 9093, 9096, 9099, 9103, 9106, 9109, 9113, + 9116, 9119, 9123, 9126, 9129, 9133, 9136, 9139, 9143, 9146, 9149, 9153, 9156, 9159, 9163, 9166, + 9169, 9173, 9176, 9179, 9182, 9186, 9189, 9192, 9196, 9199, 9202, 9206, 9209, 9212, 9216, 9219, + 9222, 9225, 9229, 9232, 9235, 9239, 9242, 9245, 9249, 9252, 9255, 9259, 9262, 9265, 9268, 9272, + 9275, 9278, 9282, 9285, 9288, 9291, 9295, 9298, 9301, 9305, 9308, 9311, 9315, 9318, 9321, 9324, + 9328, 9331, 9334, 9338, 9341, 9344, 9347, 9351, 9354, 9357, 9361, 9364, 9367, 9370, 9374, 9377, + 9380, 9384, 9387, 9390, 9393, 9397, 9400, 9403, 9406, 9410, 9413, 9416, 9420, 9423, 9426, 9429, + 9433, 9436, 9439, 9442, 9446, 9449, 9452, 9456, 9459, 9462, 9465, 9469, 9472, 9475, 9478, 9482, + 9485, 9488, 9491, 9495, 9498, 9501, 9504, 9508, 9511, 9514, 9517, 9521, 9524, 9527, 9531, 9534, + 9537, 9540, 9544, 9547, 9550, 9553, 9557, 9560, 9563, 9566, 9570, 9573, 9576, 9579, 9582, 9586, + 9589, 9592, 9595, 9599, 9602, 9605, 9608, 9612, 9615, 9618, 9621, 9625, 9628, 9631, 9634, 9638, + 9641, 9644, 9647, 9650, 9654, 9657, 9660, 9663, 9667, 9670, 9673, 9676, 9680, 9683, 9686, 9689, + 9692, 9696, 9699, 9702, 9705, 9709, 9712, 9715, 9718, 9721, 9725, 9728, 9731, 9734, 9738, 9741, + 9744, 9747, 9750, 9754, 9757, 9760, 9763, 9766, 9770, 9773, 9776, 9779, 9783, 9786, 9789, 9792, + 9795, 9799, 9802, 9805, 9808, 9811, 9815, 9818, 9821, 9824, 9827, 9831, 9834, 9837, 9840, 9843, + 9847, 9850, 9853, 9856, 9859, 9863, 9866, 9869, 9872, 9875, 9879, 9882, 9885, 9888, 9891, 9894, + 9898, 9901, 9904, 9907, 9910, 9914, 9917, 9920, 9923, 9926, 9930, 9933, 9936, 9939, 9942, 9945, + 9949, 9952, 9955, 9958, 9961, 9964, 9968, 9971, 9974, 9977, 9980, 9984, 9987, 9990, 9993, 9996, + 9999, 10003, 10006, 10009, 10012, 10015, 10018, 10022, 10025, 10028, 10031, 10034, 10037, 10041, 10044, 10047, + 10050, 10053, 10056, 10059, 10063, 10066, 10069, 10072, 10075, 10078, 10082, 10085, 10088, 10091, 10094, 10097, + 10100, 10104, 10107, 10110, 10113, 10116, 10119, 10122, 10126, 10129, 10132, 10135, 10138, 10141, 10144, 10148, + 10151, 10154, 10157, 10160, 10163, 10166, 10170, 10173, 10176, 10179, 10182, 10185, 10188, 10192, 10195, 10198, + 10201, 10204, 10207, 10210, 10213, 10217, 10220, 10223, 10226, 10229, 10232, 10235, 10238, 10242, 10245, 10248, + 10251, 10254, 10257, 10260, 10263, 10267, 10270, 10273, 10276, 10279, 10282, 10285, 10288, 10291, 10295, 10298, + 10301, 10304, 10307, 10310, 10313, 10316, 10319, 10323, 10326, 10329, 10332, 10335, 10338, 10341, 10344, 10347, + 10350, 10354, 10357, 10360, 10363, 10366, 10369, 10372, 10375, 10378, 10381, 10385, 10388, 10391, 10394, 10397, + 10400, 10403, 10406, 10409, 10412, 10415, 10419, 10422, 10425, 10428, 10431, 10434, 10437, 10440, 10443, 10446, + 10449, 10452, 10456, 10459, 10462, 10465, 10468, 10471, 10474, 10477, 10480, 10483, 10486, 10489, 10492, 10496, + 10499, 10502, 10505, 10508, 10511, 10514, 10517, 10520, 10523, 10526, 10529, 10532, 10535, 10538, 10542, 10545, + 10548, 10551, 10554, 10557, 10560, 10563, 10566, 10569, 10572, 10575, 10578, 10581, 10584, 10587, 10590, 10593, + 10597, 10600, 10603, 10606, 10609, 10612, 10615, 10618, 10621, 10624, 10627, 10630, 10633, 10636, 10639, 10642, + 10645, 10648, 10651, 10654, 10657, 10660, 10663, 10667, 10670, 10673, 10676, 10679, 10682, 10685, 10688, 10691, + 10694, 10697, 10700, 10703, 10706, 10709, 10712, 10715, 10718, 10721, 10724, 10727, 10730, 10733, 10736, 10739, + 10742, 10745, 10748, 10751, 10754, 10757, 10760, 10763, 10766, 10769, 10772, 10775, 10778, 10781, 10784, 10787, + 10790, 10793, 10796, 10799, 10802, 10806, 10809, 10812, 10815, 10818, 10821, 10824, 10827, 10830, 10833, 10836, + 10839, 10842, 10845, 10848, 10851, 10854, 10857, 10860, 10863, 10866, 10869, 10871, 10874, 10877, 10880, 10883, + 10886, 10889, 10892, 10895, 10898, 10901, 10904, 10907, 10910, 10913, 10916, 10919, 10922, 10925, 10928, 10931, + 10934, 10937, 10940, 10943, 10946, 10949, 10952, 10955, 10958, 10961, 10964, 10967, 10970, 10973, 10976, 10979, + 10982, 10985, 10988, 10991, 10994, 10997, 11000, 11003, 11005, 11008, 11011, 11014, 11017, 11020, 11023, 11026, + 11029, 11032, 11035, 11038, 11041, 11044, 11047, 11050, 11053, 11056, 11059, 11062, 11065, 11068, 11071, 11073, + 11076, 11079, 11082, 11085, 11088, 11091, 11094, 11097, 11100, 11103, 11106, 11109, 11112, 11115, 11118, 11121, + 11123, 11126, 11129, 11132, 11135, 11138, 11141, 11144, 11147, 11150, 11153, 11156, 11159, 11162, 11165, 11167, + 11170, 11173, 11176, 11179, 11182, 11185, 11188, 11191, 11194, 11197, 11200, 11203, 11205, 11208, 11211, 11214, + 11217, 11220, 11223, 11226, 11229, 11232, 11235, 11238, 11240, 11243, 11246, 11249, 11252, 11255, 11258, 11261, + 11264, 11267, 11269, 11272, 11275, 11278, 11281, 11284, 11287, 11290, 11293, 11296, 11298, 11301, 11304, 11307, + 11310, 11313, 11316, 11319, 11322, 11325, 11327, 11330, 11333, 11336, 11339, 11342, 11345, 11348, 11351, 11353, + 11356, 11359, 11362, 11365, 11368, 11371, 11374, 11376, 11379, 11382, 11385, 11388, 11391, 11394, 11397, 11399, + 11402, 11405, 11408, 11411, 11414, 11417, 11420, 11422, 11425, 11428, 11431, 11434, 11437, 11440, 11442, 11445, + 11448, 11451, 11454, 11457, 11460, 11463, 11465, 11468, 11471, 11474, 11477, 11480, 11482, 11485, 11488, 11491, + 11494, 11497, 11500, 11502, 11505, 11508, 11511, 11514, 11517, 11520, 11522, 11525, 11528, 11531, 11534, 11537, + 11539, 11542, 11545, 11548, 11551, 11554, 11556, 11559, 11562, 11565, 11568, 11571, 11573, 11576, 11579, 11582, + 11585, 11588, 11590, 11593, 11596, 11599, 11602, 11605, 11607, 11610, 11613, 11616, 11619, 11621, 11624, 11627, + 11630, 11633, 11636, 11638, 11641, 11644, 11647, 11650, 11652, 11655, 11658, 11661, 11664, 11666, 11669, 11672, + 11675, 11678, 11681, 11683, 11686, 11689, 11692, 11695, 11697, 11700, 11703, 11706, 11709, 11711, 11714, 11717, + 11720, 11723, 11725, 11728, 11731, 11734, 11736, 11739, 11742, 11745, 11748, 11750, 11753, 11756, 11759, 11762, + 11764, 11767, 11770, 11773, 11775, 11778, 11781, 11784, 11787, 11789, 11792, 11795, 11798, 11800, 11803, 11806, + 11809, 11812, 11814, 11817, 11820, 11823, 11825, 11828, 11831, 11834, 11837, 11839, 11842, 11845, 11848, 11850, + 11853, 11856, 11859, 11861, 11864, 11867, 11870, 11872, 11875, 11878, 11881, 11883, 11886, 11889, 11892, 11894, + 11897, 11900, 11903, 11905, 11908, 11911, 11914, 11916, 11919, 11922, 11925, 11927, 11930, 11933, 11936, 11938, + 11941, 11944, 11947, 11949, 11952, 11955, 11958, 11960, 11963, 11966, 11968, 11971, 11974, 11977, 11979, 11982, + 11985, 11988, 11990, 11993, 11996, 11998, 12001, 12004, 12007, 12009, 12012, 12015, 12017, 12020, 12023, 12026, + 12028, 12031, 12034, 12037, 12039, 12042, 12045, 12047, 12050, 12053, 12055, 12058, 12061, 12064, 12066, 12069, + 12072, 12074, 12077, 12080, 12083, 12085, 12088, 12091, 12093, 12096, 12099, 12101, 12104, 12107, 12110, 12112, + 12115, 12118, 12120, 12123, 12126, 12128, 12131, 12134, 12136, 12139, 12142, 12144, 12147, 12150, 12153, 12155, + 12158, 12161, 12163, 12166, 12169, 12171, 12174, 12177, 12179, 12182, 12185, 12187, 12190, 12193, 12195, 12198, + 12201, 12203, 12206, 12209, 12211, 12214, 12217, 12219, 12222, 12225, 12227, 12230, 12233, 12235, 12238, 12241, + 12243, 12246, 12249, 12251, 12254, 12257, 12259, 12262, 12265, 12267, 12270, 12273, 12275, 12278, 12280, 12283, + 12286, 12288, 12291, 12294, 12296, 12299, 12302, 12304, 12307, 12310, 12312, 12315, 12317, 12320, 12323, 12325, + 12328, 12331, 12333, 12336, 12339, 12341, 12344, 12346, 12349, 12352, 12354, 12357, 12360, 12362, 12365, 12367, + 12370, 12373, 12375, 12378, 12381, 12383, 12386, 12388, 12391, 12394, 12396, 12399, 12401, 12404, 12407, 12409, + 12412, 12415, 12417, 12420, 12422, 12425, 12428, 12430, 12433, 12435, 12438, 12441, 12443, 12446, 12448, 12451, + 12454, 12456, 12459, 12461, 12464, 12467, 12469, 12472, 12474, 12477, 12480, 12482, 12485, 12487, 12490, 12493, + 12495, 12498, 12500, 12503, 12505, 12508, 12511, 12513, 12516, 12518, 12521, 12524, 12526, 12529, 12531, 12534, + 12536, 12539, 12542, 12544, 12547, 12549, 12552, 12554, 12557, 12560, 12562, 12565, 12567, 12570, 12572, 12575, + 12577, 12580, 12583, 12585, 12588, 12590, 12593, 12595, 12598, 12601, 12603, 12606, 12608, 12611, 12613, 12616, + 12618, 12621, 12624, 12626, 12629, 12631, 12634, 12636, 12639, 12641, 12644, 12646, 12649, 12652, 12654, 12657, + 12659, 12662, 12664, 12667, 12669, 12672, 12674, 12677, 12679, 12682, 12684, 12687, 12690, 12692, 12695, 12697, + 12700, 12702, 12705, 12707, 12710, 12712, 12715, 12717, 12720, 12722, 12725, 12727, 12730, 12732, 12735, 12737, + 12740, 12743, 12745, 12748, 12750, 12753, 12755, 12758, 12760, 12763, 12765, 12768, 12770, 12773, 12775, 12778, + 12780, 12783, 12785, 12788, 12790, 12793, 12795, 12798, 12800, 12803, 12805, 12808, 12810, 12813, 12815, 12818, + 12820, 12823, 12825, 12828, 12830, 12833, 12835, 12838, 12840, 12842, 12845, 12847, 12850, 12852, 12855, 12857, + 12860, 12862, 12865, 12867, 12870, 12872, 12875, 12877, 12880, 12882, 12885, 12887, 12890, 12892, 12894, 12897, + 12899, 12902, 12904, 12907, 12909, 12912, 12914, 12917, 12919, 12922, 12924, 12926, 12929, 12931, 12934, 12936, + 12939, 12941, 12944, 12946, 12949, 12951, 12953, 12956, 12958, 12961, 12963, 12966, 12968, 12971, 12973, 12975, + 12978, 12980, 12983, 12985, 12988, 12990, 12993, 12995, 12997, 13000, 13002, 13005, 13007, 13010, 13012, 13014, + 13017, 13019, 13022, 13024, 13027, 13029, 13031, 13034, 13036, 13039, 13041, 13044, 13046, 13048, 13051, 13053, + 13056, 13058, 13060, 13063, 13065, 13068, 13070, 13073, 13075, 13077, 13080, 13082, 13085, 13087, 13089, 13092, + 13094, 13097, 13099, 13101, 13104, 13106, 13109, 13111, 13113, 13116, 13118, 13121, 13123, 13125, 13128, 13130, + 13133, 13135, 13137, 13140, 13142, 13145, 13147, 13149, 13152, 13154, 13156, 13159, 13161, 13164, 13166, 13168, + 13171, 13173, 13175, 13178, 13180, 13183, 13185, 13187, 13190, 13192, 13194, 13197, 13199, 13202, 13204, 13206, + 13209, 13211, 13213, 13216, 13218, 13221, 13223, 13225, 13228, 13230, 13232, 13235, 13237, 13239, 13242, 13244, + 13246, 13249, 13251, 13254, 13256, 13258, 13261, 13263, 13265, 13268, 13270, 13272, 13275, 13277, 13279, 13282, + 13284, 13286, 13289, 13291, 13293, 13296, 13298, 13300, 13303, 13305, 13307, 13310, 13312, 13314, 13317, 13319, + 13321, 13324, 13326, 13328, 13331, 13333, 13335, 13338, 13340, 13342, 13345, 13347, 13349, 13352, 13354, 13356, + 13359, 13361, 13363, 13365, 13368, 13370, 13372, 13375, 13377, 13379, 13382, 13384, 13386, 13389, 13391, 13393, + 13395, 13398, 13400, 13402, 13405, 13407, 13409, 13412, 13414, 13416, 13418, 13421, 13423, 13425, 13428, 13430, + 13432, 13435, 13437, 13439, 13441, 13444, 13446, 13448, 13451, 13453, 13455, 13457, 13460, 13462, 13464, 13466, + 13469, 13471, 13473, 13476, 13478, 13480, 13482, 13485, 13487, 13489, 13492, 13494, 13496, 13498, 13501, 13503, + 13505, 13507, 13510, 13512, 13514, 13516, 13519, 13521, 13523, 13525, 13528, 13530, 13532, 13534, 13537, 13539, + 13541, 13543, 13546, 13548, 13550, 13552, 13555, 13557, 13559, 13561, 13564, 13566, 13568, 13570, 13573, 13575, + 13577, 13579, 13582, 13584, 13586, 13588, 13591, 13593, 13595, 13597, 13600, 13602, 13604, 13606, 13608, 13611, + 13613, 13615, 13617, 13620, 13622, 13624, 13626, 13628, 13631, 13633, 13635, 13637, 13640, 13642, 13644, 13646, + 13648, 13651, 13653, 13655, 13657, 13659, 13662, 13664, 13666, 13668, 13670, 13673, 13675, 13677, 13679, 13681, + 13684, 13686, 13688, 13690, 13692, 13695, 13697, 13699, 13701, 13703, 13706, 13708, 13710, 13712, 13714, 13717, + 13719, 13721, 13723, 13725, 13728, 13730, 13732, 13734, 13736, 13738, 13741, 13743, 13745, 13747, 13749, 13751, + 13754, 13756, 13758, 13760, 13762, 13765, 13767, 13769, 13771, 13773, 13775, 13778, 13780, 13782, 13784, 13786, + 13788, 13790, 13793, 13795, 13797, 13799, 13801, 13803, 13806, 13808, 13810, 13812, 13814, 13816, 13818, 13821, + 13823, 13825, 13827, 13829, 13831, 13834, 13836, 13838, 13840, 13842, 13844, 13846, 13848, 13851, 13853, 13855, + 13857, 13859, 13861, 13863, 13866, 13868, 13870, 13872, 13874, 13876, 13878, 13880, 13883, 13885, 13887, 13889, + 13891, 13893, 13895, 13897, 13900, 13902, 13904, 13906, 13908, 13910, 13912, 13914, 13916, 13919, 13921, 13923, + 13925, 13927, 13929, 13931, 13933, 13935, 13938, 13940, 13942, 13944, 13946, 13948, 13950, 13952, 13954, 13956, + 13959, 13961, 13963, 13965, 13967, 13969, 13971, 13973, 13975, 13977, 13979, 13981, 13984, 13986, 13988, 13990, + 13992, 13994, 13996, 13998, 14000, 14002, 14004, 14006, 14009, 14011, 14013, 14015, 14017, 14019, 14021, 14023, + 14025, 14027, 14029, 14031, 14033, 14035, 14037, 14040, 14042, 14044, 14046, 14048, 14050, 14052, 14054, 14056, + 14058, 14060, 14062, 14064, 14066, 14068, 14070, 14072, 14074, 14077, 14079, 14081, 14083, 14085, 14087, 14089, + 14091, 14093, 14095, 14097, 14099, 14101, 14103, 14105, 14107, 14109, 14111, 14113, 14115, 14117, 14119, 14121, + 14123, 14125, 14127, 14129, 14131, 14134, 14136, 14138, 14140, 14142, 14144, 14146, 14148, 14150, 14152, 14154, + 14156, 14158, 14160, 14162, 14164, 14166, 14168, 14170, 14172, 14174, 14176, 14178, 14180, 14182, 14184, 14186, + 14188, 14190, 14192, 14194, 14196, 14198, 14200, 14202, 14204, 14206, 14208, 14210, 14212, 14214, 14216, 14218, + 14220, 14222, 14224, 14226, 14228, 14230, 14232, 14234, 14236, 14238, 14240, 14242, 14243, 14245, 14247, 14249, + 14251, 14253, 14255, 14257, 14259, 14261, 14263, 14265, 14267, 14269, 14271, 14273, 14275, 14277, 14279, 14281, + 14283, 14285, 14287, 14289, 14291, 14293, 14295, 14297, 14299, 14300, 14302, 14304, 14306, 14308, 14310, 14312, + 14314, 14316, 14318, 14320, 14322, 14324, 14326, 14328, 14330, 14332, 14334, 14335, 14337, 14339, 14341, 14343, + 14345, 14347, 14349, 14351, 14353, 14355, 14357, 14359, 14361, 14362, 14364, 14366, 14368, 14370, 14372, 14374, + 14376, 14378, 14380, 14382, 14384, 14386, 14387, 14389, 14391, 14393, 14395, 14397, 14399, 14401, 14403, 14405, + 14407, 14408, 14410, 14412, 14414, 14416, 14418, 14420, 14422, 14424, 14426, 14427, 14429, 14431, 14433, 14435, + 14437, 14439, 14441, 14443, 14444, 14446, 14448, 14450, 14452, 14454, 14456, 14458, 14460, 14461, 14463, 14465, + 14467, 14469, 14471, 14473, 14475, 14476, 14478, 14480, 14482, 14484, 14486, 14488, 14489, 14491, 14493, 14495, + 14497, 14499, 14501, 14503, 14504, 14506, 14508, 14510, 14512, 14514, 14516, 14517, 14519, 14521, 14523, 14525, + 14527, 14529, 14530, 14532, 14534, 14536, 14538, 14540, 14541, 14543, 14545, 14547, 14549, 14551, 14552, 14554, + 14556, 14558, 14560, 14562, 14563, 14565, 14567, 14569, 14571, 14573, 14574, 14576, 14578, 14580, 14582, 14584, + 14585, 14587, 14589, 14591, 14593, 14595, 14596, 14598, 14600, 14602, 14604, 14605, 14607, 14609, 14611, 14613, + 14614, 14616, 14618, 14620, 14622, 14623, 14625, 14627, 14629, 14631, 14632, 14634, 14636, 14638, 14640, 14641, + 14643, 14645, 14647, 14649, 14650, 14652, 14654, 14656, 14658, 14659, 14661, 14663, 14665, 14667, 14668, 14670, + 14672, 14674, 14675, 14677, 14679, 14681, 14683, 14684, 14686, 14688, 14690, 14691, 14693, 14695, 14697, 14698, + 14700, 14702, 14704, 14706, 14707, 14709, 14711, 14713, 14714, 14716, 14718, 14720, 14721, 14723, 14725, 14727, + 14728, 14730, 14732, 14734, 14735, 14737, 14739, 14741, 14742, 14744, 14746, 14748, 14749, 14751, 14753, 14755, + 14756, 14758, 14760, 14761, 14763, 14765, 14767, 14768, 14770, 14772, 14774, 14775, 14777, 14779, 14781, 14782, + 14784, 14786, 14787, 14789, 14791, 14793, 14794, 14796, 14798, 14799, 14801, 14803, 14805, 14806, 14808, 14810, + 14811, 14813, 14815, 14817, 14818, 14820, 14822, 14823, 14825, 14827, 14828, 14830, 14832, 14834, 14835, 14837, + 14839, 14840, 14842, 14844, 14845, 14847, 14849, 14851, 14852, 14854, 14856, 14857, 14859, 14861, 14862, 14864, + 14866, 14867, 14869, 14871, 14872, 14874, 14876, 14877, 14879, 14881, 14882, 14884, 14886, 14887, 14889, 14891, + 14892, 14894, 14896, 14897, 14899, 14901, 14902, 14904, 14906, 14907, 14909, 14911, 14912, 14914, 14916, 14917, + 14919, 14921, 14922, 14924, 14926, 14927, 14929, 14931, 14932, 14934, 14936, 14937, 14939, 14940, 14942, 14944, + 14945, 14947, 14949, 14950, 14952, 14954, 14955, 14957, 14958, 14960, 14962, 14963, 14965, 14967, 14968, 14970, + 14971, 14973, 14975, 14976, 14978, 14980, 14981, 14983, 14984, 14986, 14988, 14989, 14991, 14993, 14994, 14996, + 14997, 14999, 15001, 15002, 15004, 15005, 15007, 15009, 15010, 15012, 15013, 15015, 15017, 15018, 15020, 15021, + 15023, 15025, 15026, 15028, 15029, 15031, 15033, 15034, 15036, 15037, 15039, 15041, 15042, 15044, 15045, 15047, + 15048, 15050, 15052, 15053, 15055, 15056, 15058, 15059, 15061, 15063, 15064, 15066, 15067, 15069, 15070, 15072, + 15074, 15075, 15077, 15078, 15080, 15081, 15083, 15085, 15086, 15088, 15089, 15091, 15092, 15094, 15095, 15097, + 15099, 15100, 15102, 15103, 15105, 15106, 15108, 15109, 15111, 15113, 15114, 15116, 15117, 15119, 15120, 15122, + 15123, 15125, 15126, 15128, 15129, 15131, 15133, 15134, 15136, 15137, 15139, 15140, 15142, 15143, 15145, 15146, + 15148, 15149, 15151, 15152, 15154, 15155, 15157, 15158, 15160, 15161, 15163, 15165, 15166, 15168, 15169, 15171, + 15172, 15174, 15175, 15177, 15178, 15180, 15181, 15183, 15184, 15186, 15187, 15189, 15190, 15192, 15193, 15195, + 15196, 15198, 15199, 15201, 15202, 15204, 15205, 15207, 15208, 15210, 15211, 15213, 15214, 15215, 15217, 15218, + 15220, 15221, 15223, 15224, 15226, 15227, 15229, 15230, 15232, 15233, 15235, 15236, 15238, 15239, 15241, 15242, + 15243, 15245, 15246, 15248, 15249, 15251, 15252, 15254, 15255, 15257, 15258, 15260, 15261, 15262, 15264, 15265, + 15267, 15268, 15270, 15271, 15273, 15274, 15276, 15277, 15278, 15280, 15281, 15283, 15284, 15286, 15287, 15289, + 15290, 15291, 15293, 15294, 15296, 15297, 15299, 15300, 15301, 15303, 15304, 15306, 15307, 15309, 15310, 15311, + 15313, 15314, 15316, 15317, 15318, 15320, 15321, 15323, 15324, 15326, 15327, 15328, 15330, 15331, 15333, 15334, + 15335, 15337, 15338, 15340, 15341, 15342, 15344, 15345, 15347, 15348, 15349, 15351, 15352, 15354, 15355, 15356, + 15358, 15359, 15361, 15362, 15363, 15365, 15366, 15368, 15369, 15370, 15372, 15373, 15375, 15376, 15377, 15379, + 15380, 15381, 15383, 15384, 15386, 15387, 15388, 15390, 15391, 15392, 15394, 15395, 15397, 15398, 15399, 15401, + 15402, 15403, 15405, 15406, 15407, 15409, 15410, 15411, 15413, 15414, 15416, 15417, 15418, 15420, 15421, 15422, + 15424, 15425, 15426, 15428, 15429, 15430, 15432, 15433, 15434, 15436, 15437, 15438, 15440, 15441, 15442, 15444, + 15445, 15446, 15448, 15449, 15450, 15452, 15453, 15454, 15456, 15457, 15458, 15460, 15461, 15462, 15464, 15465, + 15466, 15468, 15469, 15470, 15472, 15473, 15474, 15476, 15477, 15478, 15480, 15481, 15482, 15483, 15485, 15486, + 15487, 15489, 15490, 15491, 15493, 15494, 15495, 15496, 15498, 15499, 15500, 15502, 15503, 15504, 15506, 15507, + 15508, 15509, 15511, 15512, 15513, 15515, 15516, 15517, 15518, 15520, 15521, 15522, 15524, 15525, 15526, 15527, + 15529, 15530, 15531, 15532, 15534, 15535, 15536, 15538, 15539, 15540, 15541, 15543, 15544, 15545, 15546, 15548, + 15549, 15550, 15551, 15553, 15554, 15555, 15556, 15558, 15559, 15560, 15561, 15563, 15564, 15565, 15566, 15568, + 15569, 15570, 15571, 15573, 15574, 15575, 15576, 15578, 15579, 15580, 15581, 15583, 15584, 15585, 15586, 15588, + 15589, 15590, 15591, 15592, 15594, 15595, 15596, 15597, 15599, 15600, 15601, 15602, 15603, 15605, 15606, 15607, + 15608, 15610, 15611, 15612, 15613, 15614, 15616, 15617, 15618, 15619, 15620, 15622, 15623, 15624, 15625, 15626, + 15628, 15629, 15630, 15631, 15632, 15634, 15635, 15636, 15637, 15638, 15640, 15641, 15642, 15643, 15644, 15646, + 15647, 15648, 15649, 15650, 15652, 15653, 15654, 15655, 15656, 15657, 15659, 15660, 15661, 15662, 15663, 15664, + 15666, 15667, 15668, 15669, 15670, 15671, 15673, 15674, 15675, 15676, 15677, 15678, 15680, 15681, 15682, 15683, + 15684, 15685, 15687, 15688, 15689, 15690, 15691, 15692, 15693, 15695, 15696, 15697, 15698, 15699, 15700, 15701, + 15703, 15704, 15705, 15706, 15707, 15708, 15709, 15711, 15712, 15713, 15714, 15715, 15716, 15717, 15719, 15720, + 15721, 15722, 15723, 15724, 15725, 15726, 15728, 15729, 15730, 15731, 15732, 15733, 15734, 15735, 15736, 15738, + 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15748, 15749, 15750, 15751, 15752, 15753, 15754, 15755, + 15756, 15757, 15759, 15760, 15761, 15762, 15763, 15764, 15765, 15766, 15767, 15768, 15769, 15770, 15772, 15773, + 15774, 15775, 15776, 15777, 15778, 15779, 15780, 15781, 15782, 15783, 15785, 15786, 15787, 15788, 15789, 15790, + 15791, 15792, 15793, 15794, 15795, 15796, 15797, 15798, 15799, 15800, 15802, 15803, 15804, 15805, 15806, 15807, + 15808, 15809, 15810, 15811, 15812, 15813, 15814, 15815, 15816, 15817, 15818, 15819, 15820, 15821, 15822, 15824, + 15825, 15826, 15827, 15828, 15829, 15830, 15831, 15832, 15833, 15834, 15835, 15836, 15837, 15838, 15839, 15840, + 15841, 15842, 15843, 15844, 15845, 15846, 15847, 15848, 15849, 15850, 15851, 15852, 15853, 15854, 15855, 15856, + 15857, 15858, 15859, 15860, 15861, 15862, 15863, 15864, 15865, 15866, 15867, 15868, 15869, 15870, 15871, 15872, + 15873, 15874, 15875, 15876, 15877, 15878, 15879, 15880, 15881, 15882, 15883, 15884, 15885, 15886, 15887, 15888, + 15889, 15890, 15891, 15892, 15893, 15894, 15895, 15896, 15897, 15898, 15899, 15900, 15901, 15902, 15902, 15903, + 15904, 15905, 15906, 15907, 15908, 15909, 15910, 15911, 15912, 15913, 15914, 15915, 15916, 15917, 15918, 15919, + 15920, 15921, 15922, 15922, 15923, 15924, 15925, 15926, 15927, 15928, 15929, 15930, 15931, 15932, 15933, 15934, + 15935, 15936, 15937, 15937, 15938, 15939, 15940, 15941, 15942, 15943, 15944, 15945, 15946, 15947, 15948, 15948, + 15949, 15950, 15951, 15952, 15953, 15954, 15955, 15956, 15957, 15958, 15958, 15959, 15960, 15961, 15962, 15963, + 15964, 15965, 15966, 15967, 15968, 15968, 15969, 15970, 15971, 15972, 15973, 15974, 15975, 15976, 15976, 15977, + 15978, 15979, 15980, 15981, 15982, 15983, 15983, 15984, 15985, 15986, 15987, 15988, 15989, 15990, 15990, 15991, + 15992, 15993, 15994, 15995, 15996, 15997, 15997, 15998, 15999, 16000, 16001, 16002, 16003, 16003, 16004, 16005, + 16006, 16007, 16008, 16009, 16009, 16010, 16011, 16012, 16013, 16014, 16014, 16015, 16016, 16017, 16018, 16019, + 16020, 16020, 16021, 16022, 16023, 16024, 16025, 16025, 16026, 16027, 16028, 16029, 16030, 16030, 16031, 16032, + 16033, 16034, 16034, 16035, 16036, 16037, 16038, 16039, 16039, 16040, 16041, 16042, 16043, 16043, 16044, 16045, + 16046, 16047, 16047, 16048, 16049, 16050, 16051, 16051, 16052, 16053, 16054, 16055, 16055, 16056, 16057, 16058, + 16059, 16059, 16060, 16061, 16062, 16063, 16063, 16064, 16065, 16066, 16067, 16067, 16068, 16069, 16070, 16070, + 16071, 16072, 16073, 16074, 16074, 16075, 16076, 16077, 16077, 16078, 16079, 16080, 16080, 16081, 16082, 16083, + 16084, 16084, 16085, 16086, 16087, 16087, 16088, 16089, 16090, 16090, 16091, 16092, 16093, 16093, 16094, 16095, + 16096, 16096, 16097, 16098, 16099, 16099, 16100, 16101, 16102, 16102, 16103, 16104, 16104, 16105, 16106, 16107, + 16107, 16108, 16109, 16110, 16110, 16111, 16112, 16113, 16113, 16114, 16115, 16115, 16116, 16117, 16118, 16118, + 16119, 16120, 16120, 16121, 16122, 16123, 16123, 16124, 16125, 16125, 16126, 16127, 16128, 16128, 16129, 16130, + 16130, 16131, 16132, 16132, 16133, 16134, 16135, 16135, 16136, 16137, 16137, 16138, 16139, 16139, 16140, 16141, + 16141, 16142, 16143, 16143, 16144, 16145, 16146, 16146, 16147, 16148, 16148, 16149, 16150, 16150, 16151, 16152, + 16152, 16153, 16154, 16154, 16155, 16156, 16156, 16157, 16158, 16158, 16159, 16160, 16160, 16161, 16162, 16162, + 16163, 16164, 16164, 16165, 16165, 16166, 16167, 16167, 16168, 16169, 16169, 16170, 16171, 16171, 16172, 16173, + 16173, 16174, 16174, 16175, 16176, 16176, 16177, 16178, 16178, 16179, 16180, 16180, 16181, 16181, 16182, 16183, + 16183, 16184, 16185, 16185, 16186, 16186, 16187, 16188, 16188, 16189, 16189, 16190, 16191, 16191, 16192, 16193, + 16193, 16194, 16194, 16195, 16196, 16196, 16197, 16197, 16198, 16199, 16199, 16200, 16200, 16201, 16202, 16202, + 16203, 16203, 16204, 16205, 16205, 16206, 16206, 16207, 16207, 16208, 16209, 16209, 16210, 16210, 16211, 16212, + 16212, 16213, 16213, 16214, 16214, 16215, 16216, 16216, 16217, 16217, 16218, 16218, 16219, 16220, 16220, 16221, + 16221, 16222, 16222, 16223, 16223, 16224, 16225, 16225, 16226, 16226, 16227, 16227, 16228, 16228, 16229, 16230, + 16230, 16231, 16231, 16232, 16232, 16233, 16233, 16234, 16234, 16235, 16235, 16236, 16237, 16237, 16238, 16238, + 16239, 16239, 16240, 16240, 16241, 16241, 16242, 16242, 16243, 16243, 16244, 16244, 16245, 16246, 16246, 16247, + 16247, 16248, 16248, 16249, 16249, 16250, 16250, 16251, 16251, 16252, 16252, 16253, 16253, 16254, 16254, 16255, + 16255, 16256, 16256, 16257, 16257, 16258, 16258, 16259, 16259, 16260, 16260, 16261, 16261, 16262, 16262, 16263, + 16263, 16264, 16264, 16264, 16265, 16265, 16266, 16266, 16267, 16267, 16268, 16268, 16269, 16269, 16270, 16270, + 16271, 16271, 16272, 16272, 16273, 16273, 16273, 16274, 16274, 16275, 16275, 16276, 16276, 16277, 16277, 16278, + 16278, 16278, 16279, 16279, 16280, 16280, 16281, 16281, 16282, 16282, 16283, 16283, 16283, 16284, 16284, 16285, + 16285, 16286, 16286, 16286, 16287, 16287, 16288, 16288, 16289, 16289, 16289, 16290, 16290, 16291, 16291, 16292, + 16292, 16292, 16293, 16293, 16294, 16294, 16295, 16295, 16295, 16296, 16296, 16297, 16297, 16297, 16298, 16298, + 16299, 16299, 16299, 16300, 16300, 16301, 16301, 16301, 16302, 16302, 16303, 16303, 16303, 16304, 16304, 16305, + 16305, 16305, 16306, 16306, 16307, 16307, 16307, 16308, 16308, 16309, 16309, 16309, 16310, 16310, 16310, 16311, + 16311, 16312, 16312, 16312, 16313, 16313, 16313, 16314, 16314, 16315, 16315, 16315, 16316, 16316, 16316, 16317, + 16317, 16317, 16318, 16318, 16318, 16319, 16319, 16320, 16320, 16320, 16321, 16321, 16321, 16322, 16322, 16322, + 16323, 16323, 16323, 16324, 16324, 16324, 16325, 16325, 16325, 16326, 16326, 16326, 16327, 16327, 16327, 16328, + 16328, 16328, 16329, 16329, 16329, 16330, 16330, 16330, 16331, 16331, 16331, 16332, 16332, 16332, 16333, 16333, + 16333, 16334, 16334, 16334, 16334, 16335, 16335, 16335, 16336, 16336, 16336, 16337, 16337, 16337, 16338, 16338, + 16338, 16338, 16339, 16339, 16339, 16340, 16340, 16340, 16340, 16341, 16341, 16341, 16342, 16342, 16342, 16342, + 16343, 16343, 16343, 16344, 16344, 16344, 16344, 16345, 16345, 16345, 16346, 16346, 16346, 16346, 16347, 16347, + 16347, 16347, 16348, 16348, 16348, 16348, 16349, 16349, 16349, 16349, 16350, 16350, 16350, 16351, 16351, 16351, + 16351, 16352, 16352, 16352, 16352, 16353, 16353, 16353, 16353, 16353, 16354, 16354, 16354, 16354, 16355, 16355, + 16355, 16355, 16356, 16356, 16356, 16356, 16357, 16357, 16357, 16357, 16357, 16358, 16358, 16358, 16358, 16359, + 16359, 16359, 16359, 16359, 16360, 16360, 16360, 16360, 16361, 16361, 16361, 16361, 16361, 16362, 16362, 16362, + 16362, 16362, 16363, 16363, 16363, 16363, 16363, 16364, 16364, 16364, 16364, 16364, 16365, 16365, 16365, 16365, + 16365, 16366, 16366, 16366, 16366, 16366, 16366, 16367, 16367, 16367, 16367, 16367, 16368, 16368, 16368, 16368, + 16368, 16368, 16369, 16369, 16369, 16369, 16369, 16369, 16370, 16370, 16370, 16370, 16370, 16370, 16371, 16371, + 16371, 16371, 16371, 16371, 16371, 16372, 16372, 16372, 16372, 16372, 16372, 16373, 16373, 16373, 16373, 16373, + 16373, 16373, 16374, 16374, 16374, 16374, 16374, 16374, 16374, 16374, 16375, 16375, 16375, 16375, 16375, 16375, + 16375, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16377, 16377, 16377, 16377, 16377, 16377, + 16377, 16377, 16377, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16378, 16379, 16379, 16379, 16379, + 16379, 16379, 16379, 16379, 16379, 16379, 16379, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, + 16380, 16380, 16380, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, 16381, + 16381, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, + 16382, 16382, 16382, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, + 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, + 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}; diff --git a/sw/airborne/math/pprz_trig_int.h b/sw/airborne/math/pprz_trig_int.h index 354e07911b..149a794ced 100644 --- a/sw/airborne/math/pprz_trig_int.h +++ b/sw/airborne/math/pprz_trig_int.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef PPRZ_TRIG_INT_H diff --git a/sw/airborne/max1167.h b/sw/airborne/max1167.h index 0cf4451414..ba0a4bd13e 100644 --- a/sw/airborne/max1167.h +++ b/sw/airborne/max1167.h @@ -10,7 +10,7 @@ extern void max1167_read( void ); #define STA_MAX1167_IDLE 0 #define STA_MAX1167_SENDING_REQ 1 -#define STA_MAX1167_READING_RES 2 +#define STA_MAX1167_READING_RES 2 #define STA_MAX1167_DATA_AVAILABLE 3 extern volatile uint8_t max1167_status; diff --git a/sw/airborne/micromag.c b/sw/airborne/micromag.c index 7fdd22c04b..7ab44a4a85 100644 --- a/sw/airborne/micromag.c +++ b/sw/airborne/micromag.c @@ -4,9 +4,9 @@ volatile uint8_t micromag_status; volatile int16_t micromag_values[MM_NB_AXIS]; void micromag_init( void ) { - + micromag_hw_init(); - + uint8_t i; for (i=0; i, @@ -19,7 +19,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "cam_control/booz_cam.h" diff --git a/sw/airborne/modules/cam_control/booz_cam.h b/sw/airborne/modules/cam_control/booz_cam.h index 24bb063629..8e656d24b6 100644 --- a/sw/airborne/modules/cam_control/booz_cam.h +++ b/sw/airborne/modules/cam_control/booz_cam.h @@ -1,4 +1,4 @@ -/* +/* * $Id: $ * * Copyright (C) 2009 Gautier Hattenberger , @@ -19,7 +19,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef BOOZ_CAM_H diff --git a/sw/airborne/modules/cam_control/cam_track.c b/sw/airborne/modules/cam_control/cam_track.c index 49feacf85a..8e68801d9f 100644 --- a/sw/airborne/modules/cam_control/cam_track.c +++ b/sw/airborne/modules/cam_control/cam_track.c @@ -1,6 +1,6 @@ /* * $Id: demo_module.c 3079 2009-03-11 16:55:42Z gautier $ - * + * * Copyright (C) 2010 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -227,7 +227,7 @@ void parse_cam_buffer( uint8_t c ) { break; } return; - error: + error: restart: cam_status = UNINIT; return; diff --git a/sw/airborne/modules/cam_control/cam_track.h b/sw/airborne/modules/cam_control/cam_track.h index 5976485e24..873e0324bf 100644 --- a/sw/airborne/modules/cam_control/cam_track.h +++ b/sw/airborne/modules/cam_control/cam_track.h @@ -1,6 +1,6 @@ /* * $Id: demo_module.h 3079 2009-03-11 16:55:42Z gautier $ - * + * * Copyright (C) 2010 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file cam_track.h - * + * * blob tracking with cmucam */ diff --git a/sw/airborne/modules/core/extra_pprz_dl.c b/sw/airborne/modules/core/extra_pprz_dl.c index 9205a9c22c..231287f7d3 100644 --- a/sw/airborne/modules/core/extra_pprz_dl.c +++ b/sw/airborne/modules/core/extra_pprz_dl.c @@ -1,6 +1,6 @@ /* * Paparazzi mcu0 $Id: pprz_transport.c 929 2006-06-02 12:11:37Z poine $ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * Copyright (C) 2010 ENAC * @@ -19,7 +19,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/core/extra_pprz_dl.h b/sw/airborne/modules/core/extra_pprz_dl.h index 255c3d650c..676075a90c 100644 --- a/sw/airborne/modules/core/extra_pprz_dl.h +++ b/sw/airborne/modules/core/extra_pprz_dl.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id: pprz_transport.h 4870 2010-04-24 03:02:39Z poine $ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -192,7 +192,7 @@ static inline void parse_extra_pprz( uint8_t c ) { static inline void extra_pprz_parse_payload(void) { uint8_t i; - for(i = 0; i < extra_pprz_payload_len; i++) + for(i = 0; i < extra_pprz_payload_len; i++) dl_buffer[i] = extra_pprz_payload[i]; dl_msg_available = TRUE; } diff --git a/sw/airborne/modules/core/sys_mon.c b/sw/airborne/modules/core/sys_mon.c index c4c759f9f4..6999c6f6a1 100644 --- a/sw/airborne/modules/core/sys_mon.c +++ b/sw/airborne/modules/core/sys_mon.c @@ -1,6 +1,6 @@ /* * $Id: $ - * + * * Copyright (C) 2010 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/core/sys_mon.h b/sw/airborne/modules/core/sys_mon.h index cb405c4cc3..469e608d15 100644 --- a/sw/airborne/modules/core/sys_mon.h +++ b/sw/airborne/modules/core/sys_mon.h @@ -1,6 +1,6 @@ /* * $Id: $ - * + * * Copyright (C) 2010 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file sys_mon.h - * + * * System monitoring * return cpu load, average exec time, ... */ diff --git a/sw/airborne/modules/core/trigger_ext.c b/sw/airborne/modules/core/trigger_ext.c index cf5acf6ae3..b5d39c6a8d 100644 --- a/sw/airborne/modules/core/trigger_ext.c +++ b/sw/airborne/modules/core/trigger_ext.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/core/trigger_ext.h b/sw/airborne/modules/core/trigger_ext.h index 59b260532c..dbd63fa75d 100644 --- a/sw/airborne/modules/core/trigger_ext.h +++ b/sw/airborne/modules/core/trigger_ext.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/demo_module/demo_module.c b/sw/airborne/modules/demo_module/demo_module.c index 2cfe3f451c..fcab1b5cda 100644 --- a/sw/airborne/modules/demo_module/demo_module.c +++ b/sw/airborne/modules/demo_module/demo_module.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/demo_module/demo_module.h b/sw/airborne/modules/demo_module/demo_module.h index 387f1ac4ff..4f6700a9e3 100644 --- a/sw/airborne/modules/demo_module/demo_module.h +++ b/sw/airborne/modules/demo_module/demo_module.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file demo_module.h - * + * * demo module with blinking LEDs */ diff --git a/sw/airborne/modules/deploy_sonar_buoy/deploy_sonar_buoy.c b/sw/airborne/modules/deploy_sonar_buoy/deploy_sonar_buoy.c index 59690f711f..4e0b788c64 100644 --- a/sw/airborne/modules/deploy_sonar_buoy/deploy_sonar_buoy.c +++ b/sw/airborne/modules/deploy_sonar_buoy/deploy_sonar_buoy.c @@ -25,10 +25,10 @@ #include "deploy_sonar_buoy.h" #include "airframe.h" -/* simple module to toggle two gpio pins on Lisa. - * The application in this was written for drops - * two sonar buoys. TODO extend to a generalised - * GPIO module +/* simple module to toggle two gpio pins on Lisa. + * The application in this was written for drops + * two sonar buoys. TODO extend to a generalised + * GPIO module */ bool_t buoy_1; @@ -42,19 +42,19 @@ void deploy_sonar_buoy_init(void) { GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIOC, &GPIO_InitStructure); + GPIO_Init(GPIOC, &GPIO_InitStructure); /* set port C pin 5 to be low */ GPIO_WriteBit(GPIOC, GPIO_Pin_5 , Bit_RESET ); - + /* initialise peripheral clock for port B */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); - /* set port B pin 0 to be low */ + /* set port B pin 0 to be low */ GPIO_WriteBit(GPIOB, GPIO_Pin_0 , Bit_RESET ); - + /* set the variables of interest to be FALSE */ buoy_1 = FALSE; buoy_2 = FALSE; diff --git a/sw/airborne/modules/digital_cam/dc.c b/sw/airborne/modules/digital_cam/dc.c index 7be283600f..4d0ba12a99 100644 --- a/sw/airborne/modules/digital_cam/dc.c +++ b/sw/airborne/modules/digital_cam/dc.c @@ -23,12 +23,12 @@ void dc_send_shot_position(void) int16_t theta = DegOfRad(estimator_theta*10.0f); float gps_z = ((float)gps_alt) / 100.0f; DOWNLINK_SEND_DC_SHOT(DefaultChannel, &dc_photo_nr, &gps_utm_east, &gps_utm_north, &gps_z, &gps_utm_zone, &phi, &theta, &gps_course, &gps_gspeed, &gps_itow); - dc_photo_nr++; + dc_photo_nr++; } uint8_t dc_shutter( void ) { - dc_timer = SHUTTER_DELAY; + dc_timer = SHUTTER_DELAY; DC_PUSH(DC_SHUTTER_LED); dc_send_shot_position(); diff --git a/sw/airborne/modules/digital_cam/dc.h b/sw/airborne/modules/digital_cam/dc.h index 1244f34b5f..95e50be693 100644 --- a/sw/airborne/modules/digital_cam/dc.h +++ b/sw/airborne/modules/digital_cam/dc.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2003-2008 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,17 +18,17 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file dc.h * \brief Digital Camera Control - * + * * Provides the control of the shutter and the zoom of a digital camera * through standard binary IOs of the board. * - * Configuration: + * Configuration: * Since the API of led.h is used, connected pins must be defined as led * numbers (usually in the airframe file): * @@ -84,7 +84,7 @@ extern uint8_t dc_shoot; uint8_t dc_shutter( void ); static inline uint8_t dc_zoom( void ) { - dc_timer = SHUTTER_DELAY; + dc_timer = SHUTTER_DELAY; #ifdef DC_ZOOM_LED DC_PUSH(DC_ZOOM_LED); #endif @@ -102,10 +102,10 @@ static inline uint8_t dc_zoom( void ) { #define dc_init() { /* initialized as leds */ dc_periodic_shutter = DC_PERIODIC_SHUTTER; DC_PUSH(DC_SHUTTER_LED);} /* Output */ -#ifndef DC_GPS_TRIGGER_START +#ifndef DC_GPS_TRIGGER_START #define DC_GPS_TRIGGER_START 1 #endif -#ifndef DC_GPS_TRIGGER_STOP +#ifndef DC_GPS_TRIGGER_STOP #define DC_GPS_TRIGGER_STOP 3 #endif @@ -127,12 +127,12 @@ static inline void dc_shoot_on_gps( void ) { { DC_RELEASE(DC_SHUTTER_LED); } - + gps_msg_counter++; if (gps_msg_counter >= DC_GPS_TRIGGER_STOP) gps_msg_counter = 0; } -} +} /* 4Hz */ static inline void dc_periodic( void ) { @@ -148,7 +148,7 @@ static inline void dc_periodic( void ) { if (dc_shoot > 0) { if (dc_periodic_shutter) { - RunOnceEvery(2, + RunOnceEvery(2, { if (dc_shutter_timer) { dc_shutter_timer--; diff --git a/sw/airborne/modules/display/lcd_dogm.c b/sw/airborne/modules/display/lcd_dogm.c index c3784dec9b..c9d4f4e079 100644 --- a/sw/airborne/modules/display/lcd_dogm.c +++ b/sw/airborne/modules/display/lcd_dogm.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -36,7 +36,7 @@ */ -#include "display/lcd_dogm_hw.h" +#include "display/lcd_dogm_hw.h" #include "lcd_dogm.h" diff --git a/sw/airborne/modules/enose/enose.c b/sw/airborne/modules/enose/enose.c index dfc26314af..c3e816bb92 100644 --- a/sw/airborne/modules/enose/enose.c +++ b/sw/airborne/modules/enose/enose.c @@ -64,7 +64,7 @@ void enose_periodic( void ) { } else if (enose_status == ENOSE_IDLE) { enose_status = ENOSE_MEASURING_WR; - const uint8_t msg[] = { ENOSE_DATA_ADDR }; + const uint8_t msg[] = { ENOSE_DATA_ADDR }; memcpy((void*)i2c0_buf, msg, sizeof(msg)); i2c0_transmit(ENOSE_SLAVE_ADDR, sizeof(msg), &enose_i2c_done); enose_i2c_done = FALSE; @@ -76,13 +76,13 @@ void enose_periodic( void ) { } else if (enose_status == ENOSE_MEASURING_RD) { uint16_t val = (i2c0_buf[0]<<8) | i2c0_buf[1]; - if (val < 5000) + if (val < 5000) enose_val[0] = val; val = (i2c0_buf[2]<<8) | i2c0_buf[3]; - if (val < 5000) + if (val < 5000) enose_val[1] = val; val = (i2c0_buf[4]<<8) | i2c0_buf[5]; - if (val < 5000) + if (val < 5000) enose_val[2] = val; enose_status = ENOSE_IDLE; } diff --git a/sw/airborne/modules/enose/enose.h b/sw/airborne/modules/enose/enose.h index bc52796970..96300304fe 100644 --- a/sw/airborne/modules/enose/enose.h +++ b/sw/airborne/modules/enose/enose.h @@ -33,9 +33,9 @@ extern void enose_periodic( void ); #define enose_SetHeat1(val) {enose_set_heat(1, val);} #define enose_SetHeat2(val) {enose_set_heat(2, val);} -#define enose_DecreaseVal0(_x) { enose_val[0] -= _x; } -#define enose_DecreaseVal1(_x) { enose_val[1] -= _x; } -#define enose_DecreaseVal2(_x) { enose_val[2] -= _x; } +#define enose_DecreaseVal0(_x) { enose_val[0] -= _x; } +#define enose_DecreaseVal1(_x) { enose_val[1] -= _x; } +#define enose_DecreaseVal2(_x) { enose_val[2] -= _x; } #endif /* ENOSE_H */ diff --git a/sw/airborne/modules/gps_i2c/runtime_configure.h b/sw/airborne/modules/gps_i2c/runtime_configure.h index 34fba12ff9..8041a888d6 100644 --- a/sw/airborne/modules/gps_i2c/runtime_configure.h +++ b/sw/airborne/modules/gps_i2c/runtime_configure.h @@ -20,7 +20,7 @@ static bool_t user_gps_configure(bool_t cpt) { UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_SOL_ID, 8, 0, 0, 0); break; case 5: - UbxSend_CFG_RATE(250 /*ms*/, 0x0001, 0x0000); + UbxSend_CFG_RATE(250 /*ms*/, 0x0001, 0x0000); return FALSE; } return TRUE; /* Continue, except for the last case */ diff --git a/sw/airborne/modules/gsm/gsm.c b/sw/airborne/modules/gsm/gsm.c index 188f883ea7..451b5d1d46 100644 --- a/sw/airborne/modules/gsm/gsm.c +++ b/sw/airborne/modules/gsm/gsm.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 ENAC, Arnaud Quintard, Pascal Brisset * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -100,7 +100,7 @@ Receiving: static bool gsm_line_received; static bool prompt_received; -static bool waiting_for_reply; /* An AT command has been sent and an answer is expected */ +static bool waiting_for_reply; /* An AT command has been sent and an answer is expected */ // static char msg_status[16]; // static char msg_date[32]; @@ -158,7 +158,7 @@ void gsm_init(void) { //} else { /* Second call */ // gsm_buf_idx = 0; // gsm_line_received = false; - // + // // Send_AT(); // gsm_status = STATUS_SEND_AT; // gsm_gsm_init_status = FALSE; @@ -208,7 +208,7 @@ static void gsm_got_line(void) gsm_receive_content(); Suppr_SMS(index_msg); gsm_status = STATUS_DELETE_SMS; - } else if (gsm_status == STATUS_IDLE + } else if (gsm_status == STATUS_IDLE && strncmp(CMTI, gsm_buf, strlen(CMTI)) == 0) { /* A SMS is available */ /* Extracting the index of the message */ @@ -226,7 +226,7 @@ static void gsm_got_line(void) waiting_for_reply = false; switch(gsm_status) { - case STATUS_CSQ : + case STATUS_CSQ : gsm_send_report_continue(); gsm_status = STATUS_WAITING_PROMPT; break; @@ -264,7 +264,7 @@ static void gsm_got_line(void) gsm_status = STATUS_IDLE; break; - default: + default: break; } } else { /** We did not get the expected answer */ @@ -349,7 +349,7 @@ static void gsm_receive_content(void) void Suppr_SMS(int index_) { char demande_suppression[20]; - + sprintf(demande_suppression, "AT+CMGD=%d", index_); strcpy(expected_ack, "OK"); waiting_for_reply = true; @@ -362,11 +362,11 @@ static void gsm_got_prompt(void) { if (gsm_status == STATUS_WAITING_PROMPT) { // We were waiting for a prompt char string[strlen(data_to_send) +3]; - + sprintf(string, "%s%c", data_to_send, CTRLZ); Send(string); } - + gsm_status = STATUS_IDLE; } @@ -376,13 +376,13 @@ static void parse_msg_header(void) { /* Extraction du flag*/ /** Extraction(buffer2, '"', 1, 1, '"', 1, 0, msg_status); */ - + /* Extraction de l'expediteur*/ // Extraction(buffer2, '"', 2, 1, '"', 1, 0, origin); - + /* Extraction de date heure*/ // Extraction(buffer2, '"', 4, 1, '"', 1, 0, msg_date); - + //pb d'ecriture du flag => solution de fortune (pb si flag != rec unread) //??????? strncpy(flag, flag, 10); } @@ -397,7 +397,7 @@ void gsm_send_report() // Checking the network coverage Send_CSQ(); gsm_status = STATUS_CSQ; - } + } } @@ -407,7 +407,7 @@ void gsm_send_report_continue(void) //We got "+CSQ: ," and on 2 digits (cf 3.5.4.4.4) // and we expect "OK" on the second line uint8_t rssi = atoi(gsm_buf + strlen("+CSQ: ")); - + // Donnee GPS :ne sont pas envoyes gps_mode, gps_itow, gps_utm_zone, gps_nb_ovrn // Donnees batterie (seuls vsupply et estimator_flight_time sont envoyes) // concatenation de toutes les infos en un seul message à transmettre @@ -443,19 +443,19 @@ static void Send_AT(void) { strcpy(expected_ack, "OK"); waiting_for_reply = true; - + Send("ATE0"); } static void Send_CMGF(void) -{ +{ strcpy(expected_ack, "OK"); waiting_for_reply = true; Send("AT+CMGF=1"); } static void Send_CSQ(void) -{ +{ /***** FIXME ****** strcpy(expected_ack, "+CSQ:"); ****/ strcpy(expected_ack, "OK"); waiting_for_reply = true; @@ -463,14 +463,14 @@ static void Send_CSQ(void) } static void Send_CNMI(void) -{ +{ strcpy(expected_ack, "OK"); waiting_for_reply = true; Send("AT+CNMI=1,1,0,0,0"); } static void Send_CPMS(void) -{ +{ strcpy(expected_ack, "+CPMS:"); waiting_for_reply = true; Send("AT+CPMS=\"SM\""); @@ -491,7 +491,7 @@ static void gsm_parse(uint8_t c) { gsm_buf_idx=0; break; default: - if (gsm_buf_idx < GSM_MAX_PAYLOAD) { + if (gsm_buf_idx < GSM_MAX_PAYLOAD) { gsm_buf[gsm_buf_idx] = c; gsm_buf_idx++; } /* else extra characters are ignored */ diff --git a/sw/airborne/modules/gsm/gsm.h b/sw/airborne/modules/gsm/gsm.h index 95777e05ab..e52cf3c06b 100644 --- a/sw/airborne/modules/gsm/gsm.h +++ b/sw/airborne/modules/gsm/gsm.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 ENAC * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file gsm.h - * + * * Communications through GSM */ diff --git a/sw/airborne/modules/ins/VN100.h b/sw/airborne/modules/ins/VN100.h index fd39aa1b34..674d178dbd 100644 --- a/sw/airborne/modules/ins/VN100.h +++ b/sw/airborne/modules/ins/VN100.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id: $ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/ins/fw_ins_vn100.c b/sw/airborne/modules/ins/fw_ins_vn100.c index bb1147c591..06002880c2 100644 --- a/sw/airborne/modules/ins/fw_ins_vn100.c +++ b/sw/airborne/modules/ins/fw_ins_vn100.c @@ -1,6 +1,6 @@ /* * Paparazzi $Id: ins_xsens.c 3872 2009-08-05 14:42:41Z mmm $ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/ins/ins_module.h b/sw/airborne/modules/ins/ins_module.h index 26c41fd8c3..0f2575d241 100644 --- a/sw/airborne/modules/ins/ins_module.h +++ b/sw/airborne/modules/ins/ins_module.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/ins/ins_xsens.h b/sw/airborne/modules/ins/ins_xsens.h index 941fee8983..446faabad8 100644 --- a/sw/airborne/modules/ins/ins_xsens.h +++ b/sw/airborne/modules/ins/ins_xsens.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id: $ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/light/light.c b/sw/airborne/modules/light/light.c index 9b3f9264ee..d017212fc4 100644 --- a/sw/airborne/modules/light/light.c +++ b/sw/airborne/modules/light/light.c @@ -1,6 +1,6 @@ /* * $Id: demo_module.c 3079 2009-03-11 16:55:42Z gautier $ - * + * * Copyright (C) 2009 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -49,7 +49,7 @@ void init_light(void) { #endif } -void periodic_light(void) +void periodic_light(void) { static uint8_t counter = 0; #ifdef LIGHT_LED_NAV diff --git a/sw/airborne/modules/light/light.h b/sw/airborne/modules/light/light.h index 0f4eaa344a..323e038448 100644 --- a/sw/airborne/modules/light/light.h +++ b/sw/airborne/modules/light/light.h @@ -1,6 +1,6 @@ /* * $Id: demo_module.h 3079 2009-03-11 16:55:42Z gautier $ - * + * * Copyright (C) 2009 Gautier Hattenberger * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file demo_module.h - * + * * demo module with blinking LEDs */ diff --git a/sw/airborne/modules/max3100/max3100_hw.c b/sw/airborne/modules/max3100/max3100_hw.c index 1dcaf58533..00158e6f1a 100644 --- a/sw/airborne/modules/max3100/max3100_hw.c +++ b/sw/airborne/modules/max3100/max3100_hw.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 ENAC * * This file is part of paparazzi. @@ -18,12 +18,12 @@ * 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. + * Boston, MA 02111-1307, USA. * */ #include "LPC21xx.h" -#include "interrupt_hw.h" +#include "interrupt_hw.h" #include "max3100_hw.h" #include "ap_downlink.h" @@ -56,7 +56,7 @@ static void SPI1_ISR(void) __attribute__((naked)); #define SSP_DSS 0x0F << 0 /* data size : 16 bits */ // #define SSP_DSS 0x07 << 0 /* data size : 8 bits */ #define SSP_FRF 0x00 << 4 /* frame format : SPI */ -#define SSP_CPOL 0x00 << 6 /* clock polarity : idle low */ +#define SSP_CPOL 0x00 << 6 /* clock polarity : idle low */ #define SSP_CPHA 0x00 << 7 /* clock phase : 0 */ #define SSP_SCR 0x0F << 8 /* serial clock rate : 29.3kHz, SSP input clock / 16 */ @@ -109,7 +109,7 @@ void max3100_init( void ) { VICIntSelect &= ~VIC_BIT( MAX3100_VIC_EINT ); // EXTINT selected as IRQ VICIntEnable = VIC_BIT( MAX3100_VIC_EINT ); // EXTINT interrupt enabled VICVectCntl8 = VIC_ENABLE | MAX3100_VIC_EINT; - VICVectAddr8 = (uint32_t)EXTINT_ISR; // address of the ISR + VICVectAddr8 = (uint32_t)EXTINT_ISR; // address of the ISR /* Configure interrupt vector for SPI */ VICIntSelect &= ~VIC_BIT(VIC_SPI1); /* SPI1 selected as IRQ */ @@ -128,7 +128,7 @@ void EXTINT_ISR(void) { ISR_ENTRY(); max3100_data_available = true; - + SetBit(EXTINT, MAX3100_IRQ_EINT); /* clear extint */ VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */ @@ -151,7 +151,7 @@ void SPI1_ISR(void) { } } SpiClearRti(); /* clear interrupt */ - SpiDisableRti(); + SpiDisableRti(); SpiDisable (); Max3100Unselect(); max3100_status = MAX3100_STATUS_IDLE; diff --git a/sw/airborne/modules/max3100/max3100_hw.h b/sw/airborne/modules/max3100/max3100_hw.h index 75692b07cf..fb3f831334 100644 --- a/sw/airborne/modules/max3100/max3100_hw.h +++ b/sw/airborne/modules/max3100/max3100_hw.h @@ -73,7 +73,7 @@ extern bool read_bytes; #if MAX3100_FOSC == 1843200 #define MAX3100_B115200 0x0 #define MAX3100_B57600 0x1 -#define MAX3100_B19200 0x9 +#define MAX3100_B19200 0x9 #define MAX3100_B9600 0xA #elif MAX3100_FOSC == 3686400 #define MAX3100_B9600 0xB @@ -116,11 +116,11 @@ static inline void max3100_transmit(uint16_t data) { #define Max3100ReadData() max3100_transmit(MAX3100_READ_DATA) -static inline void max3100_read_data(void) { +static inline void max3100_read_data(void) { Max3100ReadData(); max3100_status = MAX3100_STATUS_READING; } - + static inline void max3100_flush( void ) { if (max3100_status == MAX3100_STATUS_IDLE && max3100_tx_extract_idx != max3100_tx_insert_idx diff --git a/sw/airborne/modules/meteo/humid_hih.c b/sw/airborne/modules/meteo/humid_hih.c index 430bcc7e9e..d07eb9fba4 100644 --- a/sw/airborne/modules/meteo/humid_hih.c +++ b/sw/airborne/modules/meteo/humid_hih.c @@ -1,6 +1,6 @@ /* * $Id: humid_hih.c $ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/meteo/humid_sht.c b/sw/airborne/modules/meteo/humid_sht.c index 5ca724e690..6dd38cd44d 100644 --- a/sw/airborne/modules/meteo/humid_sht.c +++ b/sw/airborne/modules/meteo/humid_sht.c @@ -38,7 +38,7 @@ uint8_t s_write_byte(uint8_t value) uint8_t i, error=0; for (i=0x80;i>0;i/=2) //shift bit for masking - { + { if (i & value) DATA_SET; //masking value with i , write to SENSI-BUS else DATA_CLR; SCK_SET; //clk for SENSI-BUS @@ -60,7 +60,7 @@ uint8_t s_read_byte(uint8_t ack) DATA_SET; //release DATA-line for (i=0x80;i>0;i/=2) //shift bit for masking - { + { SCK_SET; //clk for SENSI-BUS if (DATA_IN) val=(val | i); //read bit SCK_CLR; @@ -190,7 +190,7 @@ uint8_t s_read_measure(uint16_t *p_value, uint8_t *p_checksum) } void calc_sht(uint16_t hum, uint16_t tem, float *fhum ,float *ftem) -{ +{ // calculates temperature [ C] and humidity [%RH] // input : humi [Ticks] (12 bit) // temp [Ticks] (14 bit) @@ -237,23 +237,23 @@ void humid_sht_init( void ) #if (DAT_PIN<16) PINSEL0 &= ~(_BV(DAT_PIN*2)|_BV(DAT_PIN*2+1)); -#else +#else PINSEL1 &= ~(_BV((DAT_PIN-16)*2)|_BV((DAT_PIN-16)*2+1)); #endif #if (SCK_PIN<16) PINSEL0 &= ~(_BV(SCK_PIN*2)|_BV(SCK_PIN*2+1)); -#else +#else PINSEL1 &= ~(_BV((SCK_PIN-16)*2)|_BV((SCK_PIN-16)*2+1)); -#endif +#endif - IO0DIR &= ~(_BV(DAT_PIN)); + IO0DIR &= ~(_BV(DAT_PIN)); IO0CLR = _BV(DAT_PIN); IO0DIR = _BV(SCK_PIN); IO0CLR = _BV(SCK_PIN); humid_sht_available = FALSE; - humid_sht_status = SHT_IDLE; + humid_sht_status = SHT_IDLE; } #if 0 @@ -285,7 +285,7 @@ void humid_sht_periodic(void) { /* init humidity read */ s_connectionreset(); s_start_measure(HUMI); - humid_sht_status = SHT_MEASURING_HUMID; + humid_sht_status = SHT_MEASURING_HUMID; } else if (humid_sht_status == SHT_MEASURING_HUMID) { /* get data */ @@ -315,7 +315,7 @@ void humid_sht_periodic(void) { humid_sht_available = TRUE; s_connectionreset(); s_start_measure(HUMI); - humid_sht_status = SHT_MEASURING_HUMID; + humid_sht_status = SHT_MEASURING_HUMID; DOWNLINK_SEND_SHT_STATUS(DefaultChannel, &humidsht, &tempsht, &fhumidsht, &ftempsht); humid_sht_available = FALSE; } diff --git a/sw/airborne/modules/meteo/humid_sht.h b/sw/airborne/modules/meteo/humid_sht.h index 4fddb7a803..cdfbe421d0 100644 --- a/sw/airborne/modules/meteo/humid_sht.h +++ b/sw/airborne/modules/meteo/humid_sht.h @@ -22,7 +22,7 @@ #define HUMI 1 //adr command r/w -//000 0011 0 +//000 0011 0 #define STATUS_REG_W 0x06 //000 0011 1 #define STATUS_REG_R 0x07 diff --git a/sw/airborne/modules/meteo/humid_sht_i2c.c b/sw/airborne/modules/meteo/humid_sht_i2c.c index 4134e0a54b..a1554d64bd 100644 --- a/sw/airborne/modules/meteo/humid_sht_i2c.c +++ b/sw/airborne/modules/meteo/humid_sht_i2c.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -49,18 +49,18 @@ uint16_t humidsht, tempsht; float fhumidsht, ftempsht; int8_t humid_sht_crc(volatile uint8_t* data) { - uint8_t i, bit, crc = 0; + uint8_t i, bit, crc = 0; for (i = 0; i < 2; i++) { crc ^= (data[i]); for (bit = 8; bit > 0; bit--) { - if (crc & 0x80) + if (crc & 0x80) crc = (crc << 1) ^ 0x131; else crc = (crc << 1); } } - if (crc != data[2]) + if (crc != data[2]) return -1; else return 0; @@ -72,7 +72,7 @@ void humid_sht_init(void) { void humid_sht_periodic( void ) { switch (sht_status) { - + case SHT_UNINIT: /* do soft reset, then wait at least 15ms */ sht_status = SHT_RESET; diff --git a/sw/airborne/modules/meteo/light_temt.c b/sw/airborne/modules/meteo/light_temt.c index 5874c974ff..0a8d9fd7af 100644 --- a/sw/airborne/modules/meteo/light_temt.c +++ b/sw/airborne/modules/meteo/light_temt.c @@ -1,6 +1,6 @@ /* * $Id: light_temt.c $ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/meteo/temp_temod.c b/sw/airborne/modules/meteo/temp_temod.c index fdece884ca..6d34906f38 100644 --- a/sw/airborne/modules/meteo/temp_temod.c +++ b/sw/airborne/modules/meteo/temp_temod.c @@ -24,7 +24,7 @@ /** \file temp_temod.c * \brief Hygrosens TEMOD-I2C-Rx temperature sensor interface for PT1000 - * e.g. Heraeus PT 1000 M 222 KL. B + * e.g. Heraeus PT 1000 M 222 KL. B */ diff --git a/sw/airborne/modules/meteo/windturbine.c b/sw/airborne/modules/meteo/windturbine.c index c65df9806f..c482cb9cda 100644 --- a/sw/airborne/modules/meteo/windturbine.c +++ b/sw/airborne/modules/meteo/windturbine.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/meteo/windturbine.h b/sw/airborne/modules/meteo/windturbine.h index 3856c785bf..83cb316183 100644 --- a/sw/airborne/modules/meteo/windturbine.h +++ b/sw/airborne/modules/meteo/windturbine.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 Martin Mueller * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/multi/tcas.c b/sw/airborne/modules/multi/tcas.c index bffaf31561..7b2e239ce2 100644 --- a/sw/airborne/modules/multi/tcas.c +++ b/sw/airborne/modules/multi/tcas.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,13 +18,13 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file tcas.c * \brief Collision avoidance library - * + * */ #include "multi/tcas.h" diff --git a/sw/airborne/modules/multi/tcas.h b/sw/airborne/modules/multi/tcas.h index 97901afcf8..d4299f1d1c 100644 --- a/sw/airborne/modules/multi/tcas.h +++ b/sw/airborne/modules/multi/tcas.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2010 ENAC * * This file is part of paparazzi. @@ -18,13 +18,13 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file tcas.h * \brief Collision avoidance library - * + * */ #ifndef TCAS_H diff --git a/sw/airborne/modules/poles/nav_poles.c b/sw/airborne/modules/poles/nav_poles.c index 5663ad57f5..7a7558f9f4 100644 --- a/sw/airborne/modules/poles/nav_poles.c +++ b/sw/airborne/modules/poles/nav_poles.c @@ -20,7 +20,7 @@ bool nav_poles_init(uint8_t wp1, uint8_t wp2, WaypointX(wp2c) = WaypointX(wp2) - (x * SAFETY_MARGIN + y) * radius; WaypointY(wp2c) = WaypointY(wp2) - (y * SAFETY_MARGIN - x) * radius; - + WaypointX(wp1c) = WaypointX(wp1) + (x * SAFETY_MARGIN - y) * radius; WaypointY(wp1c) = WaypointY(wp1) + (y * SAFETY_MARGIN + x) * radius; diff --git a/sw/airborne/modules/sensors/baro_MS5534A.c b/sw/airborne/modules/sensors/baro_MS5534A.c index c2e187780e..d44dde9dc9 100644 --- a/sw/airborne/modules/sensors/baro_MS5534A.c +++ b/sw/airborne/modules/sensors/baro_MS5534A.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -205,9 +205,9 @@ static void calibration( void ) { c4 = words[2] >> 6; uint16_t c5 = ((words[0] & 0x1) << 10) | (words[1] >> 6); c6 = words[1] & 0x3f; - + ut1 = (c5 << 3) + 20224; - + #ifndef BARO_NO_DOWNLINK DOWNLINK_SEND_BARO_WORDS(DefaultChannel, &words[0], &words[1], &words[2], &words[3]); #endif diff --git a/sw/airborne/modules/sensors/baro_MS5534A.h b/sw/airborne/modules/sensors/baro_MS5534A.h index d928791ac8..9e4aa3420a 100644 --- a/sw/airborne/modules/sensors/baro_MS5534A.h +++ b/sw/airborne/modules/sensors/baro_MS5534A.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/modules/sensors/baro_bmp.h b/sw/airborne/modules/sensors/baro_bmp.h index 443c8b31f0..ff967980b3 100644 --- a/sw/airborne/modules/sensors/baro_bmp.h +++ b/sw/airborne/modules/sensors/baro_bmp.h @@ -26,7 +26,7 @@ #define BMP085_DAT_MSB 0xF6 #define BMP085_DAT_LSB 0xF7 #define BMP085_DAT_XLSB 0xF8 - + #define BARO_BMP_UNINIT 0 #define BARO_BMP_IDLE 1 #define BARO_BMP_START_TEMP 2 diff --git a/sw/airborne/modules/sensors/mag_micromag_fw.c b/sw/airborne/modules/sensors/mag_micromag_fw.c index 4f2fddf3c9..a1544a698a 100644 --- a/sw/airborne/modules/sensors/mag_micromag_fw.c +++ b/sw/airborne/modules/sensors/mag_micromag_fw.c @@ -46,7 +46,7 @@ void micromag_event( void ) { void micromag_init( void ) { micromag_hw_init(); - + uint8_t i; for (i=0; i * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include "booz_fms.h" @@ -44,7 +44,7 @@ void booz_fms_impl_init(void) { void booz_fms_impl_periodic(void) { switch (fms_test_signal.mode) { - + case STEP_ROLL: { if (fms_test_signal.counter < fms_test_signal.period) { EULERS_ASSIGN(fms.input.h_sp.attitude, fms_test_signal.amplitude, 0, 0); @@ -66,13 +66,13 @@ void booz_fms_impl_periodic(void) { case STEP_PITCH: case STEP_VERT: break; -#if 0 +#if 0 case BOOZ_FMS_TEST_SIGNAL_MODE_VERTICAL: { if (guidance_v_mode < GUIDANCE_V_MODE_HOVER) booz_fms_test_signal_start_z = ins_ltp_pos.z; else { booz_fms_input.v_sp.height = (booz_fms_test_signal_counter < booz_fms_test_signal_period) ? - booz_fms_test_signal_start_z : + booz_fms_test_signal_start_z : booz_fms_test_signal_start_z - 256; //BOOZ_INT_OF_FLOAT(-0.5, IPOS_FRAC) } diff --git a/sw/airborne/modules/vehicle_interface/vi_test_signal.h b/sw/airborne/modules/vehicle_interface/vi_test_signal.h index eaf2fedef1..e6d0ca4ba9 100644 --- a/sw/airborne/modules/vehicle_interface/vi_test_signal.h +++ b/sw/airborne/modules/vehicle_interface/vi_test_signal.h @@ -1,6 +1,6 @@ /* * $Id: booz_fms_test_signal.h 3976 2009-08-21 01:30:22Z poine $ - * + * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef BOOZ_FMS_TEST_SIGNAL_H diff --git a/sw/airborne/nav.c b/sw/airborne/nav.c index 3f02a3f485..8bf5714827 100644 --- a/sw/airborne/nav.c +++ b/sw/airborne/nav.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file nav.c @@ -124,7 +124,7 @@ void nav_circle_XY(float x, float y, float radius) { radius += -nav_shift; float abs_radius = fabs(radius); - + /** Computes a prebank. Go straight if inside or outside the circle */ circle_bank = (dist2_center > Square(abs_radius + dist_carrot) @@ -235,7 +235,7 @@ static inline bool_t nav_compute_baseleg(uint8_t wp_af, uint8_t wp_td, uint8_t w waypoints[wp_baseleg].y = waypoints[wp_af].y - x_1 * nav_radius; waypoints[wp_baseleg].a = waypoints[wp_af].a; baseleg_out_qdr = M_PI - atan2(-y_1, -x_1); - if (nav_radius < 0) + if (nav_radius < 0) baseleg_out_qdr += M_PI; return FALSE; @@ -269,7 +269,7 @@ static inline bool_t compute_TOD(uint8_t _af, uint8_t _td, uint8_t _tod, float g -static inline void nav_follow(uint8_t _ac_id, float _distance, float _height) { +static inline void nav_follow(uint8_t _ac_id, float _distance, float _height) { struct ac_info_ * ac = get_ac_info(_ac_id); NavVerticalAutoThrottleMode(0.); NavVerticalAltitudeMode(Max(ac->alt + _height, ground_alt+SECURITY_HEIGHT), 0.); @@ -294,7 +294,7 @@ float fp_pitch; /* deg */ /** \brief Decide if the UAV is approaching the current waypoint. * Computes \a dist2_to_wp and compare it to square \a carrot. - * Return true if it is smaller. Else computes by scalar products if + * Return true if it is smaller. Else computes by scalar products if * uav has not gone past waypoint. * Return true if it is the case. */ @@ -310,7 +310,7 @@ bool_t nav_approaching_xy(float x, float y, float from_x, float from_y, float ap return TRUE; float scal_prod = (x - from_x) * pw_x + (y - from_y) * pw_y; - + return (scal_prod < 0.); } @@ -318,8 +318,8 @@ bool_t nav_approaching_xy(float x, float y, float from_x, float from_y, float ap /** * \brief Computes \a desired_x, \a desired_y and \a desired_course. */ -//static inline void fly_to_xy(float x, float y) { -void fly_to_xy(float x, float y) { +//static inline void fly_to_xy(float x, float y) { +void fly_to_xy(float x, float y) { desired_x = x; desired_y = y; if (nav_mode == NAV_MODE_COURSE) { @@ -380,7 +380,7 @@ static void nav_set_altitude(void) { /** \brief Home mode navigation (circle around HOME) */ void nav_home(void) { NavCircleWaypoint(WP_HOME, FAILSAFE_HOME_RADIUS); - /** Nominal speed */ + /** Nominal speed */ nav_pitch = 0.; v_ctl_mode = V_CTL_MODE_AUTO_ALT; nav_altitude = ground_alt+SECURITY_HEIGHT; @@ -389,7 +389,7 @@ void nav_home(void) { nav_set_altitude(); } -/** +/** * \brief Navigation main: call to the code generated from the XML flight * plan */ @@ -425,14 +425,14 @@ void nav_init(void) { nav_mode = NAV_MODE_COURSE; #ifdef NAV_GROUND_SPEED_PGAIN - nav_ground_speed_pgain = NAV_GROUND_SPEED_PGAIN; + nav_ground_speed_pgain = NAV_GROUND_SPEED_PGAIN; nav_ground_speed_setpoint = NOMINAL_AIRSPEED; #endif } -/** +/** * \brief Failsafe navigation without position estimation - * + * * Just set attitude and throttle to FAILSAFE values * to prevent the plane from crashing. */ @@ -492,7 +492,7 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { } /* The other center */ - struct point c2 = { + struct point c2 = { waypoints[target].x - d*u_x, waypoints[target].y - d*u_y, alt }; @@ -505,7 +505,7 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { waypoints[c1].x - radius * -u_y, waypoints[c1].y - radius * u_x, alt }; - + struct point c2_in = { c2.x + radius * -u_y, c2.y + radius * u_x, @@ -514,11 +514,11 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { c2.x - radius * -u_y, c2.y - radius * u_x, alt }; - + float qdr_out = M_PI - atan2(u_y, u_x); if (radius < 0) qdr_out += M_PI; - + switch (eight_status) { case C1 : NavCircleWaypoint(c1, radius); @@ -530,7 +530,7 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { case R1T: nav_route_xy(c1_out.x, c1_out.y, c2_in.x, c2_in.y); - if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c1_out.x, c1_out.y, 0)) { + if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c1_out.x, c1_out.y, 0)) { eight_status = RT2; InitStage(); } @@ -538,7 +538,7 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { case RT2: nav_route_xy(c1_out.x, c1_out.y, c2_in.x, c2_in.y); - if (nav_approaching_xy(c2_in.x, c2_in.y, c1_out.x, c1_out.y, CARROT)) { + if (nav_approaching_xy(c2_in.x, c2_in.y, c1_out.x, c1_out.y, CARROT)) { eight_status = C2; InitStage(); } @@ -551,10 +551,10 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { InitStage(); } return; - + case R2T: nav_route_xy(c2_out.x, c2_out.y, c1_in.x, c1_in.y); - if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c2_out.x, c2_out.y, 0)) { + if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c2_out.x, c2_out.y, 0)) { eight_status = RT1; InitStage(); } @@ -562,7 +562,7 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { case RT1: nav_route_xy(c2_out.x, c2_out.y, c1_in.x, c1_in.y); - if (nav_approaching_xy(c1_in.x, c1_in.y, c2_out.x, c2_out.y, CARROT)) { + if (nav_approaching_xy(c1_in.x, c1_in.y, c2_out.x, c2_out.y, CARROT)) { eight_status = C1; InitStage(); } @@ -576,9 +576,9 @@ void nav_eight(uint8_t target, uint8_t c1, float radius) { /************** Oval Navigation **********************************************/ /** Navigation along a figure O. One side leg is defined by waypoints [p1] and - [p2]. + [p2]. The navigation goes through 4 states: OC1 (half circle next to [p1]), - OR21 (route [p2] to [p1], OC2 (half circle next to [p2]) and OR12 + OR21 (route [p2] to [p1], OC2 (half circle next to [p2]) and OR12 (opposite leg). Initial state is the route along the desired segment (OC2). @@ -612,14 +612,14 @@ void nav_oval(uint8_t p1, uint8_t p2, float radius) { struct point p1_out = { waypoints[p1].x + 2*radius * -u_y, waypoints[p1].y + 2*radius * u_x, alt }; - + struct point p2_in = { waypoints[p2].x + 2*radius * -u_y, waypoints[p2].y + 2*radius * u_x, alt }; struct point p2_center = { waypoints[p2].x + radius * -u_y, waypoints[p2].y + radius * u_x, alt }; - + float qdr_out_2 = M_PI - atan2(u_y, u_x); float qdr_out_1 = qdr_out_2 + M_PI; if (radius < 0) { @@ -627,7 +627,7 @@ void nav_oval(uint8_t p1, uint8_t p2, float radius) { qdr_out_1 += M_PI; } float qdr_anticipation = (radius > 0 ? -15 : 15); - + switch (oval_status) { case OC1 : nav_circle_XY(p1_center.x,p1_center.y, -radius); @@ -640,7 +640,7 @@ void nav_oval(uint8_t p1, uint8_t p2, float radius) { case OR12: nav_route_xy(p1_out.x, p1_out.y, p2_in.x, p2_in.y); - if (nav_approaching_xy(p2_in.x, p2_in.y, p1_out.x, p1_out.y, CARROT)) { + if (nav_approaching_xy(p2_in.x, p2_in.y, p1_out.x, p1_out.y, CARROT)) { oval_status = OC2; nav_oval_count++; InitStage(); @@ -659,7 +659,7 @@ void nav_oval(uint8_t p1, uint8_t p2, float radius) { case OR21: nav_route_xy(waypoints[p2].x, waypoints[p2].y, waypoints[p1].x, waypoints[p1].y); - if (nav_approaching_xy(waypoints[p1].x, waypoints[p1].y, waypoints[p2].x, waypoints[p2].y, CARROT)) { + if (nav_approaching_xy(waypoints[p1].x, waypoints[p1].y, waypoints[p2].x, waypoints[p2].y, CARROT)) { oval_status = OC1; InitStage(); LINE_STOP_FUNCTION; diff --git a/sw/airborne/obsolete/max1167.h b/sw/airborne/obsolete/max1167.h index 0cf4451414..ba0a4bd13e 100644 --- a/sw/airborne/obsolete/max1167.h +++ b/sw/airborne/obsolete/max1167.h @@ -10,7 +10,7 @@ extern void max1167_read( void ); #define STA_MAX1167_IDLE 0 #define STA_MAX1167_SENDING_REQ 1 -#define STA_MAX1167_READING_RES 2 +#define STA_MAX1167_READING_RES 2 #define STA_MAX1167_DATA_AVAILABLE 3 extern volatile uint8_t max1167_status; diff --git a/sw/airborne/pprz_transport.c b/sw/airborne/pprz_transport.c index 5495db5cac..7985e6decd 100644 --- a/sw/airborne/pprz_transport.c +++ b/sw/airborne/pprz_transport.c @@ -1,6 +1,6 @@ /* * Paparazzi mcu0 $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/pprz_transport.h b/sw/airborne/pprz_transport.h index 5cd6538767..8df145dd90 100644 --- a/sw/airborne/pprz_transport.h +++ b/sw/airborne/pprz_transport.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -200,7 +200,7 @@ static inline void parse_pprz( uint8_t c ) { static inline void pprz_parse_payload(void) { uint8_t i; - for(i = 0; i < pprz_payload_len; i++) + for(i = 0; i < pprz_payload_len; i++) dl_buffer[i] = pprz_payload[i]; dl_msg_available = TRUE; } diff --git a/sw/airborne/print.h b/sw/airborne/print.h index b35db70d6c..6b1dbc95d9 100644 --- a/sw/airborne/print.h +++ b/sw/airborne/print.h @@ -1,6 +1,6 @@ /* * Paparazzi $I$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/rc_settings.c b/sw/airborne/rc_settings.c index 1b0022476c..e452b94fe1 100644 --- a/sw/airborne/rc_settings.c +++ b/sw/airborne/rc_settings.c @@ -1,7 +1,7 @@ /* * $Id$ * Flight-time calibration facility - * + * * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -19,7 +19,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/rc_settings.h b/sw/airborne/rc_settings.h index a8120f8425..b8680e6665 100644 --- a/sw/airborne/rc_settings.h +++ b/sw/airborne/rc_settings.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2006- Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,13 +18,13 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file rc_settings.h - * \brief Variable setting though the radio control + * \brief Variable setting though the radio control * * The 'rc_control' section of a XML flight plan allows the user to change the * value of an autopilot internal variable through the rc transmitter. diff --git a/sw/airborne/sd_card/main.c b/sw/airborne/sd_card/main.c index fd4d58a4f1..7335abe956 100644 --- a/sw/airborne/sd_card/main.c +++ b/sw/airborne/sd_card/main.c @@ -72,12 +72,12 @@ void dl_parse_msg(void) { uint8_t msg_id = IdOfMsg(dl_buffer); switch (msg_id) { - + case DL_PING: { DOWNLINK_SEND_PONG(); break; } - + case DL_SETTING : { uint8_t i = DL_SETTING_index(dl_buffer); float var = DL_SETTING_value(dl_buffer); diff --git a/sw/airborne/sd_card/sd_card.c b/sw/airborne/sd_card/sd_card.c index 73da4b9848..fb66943c1c 100644 --- a/sw/airborne/sd_card/sd_card.c +++ b/sw/airborne/sd_card/sd_card.c @@ -1,6 +1,6 @@ /* * $Id: wt_baro.c 2752 2008-10-09 07:51:24Z gautier $ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file +/** \file * \brief * */ diff --git a/sw/airborne/sd_card/sd_card.h b/sw/airborne/sd_card/sd_card.h index cb7a6136f1..01eece3df6 100644 --- a/sw/airborne/sd_card/sd_card.h +++ b/sw/airborne/sd_card/sd_card.h @@ -1,6 +1,6 @@ /* * $Id: wt_baro.h 2752 2008-10-09 07:51:24Z gautier $ - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -18,11 +18,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** \file +/** \file * \brief * */ diff --git a/sw/airborne/setup_actuators.c b/sw/airborne/setup_actuators.c index df13d47f90..c4c091b1ce 100644 --- a/sw/airborne/setup_actuators.c +++ b/sw/airborne/setup_actuators.c @@ -42,7 +42,7 @@ void dl_parse_msg( void ) { float val = settings_get_value(i); DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val); } -#endif +#endif } #define PprzUartInit() Link(Init()) @@ -71,7 +71,7 @@ void periodic_task_fbw(void) { /* t += 1./60.; */ /* uint16_t servo_value = 1500+ 500*sin(t); */ /* SetServo(SERVO_THROTTLE, servo_value); */ - + RunOnceEvery(300, DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM)); RunOnceEvery(300, DOWNLINK_SEND_ACTUATORS(DefaultChannel, SERVOS_NB, actuators )); } @@ -84,7 +84,7 @@ void event_task_fbw(void) { pprz_msg_received = FALSE; pprz_parse_payload(); LED_TOGGLE(3); - } + } if (dl_msg_available) { dl_parse_msg(); dl_msg_available = FALSE; diff --git a/sw/airborne/snav.c b/sw/airborne/snav.c index 0170bdb167..c30df19b73 100644 --- a/sw/airborne/snav.c +++ b/sw/airborne/snav.c @@ -60,16 +60,16 @@ bool_t snav_init(uint8_t a, float desired_course_rad, float radius) { u_y = wp_ca.y - wp_cd.y; cd_ca = sqrt(u_x*u_x+u_y*u_y); } - + u_x /= cd_ca; u_y /= cd_ca; - + if (a_radius * d_radius > 0) { /* Both arcs are in the same direction */ /* CD_TD orthogonal to CD_CA */ wp_td.x = wp_cd.x - d_radius * u_y; wp_td.y = wp_cd.y + d_radius * u_x; - + /* CA_TA also orthogonal to CD_CA */ wp_ta.x = wp_ca.x - a_radius * u_y; wp_ta.y = wp_ca.y + a_radius * u_x; @@ -78,7 +78,7 @@ bool_t snav_init(uint8_t a, float desired_course_rad, float radius) { float alpha = atan2(u_y, u_x) + acos(d_radius/(cd_ca/2)); wp_td.x = wp_cd.x + d_radius * cos(alpha); wp_td.y = wp_cd.y + d_radius * sin(alpha); - + wp_ta.x = wp_ca.x + a_radius * cos(alpha); wp_ta.y = wp_ca.y + a_radius * sin(alpha); } @@ -87,7 +87,7 @@ bool_t snav_init(uint8_t a, float desired_course_rad, float radius) { wp_td.a = wp_cd.a; wp_ta.a = wp_ca.a; ground_speed_timer = 0; - + return FALSE; } @@ -105,7 +105,7 @@ bool_t snav_route(void) { NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(wp_cd.a, 0.); nav_route_xy(wp_td.x, wp_td.y, wp_ta.x, wp_ta.y); - + return (! nav_approaching_xy(wp_ta.x, wp_ta.y, wp_td.x, wp_td.y, CARROT)); } @@ -183,7 +183,7 @@ bool_t snav_on_time(float nominal_radius) { float radius = remaining_time / nominal_time * nominal_radius; if (radius > 2. * nominal_radius) radius = nominal_radius; - + NavVerticalAutoThrottleMode(0); /* No pitch */ NavVerticalAltitudeMode(wp_cd.a, 0.); @@ -191,7 +191,7 @@ bool_t snav_on_time(float nominal_radius) { wp_ca.x = WaypointX(wp_a) + radius * u_a_ca_x; wp_ca.y = WaypointY(wp_a) + radius * u_a_ca_y; nav_circle_XY(wp_ca.x, wp_ca.y, radius); - + /* Stay in this mode until the end of time */ return(remaining_time > 0); } diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c index c69a6e6285..90e8823e4a 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c @@ -44,15 +44,15 @@ struct AhrsFloatCmplRmat ahrs_impl; void ahrs_init(void) { ahrs_float.status = AHRS_UNINIT; - - /* + + /* * Initialises our IMU alignement variables * This should probably done in the IMU code instead */ struct FloatEulers body_to_imu_euler = - {IMU_BODY_TO_IMU_PHI, IMU_BODY_TO_IMU_THETA, IMU_BODY_TO_IMU_PSI}; - FLOAT_QUAT_OF_EULERS(ahrs_impl.body_to_imu_quat, body_to_imu_euler); - FLOAT_RMAT_OF_EULERS(ahrs_impl.body_to_imu_rmat, body_to_imu_euler); + {IMU_BODY_TO_IMU_PHI, IMU_BODY_TO_IMU_THETA, IMU_BODY_TO_IMU_PSI}; + FLOAT_QUAT_OF_EULERS(ahrs_impl.body_to_imu_quat, body_to_imu_euler); + FLOAT_RMAT_OF_EULERS(ahrs_impl.body_to_imu_rmat, body_to_imu_euler); /* set ltp_to_body to zero */ FLOAT_QUAT_ZERO(ahrs_float.ltp_to_body_quat); @@ -90,7 +90,7 @@ void ahrs_align(void) { void ahrs_propagate(void) { - + /* converts gyro to floating point */ struct FloatRates gyro_float; RATES_FLOAT_OF_BFP(gyro_float, imu.gyro_prev); @@ -140,7 +140,7 @@ void ahrs_update_accel(void) { const float gravity_bias_update_gain = -5e-6; FLOAT_RATES_ADD_SCALED_VECT(ahrs_impl.gyro_bias, residual, weight*gravity_bias_update_gain); /* FIXME: saturate bias */ - + } void ahrs_update_mag(void) { @@ -190,13 +190,13 @@ void ahrs_update_mag2(void) { } -/* +/* * Compute ltp to imu rotation in euler angles and quaternion representations - * from the rotation matrice representation + * from the rotation matrice representation */ static inline void compute_imu_quat_and_euler_from_rmat(void) { FLOAT_QUAT_OF_RMAT(ahrs_float.ltp_to_imu_quat, ahrs_float.ltp_to_imu_rmat); - FLOAT_EULERS_OF_RMAT(ahrs_float.ltp_to_imu_euler, ahrs_float.ltp_to_imu_rmat); + FLOAT_EULERS_OF_RMAT(ahrs_float.ltp_to_imu_euler, ahrs_float.ltp_to_imu_rmat); } /* @@ -204,9 +204,9 @@ static inline void compute_imu_quat_and_euler_from_rmat(void) { */ static inline void compute_body_orientation_and_rates(void) { - FLOAT_QUAT_COMP_INV(ahrs_float.ltp_to_body_quat, + FLOAT_QUAT_COMP_INV(ahrs_float.ltp_to_body_quat, ahrs_float.ltp_to_imu_quat, ahrs_impl.body_to_imu_quat); - FLOAT_RMAT_COMP_INV(ahrs_float.ltp_to_body_rmat, + FLOAT_RMAT_COMP_INV(ahrs_float.ltp_to_body_rmat, ahrs_float.ltp_to_imu_rmat, ahrs_impl.body_to_imu_rmat); FLOAT_EULERS_OF_RMAT(ahrs_float.ltp_to_body_euler, ahrs_float.ltp_to_body_rmat); FLOAT_RMAT_TRANSP_RATEMULT(ahrs_float.body_rate, ahrs_impl.body_to_imu_rmat, ahrs_float.imu_rate); diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.h b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.h index 1fa539e558..ba5aaa553c 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.h +++ b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.h @@ -27,8 +27,8 @@ struct AhrsFloatCmplRmat { struct FloatRates gyro_bias; struct FloatRates rate_correction; - /* - Holds float version of IMU alignement + /* + Holds float version of IMU alignement in order to be able to run against the fixed point version of the IMU */ diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_utils.h b/sw/airborne/subsystems/ahrs/ahrs_float_utils.h index b06fe4ed8e..679f0774b5 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_utils.h +++ b/sw/airborne/subsystems/ahrs/ahrs_float_utils.h @@ -4,10 +4,10 @@ static inline void ahrs_float_get_euler_from_accel_mag(struct FloatEulers* e, struct Int32Vect3* accel, struct Int32Vect3* mag) { /* get phi and theta from accelerometer */ struct FloatVect3 accelf; - ACCELS_FLOAT_OF_BFP(accelf, *accel); + ACCELS_FLOAT_OF_BFP(accelf, *accel); const float phi = atan2f(-accelf.y, -accelf.z); const float cphi = cosf(phi); - const float theta = atan2f(cphi*accelf.x, -accelf.z); + const float theta = atan2f(cphi*accelf.x, -accelf.z); /* get psi from magnetometer */ /* project mag on local tangeant plane */ struct FloatVect3 magf; diff --git a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c index 547981e0e8..80bdfaa72d 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c +++ b/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c @@ -65,12 +65,12 @@ void ahrs_init(void) { } void ahrs_align(void) { - + get_phi_theta_measurement_fom_accel(&ahrs_impl.hi_res_euler.phi, &ahrs_impl.hi_res_euler.theta, ahrs_aligner.lp_accel); - get_psi_measurement_from_mag(&ahrs_impl.hi_res_euler.psi, + get_psi_measurement_from_mag(&ahrs_impl.hi_res_euler.psi, ahrs_impl.hi_res_euler.phi/F_UPDATE, ahrs_impl.hi_res_euler.theta/F_UPDATE, ahrs_aligner.lp_mag); - EULERS_COPY(ahrs_impl.measure, ahrs_impl.hi_res_euler); + EULERS_COPY(ahrs_impl.measure, ahrs_impl.hi_res_euler); EULERS_COPY(ahrs_impl.measurement, ahrs_impl.hi_res_euler); /* Compute LTP to IMU eulers */ @@ -133,7 +133,7 @@ void ahrs_propagate(void) { /* Compute LTP to IMU eulers */ EULERS_SDIV(ahrs.ltp_to_imu_euler, ahrs_impl.hi_res_euler, F_UPDATE); - + compute_imu_quat_and_rmat_from_euler(); compute_body_orientation(); @@ -150,7 +150,7 @@ void ahrs_update_accel(void) { void ahrs_update_mag(void) { get_psi_measurement_from_mag(&ahrs_impl.measurement.psi, ahrs.ltp_to_imu_euler.phi, ahrs.ltp_to_imu_euler.theta, imu.mag); - + } /* measures phi and theta assuming no dynamic acceleration ?!! */ @@ -168,7 +168,7 @@ static inline void get_phi_theta_measurement_fom_accel(int32_t* phi_meas, int32_ /* measure psi by projecting magnetic vector in local tangeant plan */ static inline void get_psi_measurement_from_mag(int32_t* psi_meas, int32_t phi_est, int32_t theta_est, struct Int32Vect3 mag) { - + int32_t sphi; PPRZ_ITRIG_SIN(sphi, phi_est); int32_t cphi; @@ -197,12 +197,12 @@ static inline void get_psi_measurement_from_mag(int32_t* psi_meas, int32_t phi_e /* Compute ltp to imu rotation in quaternion and rotation matrice representation from the euler angle representation */ static inline void compute_imu_quat_and_rmat_from_euler(void) { - + /* Compute LTP to IMU quaternion */ INT32_QUAT_OF_EULERS(ahrs.ltp_to_imu_quat, ahrs.ltp_to_imu_euler); /* Compute LTP to IMU rotation matrix */ INT32_RMAT_OF_EULERS(ahrs.ltp_to_imu_rmat, ahrs.ltp_to_imu_euler); - + } static inline void compute_body_orientation(void) { diff --git a/sw/airborne/sys_time.h b/sw/airborne/sys_time.h index afd290da19..a665e88c5c 100644 --- a/sw/airborne/sys_time.h +++ b/sw/airborne/sys_time.h @@ -23,7 +23,7 @@ */ /* - *\brief architecture independant timing functions + *\brief architecture independant timing functions * */ diff --git a/sw/airborne/test/ahrs/run_ahrs_on_flight_log.c b/sw/airborne/test/ahrs/run_ahrs_on_flight_log.c index f3b16af416..c58cadcc9e 100644 --- a/sw/airborne/test/ahrs/run_ahrs_on_flight_log.c +++ b/sw/airborne/test/ahrs/run_ahrs_on_flight_log.c @@ -152,7 +152,7 @@ static void feed_imu(int i) { /* * */ -#if defined AHRS_TYPE && AHRS_TYPE == AHRS_TYPE_FLQ +#if defined AHRS_TYPE && AHRS_TYPE == AHRS_TYPE_FLQ static void store_filter_output(int i) { #ifdef OUTPUT_IN_BODY_FRAME QUAT_COPY(output[i].quat_est, ahrs_float.ltp_to_body_quat); @@ -197,9 +197,9 @@ static void dump_output(const char* filename) { FILE* fd = fopen(filename, "w"); int i; for (i=0; i * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include @@ -77,9 +77,9 @@ static inline void main_event_task( void ) { } static inline void on_mag(void) { - LED_TOGGLE(4); + LED_TOGGLE(4); ami601_status = AMI601_IDLE; struct Int32Vect3 bla = {ami601_values[0], ami601_values[1], ami601_values[2]}; DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, &bla.x, &bla.y, &bla.z); - + } diff --git a/sw/airborne/test/test_algebra.c b/sw/airborne/test/test_algebra.c index b72960d8cb..b8b7ce4d8b 100644 --- a/sw/airborne/test/test_algebra.c +++ b/sw/airborne/test/test_algebra.c @@ -77,7 +77,7 @@ static void test_1(void) { struct Int32Eulers euler_i; EULERS_BFP_OF_REAL(euler_i, euler_f); DISPLAY_INT32_EULERS("euler_i", euler_i); - + struct FloatQuat quat_f; FLOAT_QUAT_OF_EULERS(quat_f, euler_f); DISPLAY_FLOAT_QUAT("quat_f", quat_f); @@ -89,12 +89,12 @@ static void test_1(void) { struct Int32RMat rmat_i; INT32_RMAT_OF_QUAT(rmat_i, quat_i); DISPLAY_INT32_RMAT("rmat_i", rmat_i); - + } static void test_2(void) { - + struct Int32Vect3 v1 = { 5000, 5000, 5000 }; DISPLAY_INT32_VECT3("v1", v1); @@ -173,7 +173,7 @@ static void test_3(void) { struct Int32Quat l2i_q; INT32_QUAT_OF_EULERS(l2i_q, l2i_e); DISPLAY_INT32_QUAT_AS_EULERS_DEG("l2i_q", l2i_q); - + /* Compute LTP to IMU rotation matrix */ struct Int32RMat l2i_r; INT32_RMAT_OF_EULERS(l2i_r, l2i_e); @@ -214,7 +214,7 @@ static void test_3(void) { struct Int32Eulers l2b_e2; INT32_EULERS_OF_QUAT(l2b_e2, l2b_q); DISPLAY_INT32_EULERS_AS_FLOAT_DEG("l2b_e2", l2b_e2); - + } @@ -240,7 +240,7 @@ static void test_4_int(void) { INT32_EULERS_OF_QUAT(_e2, _q); DISPLAY_INT32_EULERS_AS_FLOAT_DEG("back to euler ", _e2); - + } @@ -288,7 +288,7 @@ static void test_5(void) { float test_eulers_of_quat(struct FloatQuat fq, int display) { - + struct FloatEulers fe; FLOAT_EULERS_OF_QUAT(fe, fq); struct Int32Quat iq; @@ -300,7 +300,7 @@ float test_eulers_of_quat(struct FloatQuat fq, int display) { EULERS_SUB(fe2, ie); float norm_err = FLOAT_EULERS_NORM(fe2); - if (display) { + if (display) { printf("euler of quat\n"); DISPLAY_FLOAT_QUAT("fq", fq); DISPLAY_FLOAT_EULERS_DEG("fe", fe); @@ -325,7 +325,7 @@ float test_eulers_of_rmat(struct FloatRMat frm, int display) { EULERS_SUB(fe2, ie); float norm_err = FLOAT_EULERS_NORM(fe2); - if (display) { + if (display) { printf("euler of rmat\n"); // DISPLAY_FLOAT_RMAT("fr", fr); DISPLAY_FLOAT_EULERS_DEG("fe", fe); @@ -349,17 +349,17 @@ static void test_6(void) { struct FloatEulers eb2c; EULERS_ASSIGN(eb2c, RadOfDeg(0.), RadOfDeg(0.), RadOfDeg(90.)); DISPLAY_FLOAT_EULERS_DEG("eb2c", eb2c); - struct FloatRMat fa2b; + struct FloatRMat fa2b; FLOAT_RMAT_OF_EULERS(fa2b, ea2b); - struct FloatRMat fb2c; + struct FloatRMat fb2c; FLOAT_RMAT_OF_EULERS(fb2c, eb2c); printf("\n"); test_rmat_comp(fa2b, fb2c, 1); - struct FloatQuat qa2b; + struct FloatQuat qa2b; FLOAT_QUAT_OF_EULERS(qa2b, ea2b); - struct FloatQuat qb2c; + struct FloatQuat qb2c; FLOAT_QUAT_OF_EULERS(qb2c, eb2c); printf("\n"); @@ -385,12 +385,12 @@ float test_rmat_comp(struct FloatRMat ma2b_f, struct FloatRMat mb2c_f, int displ RMAT_DIFF(err, ma2c_f, ma2c_i); float norm_err = FLOAT_RMAT_NORM(err); - if (display) { + if (display) { printf("rmap comp\n"); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("a2cf", ma2c_f); DISPLAY_INT32_RMAT_AS_EULERS_DEG("a2ci", ma2c_i); } - + return norm_err; } @@ -411,12 +411,12 @@ float test_quat_comp(struct FloatQuat qa2b_f, struct FloatQuat qb2c_f, int displ QUAT_DIFF(err, qa2c_f, qa2c_i); float norm_err = FLOAT_QUAT_NORM(err); - if (display) { + if (display) { printf("quat comp\n"); DISPLAY_FLOAT_QUAT_AS_EULERS_DEG("a2cf", qa2c_f); DISPLAY_INT32_QUAT_AS_EULERS_DEG("a2ci", qa2c_i); } - + return norm_err; } @@ -424,9 +424,9 @@ float test_quat_comp(struct FloatQuat qa2b_f, struct FloatQuat qb2c_f, int displ static void test_7(void) { - - + + @@ -434,21 +434,21 @@ static void test_7(void) { struct FloatEulers ea2c; EULERS_ASSIGN(ea2c, RadOfDeg(29.742755), RadOfDeg(-40.966522), RadOfDeg(69.467265)); DISPLAY_FLOAT_EULERS_DEG("ea2c", ea2c); - + struct FloatEulers eb2c; EULERS_ASSIGN(eb2c, RadOfDeg(0.), RadOfDeg(0.), RadOfDeg(90.)); DISPLAY_FLOAT_EULERS_DEG("eb2c", eb2c); - struct FloatRMat fa2c; + struct FloatRMat fa2c; FLOAT_RMAT_OF_EULERS(fa2c, ea2c); - struct FloatRMat fb2c; + struct FloatRMat fb2c; FLOAT_RMAT_OF_EULERS(fb2c, eb2c); printf("\n"); test_rmat_comp_inv(fa2c, fb2c, 1); - struct FloatQuat qa2c; + struct FloatQuat qa2c; FLOAT_QUAT_OF_EULERS(qa2c, ea2c); - struct FloatQuat qb2c; + struct FloatQuat qb2c; FLOAT_QUAT_OF_EULERS(qb2c, eb2c); printf("\n"); @@ -492,14 +492,14 @@ static void test_9(void) { } static void test_10(void) { - + struct FloatEulers euler; EULERS_ASSIGN(euler , RadOfDeg(0.), RadOfDeg(10.), RadOfDeg(0.)); DISPLAY_FLOAT_EULERS_DEG("euler", euler); struct FloatQuat quat; FLOAT_QUAT_OF_EULERS(quat, euler); DISPLAY_FLOAT_QUAT("####quat", quat); - + struct Int32Eulers euleri; EULERS_BFP_OF_REAL(euleri, euler); DISPLAY_INT32_EULERS("euleri", euleri); @@ -509,11 +509,11 @@ static void test_10(void) { struct Int32RMat rmati; INT32_RMAT_OF_EULERS(rmati, euleri); DISPLAY_INT32_RMAT("####rmat", rmati); - + struct Int32Quat quat_ltp_to_body; struct Int32Quat body_to_imu_quat; INT32_QUAT_ZERO( body_to_imu_quat); - + INT32_QUAT_COMP_INV(quat_ltp_to_body, body_to_imu_quat, quati); DISPLAY_INT32_QUAT("####quat_ltp_to_body", quat_ltp_to_body); @@ -535,12 +535,12 @@ float test_rmat_comp_inv(struct FloatRMat ma2c_f, struct FloatRMat mb2c_f, int d RMAT_DIFF(err, ma2b_f, ma2b_i); float norm_err = FLOAT_RMAT_NORM(err); - if (display) { + if (display) { printf("rmap comp_inv\n"); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("a2cf", ma2b_f); DISPLAY_INT32_RMAT_AS_EULERS_DEG("a2ci", ma2b_i); } - + return norm_err; } @@ -560,12 +560,12 @@ float test_quat_comp_inv(struct FloatQuat qa2c_f, struct FloatQuat qb2c_f, int d QUAT_DIFF(err, qa2b_f, qa2b_i); float norm_err = FLOAT_QUAT_NORM(err); - if (display) { + if (display) { printf("quat comp_inv\n"); DISPLAY_FLOAT_QUAT_AS_EULERS_DEG("a2bf", qa2b_f); DISPLAY_INT32_QUAT_AS_EULERS_DEG("a2bi", qa2b_i); } - + return norm_err; } @@ -590,7 +590,7 @@ void test_of_axis_angle(void) { DISPLAY_FLOAT_RMAT("rmat1", my_r1); struct FloatMat33 my_r; - FLOAT_RMAT_OF_AXIS_ANGLE(my_r, axis, angle); + FLOAT_RMAT_OF_AXIS_ANGLE(my_r, axis, angle); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat", my_r); DISPLAY_FLOAT_RMAT("rmat", my_r); @@ -624,7 +624,7 @@ void test_of_axis_angle(void) { FLOAT_RMAT_OF_EULERS(rmat1, eul); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat1", rmat1); DISPLAY_FLOAT_RMAT("rmat1", rmat1); - + } float test_quat_of_rmat(void) { @@ -632,7 +632,7 @@ float test_quat_of_rmat(void) { // struct FloatEulers eul = {-0.280849, 0.613423, -1.850440}; struct FloatEulers eul = {RadOfDeg(0.131579), RadOfDeg(-62.397659), RadOfDeg(-110.470299)}; // struct FloatEulers eul = {RadOfDeg(0.13), RadOfDeg(180.), RadOfDeg(-61.)}; - + struct FloatMat33 rm; FLOAT_RMAT_OF_EULERS(rm, eul); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat", rm); @@ -651,13 +651,13 @@ float test_quat_of_rmat(void) { struct FloatMat33 r_att; struct FloatEulers e312 = { eul.phi, eul.theta, eul.psi }; - FLOAT_RMAT_OF_EULERS_312(r_att, e312); + FLOAT_RMAT_OF_EULERS_312(r_att, e312); DISPLAY_FLOAT_RMAT("r_att ", r_att); DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("r_att ", r_att); struct FloatQuat q_att; FLOAT_QUAT_OF_RMAT(q_att, r_att); - + struct FloatEulers e_att; FLOAT_EULERS_OF_RMAT(e_att, r_att); DISPLAY_FLOAT_EULERS_DEG("of rmat", e_att); @@ -673,19 +673,19 @@ float test_rmat_of_eulers_312(void) { struct FloatEulers eul312_f; EULERS_ASSIGN(eul312_f, RadOfDeg(45.), RadOfDeg(22.), RadOfDeg(0.)); - DISPLAY_FLOAT_EULERS_DEG("eul312_f", eul312_f); + DISPLAY_FLOAT_EULERS_DEG("eul312_f", eul312_f); struct Int32Eulers eul312_i; EULERS_BFP_OF_REAL(eul312_i, eul312_f); DISPLAY_INT32_EULERS("eul312_i", eul312_i); - + struct FloatRMat rmat_f; FLOAT_RMAT_OF_EULERS_312(rmat_f, eul312_f); - DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat float", rmat_f); + DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat float", rmat_f); struct Int32RMat rmat_i; INT32_RMAT_OF_EULERS_312(rmat_i, eul312_i); - DISPLAY_INT32_RMAT_AS_EULERS_DEG("rmat int", rmat_i); - + DISPLAY_INT32_RMAT_AS_EULERS_DEG("rmat int", rmat_i); + return 0; } @@ -693,7 +693,7 @@ float test_rmat_of_eulers_312(void) { void test1234(void) { struct FloatEulers eul = {RadOfDeg(33.), RadOfDeg(25.), RadOfDeg(26.)}; - + struct FloatVect3 uz = { 0., 0., 1.}; struct FloatMat33 r_yaw; FLOAT_RMAT_OF_AXIS_ANGLE(r_yaw, uz, eul.psi); @@ -705,7 +705,7 @@ void test1234(void) { struct FloatVect3 ux = { 1., 0., 0.}; struct FloatMat33 r_roll; FLOAT_RMAT_OF_AXIS_ANGLE(r_roll, ux, eul.phi); - + struct FloatMat33 r_tmp; FLOAT_RMAT_COMP(r_tmp, r_yaw, r_roll); @@ -713,12 +713,12 @@ void test1234(void) { FLOAT_RMAT_COMP(r_att, r_tmp, r_pitch); DISPLAY_FLOAT_RMAT("r_att_ref ", r_att); - FLOAT_RMAT_OF_EULERS_312(r_att, eul); + FLOAT_RMAT_OF_EULERS_312(r_att, eul); DISPLAY_FLOAT_RMAT("r_att312 ", r_att); - + } @@ -766,20 +766,20 @@ float test_quat(void) { } float test_quat2(void) { - + struct FloatEulers eula2b; EULERS_ASSIGN(eula2b, RadOfDeg(70.), RadOfDeg(0.), RadOfDeg(0.)); - // DISPLAY_FLOAT_EULERS_DEG("eula2b", eula2b); - + // DISPLAY_FLOAT_EULERS_DEG("eula2b", eula2b); + struct FloatQuat qa2b; FLOAT_QUAT_OF_EULERS(qa2b, eula2b); - DISPLAY_FLOAT_QUAT("qa2b", qa2b); + DISPLAY_FLOAT_QUAT("qa2b", qa2b); struct DoubleEulers eula2b_d; EULERS_ASSIGN(eula2b_d, RadOfDeg(70.), RadOfDeg(0.), RadOfDeg(0.)); struct DoubleQuat qa2b_d; DOUBLE_QUAT_OF_EULERS(qa2b_d, eula2b_d); - DISPLAY_FLOAT_QUAT("qa2b_d", qa2b_d); + DISPLAY_FLOAT_QUAT("qa2b_d", qa2b_d); struct FloatVect3 u = { 1., 0., 0.}; float angle = RadOfDeg(70.); @@ -789,30 +789,30 @@ float test_quat2(void) { DISPLAY_FLOAT_QUAT("q ", q); - + struct FloatEulers eula2c; EULERS_ASSIGN(eula2c, RadOfDeg(80.), RadOfDeg(0.), RadOfDeg(0.)); - // DISPLAY_FLOAT_EULERS_DEG("eula2c", eula2c); - + // DISPLAY_FLOAT_EULERS_DEG("eula2c", eula2c); + struct FloatQuat qa2c; FLOAT_QUAT_OF_EULERS(qa2c, eula2c); - DISPLAY_FLOAT_QUAT("qa2c", qa2c); + DISPLAY_FLOAT_QUAT("qa2c", qa2c); struct FloatQuat qb2a; FLOAT_QUAT_INVERT(qb2a, qa2b); - DISPLAY_FLOAT_QUAT("qb2a", qb2a); + DISPLAY_FLOAT_QUAT("qb2a", qb2a); struct FloatQuat qb2c1; FLOAT_QUAT_COMP(qb2c1, qb2a, qa2c); - DISPLAY_FLOAT_QUAT("qb2c1", qb2c1); + DISPLAY_FLOAT_QUAT("qb2c1", qb2c1); struct FloatQuat qb2c2; FLOAT_QUAT_INV_COMP(qb2c2, qa2b, qa2c); - DISPLAY_FLOAT_QUAT("qb2c2", qb2c2); + DISPLAY_FLOAT_QUAT("qb2c2", qb2c2); return 0.; @@ -820,35 +820,35 @@ float test_quat2(void) { float test_INT32_QUAT_OF_RMAT(struct FloatEulers* eul_f, bool_t display) { - + struct Int32Eulers eul312_i; EULERS_BFP_OF_REAL(eul312_i, (*eul_f)); if (display) DISPLAY_INT32_EULERS("eul312_i", eul312_i); - + struct FloatRMat rmat_f; FLOAT_RMAT_OF_EULERS_312(rmat_f, (*eul_f)); - if (display) DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat float", rmat_f); - if (display) DISPLAY_FLOAT_RMAT("rmat float", rmat_f); + if (display) DISPLAY_FLOAT_RMAT_AS_EULERS_DEG("rmat float", rmat_f); + if (display) DISPLAY_FLOAT_RMAT("rmat float", rmat_f); struct Int32RMat rmat_i; INT32_RMAT_OF_EULERS_312(rmat_i, eul312_i); - if (display) DISPLAY_INT32_RMAT_AS_EULERS_DEG("rmat int", rmat_i); - if (display) DISPLAY_INT32_RMAT("rmat int", rmat_i); - if (display) DISPLAY_INT32_RMAT_AS_FLOAT("rmat int", rmat_i); + if (display) DISPLAY_INT32_RMAT_AS_EULERS_DEG("rmat int", rmat_i); + if (display) DISPLAY_INT32_RMAT("rmat int", rmat_i); + if (display) DISPLAY_INT32_RMAT_AS_FLOAT("rmat int", rmat_i); struct FloatQuat qf; FLOAT_QUAT_OF_RMAT(qf, rmat_f); FLOAT_QUAT_WRAP_SHORTEST(qf); - if (display) DISPLAY_FLOAT_QUAT("qf", qf); + if (display) DISPLAY_FLOAT_QUAT("qf", qf); struct Int32Quat qi; INT32_QUAT_OF_RMAT(qi, rmat_i); INT32_QUAT_WRAP_SHORTEST(qi); - if (display) DISPLAY_INT32_QUAT("qi", qi); - if (display) DISPLAY_INT32_QUAT_2("qi", qi); + if (display) DISPLAY_INT32_QUAT("qi", qi); + if (display) DISPLAY_INT32_QUAT_2("qi", qi); struct FloatQuat qif; - QUAT_FLOAT_OF_BFP(qif, qi); + QUAT_FLOAT_OF_BFP(qif, qi); struct FloatQuat qerr; QUAT_DIFF(qerr, qif, qf); diff --git a/sw/airborne/test/test_bla.c b/sw/airborne/test/test_bla.c index cf44820534..e7bb9da462 100644 --- a/sw/airborne/test/test_bla.c +++ b/sw/airborne/test/test_bla.c @@ -20,7 +20,7 @@ int main(int argc, char** argv) { struct FloatEulers eb = { RadOfDeg(42.), RadOfDeg(45.), RadOfDeg(0.)}; DISPLAY_FLOAT_EULERS("eb", eb); - + struct FloatRMat ra; FLOAT_RMAT_OF_EULERS(ra, ea); struct FloatRMat rb; diff --git a/sw/airborne/test/test_esc_asctecv1_simple.c b/sw/airborne/test/test_esc_asctecv1_simple.c index 2447848539..8acc668a5e 100644 --- a/sw/airborne/test/test_esc_asctecv1_simple.c +++ b/sw/airborne/test/test_esc_asctecv1_simple.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ @@ -54,7 +54,7 @@ static inline void main_init( void ) { static inline void main_periodic_task( void ) { - + trans.type = I2CTransTx; trans.slave_addr = 0x02; trans.len_w = 4; diff --git a/sw/airborne/test/test_geodetic.c b/sw/airborne/test/test_geodetic.c index e9ef0944a1..4e017bdb30 100644 --- a/sw/airborne/test/test_geodetic.c +++ b/sw/airborne/test/test_geodetic.c @@ -27,7 +27,7 @@ static void test_enu_of_ecef_int(void); static void test_ned_to_ecef_to_ned(void); static void test_enu_to_ecef_to_enu( void ); -/* +/* * toulouse 43.6052765, 1.4427764, 180.123019274324 -> 4624497.0 116475.0 4376563.0 */ @@ -51,23 +51,23 @@ static void test_floats(void) { // ref_coor.lat = RAD_OF_DEG(43.605278); // ref_coor.lon = RAD_OF_DEG(1.442778); // ref_coor.alt = 180.0; - + struct EcefCoor_f ref_coor = { 4624497.0 , 116475.0, 4376563.0}; - printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); + printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); struct LtpDef_f ltp_def; ltp_def_from_ecef_f(<p_def, &ref_coor); - printf("lla0 : (%f,%f,%f)\n", DegOfRad(ltp_def.lla.lat), DegOfRad(ltp_def.lla.lon), ltp_def.lla.alt); + printf("lla0 : (%f,%f,%f)\n", DegOfRad(ltp_def.lla.lat), DegOfRad(ltp_def.lla.lon), ltp_def.lla.alt); struct EcefCoor_f my_ecef_point = ref_coor; struct EnuCoor_f my_enu_point; enu_of_ecef_point_f(&my_enu_point, <p_def, &my_ecef_point); - printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", - my_ecef_point.x, my_ecef_point.y, my_ecef_point.z, + printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", + my_ecef_point.x, my_ecef_point.y, my_ecef_point.z, my_enu_point.x, my_enu_point.y, my_enu_point.z ); - printf("\n"); + printf("\n"); } @@ -78,23 +78,23 @@ static void test_doubles(void) { // ref_coor.lat = RAD_OF_DEG(43.605278); // ref_coor.lon = RAD_OF_DEG(1.442778); // ref_coor.alt = 180.0; - + struct EcefCoor_d ref_coor = { 4624497.0 , 116475.0, 4376563.0}; - printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); + printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); struct LtpDef_d ltp_def; ltp_def_from_ecef_d(<p_def, &ref_coor); - printf("lla0 : (%f,%f,%f)\n", DegOfRad(ltp_def.lla.lat), DegOfRad(ltp_def.lla.lon), ltp_def.lla.alt); + printf("lla0 : (%f,%f,%f)\n", DegOfRad(ltp_def.lla.lat), DegOfRad(ltp_def.lla.lon), ltp_def.lla.alt); struct EcefCoor_d my_ecef_point = ref_coor; struct EnuCoor_d my_enu_point; enu_of_ecef_point_d(&my_enu_point, <p_def, &my_ecef_point); - printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", - my_ecef_point.x, my_ecef_point.y, my_ecef_point.z, + printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", + my_ecef_point.x, my_ecef_point.y, my_ecef_point.z, my_enu_point.x, my_enu_point.y, my_enu_point.z ); - printf("\n"); + printf("\n"); } @@ -105,18 +105,18 @@ static void test_enu_of_ecef_int(void) { struct LtpDef_f ltp_def_f; ltp_def_from_ecef_f(<p_def_f, &ref_coor_f); - struct EcefCoor_i ref_coor_i = { rint(CM_OF_M(ref_coor_f.x)), - rint(CM_OF_M(ref_coor_f.y)), + struct EcefCoor_i ref_coor_i = { rint(CM_OF_M(ref_coor_f.x)), + rint(CM_OF_M(ref_coor_f.y)), rint(CM_OF_M(ref_coor_f.z))}; - printf("ecef0 : (%d,%d,%d)\n", ref_coor_i.x, ref_coor_i.y, ref_coor_i.z); + printf("ecef0 : (%d,%d,%d)\n", ref_coor_i.x, ref_coor_i.y, ref_coor_i.z); struct LtpDef_i ltp_def_i; ltp_def_from_ecef_i(<p_def_i, &ref_coor_i); printf("lla0 : (%d %d %d) (%f,%f,%f)\n", ltp_def_i.lla.lat, ltp_def_i.lla.lon, ltp_def_i.lla.alt, - DegOfRad(RAD_OF_EM7RAD((double)ltp_def_i.lla.lat)), + DegOfRad(RAD_OF_EM7RAD((double)ltp_def_i.lla.lat)), DegOfRad(RAD_OF_EM7RAD((double)ltp_def_i.lla.lon)), - M_OF_CM((double)ltp_def_i.lla.alt)); + M_OF_CM((double)ltp_def_i.lla.alt)); -#define STEP 1000. +#define STEP 1000. #define RANGE 100000. double sum_err = 0; struct FloatVect3 max_err; @@ -125,28 +125,28 @@ static void test_enu_of_ecef_int(void) { for (offset.x=-RANGE; offset.x<=RANGE; offset.x+=STEP) { for (offset.y=-RANGE; offset.y<=RANGE; offset.y+=STEP) { for (offset.z=-RANGE; offset.z<=RANGE; offset.z+=STEP) { - struct EcefCoor_f my_ecef_point_f = ref_coor_f; + struct EcefCoor_f my_ecef_point_f = ref_coor_f; VECT3_ADD(my_ecef_point_f, offset); struct EnuCoor_f my_enu_point_f; enu_of_ecef_point_f(&my_enu_point_f, <p_def_f, &my_ecef_point_f); #if DEBUG - printf("ecef to enu float : (%.02f,%.02f,%.02f) -> (%.02f,%.02f,%.02f)\n", - my_ecef_point_f.x, my_ecef_point_f.y, my_ecef_point_f.z, + printf("ecef to enu float : (%.02f,%.02f,%.02f) -> (%.02f,%.02f,%.02f)\n", + my_ecef_point_f.x, my_ecef_point_f.y, my_ecef_point_f.z, my_enu_point_f.x, my_enu_point_f.y, my_enu_point_f.z ); #endif - struct EcefCoor_i my_ecef_point_i = { rint(CM_OF_M(my_ecef_point_f.x)), - rint(CM_OF_M(my_ecef_point_f.y)), + struct EcefCoor_i my_ecef_point_i = { rint(CM_OF_M(my_ecef_point_f.x)), + rint(CM_OF_M(my_ecef_point_f.y)), rint(CM_OF_M(my_ecef_point_f.z))};; struct EnuCoor_i my_enu_point_i; enu_of_ecef_point_i(&my_enu_point_i, <p_def_i, &my_ecef_point_i); #if DEBUG // printf("def->ecef (%d,%d,%d)\n", ltp_def_i.ecef.x, ltp_def_i.ecef.y, ltp_def_i.ecef.z); - printf("ecef to enu int : (%.2f,%.02f,%.02f) -> (%.02f,%.02f,%.02f)\n\n", - M_OF_CM((double)my_ecef_point_i.x), + printf("ecef to enu int : (%.2f,%.02f,%.02f) -> (%.02f,%.02f,%.02f)\n\n", + M_OF_CM((double)my_ecef_point_i.x), M_OF_CM((double)my_ecef_point_i.y), - M_OF_CM((double)my_ecef_point_i.z), + M_OF_CM((double)my_ecef_point_i.z), M_OF_CM((double)my_enu_point_i.x), M_OF_CM((double)my_enu_point_i.y), M_OF_CM((double)my_enu_point_i.z)); @@ -162,15 +162,15 @@ static void test_enu_of_ecef_int(void) { } } } - + double nb_samples = (2*RANGE / STEP + 1) * (2*RANGE / STEP + 1) * (2*RANGE / STEP + 1); printf("enu_of_ecef int/float comparison:\n"); - printf("error max (%f,%f,%f) m\n", max_err.x, max_err.y, max_err.z ); - printf("error avg (%f ) m \n", sqrt(sum_err) / nb_samples ); - printf("\n"); - + printf("error max (%f,%f,%f) m\n", max_err.x, max_err.y, max_err.z ); + printf("error avg (%f ) m \n", sqrt(sum_err) / nb_samples ); + printf("\n"); + } @@ -182,25 +182,25 @@ void test_ned_to_ecef_to_ned( void ) { #if 0 struct EcefCoor_d ref_coor = { 4624497.0 , 116475.0, 4376563.0}; - printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); + printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); struct LtpDef_d ltp_def; ltp_def_from_ecef_d(<p_def, &ref_coor); - + struct EcefCoor_d ecef_p1 = ref_coor; struct NedCoor_d ned_p1; ned_of_ecef_point_d(&ned_p1, <p_def, &ecef_p1); - printf("ecef to ned : (%f,%f,%f) -> (%f,%f,%f)\n", - ecef_p1.x, ecef_p1.y, ecef_p1.z, + printf("ecef to ned : (%f,%f,%f) -> (%f,%f,%f)\n", + ecef_p1.x, ecef_p1.y, ecef_p1.z, ned_p1.x, ned_p1.y, ned_p1.z ); struct EcefCoor_d ecef_p2; ecef_of_ned_point_d(&ecef_p2, <p_def, &ned_p1); - printf("ned to ecef : (%f,%f,%f) -> (%f,%f,%f)\n", + printf("ned to ecef : (%f,%f,%f) -> (%f,%f,%f)\n", ned_p1.x, ned_p1.y, ned_p1.z, ecef_p2.x, ecef_p2.y, ecef_p2.z); - - printf("\n"); + + printf("\n"); #endif @@ -214,26 +214,26 @@ void test_ned_to_ecef_to_ned( void ) { void test_enu_to_ecef_to_enu( void ) { struct EcefCoor_f ref_coor = { 4624497.0 , 116475.0, 4376563.0}; - printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); + printf("ecef0 : (%.02f,%.02f,%.02f)\n", ref_coor.x, ref_coor.y, ref_coor.z); struct LtpDef_f ltp_def; ltp_def_from_ecef_f(<p_def, &ref_coor); - + struct EcefCoor_f ecef_p1 = ref_coor; struct EnuCoor_f enu_p1; enu_of_ecef_point_f(&enu_p1, <p_def, &ecef_p1); - printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", - ecef_p1.x, ecef_p1.y, ecef_p1.z, + printf("ecef to enu : (%f,%f,%f) -> (%f,%f,%f)\n", + ecef_p1.x, ecef_p1.y, ecef_p1.z, enu_p1.x, enu_p1.y, enu_p1.z ); #if 0 struct EcefCoor_f ecef_p2; ecef_of_enu_point_f(&ecef_p2, <p_def, &enu_p1); - printf("enu to ecef : (%f,%f,%f) -> (%f,%f,%f)\n", + printf("enu to ecef : (%f,%f,%f) -> (%f,%f,%f)\n", enu_p1.x, enu_p1.y, enu_p1.z, ecef_p2.x, ecef_p2.y, ecef_p2.z); - - printf("\n"); + + printf("\n"); #endif diff --git a/sw/airborne/test/test_matrix.c b/sw/airborne/test/test_matrix.c index 1fe3728700..4964c59707 100644 --- a/sw/airborne/test/test_matrix.c +++ b/sw/airborne/test/test_matrix.c @@ -16,13 +16,13 @@ int main(int argc, char** argv) { float C[2][3] = {{ 1., 2., 3.}, { 4., 5., 6.}}; - + float D[2][2]; float E[3][3] = {{ 1., 2., 3.}, { 5., 1., 3.}, { 3., 4., 6.}}; - + float F[3][3]; printf("\n"); diff --git a/sw/airborne/test/test_nav.c b/sw/airborne/test/test_nav.c index 0333061ae9..d50ace20a1 100644 --- a/sw/airborne/test/test_nav.c +++ b/sw/airborne/test/test_nav.c @@ -12,7 +12,7 @@ int main(void) { angle = 360. * 257 + 10.; NormCourse(angle); assert(angle > 360); - + assert(CloseDegAngles(180, 175+10*360)); assert(CloseDegAngles(175+10*360, 180)); assert(CloseDegAngles(355, 4+5*360)); diff --git a/sw/airborne/test/test_telemetry.c b/sw/airborne/test/test_telemetry.c index 1d7b7d0c4d..81c1c64e29 100644 --- a/sw/airborne/test/test_telemetry.c +++ b/sw/airborne/test/test_telemetry.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #include BOARD_CONFIG diff --git a/sw/airborne/traffic_info.c b/sw/airborne/traffic_info.c index 06e129655c..e377bf8205 100644 --- a/sw/airborne/traffic_info.c +++ b/sw/airborne/traffic_info.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file traffic_info.c @@ -33,7 +33,7 @@ uint8_t acs_idx; uint8_t the_acs_id[NB_ACS_ID]; struct ac_info_ the_acs[NB_ACS]; - + void traffic_info_init( void ) { the_acs_id[0] = 0; // ground station the_acs_id[AC_ID] = 1; diff --git a/sw/airborne/traffic_info.h b/sw/airborne/traffic_info.h index a4cbe031a3..78405ef74f 100644 --- a/sw/airborne/traffic_info.h +++ b/sw/airborne/traffic_info.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ /** \file traffic_info.h diff --git a/sw/airborne/uart.h b/sw/airborne/uart.h index 466abbb6aa..03e043ae5f 100644 --- a/sw/airborne/uart.h +++ b/sw/airborne/uart.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/usb_serial.h b/sw/airborne/usb_serial.h index 52bf985f1f..fa080e407e 100644 --- a/sw/airborne/usb_serial.h +++ b/sw/airborne/usb_serial.h @@ -1,6 +1,6 @@ /* * Paparazzi $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin, Michel Gorraz * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/xbee.c b/sw/airborne/xbee.c index f4d161dc05..dac33d7b48 100644 --- a/sw/airborne/xbee.c +++ b/sw/airborne/xbee.c @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/xbee.h b/sw/airborne/xbee.h index 7c25aed0ca..6e3d1288d0 100644 --- a/sw/airborne/xbee.h +++ b/sw/airborne/xbee.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -110,7 +110,7 @@ void xbee_init( void ); } #endif - + #define XBeeTransportPutInt8ByAddr(_x) XBeeTransportPut1ByteByAddr(_x) #define XBeeTransportPutUint8ByAddr(_x) XBeeTransportPut1ByteByAddr((const uint8_t*)_x) #define XBeeTransportPutInt16ByAddr(_x) XBeeTransportPut2ByteByAddr((const uint8_t*)_x) @@ -216,7 +216,7 @@ static inline void xbee_parse_payload(void) { case XBEE_TX_ID: /* Useful if A/C is connected to the PC with a cable */ XbeeGetRSSI(); uint8_t i; - for(i = XBEE_RFDATA_OFFSET; i < xbee_payload_len; i++) + for(i = XBEE_RFDATA_OFFSET; i < xbee_payload_len; i++) dl_buffer[i-XBEE_RFDATA_OFFSET] = xbee_payload[i]; dl_msg_available = TRUE; break; diff --git a/sw/airborne/xbee24.h b/sw/airborne/xbee24.h index 4bd3299af1..c217776f80 100644 --- a/sw/airborne/xbee24.h +++ b/sw/airborne/xbee24.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ diff --git a/sw/airborne/xbee868.h b/sw/airborne/xbee868.h index 08e37063f8..4cf3ecb479 100644 --- a/sw/airborne/xbee868.h +++ b/sw/airborne/xbee868.h @@ -1,6 +1,6 @@ /* * $Id$ - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */