diff options
Diffstat (limited to 'nuttx/arch')
-rw-r--r-- | nuttx/arch/arm/src/common/up_initialize.c | 86 |
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(); |