generic sys_time_init and arch specific sys_time_arch_init. sys_time_arch stuff for sim, compile sim with gnu99 standard

This commit is contained in:
Felix Ruess
2012-01-06 19:21:41 +01:00
parent 2cd0a8666a
commit f833cb1a04
9 changed files with 106 additions and 38 deletions
+7 -7
View File
@@ -51,12 +51,12 @@ ifneq ($(SIM_TYPE),JSBSIM)
INCLUDES += -I `ocamlc -where`
endif
CFLAGS = \
-W -Wall \
$(INCLUDES) \
$($(TARGET).CFLAGS) \
$(LOCAL_CFLAGS) \
-O2 \
CFLAGS = -W -Wall
CFLAGS += $(INCLUDES)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(LOCAL_CFLAGS)
CFLAGS += -O2
CFLAGS += -std=gnu99
# meschach prototypes trigger numerous warnings
ifneq ($(SIM_TYPE),BOOZ)
@@ -66,7 +66,7 @@ endif
endif
LDFLAGS = -lm \
LDFLAGS = -lm
ifeq ($(SIM_TYPE),BOOZ)
LDFLAGS += $($(TARGET).LDFLAGS)
@@ -71,7 +71,7 @@ ifndef PERIODIC_FREQUENCY
PERIODIC_FREQUENCY = 60
endif
$(TARGET).CFLAGS += -DPERIODIC_TASK_PERIOD='CPU_TICKS_OF_SEC((1./$(PERIODIC_FREQUENCY).))' -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
$(TARGET).srcs += mcu_periph/sys_time.c
$(TARGET).srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
#
# InterMCU & Commands
@@ -127,7 +127,6 @@ endif
# Sys-time
#
ns_CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_RESOLUTION='(1./300.)'
ns_srcs += $(SRC_ARCH)/mcu_periph/sys_time_arch.c
#
@@ -70,7 +70,7 @@ endif
sim.CFLAGS += -DPERIODIC_TASK_PERIOD='CPU_TICKS_OF_SEC((1./512.))'
#sim.CFLAGS += -DUSE_LED
sim.srcs += mcu_periph/sys_time.c
sim.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
sim.srcs += subsystems/settings.c
sim.srcs += $(SRC_ARCH)/subsystems/settings_arch.c
@@ -87,7 +87,7 @@
AMI601_IT)
void sys_time_init( void ) {
void sys_time_arch_init( void ) {
/* setup Timer 0 to count forever */
/* reset & disable timer 0 */
T0TCR = TCR_RESET;
@@ -113,19 +113,6 @@ void sys_time_init( void ) {
/* set first sys tick interrupt */
T0MR1 = SYS_TIME_RESOLUTION_CPU_TICKS;
sys_time.nb_sec = 0;
sys_time.nb_sec_rem = 0;
sys_time.nb_tick = 0;
for (unsigned int i=0; i<SYS_TIME_NB_TIMER; i++) {
sys_time.timer[i].in_use = FALSE;
sys_time.timer[i].cb = NULL;
sys_time.timer[i].elapsed = FALSE;
sys_time.timer[i].end_time = 0;
sys_time.timer[i].duration = 0;
}
}
@@ -0,0 +1,28 @@
/*
*
* 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.
*/
#include "mcu_periph/sys_time.h"
void sys_time_arch_init( void ) {
}
@@ -0,0 +1,48 @@
/*
*
* 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.
*
*/
/*
*\brief simulator dummy timing functions
*
*/
#ifndef SYS_TIME_ARCH_H
#define SYS_TIME_ARCH_H
#include <unistd.h>
#define CPU_TICKS_OF_SEC(x) (x)
#define SIGNED_CPU_TICKS_OF_SEC(x) (x)
#define SEC_OF_CPU_TICKS(st) (st)
#define MSEC_OF_CPU_TICKS(st) (st)
#define USEC_OF_CPU_TICKS(st) (st)
#define SysTimeTimerStart(_t) { }
#define SysTimeTimer(_t) (_t)
#define SysTimeTimerStop(_t) { }
static inline void sys_time_usleep(uint32_t us) {}
#endif /* SYS_TIME_ARCH_H */
@@ -27,7 +27,7 @@
#include "led.h"
#endif
void sys_time_init( void ) {
void sys_time_arch_init( void ) {
/* Generate SysTick interrupt every SYS_TIME_RESOLUTION_CPU_TICKS
* The timer interrupt is activated on the transition from 1 to 0,
@@ -38,19 +38,6 @@ void sys_time_init( void ) {
/* Set SysTick handler priority */
NVIC_SetPriority(SysTick_IRQn, 0x0);
sys_time.nb_sec = 0;
sys_time.nb_sec_rem = 0;
sys_time.nb_tick = 0;
for (unsigned int i=0; i<SYS_TIME_NB_TIMER; i++) {
sys_time.timer[i].in_use = FALSE;
sys_time.timer[i].cb = NULL;
sys_time.timer[i].elapsed = FALSE;
sys_time.timer[i].end_time = 0;
sys_time.timer[i].duration = 0;
}
}
+16
View File
@@ -61,3 +61,19 @@ void sys_time_update_timer(uint8_t id, uint32_t duration) {
sys_time.timer[id].duration = duration;
mcu_int_enable();
}
void sys_time_init( void ) {
sys_time_arch_init();
sys_time.nb_sec = 0;
sys_time.nb_sec_rem = 0;
sys_time.nb_tick = 0;
for (unsigned int i=0; i<SYS_TIME_NB_TIMER; i++) {
sys_time.timer[i].in_use = FALSE;
sys_time.timer[i].cb = NULL;
sys_time.timer[i].elapsed = FALSE;
sys_time.timer[i].end_time = 0;
sys_time.timer[i].duration = 0;
}
}
+3
View File
@@ -108,5 +108,8 @@ static inline bool_t sys_time_check_and_ack_timer( uint8_t id ) {
#include "mcu_periph/sys_time_arch.h"
/* architecture specific init implementation */
extern void sys_time_arch_init(void);
#endif /* SYS_TIME_H */