summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/sam34/sam_timerisr.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-06-13 09:14:40 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-06-13 09:14:40 +0200
commitc255df1df9c1cd51e6d0e71ee5f2e92a22eac5cf (patch)
tree2254ceb7c66ba63b6cb6738af92c839f3868c748 /nuttx/arch/arm/src/sam34/sam_timerisr.c
parentbc5c15a4909386a1efd556f4648385440379b164 (diff)
downloadpx4-nuttx-c255df1df9c1cd51e6d0e71ee5f2e92a22eac5cf.tar.gz
px4-nuttx-c255df1df9c1cd51e6d0e71ee5f2e92a22eac5cf.tar.bz2
px4-nuttx-c255df1df9c1cd51e6d0e71ee5f2e92a22eac5cf.zip
Merged in upstream, took upstream UART driver without changes, needs re-evaluation (minor diffs to local version)
Diffstat (limited to 'nuttx/arch/arm/src/sam34/sam_timerisr.c')
-rw-r--r--nuttx/arch/arm/src/sam34/sam_timerisr.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/sam34/sam_timerisr.c b/nuttx/arch/arm/src/sam34/sam_timerisr.c
index e1879d5cc..572b04626 100644
--- a/nuttx/arch/arm/src/sam34/sam_timerisr.c
+++ b/nuttx/arch/arm/src/sam34/sam_timerisr.c
@@ -55,6 +55,20 @@
/****************************************************************************
* Definitions
****************************************************************************/
+/* Select MCU-specific settings
+ *
+ * For the SAM3U, Systick is driven by the main clock.
+ * For the SAM4L, Systick is driven by the CPU clock which is just the main
+ * clock divided down.
+ */
+
+#if defined(CONFIG_ARCH_CHIP_SAM3U)
+# define SAM_SYSTICK_CLOCK BOARD_MCK_FREQUENCY /* Frequency of the main clock */
+#elif defined(CONFIG_ARCH_CHIP_SAM4L) || defined(CONFIG_ARCH_CHIP_SAM4S)
+# define SAM_SYSTICK_CLOCK BOARD_CPU_FREQUENCY /* CPU frequency */
+#else
+# error Unrecognized SAM architecture
+#endif
/* The desired timer interrupt frequency is provided by the definition
* CLK_TCK (see include/time.h). CLK_TCK defines the desired number of
@@ -69,9 +83,9 @@
#undef CONFIG_SAM34_SYSTICK_HCLKd8 /* Power up default is MCK, not MCK/8 */
#if CONFIG_SAM34_SYSTICK_HCLKd8
-# define SYSTICK_RELOAD ((SAM_MCK_FREQUENCY / 8 / CLK_TCK) - 1)
+# define SYSTICK_RELOAD ((SAM_SYSTICK_CLOCK / 8 / CLK_TCK) - 1)
#else
-# define SYSTICK_RELOAD ((SAM_MCK_FREQUENCY / CLK_TCK) - 1)
+# define SYSTICK_RELOAD ((SAM_SYSTICK_CLOCK / CLK_TCK) - 1)
#endif
/* The size of the reload field is 24 bits. Verify that the reload value