os/nandboot-R2_0_4/lib/delay.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002 *!
00003 *! FILE NAME  : delay.c
00004 *!
00005 *! DESCRIPTION: Precise delay loops for ETRAX FS.
00006 *!              Trivial mod. for boot loader.
00007 *!
00008 *! ---------------------------------------------------------------------------
00009 *! (C) Copyright 2006-2007, Axis Communications AB, LUND, SWEDEN
00010 *!
00011 *! This program is free software; you can redistribute it and/or modify
00012 *! it under the terms of the GNU General Public License version 2 as 
00013 *! published by the Free Software Foundation.
00014 *!
00015 *! This program is distributed in the hope that it will be useful,
00016 *! but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *! GNU General Public License for more details.
00019 *!
00020 *! You should have received a copy of the GNU General Public License
00021 *! along with this program; if not, write to the Free Software
00022 *! Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 *!
00024 *!***************************************************************************/
00025 
00026 #include <asm/arch/hwregs/reg_map.h>
00027 #include <asm/arch/hwregs/reg_rdwr.h>
00028 #include <asm/arch/hwregs/timer_defs.h>
00029 #include <linux/types.h>
00030 #include "delay.h"
00031 
00032 /*
00033  * On ETRAX FS, we can check the free-running read-only 100MHz timer
00034  * getting 32-bit 10ns precision, theoretically good for 42.94967295
00035  * seconds.  Unsigned arithmetic and careful expression handles
00036  * wrapping.
00037  */
00038 
00039 void cris_delay10ns(u32 n10ns)
00040 {
00041         u32 t0 = REG_RD(timer, regi_timer, r_time);
00042         while (REG_RD(timer, regi_timer, r_time) - t0 < n10ns)
00043                 ;
00044 }

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1