9
0
Fork 0

Add support for custom system timer frequency

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@274 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2007-06-09 15:49:44 +00:00
parent 076dd68710
commit c1d7cdfbed
14 changed files with 97 additions and 17 deletions

View File

@ -161,6 +161,8 @@
* sched/usleep.c: Fixed nsec calculation
* lib/lib_strcspn.c: Function incorrectly named strspn().
* examples/ostest/main.c: Errors in SDCC version of a memcpy() call
* examples/ostest/sighandl.c: Don't call fflush() if streams are disabled
* examples/ostest/sighand.c: Don't call fflush() if streams are disabled
* include/limits.h, include/time.h, sched/clock_internal.h: A support for
using selectable system timer frequency.
* Started m68322

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: May 26, 2007</p>
<p>Last Updated: June 9, 2007</p>
</td>
</tr>
</table>
@ -595,7 +595,9 @@ Other memory:
* sched/usleep.c: Fixed nsec calculation
* lib/lib_strcspn.c: Function incorrectly named strspn().
* examples/ostest/main.c: Errors in SDCC version of a memcpy() call
* examples/ostest/sighandl.c: Don't call fflush() if streams are disabled
* examples/ostest/sighand.c: Don't call fflush() if streams are disabled
* include/limits.h, include/time.h, sched/clock_internal.h: A support for
using selectable system timer frequency.
* Started m68322
</pre></ul>

View File

@ -1163,6 +1163,12 @@ The system can be re-made subsequently by just typing <code>make</code>.
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
</li>
<li>
<code>CONFIG_TICKS_PER_MSEC</code>: The default system timer is 100Hz
or <code>TICKS_PER_MSEC</code>=10. This setting may be defined to inform NuttX
that the processor hardware is providing system timer interrupts at some interrupt
interval other than 10 msec.
</li>
<li>
<code>CONFIG_RR_INTERVAL</code>: The round robin timeslice will be set
this number of milliseconds; Round robin scheduling can

View File

@ -7,10 +7,6 @@ o Task/Scheduler
- Implement sys/mman.h and functions
- Implement sys/wait.h and functions
- Implement priority inheritance
- Make the system timer frequency configurable via defconfig. See:
_POSIX_CLOCKRES_MIN in limits.h
CLK_TCK in time.h
MSEC_PER_TICK in sched/clock_internal.h
- Consider implementing wait, waitpid, waitid. At present, a parent has
no information about child tasks.
- Several APIs do not set errno. Need to review all APIs.

View File

@ -132,6 +132,11 @@ defconfig -- This is a configuration file similar to the Linux
regions of memory to allocate from, this specifies the
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
or TICKS_PER_MSEC=10. This setting may be defined to
inform NuttX that the processor hardware is providing
system timer interrupts at some interrupt interval other
than 10 msec.
CONFIG_RR_INTERVAL - The round robin timeslice will be set
this number of milliseconds; Round robin scheduling can
be disabled by setting this value to zero.

View File

@ -109,6 +109,11 @@ CONFIG_UART_MODEM_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -98,6 +98,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -122,6 +122,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -107,6 +107,11 @@ CONFIG_UART1_2STOP=0
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -95,6 +95,11 @@ CONFIG_LED_DEBUG=n
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -63,6 +63,11 @@ CONFIG_ARCH_BOARD_SIM=y
# handle and enables the API mm_addregion(start, end);
# CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
# time console output
# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
# or TICKS_PER_MSEC=10. This setting may be defined to
# inform NuttX that the processor hardware is providing
# system timer interrupts at some interrupt interval other
# than 10 msec.
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
# this number of milliseconds; Round robin scheduling can
# be disabled by setting this value to zero.

View File

@ -114,11 +114,27 @@
#define _POSIX_RTSIG_MAX 31
#define _POSIX_SIGQUEUE_MAX 32
/* Required for POSIX timers */
/* Required for POSIX timers.
*
* _POSIX_DELAYTIMER_MAX is the number of timer expiration overruns.
*
* _POSIX_TIMER_MAX is the per-process number of timers.
*
* _POSIX_CLOCKRES_MIN is the resolution of the CLOCK_REALTIME clock in nanoseconds.
* CLOCK_REALTIME is controlled by the NuttX system time. The default value is the
* system timer which has a resolution of 10 milliseconds. This default setting can
* be overridden by defining the clock interval in milliseconds as CONFIG_MSEC_PER_TICK
* in the board configuration file.
*/
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_TIMER_MAX 32
#define _POSIX_CLOCKRES_MIN 10000000
#ifdef CONFIG_MSEC_PER_TICK
# define _POSIX_CLOCKRES_MIN ((CONFIG_MSEC_PER_TICK)*1000000)
#else
# define _POSIX_CLOCKRES_MIN (10*1000000)
#endif
/* Required for asynchronous I/O */

View File

@ -51,9 +51,16 @@
* Definitions
********************************************************************************/
/* Clock tick of the system */
/* Clock tick of the system (frequency Hz). The default value is 100Hz, but this
* default setting can be overridden by defining the clock interval in
* milliseconds as CONFIG_MSEC_PER_TICK in the board configuration file.
*/
#define CLK_TCK 100
#ifdef CONFIG_MSEC_PER_TICK
# define CLK_TCK (1000/CONFIG_MSEC_PER_TICK)
#else
# define CLK_TCK (100)
#endif
/* This is the only clock_id supported by the "Clock and Timer
* Functions."

View File

@ -40,6 +40,7 @@
* Included Files
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/compiler.h>
@ -56,7 +57,20 @@
#define USEC_PER_MSEC 1000
#define NSEC_PER_USEC 1000
#define MSEC_PER_TICK 10
/* The interrupt interval of the system timer is given by MSEC_PER_TICK. This
* is the expected number of milliseconds between calls from the processor-
* specific logic to sched_process_timer(). The default value of MSEC_PER_TICK
* is 10 milliseconds (100KHz). However, this default setting can be overridden
* by defining the interval in milliseconds as CONFIG_MSEC_PER_TICK in the board
* configuration file.
*/
#ifdef CONFIG_MSEC_PER_TICK
# define MSEC_PER_TICK (CONFIG_MSEC_PER_TICK)
#else
# define MSEC_PER_TICK (10)
#endif
#define USEC_PER_TICK (MSEC_PER_TICK * USEC_PER_MSEC)
#define NSEC_PER_TICK (MSEC_PER_TICK * NSEC_PER_MSEC)
#define TICK_PER_SEC (MSEC_PER_SEC / MSEC_PER_TICK)
@ -64,13 +78,15 @@
#define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK)
#define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK)
#define JD_OF_EPOCH 2440588 /* Julian Date of noon, J1970 */
#define JD_OF_EPOCH 2440588 /* Julian Date of noon, J1970 */
#ifdef CONFIG_JULIAN_TIME
# define GREG_DUTC -141427 /* Default is October 15, 1582 */
# define GREG_YEAR 1582
# define GREG_MONTH 10
# define GREG_DAY 15
# define GREG_DUTC -141427 /* Default is October 15, 1582 */
# define GREG_YEAR 1582
# define GREG_MONTH 10
# define GREG_DAY 15
#endif /* CONFIG_JULIAN_TIME */
/********************************************************************************