summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-19 15:47:14 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-19 15:47:14 +0000
commit49a4016507e6239ca313bafff5dcaf37cd6647fd (patch)
tree076c0ba4437083f66b3093465071a53af8e513d2 /c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
parent2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-49a4016507e6239ca313bafff5dcaf37cd6647fd.tar.bz2
2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
* dswifi/arm7/makefile, dswifi/include/netinet/in.h, libnds/basicARM7/source/defaultARM7.c, libnds/include/gbfs.h, libnds/include/nds/bios.h, libnds/include/nds/card.h, libnds/include/nds/dma.h, libnds/include/nds/interrupts.h, libnds/include/nds/ipc.h, libnds/include/nds/jtypes.h, libnds/include/nds/registers_alt.h, libnds/include/nds/system.h, libnds/include/nds/timers.h, libnds/include/nds/arm7/audio.h, libnds/include/nds/arm7/clock.h, libnds/include/nds/arm7/serial.h, libnds/include/nds/arm7/touch.h, libnds/include/nds/arm9/boxtest.h, libnds/include/nds/arm9/cache.h, libnds/include/nds/arm9/console.h, libnds/include/nds/arm9/ndsmotion.h, libnds/include/nds/arm9/video.h, libnds/include/nds/arm9/videoGL.h, libnds/source/arm7/audio.c, libnds/source/arm7/clock.c, libnds/source/arm7/microphone.c, libnds/source/arm7/touch.c, libnds/source/arm7/userSettings.c, libnds/source/arm9/boxtest.c, libnds/source/arm9/gurumeditation.c, libnds/source/arm9/ndsmotion.c, libnds/source/arm9/videoGL.c, libnds/source/common/card.c, libnds/source/common/interruptDispatcher.S, touchscreen/reco.c: Fix various warnings by fixing prototypes. Remove unused .bin files. Convert all files to UNIX CF/LF. * libnds/source/arm9/COS.bin, libnds/source/arm9/SIN.bin, libnds/source/arm9/TAN.bin, libnds/source/arm9/default_font.bin: Removed.
Diffstat (limited to 'c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h')
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h412
1 files changed, 206 insertions, 206 deletions
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
index c0edfbb6b7..39951d33ca 100644
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
+++ b/c/src/lib/libbsp/arm/nds/libnds/include/nds/timers.h
@@ -1,206 +1,206 @@
-/*---------------------------------------------------------------------------------
- $Id$
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-
-/*! \file timers.h
- \brief Contains defines and macros for ARM7 and ARM9 timer operation.
-
- The timers are fed with a 33.4 MHz source on the ARM9. The ARM7
- timing hasn't been tested yet, but is likely to be the same.
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef NDS_TIMERS_INCLUDE
-#define NDS_TIMERS_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------------
-#ifdef __cplusplus
-extern "C" {
-#endif
-//---------------------------------------------------------------------------------
-
-
-#include <nds/jtypes.h>
-
-// Timers
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul>
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
-
- %TIMER_DATA(0) = %TIMER_FREQ(freq_in_hz); \n
- %TIMER_CR(0) = %TIMER_DIV1 | %TIMER_ENABLE; \n
- \n
- Max frequency is: 33554432Hz\n
- Min frequency is: 512Hz\n
-*/
-#define TIMER_FREQ(n) (-0x2000000/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul>
-
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_64(freq_in_hz)\n
- \n
- Max frequency is: 524288Hz\n
- Min frequency is: 8Hz\n
-*/
-#define TIMER_FREQ_64(n) (-(0x2000000>>6)/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> %TIMER_FREQ_1024(f) </li>
- </ul> <p>
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_256(freq_in_hz)\n
- \n
- Max frequency is: 131072Hz\n
- Min frequency is: 2Hz\n
-*/
-#define TIMER_FREQ_256(n) (-(0x2000000>>8)/(n))
-
-//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
-/*! Use the appropriate macro depending on clock divider: \n
- <ul>
- <li> %TIMER_FREQ(f) </li>
- <li> %TIMER_FREQ_64(f) </li>
- <li> %TIMER_FREQ_256(f) </li>
- <li> TIMER_FREQ_1024(f) </li>
- </ul>
-
- Clock divider is controlled by %TIMER_CR(n) \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(x) = %TIMER_FREQ_1024(freq_in_hz)\n
- \n
- Max frequency is: 32768Hz\n
- Min frequency is: 0.5Hz\n
-*/
-#define TIMER_FREQ_1024(n) (-(0x2000000>>10)/(n))
-
-
-//! Same as %TIMER_DATA(0).
-#define TIMER0_DATA (*(vuint16*)0x04000100)
-//! Same as %TIMER_DATA(1).
-#define TIMER1_DATA (*(vuint16*)0x04000104)
-//! Same as %TIMER_DATA(2).
-#define TIMER2_DATA (*(vuint16*)0x04000108)
-//! Same as %TIMER_DATA(3).
-#define TIMER3_DATA (*(vuint16*)0x0400010C)
-
-//! Returns a dereferenced pointer to the data register for timer number "n".
-/*! \see TIMER_CR(n)
- \see TIMER_FREQ(n)
-
- %TIMER_DATA(n) when set will latch that value into the counter. Everytime the
- counter rolls over %TIMER_DATA(0) will return to the latched value. This allows
- you to control the frequency of the timer using the following formula:\n
- %TIMER_DATA(x) = -(0x2000000/(freq * divider)); \n
- \n
- <b>Example Usage:</b>
- %TIMER_DATA(0) = value; were 0 can be 0 through 3 and value is 16 bits.
-*/
-#define TIMER_DATA(n) (*(vuint16*)(0x04000100+((n)<<2)))
-
-// Timer control registers
-//! Same as %TIMER_CR(0).
-#define TIMER0_CR (*(vuint16*)0x04000102)
-//! Same as %TIMER_CR(1).
-#define TIMER1_CR (*(vuint16*)0x04000106)
-//! Same as %TIMER_CR(2).
-#define TIMER2_CR (*(vuint16*)0x0400010A)
-//! Same as %TIMER_CR(3).
-#define TIMER3_CR (*(vuint16*)0x0400010E)
-
-//! Returns a dereferenced pointer to the data register for timer control Register.
-/*! <b>Example Usage:</b> %TIMER_CR(x) = %TIMER_ENABLE | %TIMER_DIV_64; \n
- \n
- Possible bit defines: \n
-
- \see TIMER_ENABLE
- \see TIMER_IRQ_REQ
- \see TIMER_DIV_1
- \see TIMER_DIV_64
- \see TIMER_DIV_256
- \see TIMER_DIV_1024
-*/
-#define TIMER_CR(n) (*(vuint16*)(0x04000102+((n)<<2)))
-
-//! Enables the timer.
-#define TIMER_ENABLE (1<<7)
-
-//! Causes the timer to request an Interupt on overflow.
-#define TIMER_IRQ_REQ (1<<6)
-
-//! When set will cause the timer to count when the timer below overflows (unavailable for timer 0).
-#define TIMER_CASCADE (1<<2)
-
-//! Causes the timer to count at 33.514Mhz.
-#define TIMER_DIV_1 (0)
-//! Causes the timer to count at (33.514 / 64) Mhz.
-#define TIMER_DIV_64 (1)
-//! Causes the timer to count at (33.514 / 256) Mhz.
-#define TIMER_DIV_256 (2)
-//! Causes the timer to count at (33.514 / 1024)Mhz.
-#define TIMER_DIV_1024 (3)
-
-//---------------------------------------------------------------------------------
-#ifdef __cplusplus
-}
-#endif
-//---------------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------------
-#endif
-//---------------------------------------------------------------------------------
-
+/*---------------------------------------------------------------------------------
+ $Id$
+
+ Copyright (C) 2005
+ Michael Noland (joat)
+ Jason Rogers (dovoto)
+ Dave Murphy (WinterMute)
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any
+ damages arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any
+ purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you use
+ this software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+---------------------------------------------------------------------------------*/
+
+
+/*! \file timers.h
+ \brief Contains defines and macros for ARM7 and ARM9 timer operation.
+
+ The timers are fed with a 33.4 MHz source on the ARM9. The ARM7
+ timing hasn't been tested yet, but is likely to be the same.
+*/
+
+//---------------------------------------------------------------------------------
+#ifndef NDS_TIMERS_INCLUDE
+#define NDS_TIMERS_INCLUDE
+//---------------------------------------------------------------------------------
+
+
+//---------------------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+//---------------------------------------------------------------------------------
+
+
+#include <nds/jtypes.h>
+
+// Timers
+
+//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
+/*! Use the appropriate macro depending on clock divider: \n
+ <ul>
+ <li> %TIMER_FREQ(f) </li>
+ <li> %TIMER_FREQ_64(f) </li>
+ <li> %TIMER_FREQ_256(f) </li>
+ <li> %TIMER_FREQ_1024(f) </li>
+ </ul>
+ Clock divider is controlled by %TIMER_CR(n) \n
+ \n
+ <b>Example Usage:</b>
+
+ %TIMER_DATA(0) = %TIMER_FREQ(freq_in_hz); \n
+ %TIMER_CR(0) = %TIMER_DIV1 | %TIMER_ENABLE; \n
+ \n
+ Max frequency is: 33554432Hz\n
+ Min frequency is: 512Hz\n
+*/
+#define TIMER_FREQ(n) (-0x2000000/(n))
+
+//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
+/*! Use the appropriate macro depending on clock divider: \n
+ <ul>
+ <li> %TIMER_FREQ(f) </li>
+ <li> %TIMER_FREQ_64(f) </li>
+ <li> %TIMER_FREQ_256(f) </li>
+ <li> %TIMER_FREQ_1024(f) </li>
+ </ul>
+
+
+ Clock divider is controlled by %TIMER_CR(n) \n
+ \n
+ <b>Example Usage:</b>
+ %TIMER_DATA(x) = %TIMER_FREQ_64(freq_in_hz)\n
+ \n
+ Max frequency is: 524288Hz\n
+ Min frequency is: 8Hz\n
+*/
+#define TIMER_FREQ_64(n) (-(0x2000000>>6)/(n))
+
+//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
+/*! Use the appropriate macro depending on clock divider: \n
+ <ul>
+ <li> %TIMER_FREQ(f) </li>
+ <li> %TIMER_FREQ_64(f) </li>
+ <li> %TIMER_FREQ_256(f) </li>
+ <li> %TIMER_FREQ_1024(f) </li>
+ </ul> <p>
+
+ Clock divider is controlled by %TIMER_CR(n) \n
+ \n
+ <b>Example Usage:</b>
+ %TIMER_DATA(x) = %TIMER_FREQ_256(freq_in_hz)\n
+ \n
+ Max frequency is: 131072Hz\n
+ Min frequency is: 2Hz\n
+*/
+#define TIMER_FREQ_256(n) (-(0x2000000>>8)/(n))
+
+//! A macro that calculates %TIMER_DATA(n) settings for a given frequency of n.
+/*! Use the appropriate macro depending on clock divider: \n
+ <ul>
+ <li> %TIMER_FREQ(f) </li>
+ <li> %TIMER_FREQ_64(f) </li>
+ <li> %TIMER_FREQ_256(f) </li>
+ <li> TIMER_FREQ_1024(f) </li>
+ </ul>
+
+ Clock divider is controlled by %TIMER_CR(n) \n
+ \n
+ <b>Example Usage:</b>
+ %TIMER_DATA(x) = %TIMER_FREQ_1024(freq_in_hz)\n
+ \n
+ Max frequency is: 32768Hz\n
+ Min frequency is: 0.5Hz\n
+*/
+#define TIMER_FREQ_1024(n) (-(0x2000000>>10)/(n))
+
+
+//! Same as %TIMER_DATA(0).
+#define TIMER0_DATA (*(vuint16*)0x04000100)
+//! Same as %TIMER_DATA(1).
+#define TIMER1_DATA (*(vuint16*)0x04000104)
+//! Same as %TIMER_DATA(2).
+#define TIMER2_DATA (*(vuint16*)0x04000108)
+//! Same as %TIMER_DATA(3).
+#define TIMER3_DATA (*(vuint16*)0x0400010C)
+
+//! Returns a dereferenced pointer to the data register for timer number "n".
+/*! \see TIMER_CR(n)
+ \see TIMER_FREQ(n)
+
+ %TIMER_DATA(n) when set will latch that value into the counter. Everytime the
+ counter rolls over %TIMER_DATA(0) will return to the latched value. This allows
+ you to control the frequency of the timer using the following formula:\n
+ %TIMER_DATA(x) = -(0x2000000/(freq * divider)); \n
+ \n
+ <b>Example Usage:</b>
+ %TIMER_DATA(0) = value; were 0 can be 0 through 3 and value is 16 bits.
+*/
+#define TIMER_DATA(n) (*(vuint16*)(0x04000100+((n)<<2)))
+
+// Timer control registers
+//! Same as %TIMER_CR(0).
+#define TIMER0_CR (*(vuint16*)0x04000102)
+//! Same as %TIMER_CR(1).
+#define TIMER1_CR (*(vuint16*)0x04000106)
+//! Same as %TIMER_CR(2).
+#define TIMER2_CR (*(vuint16*)0x0400010A)
+//! Same as %TIMER_CR(3).
+#define TIMER3_CR (*(vuint16*)0x0400010E)
+
+//! Returns a dereferenced pointer to the data register for timer control Register.
+/*! <b>Example Usage:</b> %TIMER_CR(x) = %TIMER_ENABLE | %TIMER_DIV_64; \n
+ \n
+ Possible bit defines: \n
+
+ \see TIMER_ENABLE
+ \see TIMER_IRQ_REQ
+ \see TIMER_DIV_1
+ \see TIMER_DIV_64
+ \see TIMER_DIV_256
+ \see TIMER_DIV_1024
+*/
+#define TIMER_CR(n) (*(vuint16*)(0x04000102+((n)<<2)))
+
+//! Enables the timer.
+#define TIMER_ENABLE (1<<7)
+
+//! Causes the timer to request an Interupt on overflow.
+#define TIMER_IRQ_REQ (1<<6)
+
+//! When set will cause the timer to count when the timer below overflows (unavailable for timer 0).
+#define TIMER_CASCADE (1<<2)
+
+//! Causes the timer to count at 33.514Mhz.
+#define TIMER_DIV_1 (0)
+//! Causes the timer to count at (33.514 / 64) Mhz.
+#define TIMER_DIV_64 (1)
+//! Causes the timer to count at (33.514 / 256) Mhz.
+#define TIMER_DIV_256 (2)
+//! Causes the timer to count at (33.514 / 1024)Mhz.
+#define TIMER_DIV_1024 (3)
+
+//---------------------------------------------------------------------------------
+#ifdef __cplusplus
+}
+#endif
+//---------------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------------
+#endif
+//---------------------------------------------------------------------------------
+