Change CONFIG_MSEC_PER_TICK to CONFIG_USEC_PER_TICK. This gives more options for system timers in general, but more importantly, let's us realize higher resolution for the case of CONFIG_SCHED_TICKLESS=y -- of course, at the risk of some new interger overvflow problems

This commit is contained in:
Gregory Nutt 2014-08-07 13:42:47 -06:00
parent f140e112e0
commit 8b2a8fceba
4 changed files with 11 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/avr/src/at32uc3/at32uc3_timerisr.c * arch/avr/src/at32uc3/at32uc3_timerisr.c
* *
* Copyright (C) 2010 Gregory Nutt. All rights reserved. * Copyright (C) 2010, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -61,12 +61,12 @@
* setting that defaults to 100 (100 ticks per second = 10 MS interval). * setting that defaults to 100 (100 ticks per second = 10 MS interval).
* *
* However, the AVR RTC does not support that default value well and so, we * However, the AVR RTC does not support that default value well and so, we
* will insist that default is over-ridden by CONFIG_MSEC_PER_TICK in the * will insist that default is over-ridden by CONFIG_USEC_PER_TICK in the
* configuration file. Further, we will insist that CONFIG_MSEC_PER_TICK * configuration file. Further, we will insist that CONFIG_USEC_PER_TICK
* have the value 8 (see reasoning below). * have the value 10000 (see reasoning below).
*/ */
#if defined(CONFIG_MSEC_PER_TICK) && CONFIG_MSEC_PER_TICK != 10 #if defined(CONFIG_USEC_PER_TICK) && CONFIG_USEC_PER_TICK != 10000
# error "Only a 100KHz system clock is supported" # error "Only a 100KHz system clock is supported"
#endif #endif

View File

@ -56,7 +56,7 @@
****************************************************************************/ ****************************************************************************/
/* The CPU frequency is given by BOARD_CPU_CLOCK (defined in board.h). The /* The CPU frequency is given by BOARD_CPU_CLOCK (defined in board.h). The
* desired interrupt frequency is given by CONFIG_MSEC_PER_TICK. An unscaled * desired interrupt frequency is given by CONFIG_USEC_PER_TICK. An unscaled
* ideal match is given by: * ideal match is given by:
* *
* CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec

View File

@ -56,7 +56,7 @@
****************************************************************************/ ****************************************************************************/
/* The CPU frequency is given by BOARD_CPU_CLOCK (defined in board.h). The /* The CPU frequency is given by BOARD_CPU_CLOCK (defined in board.h). The
* desired interrupt frequency is given by CONFIG_MSEC_PER_TICK. An unscaled * desired interrupt frequency is given by CONFIG_USEC_PER_TICK. An unscaled
* ideal match is given by: * ideal match is given by:
* *
* CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec * CLOCK = CPU_CLOCK / DIVISOR # CPU clocks/sec

View File

@ -46,6 +46,8 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/sched.h> #include <nuttx/sched.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <semaphore.h> #include <semaphore.h>
#include <queue.h> #include <queue.h>
#include <stdlib.h> #include <stdlib.h>
@ -55,8 +57,8 @@
int nest_irq = 0; int nest_irq = 0;
// the default time is 10ms // the default time is 10ms
#ifdef CONFIG_MSEC_PER_TICK #ifdef MSEC_PER_TICK
const unsigned int rtos_tick_time = CONFIG_MSEC_PER_TICK; const unsigned int rtos_tick_time = MSEC_PER_TICK;
#else #else
const unsigned int rtos_tick_time = 10; const unsigned int rtos_tick_time = 10;
#endif #endif