summaryrefslogtreecommitdiff
path: root/nuttx/include/nuttx/clock.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-13 03:12:51 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-13 03:12:51 +0000
commitc14fdd3ffe106e6f5eee49abc5182d55e190709c (patch)
treee2650391fd2e7143cc04c1856fedfac5e602e975 /nuttx/include/nuttx/clock.h
parent36b629aa8d334aab147dcfcf76d17f4033f35cac (diff)
downloadnuttx-c14fdd3ffe106e6f5eee49abc5182d55e190709c.tar.gz
nuttx-c14fdd3ffe106e6f5eee49abc5182d55e190709c.tar.bz2
nuttx-c14fdd3ffe106e6f5eee49abc5182d55e190709c.zip
LPCXpression console on UART3
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3497 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/nuttx/clock.h')
-rw-r--r--nuttx/include/nuttx/clock.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h
index 68f3a46f2..3cd3e36f8 100644
--- a/nuttx/include/nuttx/clock.h
+++ b/nuttx/include/nuttx/clock.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/clock.h
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -96,15 +96,24 @@
#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */
#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */
-
/****************************************************************************
* Global Data
****************************************************************************/
/* Access to raw system clock ***********************************************/
+/* Direct access to the system timer/counter is supported only if (1) the
+ * system clock is not disabled and (2) the executation environement has
+ * direct access to kernel global data.
+ *
+ * The code in this execution context can access the kernel global data
+ * directly if: (1) this is an un-protected, non-kernel build, or (2)
+ * this code is being built for execution within the kernel.
+ */
-#ifndef CONFIG_DISABLE_CLOCK
+#if !defined(CONFIG_DISABLE_CLOCK) && \
+ (!defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__))
extern volatile uint32_t g_system_timer;
+#define os_systime32() g_system_timer
#endif
/****************************************************************************
@@ -122,6 +131,15 @@ extern "C" {
#define EXTERN extern
#endif
+/* If direct access to the system timer/counter is not supported (see above),
+ * then the value can be obtained via os_systime32 through a system call.
+ */
+
+#if !defined(CONFIG_DISABLE_CLOCK) && \
+ defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__)
+EXTERN uint32_t os_systime32(void);
+#endif
+
#undef EXTERN
#ifdef __cplusplus
}