diff --git a/sw/airborne/arch/chibios/mcu_periph/can_arch.c b/sw/airborne/arch/chibios/mcu_periph/can_arch.c index 343e5c9d09..eee94219d1 100644 --- a/sw/airborne/arch/chibios/mcu_periph/can_arch.c +++ b/sw/airborne/arch/chibios/mcu_periph/can_arch.c @@ -13,7 +13,7 @@ #include "mcu_periph/can_arch.h" #include "mcu_periph/can.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include "stdio.h" #include "string.h" diff --git a/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.c b/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.c index 313d466182..c0aee44e88 100644 --- a/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.c +++ b/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.c @@ -32,6 +32,7 @@ * Mostly empty functions for Paparazzi compatibility, * since ChibiOS uses different system time functions. */ +#include "mcu_periph/sys_time.h" #include "mcu_periph/sys_time_arch.h" #include BOARD_CONFIG #include @@ -44,7 +45,8 @@ static MUTEX_DECL(sys_time_mtx); */ static void thd_sys_tick(void *arg); static THD_WORKING_AREA(wa_thd_sys_tick, 1024); -static void sys_tick_handler(void); + +void sys_tick_handler(void); static uint32_t cpu_ticks = 0; static uint32_t cpu_counter = 0; @@ -130,12 +132,6 @@ void sys_time_msleep(uint32_t ms) chThdSleepMilliseconds(ms); } -void sys_time_ssleep(uint8_t s) -{ - chThdSleepSeconds(s); -} - - /* * Sys_tick thread */ @@ -151,7 +147,7 @@ static __attribute__((noreturn)) void thd_sys_tick(void *arg) } } -static void sys_tick_handler(void) +void sys_tick_handler(void) { chMtxLock(&sys_time_mtx); /* current time in sys_ticks */ diff --git a/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.h b/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.h index 4639dbe603..6247cde946 100644 --- a/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.h +++ b/sw/airborne/arch/chibios/mcu_periph/sys_time_arch.h @@ -33,7 +33,6 @@ #ifndef SYS_TIME_ARCH_H #define SYS_TIME_ARCH_H -#include "mcu_periph/sys_time.h" #include #include @@ -41,9 +40,4 @@ #define STM32_SYSCLK STM32_SYS_CK #endif -extern uint32_t get_sys_time_usec(void); -extern uint32_t get_sys_time_usec100(void); -extern uint32_t get_sys_time_msec(void); -extern void sys_time_ssleep(uint8_t s); - #endif /* SYS_TIME_ARCH_H */ diff --git a/sw/airborne/arch/chibios/modules/actuators/dshot_rpmCapture.h b/sw/airborne/arch/chibios/modules/actuators/dshot_rpmCapture.h index a04d0669c9..2c057e6561 100644 --- a/sw/airborne/arch/chibios/modules/actuators/dshot_rpmCapture.h +++ b/sw/airborne/arch/chibios/modules/actuators/dshot_rpmCapture.h @@ -6,6 +6,7 @@ #include "mcu_periph/hal_stm32_dma.h" #include "mcu_periph/timerDmaCache.h" #include "modules/actuators/esc_dshot_config.h" +#include "mcu_periph/sys_time_arch.h" #ifdef __cplusplus extern "C" { @@ -64,14 +65,6 @@ extern "C" { #endif // DSHOT_CHANNELS = X -#if !defined STM32_SYSCLK && !defined STM32_SYS_CK -#error neither STM32_SYSCLK or STM32_SYS_CK defined -#endif -#if !defined STM32_SYSCLK -#define STM32_SYSCLK STM32_SYS_CK -#endif - - /** * @brief structure defining dma channel * @note does not apply for DMAMUX MCU diff --git a/sw/airborne/arch/chibios/modules/actuators/esc_dshot.c b/sw/airborne/arch/chibios/modules/actuators/esc_dshot.c index cb6dd3d826..887d9afb40 100644 --- a/sw/airborne/arch/chibios/modules/actuators/esc_dshot.c +++ b/sw/airborne/arch/chibios/modules/actuators/esc_dshot.c @@ -31,6 +31,7 @@ #include #include #include +#include "mcu_periph/sys_time.h" #include "mcu_periph/sys_time_arch.h" /* diff --git a/sw/airborne/arch/chibios/modules/core/microrl/microrlShell.c b/sw/airborne/arch/chibios/modules/core/microrl/microrlShell.c index 8d344209e6..789b79ffb7 100644 --- a/sw/airborne/arch/chibios/modules/core/microrl/microrlShell.c +++ b/sw/airborne/arch/chibios/modules/core/microrl/microrlShell.c @@ -11,6 +11,7 @@ #include "microrl/microrl.h" #include "printf.h" //#include "stdutil.h" +#include "mcu_periph/sys_time_arch.h" #define printScreen(...) {chprintf (chpg, __VA_ARGS__); chprintf (chpg, "\r\n");} diff --git a/sw/airborne/arch/chibios/modules/core/rtos_mon_arch.c b/sw/airborne/arch/chibios/modules/core/rtos_mon_arch.c index 0922f27633..18e26282cb 100644 --- a/sw/airborne/arch/chibios/modules/core/rtos_mon_arch.c +++ b/sw/airborne/arch/chibios/modules/core/rtos_mon_arch.c @@ -26,6 +26,7 @@ */ #include "modules/core/sys_mon_rtos.h" +#include "mcu_periph/sys_time_arch.h" #include #if !CH_DBG_STATISTICS diff --git a/sw/airborne/arch/chibios/modules/light/light_ws2812_arch.c b/sw/airborne/arch/chibios/modules/light/light_ws2812_arch.c index 110164057d..8960cc1c47 100644 --- a/sw/airborne/arch/chibios/modules/light/light_ws2812_arch.c +++ b/sw/airborne/arch/chibios/modules/light/light_ws2812_arch.c @@ -34,6 +34,7 @@ https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ #include "modules/light/light_ws2812_arch.h" #include "mcu_periph/hal_stm32_dma.h" #include "mcu_periph/gpio.h" +#include "mcu_periph/sys_time_arch.h" #include BOARD_CONFIG diff --git a/sw/airborne/arch/linux/mcu_periph/can_arch.c b/sw/airborne/arch/linux/mcu_periph/can_arch.c index 963eff1f79..5834dbcc3e 100644 --- a/sw/airborne/arch/linux/mcu_periph/can_arch.c +++ b/sw/airborne/arch/linux/mcu_periph/can_arch.c @@ -2,7 +2,7 @@ #include "mcu_periph/can_arch.h" #include "mcu_periph/can.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include "stdio.h" #include "string.h" diff --git a/sw/airborne/arch/linux/mcu_periph/sys_time_arch.c b/sw/airborne/arch/linux/mcu_periph/sys_time_arch.c index 96a93649ed..f3a537ef25 100644 --- a/sw/airborne/arch/linux/mcu_periph/sys_time_arch.c +++ b/sw/airborne/arch/linux/mcu_periph/sys_time_arch.c @@ -20,18 +20,20 @@ * Boston, MA 02111-1307, USA. */ -/** @file arch/linux/mcu_periph/sys_time_arch.h +/** @file arch/linux/mcu_periph/sys_time_arch.c * linux timing functions */ #include "mcu_periph/sys_time.h" -#include "mcu_periph/sys_time_arch.h" #include #include #include #include #include "rt_priority.h" +#include "std.h" +#include + #ifdef SYS_TIME_LED #include "led.h" #endif @@ -42,7 +44,8 @@ static struct timespec startup_time; -static void sys_tick_handler(void); +void sys_tick_handler(void); + void *sys_time_thread_main(void *data); #define NSEC_OF_SEC(sec) ((sec) * 1e9) @@ -109,7 +112,7 @@ void sys_time_arch_init(void) #endif } -static void sys_tick_handler(void) +void sys_tick_handler(void) { /* get current time */ struct timespec now; diff --git a/sw/airborne/arch/linux/mcu_periph/sys_time_arch.h b/sw/airborne/arch/linux/mcu_periph/sys_time_arch.h deleted file mode 100644 index aba55687b4..0000000000 --- a/sw/airborne/arch/linux/mcu_periph/sys_time_arch.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * - * Copyright (C) 2009-2013 The Paparazzi Team - * - * This file is part of paparazzi. - * - * paparazzi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * paparazzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/** @file arch/linux/mcu_periph/sys_time_arch.h - * linux timing functions - */ - -#ifndef SYS_TIME_ARCH_H -#define SYS_TIME_ARCH_H - -#include "std.h" -#include -#include "mcu_periph/sys_time.h" - -/** - * Get the time in microseconds since startup. - * WARNING: overflows after 71min34seconds! - * @return current system time as uint32_t - */ -extern uint32_t get_sys_time_usec(void); - -/** - * Get the time in microseconds since startup. - * WARNING: overflows after 7000 minutes! - * @return current system time as uint32_t - */ -extern uint32_t get_sys_time_usec100(void); - -/** - * Get the time in milliseconds since startup. - * @return milliseconds since startup as uint32_t - */ -extern uint32_t get_sys_time_msec(void); - - -/** elapsed time in microsecs between two timespecs */ -static inline unsigned int sys_time_elapsed_us(struct timespec *prev, struct timespec *now) -{ - time_t d_sec = now->tv_sec - prev->tv_sec; - long d_nsec = now->tv_nsec - prev->tv_nsec; - /* wrap if negative nanoseconds */ - if (d_nsec < 0) { - d_sec -= 1; - d_nsec += 1000000000L; - } - return d_sec * 1000000 + d_nsec / 1000; -} - -#endif /* SYS_TIME_ARCH_H */ diff --git a/sw/airborne/arch/sim/mcu_periph/sys_time_arch.c b/sw/airborne/arch/sim/mcu_periph/sys_time_arch.c index 74743e5f10..fa01d5fd8c 100644 --- a/sw/airborne/arch/sim/mcu_periph/sys_time_arch.c +++ b/sw/airborne/arch/sim/mcu_periph/sys_time_arch.c @@ -26,8 +26,9 @@ */ #include "mcu_periph/sys_time.h" -#include "mcu_periph/sys_time_arch.h" +#include "std.h" +void sys_tick_handler(void); void sys_time_arch_init(void) { @@ -36,6 +37,24 @@ void sys_time_arch_init(void) sys_time.resolution_cpu_ticks = (uint32_t)(sys_time.resolution * sys_time.cpu_ticks_per_sec + 0.5); } +uint32_t get_sys_time_usec(void) +{ + return sys_time.nb_sec * 1000000 + + usec_of_cpu_ticks(sys_time.nb_sec_rem); +} + +uint32_t get_sys_time_usec100(void) +{ + return sys_time.nb_sec * 10000 + + usec_of_cpu_ticks(sys_time.nb_sec_rem)/100; +} + +uint32_t get_sys_time_msec(void) +{ + return sys_time.nb_sec * 1000 + + msec_of_cpu_ticks(sys_time.nb_sec_rem); +} + void sys_tick_handler(void) { sys_time.nb_tick++; diff --git a/sw/airborne/arch/sim/mcu_periph/sys_time_arch.h b/sw/airborne/arch/sim/mcu_periph/sys_time_arch.h deleted file mode 100644 index 1c2b14822e..0000000000 --- a/sw/airborne/arch/sim/mcu_periph/sys_time_arch.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Copyright (C) 2009-2011 The Paparazzi Team - * - * This file is part of paparazzi. - * - * paparazzi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * paparazzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/** @file arch/sim/mcu_periph/sys_time_arch.h - * Simulator timing functions. - */ - -#ifndef SYS_TIME_ARCH_H -#define SYS_TIME_ARCH_H - -#include "std.h" -#include "mcu_periph/sys_time.h" - -extern void sys_tick_handler(void); - -/** - * Get the time in microseconds since startup. - * @return microseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_usec(void) -{ - return sys_time.nb_sec * 1000000 + - usec_of_cpu_ticks(sys_time.nb_sec_rem); -} - -/** - * Get the time in 100microseconds since startup. - * @return 100microseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_usec100(void) -{ - return sys_time.nb_sec * 10000 + - usec_of_cpu_ticks(sys_time.nb_sec_rem)/100; -} - -/** - * Get the time in milliseconds since startup. - * @return milliseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_msec(void) -{ - return sys_time.nb_sec * 1000 + - msec_of_cpu_ticks(sys_time.nb_sec_rem); -} - -#endif /* SYS_TIME_ARCH_H */ diff --git a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c b/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c index 012278af8e..b4ad4bc673 100644 --- a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c +++ b/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c @@ -28,7 +28,10 @@ */ #include "mcu_periph/sys_time.h" -#include "mcu_periph/sys_time_arch.h" +#include +#include +#include +#include "std.h" #include "libopencm3/cm3/systick.h" @@ -68,6 +71,27 @@ void sys_time_arch_init(void) } +uint32_t get_sys_time_usec(void) +{ + return sys_time.nb_sec * 1000000 + + usec_of_cpu_ticks(sys_time.nb_sec_rem) + + usec_of_cpu_ticks(systick_get_reload() - systick_get_value()); +} + +uint32_t get_sys_time_usec100(void) +{ + return sys_time.nb_sec * 10000 + + usec_of_cpu_ticks(sys_time.nb_sec_rem)/100 + + usec_of_cpu_ticks(systick_get_reload() - systick_get_value())/100; +} + +uint32_t get_sys_time_msec(void) +{ + return sys_time.nb_sec * 1000 + + msec_of_cpu_ticks(sys_time.nb_sec_rem) + + msec_of_cpu_ticks(systick_get_reload() - systick_get_value()); +} + // FIXME : nb_tick rollover ??? // // 97 days at 512hz diff --git a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.h b/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.h deleted file mode 100644 index aab1bf5655..0000000000 --- a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright (C) 2009-2011 The Paparazzi Team - * - * This file is part of paparazzi. - * - * paparazzi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * paparazzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/** - * @file arch/stm32/mcu_periph/sys_time_arch.h - * @ingroup stm32_arch - * - * STM32 timing functions. - * - */ - -#ifndef SYS_TIME_ARCH_H -#define SYS_TIME_ARCH_H - -#include "mcu_periph/sys_time.h" - -#include -#include -#include -#include "std.h" - -/** - * Get the time in microseconds since startup. - * WARNING: overflows after 70min! - * @return microseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_usec(void) -{ - return sys_time.nb_sec * 1000000 + - usec_of_cpu_ticks(sys_time.nb_sec_rem) + - usec_of_cpu_ticks(systick_get_reload() - systick_get_value()); -} - -/** - * Get the time in 100microseconds since startup. - * WARNING: overflows after 7000min! - * @return 100microseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_usec100(void) -{ - return sys_time.nb_sec * 10000 + - usec_of_cpu_ticks(sys_time.nb_sec_rem)/100 + - usec_of_cpu_ticks(systick_get_reload() - systick_get_value())/100; -} - -/** - * Get the time in milliseconds since startup. - * @return milliseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_msec(void) -{ - return sys_time.nb_sec * 1000 + - msec_of_cpu_ticks(sys_time.nb_sec_rem) + - msec_of_cpu_ticks(systick_get_reload() - systick_get_value()); -} - -#endif /* SYS_TIME_ARCH_H */ diff --git a/sw/airborne/arch/stm32/usb_ser_hw.c b/sw/airborne/arch/stm32/usb_ser_hw.c index c653b36ba7..0559fac015 100644 --- a/sw/airborne/arch/stm32/usb_ser_hw.c +++ b/sw/airborne/arch/stm32/usb_ser_hw.c @@ -40,7 +40,7 @@ #include "mcu_periph/usb_serial.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" /* Max packet size for USB transfer */ #define MAX_PACKET_SIZE 64 diff --git a/sw/airborne/mcu_periph/sys_time.h b/sw/airborne/mcu_periph/sys_time.h index 0676c03c99..e316e8fecd 100644 --- a/sw/airborne/mcu_periph/sys_time.h +++ b/sw/airborne/mcu_periph/sys_time.h @@ -82,6 +82,8 @@ struct sys_time { extern struct sys_time sys_time; +extern void sys_time_init(void); + /** * Sleep @param us microseconds */ @@ -93,7 +95,25 @@ void sys_time_usleep(uint32_t us); void sys_time_msleep(uint32_t ms); -extern void sys_time_init(void); +/** + * Get the time in microseconds since startup. + * WARNING: overflows after 70min! + * @return microseconds since startup as uint32_t + */ +uint32_t get_sys_time_usec(void); + +/** + * Get the time in 100microseconds since startup. + * WARNING: overflows after 7000min! + * @return 100microseconds since startup as uint32_t + */ +uint32_t get_sys_time_usec100(void); + +/** + * Get the time in milliseconds since startup. + * @return milliseconds since startup as uint32_t + */ +uint32_t get_sys_time_msec(void); /** * Register a new system timer. @@ -228,10 +248,9 @@ static inline uint32_t nsec_of_cpu_ticks(uint32_t cpu_ticks) #define USEC_OF_SEC(sec) ((sec) * 1e6) -#include "mcu_periph/sys_time_arch.h" - /* architecture specific init implementation */ -extern void sys_time_arch_init(void); +void sys_time_arch_init(void); + /* Generic timer macros */ #define SysTimeTimerStart(_t) { _t = get_sys_time_usec(); } diff --git a/sw/airborne/modules/actuators/actuators_sts3032.c b/sw/airborne/modules/actuators/actuators_sts3032.c index 85c0bd26ca..eb04bb75ed 100644 --- a/sw/airborne/modules/actuators/actuators_sts3032.c +++ b/sw/airborne/modules/actuators/actuators_sts3032.c @@ -28,7 +28,7 @@ #include "string.h" #include "mcu_periph/uart.h" #include "mcu_periph/sys_time.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include #include "peripherals/sts3032_regs.h" diff --git a/sw/airborne/modules/px4_flash/px4_flash.c b/sw/airborne/modules/px4_flash/px4_flash.c index f6ed78601b..81e0db8a0b 100644 --- a/sw/airborne/modules/px4_flash/px4_flash.c +++ b/sw/airborne/modules/px4_flash/px4_flash.c @@ -26,7 +26,7 @@ #include "modules/px4_flash/px4_flash.h" #include "modules/px4_flash/protocol.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include "modules/intermcu/intermcu_ap.h" // Serial Port diff --git a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c index dd728a7a7d..775520ee62 100644 --- a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c +++ b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c @@ -29,7 +29,7 @@ #include "mcu.h" #include "modules/radio_control/radio_control.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include "mcu_periph/uart.h" #include "mcu_periph/gpio.h" diff --git a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_fbw.c b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_fbw.c index 26e679b48a..72cc5d9a13 100644 --- a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_fbw.c +++ b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_fbw.c @@ -27,7 +27,7 @@ #include "modules/intermcu/intermcu_fbw.h" #include "mcu.h" #include "modules/radio_control/radio_control.h" -#include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/sys_time.h" #include "mcu_periph/gpio.h" diff --git a/sw/airborne/test/mcu_periph/chibios_test_gpio.c b/sw/airborne/test/mcu_periph/chibios_test_gpio.c index b91d273383..715f2e488b 100644 --- a/sw/airborne/test/mcu_periph/chibios_test_gpio.c +++ b/sw/airborne/test/mcu_periph/chibios_test_gpio.c @@ -92,7 +92,7 @@ int main(void) while (TRUE) { - sys_time_ssleep(1); + sys_time_msleep(1000); main_periodic_2(); } diff --git a/sw/airborne/test/mcu_periph/chibios_test_serial.c b/sw/airborne/test/mcu_periph/chibios_test_serial.c index a5184eb4cb..b39f648580 100644 --- a/sw/airborne/test/mcu_periph/chibios_test_serial.c +++ b/sw/airborne/test/mcu_periph/chibios_test_serial.c @@ -103,7 +103,7 @@ int main(void) while (1) { /* sleep for 1s */ - sys_time_ssleep(1); + sys_time_msleep(1000); uart_transmit(&SERIAL_PORT, 'N'); uart_transmit(&SERIAL_PORT, 'i'); uart_transmit(&SERIAL_PORT, 'c'); diff --git a/sw/airborne/test/mcu_periph/chibios_test_sys_time_usleep.c b/sw/airborne/test/mcu_periph/chibios_test_sys_time_usleep.c index f25622926b..148eca49c0 100644 --- a/sw/airborne/test/mcu_periph/chibios_test_sys_time_usleep.c +++ b/sw/airborne/test/mcu_periph/chibios_test_sys_time_usleep.c @@ -82,7 +82,7 @@ int main(void) while (1) { /* sleep for 1s */ - sys_time_ssleep(1); + sys_time_msleep(1000); main_periodic_1(); /* sleep for 0.42s */ diff --git a/sw/simulator/nps/nps_autopilot_fixedwing.c b/sw/simulator/nps/nps_autopilot_fixedwing.c index 389c7f8ac4..fb25b92004 100644 --- a/sw/simulator/nps/nps_autopilot_fixedwing.c +++ b/sw/simulator/nps/nps_autopilot_fixedwing.c @@ -61,6 +61,7 @@ bool nps_bypass_ins; #define NPS_BYPASS_INS FALSE #endif +void sys_tick_handler(void); //#if !defined (FBW) || !defined (AP) //#error NPS does not currently support dual processor simulation for FBW and AP on fixedwing! diff --git a/sw/simulator/nps/nps_autopilot_rotorcraft.c b/sw/simulator/nps/nps_autopilot_rotorcraft.c index 3565f5e9ca..987dfc6344 100644 --- a/sw/simulator/nps/nps_autopilot_rotorcraft.c +++ b/sw/simulator/nps/nps_autopilot_rotorcraft.c @@ -73,6 +73,8 @@ bool nps_bypass_ins; #error "INDI_RPM_FEEDBACK can not be used in simulation!" #endif +void sys_tick_handler(void); + void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char *rc_dev) { nps_autopilot.launch = TRUE; diff --git a/sw/simulator/nps/nps_autopilot_rover.c b/sw/simulator/nps/nps_autopilot_rover.c index 390bd109fa..54690cd166 100644 --- a/sw/simulator/nps/nps_autopilot_rover.c +++ b/sw/simulator/nps/nps_autopilot_rover.c @@ -69,6 +69,8 @@ bool nps_bypass_ins; #error "INDI_RPM_FEEDBACK can not be used in simulation!" #endif +void sys_tick_handler(void); + void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char *rc_dev) { nps_autopilot.launch = TRUE; diff --git a/tests/modules/test_arch/mcu_periph/sys_time_arch.h b/tests/modules/test_arch/mcu_periph/sys_time_arch.h deleted file mode 100644 index a12ea0fb74..0000000000 --- a/tests/modules/test_arch/mcu_periph/sys_time_arch.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (C) 2009-2011 The Paparazzi Team - * - * This file is part of paparazzi. - * - * paparazzi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * paparazzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -/** @file mcu_periph/sys_time_arch.h - * test timing functions. - */ - -#ifndef SYS_TIME_ARCH_H -#define SYS_TIME_ARCH_H - -#include "std.h" - -extern void sys_tick_handler(void); - -/** - * Get the time in microseconds since startup. - * @return microseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_usec(void) -{ - return sys_time.nb_sec * 1000000 + - usec_of_cpu_ticks(sys_time.nb_sec_rem); -} - -/** - * Get the time in milliseconds since startup. - * @return milliseconds since startup as uint32_t - */ -static inline uint32_t get_sys_time_msec(void) -{ - return sys_time.nb_sec * 1000 + - msec_of_cpu_ticks(sys_time.nb_sec_rem); -} - -#endif /* SYS_TIME_ARCH_H */