Commit from zer0 on branch b_zer0 (2007-06-14 18:29 CEST)
---------------------------------

fix scheduler for 16 bits timer

  aversive  modules/base/scheduler/scheduler.h                1.8.4.4
  aversive  modules/base/scheduler/scheduler_private.h        1.1.2.5
  aversive  modules/base/scheduler/config/scheduler_config.h  1.1.10.6
  aversive  modules/base/scheduler/test/scheduler_config.h    1.4.10.5


-------------------------------------------
aversive/modules/base/scheduler/scheduler.h  (1.8.4.3 -> 1.8.4.4)
-------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler.h,v 1.8.4.3 2007-05-23 17:18:11 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler.h,v 1.8.4.4 2007-06-14 16:29:51 zer0 Exp $
   *
   */
  
***************
*** 49,62 ****
  #include <aversive.h>
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
  #include <timer.h>
! #endif
  #include <scheduler_config.h>
  
! #define SCHEDULER_MCU_CLOCK (F_CPU / KHz)
  
  /** TIME_UNIT is the number of microseconds between each interruption
   * if the prescaler equals 1 */
! #define TIMER_UNIT ( 256000l / (SCHEDULER_MCU_CLOCK) )
  
  /** SCHEDULER_UNIT is the REAL number of microseconds between each
   *  interruption. We can use it like this :
--- 49,106 ----
  #include <aversive.h>
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
  #include <timer.h>
! #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
  #include <scheduler_config.h>
  
! #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #if SCHEDULER_TIMER_NUM == 0
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! #ifdef TCNT0H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 1
! #define SCHEDULER_TIMER_REGISTER()  
timer1_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer1_get_prescaler_div()
! #ifdef TCNT1H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 2
! #define SCHEDULER_TIMER_REGISTER()  
timer2_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer2_get_prescaler_div()
! #ifdef TCNT2H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 3
! #define SCHEDULER_TIMER_REGISTER()  
timer3_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer3_get_prescaler_div()
! #ifdef TCNT3H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #else
! #error "Bad SCHEDULER_TIMER_NUM value in config file"
! #endif
! #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
  
  /** TIME_UNIT is the number of microseconds between each interruption
   * if the prescaler equals 1 */
! #if SCHEDULER_TIMER_BITS == 8
! #define TIMER_UNIT ( 256000000LL / (CONFIG_QUARTZ) )
! #else
! #define TIMER_UNIT ( 65536000000LL / (CONFIG_QUARTZ) )
! #endif
  
  /** SCHEDULER_UNIT is the REAL number of microseconds between each
   *  interruption. We can use it like this :


---------------------------------------------------
aversive/modules/base/scheduler/scheduler_private.h  (1.1.2.4 -> 1.1.2.5)
---------------------------------------------------

***************
*** 15,34 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_private.h,v 1.1.2.4 2007-05-23 17:18:11 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_PRIVATE_H_
  #define _SCHEDULER_PRIVATE_H_
  
! #if _SCHEDULER_CONFIG_VERSION_ != 2 
  #warning "You are using an old version of scheduler_config.h file"
! #warning "_SCHEDULER_CONFIG_VERSION_ is != 2"
  #warning "Look in modules/base/scheduler/config directory to import changes"
  #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK"
  #endif
  
  #include <stdint.h>
  
  #include <aversive/queue.h>
--- 15,43 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_private.h,v 1.1.2.5 2007-06-14 16:29:51 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_PRIVATE_H_
  #define _SCHEDULER_PRIVATE_H_
  
! /* sanity checks */
! #if _SCHEDULER_CONFIG_VERSION_ != 3 
  #warning "You are using an old version of scheduler_config.h file"
! #warning "_SCHEDULER_CONFIG_VERSION_ is != 3"
  #warning "Look in modules/base/scheduler/config directory to import changes"
  #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK"
  #endif
  
+ #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
+ #if defined SCHEDULER_TIMER_REGISTER || defined SCHEDULER_CLOCK_PRESCALER
+ #warning "SCHEDULER_TIMER_REGISTER or SCHEDULER_CLOCK_PRESCALER is already"
+ #warning "defined in your scheduler config file, and you are using the"
+ #warning "timer module."
+ #endif
+ #endif
+ 
  #include <stdint.h>
  
  #include <aversive/queue.h>


---------------------------------------------------------
aversive/modules/base/scheduler/config/scheduler_config.h  (1.1.10.5 -> 
1.1.10.6)
---------------------------------------------------------

***************
*** 15,28 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.1.10.5 2007-05-23 17:18:11 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 2
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
--- 15,28 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.1.10.6 2007-06-14 16:29:51 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 3
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
***************
*** 32,40 ****
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! 
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device
--- 32,39 ----
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! /** the num of the timer to use for the scheduler */
! #define SCHEDULER_TIMER_NUM 0
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device


-------------------------------------------------------
aversive/modules/base/scheduler/test/scheduler_config.h  (1.4.10.4 -> 1.4.10.5)
-------------------------------------------------------

***************
*** 15,28 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.4.10.4 2007-05-23 17:18:11 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 2
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
--- 15,28 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.4.10.5 2007-06-14 16:29:51 zer0 
Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 3
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
***************
*** 32,40 ****
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! 
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device
--- 32,39 ----
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! /** the num of the timer to use for the scheduler */
! #define SCHEDULER_TIMER_NUM 0
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device


Commit from zer0 (2007-06-14 18:34 CEST)
----------------

merge from b_zer0
- fix integer sqrt
- fix scheduler for 16 bits timers

  aversive  modules/base/math/fixed_point/f16_sqrt.c                    1.6
  aversive  modules/base/math/fixed_point/f32_sqrt.c                    1.6
  aversive  modules/base/math/fixed_point/f64_sqrt.c                    1.6
  aversive  modules/base/math/fixed_point/test/main.c                   1.6
  aversive  modules/base/scheduler/scheduler.h                          1.11
  aversive  modules/base/scheduler/scheduler_private.h                  1.4
  aversive  modules/base/scheduler/config/scheduler_config.h            1.4
  aversive  modules/base/scheduler/test/scheduler_config.h              1.7
  aversive  modules/devices/control_system/filters/quadramp/quadramp.c  1.7


-------------------------------------------------
aversive/modules/base/math/fixed_point/f16_sqrt.c  (1.5 -> 1.6)
-------------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f16_sqrt.c,v 1.5 2006-11-03 09:05:10 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f16_sqrt.c,v 1.6 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 24,52 ****
  #include <s16_to_f16.h>
  
  
! /* could be optimized... */
! static inline uint16_t  u16_sqrt(uint16_t x)
! {
!     uint16_t root=0x80;
!     uint16_t mask=0x80;
  
!     while(mask) {
!         if( root*root < x ) {
!             mask >>= 1;
!             root |= mask;
!         }
!         else if ( root*root > x ) {
!             root &= ~(mask);
!             mask >>= 1;
!             root |= mask;
!             continue;
!         }
!         else 
!             break;
!     }
!     return root;
  }
  
  f16 f16_sqrt(f16 f)
  {
      uint16_t a,b,c,d;
--- 24,46 ----
  #include <s16_to_f16.h>
  
  
! #define NEXT(n, i)  (((n) + (i)/(n)) >> 1)
  
! static uint16_t u16_sqrt(uint16_t number) {
!       uint16_t n  = 1;
!       uint16_t n1 = NEXT(n, number);
!       
!       while(ABS(n1 - n) > 1) {
!               n  = n1;
!               n1 = NEXT(n, number);
!       }
!       while((n1*n1) > number) {
!               n1 -= 1;
!       }
!       return n1;
  }
  
+ 
  f16 f16_sqrt(f16 f)
  {
      uint16_t a,b,c,d;


-------------------------------------------------
aversive/modules/base/math/fixed_point/f32_sqrt.c  (1.5 -> 1.6)
-------------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f32_sqrt.c,v 1.5 2006-11-03 09:05:10 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f32_sqrt.c,v 1.6 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 23,49 ****
  #include <f32.h>
  #include <s32_to_f32.h>
  
! /* could be optimized... */
! static inline uint32_t  u32_sqrt(uint32_t x)
! {
!     uint32_t root=0x8000;
!     uint32_t mask=0x8000;
  
!     while(mask) {
!         if( root*root < x ) {
!             mask >>= 1;
!             root |= mask;
!         }
!         else if ( root*root > x ) {
!             root &= ~(mask);
!             mask >>= 1;
!             root |= mask;
!             continue;
!         }
!         else 
!             break;
!     }
!     return root;
  }
  
  f32 f32_sqrt(f32 f)
--- 23,42 ----
  #include <f32.h>
  #include <s32_to_f32.h>
  
! #define NEXT(n, i)  (((n) + (i)/(n)) >> 1)
  
! static uint32_t u32_sqrt(uint32_t number) {
!       uint32_t n  = 1;
!       uint32_t n1 = NEXT(n, number);
!       
!       while(ABS(n1 - n) > 1) {
!               n  = n1;
!               n1 = NEXT(n, number);
!       }
!       while((n1*n1) > number) {
!               n1 -= 1;
!       }
!       return n1;
  }
  
  f32 f32_sqrt(f32 f)


-------------------------------------------------
aversive/modules/base/math/fixed_point/f64_sqrt.c  (1.5 -> 1.6)
-------------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f64_sqrt.c,v 1.5 2006-11-03 09:05:10 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: f64_sqrt.c,v 1.6 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 23,49 ****
  #include <f64.h>
  #include <s64_to_f64.h>
  
! /* could be optimized... */
! static inline uint64_t  u64_sqrt(uint64_t x)
! {
!     uint64_t root=0x80000000;
!     uint64_t mask=0x80000000;
  
!     while(mask) {
!         if( root*root < x ) {
!             mask >>= 1;
!             root |= mask;
!         }
!         else if ( root*root > x ) {
!             root &= ~(mask);
!             mask >>= 1;
!             root |= mask;
!             continue;
!         }
!         else 
!             break;
!     }
!     return root;
  }
  
  f64 f64_sqrt(f64 f)
--- 23,42 ----
  #include <f64.h>
  #include <s64_to_f64.h>
  
! #define NEXT(n, i)  (((n) + (i)/(n)) >> 1)
  
! static uint64_t u64_sqrt(uint64_t number) {
!       uint64_t n  = 1;
!       uint64_t n1 = NEXT(n, number);
!       
!       while(ABS(n1 - n) > 1) {
!               n  = n1;
!               n1 = NEXT(n, number);
!       }
!       while((n1*n1) > number) {
!               n1 -= 1;
!       }
!       return n1;
  }
  
  f64 f64_sqrt(f64 f)


--------------------------------------------------
aversive/modules/base/math/fixed_point/test/main.c  (1.5 -> 1.6)
--------------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: main.c,v 1.5 2006-10-14 11:35:04 larribe Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: main.c,v 1.6 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 99,104 ****
--- 99,105 ----
      printf("*** SQRT\n\n");
      printf("Result is        ");
      f64_print(f64_sqrt(a));
+     f64_sqrt(a);
      printf("\nResult should be %f\n\n", sqrt(A));
      printf("Result is        ");
      f64_print(f64_sqrt(b));


-------------------------------------------
aversive/modules/base/scheduler/scheduler.h  (1.10 -> 1.11)
-------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler.h,v 1.10 2007-05-24 13:08:46 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler.h,v 1.11 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 49,62 ****
  #include <aversive.h>
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
  #include <timer.h>
! #endif
  #include <scheduler_config.h>
  
! #define SCHEDULER_MCU_CLOCK (F_CPU / KHz)
  
  /** TIME_UNIT is the number of microseconds between each interruption
   * if the prescaler equals 1 */
! #define TIMER_UNIT ( 256000l / (SCHEDULER_MCU_CLOCK) )
  
  /** SCHEDULER_UNIT is the REAL number of microseconds between each
   *  interruption. We can use it like this :
--- 49,106 ----
  #include <aversive.h>
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
  #include <timer.h>
! #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
  #include <scheduler_config.h>
  
! #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #if SCHEDULER_TIMER_NUM == 0
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! #ifdef TCNT0H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 1
! #define SCHEDULER_TIMER_REGISTER()  
timer1_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer1_get_prescaler_div()
! #ifdef TCNT1H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 2
! #define SCHEDULER_TIMER_REGISTER()  
timer2_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer2_get_prescaler_div()
! #ifdef TCNT2H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #elif SCHEDULER_TIMER_NUM == 3
! #define SCHEDULER_TIMER_REGISTER()  
timer3_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer3_get_prescaler_div()
! #ifdef TCNT3H
! #define SCHEDULER_TIMER_BITS 16
! #else
! #define SCHEDULER_TIMER_BITS 8
! #endif
! 
! #else
! #error "Bad SCHEDULER_TIMER_NUM value in config file"
! #endif
! #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
  
  /** TIME_UNIT is the number of microseconds between each interruption
   * if the prescaler equals 1 */
! #if SCHEDULER_TIMER_BITS == 8
! #define TIMER_UNIT ( 256000000LL / (CONFIG_QUARTZ) )
! #else
! #define TIMER_UNIT ( 65536000000LL / (CONFIG_QUARTZ) )
! #endif
  
  /** SCHEDULER_UNIT is the REAL number of microseconds between each
   *  interruption. We can use it like this :


---------------------------------------------------
aversive/modules/base/scheduler/scheduler_private.h  (1.3 -> 1.4)
---------------------------------------------------

***************
*** 15,34 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_private.h,v 1.3 2007-05-24 13:08:46 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_PRIVATE_H_
  #define _SCHEDULER_PRIVATE_H_
  
! #if _SCHEDULER_CONFIG_VERSION_ != 2 
  #warning "You are using an old version of scheduler_config.h file"
! #warning "_SCHEDULER_CONFIG_VERSION_ is != 2"
  #warning "Look in modules/base/scheduler/config directory to import changes"
  #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK"
  #endif
  
  #include <stdint.h>
  
  #include <aversive/queue.h>
--- 15,43 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_private.h,v 1.4 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_PRIVATE_H_
  #define _SCHEDULER_PRIVATE_H_
  
! /* sanity checks */
! #if _SCHEDULER_CONFIG_VERSION_ != 3 
  #warning "You are using an old version of scheduler_config.h file"
! #warning "_SCHEDULER_CONFIG_VERSION_ is != 3"
  #warning "Look in modules/base/scheduler/config directory to import changes"
  #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK"
  #endif
  
+ #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
+ #if defined SCHEDULER_TIMER_REGISTER || defined SCHEDULER_CLOCK_PRESCALER
+ #warning "SCHEDULER_TIMER_REGISTER or SCHEDULER_CLOCK_PRESCALER is already"
+ #warning "defined in your scheduler config file, and you are using the"
+ #warning "timer module."
+ #endif
+ #endif
+ 
  #include <stdint.h>
  
  #include <aversive/queue.h>


---------------------------------------------------------
aversive/modules/base/scheduler/config/scheduler_config.h  (1.3 -> 1.4)
---------------------------------------------------------

***************
*** 15,28 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.3 2007-05-24 13:08:46 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 2
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
--- 15,28 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.4 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 3
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
***************
*** 32,40 ****
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! 
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device
--- 32,39 ----
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! /** the num of the timer to use for the scheduler */
! #define SCHEDULER_TIMER_NUM 0
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device


-------------------------------------------------------
aversive/modules/base/scheduler/test/scheduler_config.h  (1.6 -> 1.7)
-------------------------------------------------------

***************
*** 15,28 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.6 2007-05-24 13:08:46 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 2
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
--- 15,28 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: scheduler_config.h,v 1.7 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
  #ifndef _SCHEDULER_CONFIG_H_
  #define _SCHEDULER_CONFIG_H_
  
! #define _SCHEDULER_CONFIG_VERSION_ 3
  
  /** maximum number of allocated events */
  #define SCHEDULER_NB_MAX_EVENT 5
***************
*** 32,40 ****
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! #define SCHEDULER_TIMER_REGISTER()  
timer0_register_OV_intr(scheduler_interrupt)
! #define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div()
! 
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device
--- 32,39 ----
     this case, precaler is defined in timers_config.h in your project
     directory. */
  #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
! /** the num of the timer to use for the scheduler */
! #define SCHEDULER_TIMER_NUM 0
  
  /* or set the prescaler manually (in this case, you use must TIMER0,
     and the prescaler must be a correct value regarding the AVR device


-------------------------------------------------------------------
aversive/modules/devices/control_system/filters/quadramp/quadramp.c  (1.6 -> 
1.7)
-------------------------------------------------------------------

***************
*** 15,21 ****
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: quadramp.c,v 1.6 2007-05-24 13:08:47 zer0 Exp $
   *
   */
  
--- 15,21 ----
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
!  *  Revision : $Id: quadramp.c,v 1.7 2007-06-14 16:34:03 zer0 Exp $
   *
   */
  
***************
*** 24,53 ****
  #include <aversive.h>
  #include <quadramp.h>
  
! /* could be optimized... */
! static inline uint32_t  u32_sqrt(uint32_t x)
! {
!     uint32_t root=0x8000;
!     uint32_t mask=0x8000;
  
!     while(mask) {
!         if( root*root < x ) {
!             mask >>= 1;
!             root |= mask;
!         }
!         else if ( root*root > x ) {
!             root &= ~(mask);
!             mask >>= 1;
!             root |= mask;
!             continue;
!         }
!         else 
!             break;
!     }
!     return root;
  }
  
! inline void quadramp_init(struct quadramp_filter * q)
  {
        uint8_t flags;
        IRQ_LOCK(flags);
--- 24,46 ----
  #include <aversive.h>
  #include <quadramp.h>
  
! #define NEXT(n, i)  (((n) + (i)/(n)) >> 1)
  
! static uint32_t u32_sqrt(uint32_t number) {
!       uint32_t n  = 1;
!       uint32_t n1 = NEXT(n, number);
!       
!       while(ABS(n1 - n) > 1) {
!               n  = n1;
!               n1 = NEXT(n, number);
!       }
!       while((n1*n1) > number) {
!               n1 -= 1;
!       }
!       return n1;
  }
  
! void quadramp_init(struct quadramp_filter * q)
  {
        uint8_t flags;
        IRQ_LOCK(flags);
***************
*** 62,68 ****
        IRQ_UNLOCK(flags);
  }
  
! inline void quadramp_set_2nd_order_vars(struct quadramp_filter * q, uint32_t 
var_2nd_ord_pos, uint32_t var_2nd_ord_neg)
  {
        uint8_t flags;
        IRQ_LOCK(flags);
--- 55,61 ----
        IRQ_UNLOCK(flags);
  }
  
! void quadramp_set_2nd_order_vars(struct quadramp_filter * q, uint32_t 
var_2nd_ord_pos, uint32_t var_2nd_ord_neg)
  {
        uint8_t flags;
        IRQ_LOCK(flags);
***************
*** 71,77 ****
        IRQ_UNLOCK(flags);
  }
  
! inline void quadramp_set_1st_order_vars(struct quadramp_filter * q, uint32_t 
var_1st_ord_pos, uint32_t var_1st_ord_neg)
  {
        uint8_t flags;
        IRQ_LOCK(flags);
--- 64,70 ----
        IRQ_UNLOCK(flags);
  }
  
! void quadramp_set_1st_order_vars(struct quadramp_filter * q, uint32_t 
var_1st_ord_pos, uint32_t var_1st_ord_neg)
  {
        uint8_t flags;
        IRQ_LOCK(flags);

_______________________________________________
Avr-list mailing list
Avr-list@droids-corp.org
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog

Répondre à