⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time.c

📁 广州斯道2410普及版II的源代码
💻 C
字号:
/* *  linux/arch/arm/mach-clps711x/time.c * *  Copyright (C) 2001 Deep Blue Solutions Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#include <linux/sched.h>#include <linux/init.h>#include <asm/hardware.h>#include <asm/io.h>#include <asm/hardware/clps7111.h>extern unsigned long (*gettimeoffset)(void);/* * gettimeoffset() returns time since last timer tick, in usecs. * * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy. * 'tick' is usecs per jiffy. */static unsigned long clps711x_gettimeoffset(void){	unsigned long hwticks;	hwticks = LATCH - (clps_readl(TC2D) & 0xffff);	/* since last underflow */	return (hwticks * tick) / LATCH;}void __init clps711x_setup_timer(void){	unsigned int syscon;	gettimeoffset = clps711x_gettimeoffset;	syscon = clps_readl(SYSCON1);	syscon |= SYSCON1_TC2S | SYSCON1_TC2M;	clps_writel(syscon, SYSCON1);	clps_writel(LATCH-1, TC2D); /* 512kHz / 100Hz - 1 */	xtime.tv_sec = clps_readl(RTCDR);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -