summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-06 16:17:50 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-06 16:17:50 +0000
commit4fc87116d818f5285403dbb37d2aa60d33e4203a (patch)
tree8e2327f902c41cf79ffab0997a6754d8e78b012a /nuttx/arch
parent13a1d731ec51a27983bc9e6fcaa841607a090764 (diff)
downloadpx4-nuttx-4fc87116d818f5285403dbb37d2aa60d33e4203a.tar.gz
px4-nuttx-4fc87116d818f5285403dbb37d2aa60d33e4203a.tar.bz2
px4-nuttx-4fc87116d818f5285403dbb37d2aa60d33e4203a.zip
Reduce debug output; calibrate DM320 timer
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@372 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/common/up_initialize.c86
1 files changed, 60 insertions, 26 deletions
diff --git a/nuttx/arch/arm/src/common/up_initialize.c b/nuttx/arch/arm/src/common/up_initialize.c
index b9622d0d0..b8ed24f08 100644
--- a/nuttx/arch/arm/src/common/up_initialize.c
+++ b/nuttx/arch/arm/src/common/up_initialize.c
@@ -1,4 +1,4 @@
-/************************************************************
+/****************************************************************************
* common/up_initialize.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
@@ -45,37 +45,67 @@
#include "up_arch.h"
#include "up_internal.h"
-/************************************************************
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Define to enable timing loop calibration */
+
+#undef CONFIG_ARM_CALIBRATION
+
+/****************************************************************************
* Private Types
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
- * Private Function Prototypes
- ************************************************************/
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
-/************************************************************
- * Global Functions
- ************************************************************/
+/****************************************************************************
+ * Name: up_calibratedelay
+ *
+ * Description:
+ * Delay loops are provided for short timing loops. This function, if
+ * enabled, will just wait for 100 seconds. Using a stopwatch, you can
+ * can then determine if the timing loops are properly calibrated.
+ *
+ ****************************************************************************/
-/************************************************************
+#if defined(CONFIG_ARM_CALIBRATION) & defined(CONFIG_DEBUG)
+static void up_calibratedelay(void)
+{
+ int i;
+ lldbg("Beginning 100s delay\n");
+ for (i = 0; i < 100; i++)
+ {
+ up_mdelay(1000);
+ }
+ lldbg("End 100s delay\n");
+}
+#else
+# define up_calibratedelay()
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
* Name: up_initialize
*
* Description:
- * up_initialize will be called once during OS
- * initialization after the basic OS services have been
- * initialized. The architecture specific details of
- * initializing the OS will be handled here. Such things as
- * setting up interrupt service routines, starting the
- * clock, and registering device drivers are some of the
- * things that are different for each processor and hardware
- * platform.
+ * up_initialize will be called once during OS initialization after the
+ * basic OS services have been initialized. The architecture specific
+ * details of initializing the OS will be handled here. Such things as
+ * setting up interrupt service routines, starting the clock, and
+ * registering device drivers are some of the things that are different
+ * for each processor and hardware platform.
*
- * up_initialize is called after the OS initialized but
- * before the init process has been started and before the
- * libraries have been initialized. OS services and driver
- * services are available.
+ * up_initialize is called after the OS initialized but before the user
+ * initialization logic has been started and before the libraries have
+ * been initialized. OS services and driver services are available.
*
- ************************************************************/
+ ****************************************************************************/
void up_initialize(void)
{
@@ -83,6 +113,10 @@ void up_initialize(void)
current_regs = NULL;
+ /* Calibrate the timing loop */
+
+ up_calibratedelay();
+
/* Initialize the interrupt subsystem */
up_irqinitialize();