亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? timer.c

?? Linux2.4.20針對三星公司的s3c2410開發板的內核改造。
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  linux/kernel/timer.c * *  Kernel internal timers, kernel timekeeping, basic process system calls * *  Copyright (C) 1991, 1992  Linus Torvalds * *  1997-01-28  Modified by Finn Arne Gangstad to make timers scale better. * *  1997-09-10  Updated NTP code according to technical memorandum Jan '96 *              "A Kernel Model for Precision Timekeeping" by Dave Mills *  1998-12-24  Fixed a xtime SMP race (we need the xtime_lock rw spinlock to *              serialize accesses to xtime/lost_ticks). *                              Copyright (C) 1998  Andrea Arcangeli *  1999-03-10  Improved NTP compatibility by Ulrich Windl */#include <linux/config.h>#include <linux/mm.h>#include <linux/timex.h>#include <linux/delay.h>#include <linux/smp_lock.h>#include <linux/interrupt.h>#include <linux/kernel_stat.h>#include <linux/trace.h>#include <asm/uaccess.h>struct kernel_stat kstat;/* * Timekeeping variables */long tick = (1000000 + HZ/2) / HZ;	/* timer interrupt period *//* The current time */struct timeval xtime __attribute__ ((aligned (16)));/* Don't completely fail for HZ > 500.  */int tickadj = 500/HZ ? : 1;		/* microsecs */DECLARE_TASK_QUEUE(tq_timer);DECLARE_TASK_QUEUE(tq_immediate);/* * phase-lock loop variables *//* TIME_ERROR prevents overwriting the CMOS clock */int time_state = TIME_OK;		/* clock synchronization status	*/int time_status = STA_UNSYNC;		/* clock status bits		*/long time_offset;			/* time adjustment (us)		*/long time_constant = 2;			/* pll time constant		*/long time_tolerance = MAXFREQ;		/* frequency tolerance (ppm)	*/long time_precision = 1;		/* clock precision (us)		*/long time_maxerror = NTP_PHASE_LIMIT;	/* maximum error (us)		*/long time_esterror = NTP_PHASE_LIMIT;	/* estimated error (us)		*/long time_phase;			/* phase offset (scaled us)	*/long time_freq = ((1000000 + HZ/2) % HZ - HZ/2) << SHIFT_USEC;					/* frequency offset (scaled ppm)*/long time_adj;				/* tick adjust (scaled 1 / HZ)	*/long time_reftime;			/* time at last adjustment (s)	*/long time_adjust;long time_adjust_step;unsigned long event;extern int do_setitimer(int, struct itimerval *, struct itimerval *);unsigned long volatile jiffies;unsigned int * prof_buffer;unsigned long prof_len;unsigned long prof_shift;/* * Event timer code */#define TVN_BITS 6#define TVR_BITS 8#define TVN_SIZE (1 << TVN_BITS)#define TVR_SIZE (1 << TVR_BITS)#define TVN_MASK (TVN_SIZE - 1)#define TVR_MASK (TVR_SIZE - 1)struct timer_vec {	int index;	struct list_head vec[TVN_SIZE];};struct timer_vec_root {	int index;	struct list_head vec[TVR_SIZE];};static struct timer_vec tv5;static struct timer_vec tv4;static struct timer_vec tv3;static struct timer_vec tv2;static struct timer_vec_root tv1;static struct timer_vec * const tvecs[] = {	(struct timer_vec *)&tv1, &tv2, &tv3, &tv4, &tv5};static struct list_head * run_timer_list_running;#define NOOF_TVECS (sizeof(tvecs) / sizeof(tvecs[0]))void init_timervecs (void){	int i;	for (i = 0; i < TVN_SIZE; i++) {		INIT_LIST_HEAD(tv5.vec + i);		INIT_LIST_HEAD(tv4.vec + i);		INIT_LIST_HEAD(tv3.vec + i);		INIT_LIST_HEAD(tv2.vec + i);	}	for (i = 0; i < TVR_SIZE; i++)		INIT_LIST_HEAD(tv1.vec + i);}static unsigned long timer_jiffies;static inline void internal_add_timer(struct timer_list *timer){	/*	 * must be cli-ed when calling this	 */	unsigned long expires = timer->expires;	unsigned long idx = expires - timer_jiffies;	struct list_head * vec;	if (run_timer_list_running)		vec = run_timer_list_running;	else if (idx < TVR_SIZE) {		int i = expires & TVR_MASK;		vec = tv1.vec + i;	} else if (idx < 1 << (TVR_BITS + TVN_BITS)) {		int i = (expires >> TVR_BITS) & TVN_MASK;		vec = tv2.vec + i;	} else if (idx < 1 << (TVR_BITS + 2 * TVN_BITS)) {		int i = (expires >> (TVR_BITS + TVN_BITS)) & TVN_MASK;		vec =  tv3.vec + i;	} else if (idx < 1 << (TVR_BITS + 3 * TVN_BITS)) {		int i = (expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK;		vec = tv4.vec + i;	} else if ((signed long) idx < 0) {		/* can happen if you add a timer with expires == jiffies,		 * or you set a timer to go off in the past		 */		vec = tv1.vec + tv1.index;	} else if (idx <= 0xffffffffUL) {		int i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;		vec = tv5.vec + i;	} else {		/* Can only get here on architectures with 64-bit jiffies */		INIT_LIST_HEAD(&timer->list);		return;	}	/*	 * Timers are FIFO!	 */	list_add(&timer->list, vec->prev);}/* Initialize both explicitly - let's try to have them in the same cache line */spinlock_t timerlist_lock = SPIN_LOCK_UNLOCKED;#ifdef CONFIG_SMPvolatile struct timer_list * volatile running_timer;#define timer_enter(t) do { running_timer = t; mb(); } while (0)#define timer_exit() do { running_timer = NULL; } while (0)#define timer_is_running(t) (running_timer == t)#define timer_synchronize(t) while (timer_is_running(t)) barrier()#else#define timer_enter(t)		do { } while (0)#define timer_exit()		do { } while (0)#endifvoid add_timer(struct timer_list *timer){	unsigned long flags;	spin_lock_irqsave(&timerlist_lock, flags);	if (timer_pending(timer))		goto bug;	internal_add_timer(timer);	spin_unlock_irqrestore(&timerlist_lock, flags);	return;bug:	spin_unlock_irqrestore(&timerlist_lock, flags);	printk("bug: kernel timer added twice at %p.\n",			__builtin_return_address(0));}static inline int detach_timer (struct timer_list *timer){	if (!timer_pending(timer))		return 0;	list_del(&timer->list);	return 1;}int mod_timer(struct timer_list *timer, unsigned long expires){	int ret;	unsigned long flags;	spin_lock_irqsave(&timerlist_lock, flags);	timer->expires = expires;	ret = detach_timer(timer);	internal_add_timer(timer);	spin_unlock_irqrestore(&timerlist_lock, flags);	return ret;}int del_timer(struct timer_list * timer){	int ret;	unsigned long flags;	spin_lock_irqsave(&timerlist_lock, flags);	ret = detach_timer(timer);	timer->list.next = timer->list.prev = NULL;	spin_unlock_irqrestore(&timerlist_lock, flags);	return ret;}#ifdef CONFIG_SMPvoid sync_timers(void){	spin_unlock_wait(&global_bh_lock);}/* * SMP specific function to delete periodic timer. * Caller must disable by some means restarting the timer * for new. Upon exit the timer is not queued and handler is not running * on any CPU. It returns number of times, which timer was deleted * (for reference counting). */int del_timer_sync(struct timer_list * timer){	int ret = 0;	for (;;) {		unsigned long flags;		int running;		spin_lock_irqsave(&timerlist_lock, flags);		ret += detach_timer(timer);		timer->list.next = timer->list.prev = 0;		running = timer_is_running(timer);		spin_unlock_irqrestore(&timerlist_lock, flags);		if (!running)			break;		timer_synchronize(timer);	}	return ret;}#endifstatic inline void cascade_timers(struct timer_vec *tv){	/* cascade all the timers from tv up one level */	struct list_head *head, *curr, *next;	head = tv->vec + tv->index;	curr = head->next;	/*	 * We are removing _all_ timers from the list, so we don't  have to	 * detach them individually, just clear the list afterwards.	 */	while (curr != head) {		struct timer_list *tmp;		tmp = list_entry(curr, struct timer_list, list);		next = curr->next;		list_del(curr); // not needed		internal_add_timer(tmp);		curr = next;	}	INIT_LIST_HEAD(head);	tv->index = (tv->index + 1) & TVN_MASK;}static inline void run_timer_list(void){	spin_lock_irq(&timerlist_lock);	while ((long)(jiffies - timer_jiffies) >= 0) {		LIST_HEAD(queued);		struct list_head *head, *curr;		if (!tv1.index) {			int n = 1;			do {				cascade_timers(tvecs[n]);			} while (tvecs[n]->index == 1 && ++n < NOOF_TVECS);		}		run_timer_list_running = &queued;repeat:		head = tv1.vec + tv1.index;		curr = head->next;		if (curr != head) {			struct timer_list *timer;			void (*fn)(unsigned long);			unsigned long data;			timer = list_entry(curr, struct timer_list, list); 			fn = timer->function; 			data= timer->data;			detach_timer(timer);			timer->list.next = timer->list.prev = NULL;			timer_enter(timer);			spin_unlock_irq(&timerlist_lock);			fn(data);			spin_lock_irq(&timerlist_lock);			timer_exit();			goto repeat;		}		run_timer_list_running = NULL;		++timer_jiffies; 		tv1.index = (tv1.index + 1) & TVR_MASK;		curr = queued.next;		while (curr != &queued) {			struct timer_list *timer;			timer = list_entry(curr, struct timer_list, list);			curr = curr->next;			internal_add_timer(timer);		}				}	spin_unlock_irq(&timerlist_lock);}spinlock_t tqueue_lock = SPIN_LOCK_UNLOCKED;void tqueue_bh(void){	run_task_queue(&tq_timer);}void immediate_bh(void){	run_task_queue(&tq_immediate);}/* * this routine handles the overflow of the microsecond field * * The tricky bits of code to handle the accurate clock support * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. * They were originally developed for SUN and DEC kernels. * All the kudos should go to Dave for this stuff. * */static void second_overflow(void){    long ltemp;    /* Bump the maxerror field */    time_maxerror += time_tolerance >> SHIFT_USEC;    if ( time_maxerror > NTP_PHASE_LIMIT ) {	time_maxerror = NTP_PHASE_LIMIT;	time_status |= STA_UNSYNC;    }    /*     * Leap second processing. If in leap-insert state at     * the end of the day, the system clock is set back one     * second; if in leap-delete state, the system clock is     * set ahead one second. The microtime() routine or     * external clock driver will insure that reported time     * is always monotonic. The ugly divides should be     * replaced.     */    switch (time_state) {    case TIME_OK:	if (time_status & STA_INS)	    time_state = TIME_INS;	else if (time_status & STA_DEL)	    time_state = TIME_DEL;	break;    case TIME_INS:	if (xtime.tv_sec % 86400 == 0) {	    xtime.tv_sec--;	    time_state = TIME_OOP;	    printk(KERN_NOTICE "Clock: inserting leap second 23:59:60 UTC\n");	}	break;    case TIME_DEL:	if ((xtime.tv_sec + 1) % 86400 == 0) {	    xtime.tv_sec++;	    time_state = TIME_WAIT;	    printk(KERN_NOTICE "Clock: deleting leap second 23:59:59 UTC\n");	}	break;    case TIME_OOP:	time_state = TIME_WAIT;	break;    case TIME_WAIT:	if (!(time_status & (STA_INS | STA_DEL)))	    time_state = TIME_OK;    }    /*     * Compute the phase adjustment for the next second. In     * PLL mode, the offset is reduced by a fixed factor     * times the time constant. In FLL mode the offset is     * used directly. In either mode, the maximum phase     * adjustment for each second is clamped so as to spread     * the adjustment over not more than the number of     * seconds between updates.     */    if (time_offset < 0) {	ltemp = -time_offset;	if (!(time_status & STA_FLL))	    ltemp >>= SHIFT_KG + time_constant;	if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)	    ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;	time_offset += ltemp;	time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);    } else {	ltemp = time_offset;	if (!(time_status & STA_FLL))	    ltemp >>= SHIFT_KG + time_constant;	if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)	    ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;	time_offset -= ltemp;	time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);    }    /*     * Compute the frequency estimate and additional phase     * adjustment due to frequency error for the next     * second. When the PPS signal is engaged, gnaw on the     * watchdog counter and update the frequency computed by     * the pll and the PPS signal.     */    pps_valid++;    if (pps_valid == PPS_VALID) {	/* PPS signal lost */	pps_jitter = MAXTIME;	pps_stabil = MAXFREQ;	time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER |			 STA_PPSWANDER | STA_PPSERROR);    }    ltemp = time_freq + pps_freq;    if (ltemp < 0)	time_adj -= -ltemp >>	    (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE);    else	time_adj += ltemp >>	    (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE);#if HZ == 100

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美综合一区二区| 国产精品亚洲成人| 欧美三级在线看| 亚洲国产一区二区视频| 欧美乱妇15p| 久久91精品国产91久久小草| 精品国产伦一区二区三区免费| 韩国中文字幕2020精品| 中文字幕亚洲精品在线观看| 色婷婷综合视频在线观看| 亚洲成人黄色小说| 久久久九九九九| 91麻豆免费视频| 麻豆国产一区二区| 国产欧美一区二区三区沐欲| 色又黄又爽网站www久久| 日韩电影免费在线观看网站| 久久新电视剧免费观看| av电影一区二区| 免费成人你懂的| 国产精品网站在线| 欧美裸体一区二区三区| 国产成人精品免费| 亚洲小说春色综合另类电影| 久久综合狠狠综合久久激情| 91麻豆高清视频| 美国三级日本三级久久99| 亚洲素人一区二区| 精品少妇一区二区| 欧美在线三级电影| 国产成人免费9x9x人网站视频| 亚洲综合男人的天堂| 久久久久久夜精品精品免费| 欧美日韩一区小说| 国产91露脸合集magnet| 日本伊人午夜精品| 一区二区在线观看免费视频播放| 日韩精品一区二区三区四区 | 日韩欧美国产成人一区二区| 成人免费av在线| 日本三级韩国三级欧美三级| 亚洲天天做日日做天天谢日日欢| 日韩精品一区二区三区视频在线观看| 91蜜桃免费观看视频| 国产精品18久久久久久久久| 亚洲国产综合人成综合网站| 亚洲国产高清不卡| 日韩免费视频线观看| 欧美日韩国产天堂| 99久久精品免费精品国产| 狠狠色丁香婷婷综合| 亚洲va国产va欧美va观看| 亚洲免费在线观看视频| 中文子幕无线码一区tr| 久久夜色精品一区| 精品99久久久久久| 在线不卡a资源高清| 欧美色视频在线| 欧美自拍偷拍一区| 在线观看一区二区精品视频| 91丝袜美腿高跟国产极品老师 | 国产成人午夜精品影院观看视频| 亚洲成人免费在线观看| 亚洲欧美日韩在线| 国产精品美女久久久久久久网站| 精品乱人伦一区二区三区| 欧美精品免费视频| 欧美视频中文字幕| 色婷婷狠狠综合| 日本道在线观看一区二区| 99久久综合国产精品| 成人动漫av在线| 成人黄色大片在线观看| eeuss影院一区二区三区 | 国产精品一二三| 国产精品一二二区| 成人精品视频.| youjizz国产精品| 99r精品视频| 色噜噜狠狠色综合欧洲selulu| 99精品黄色片免费大全| 99精品偷自拍| 91福利社在线观看| 欧美日韩精品专区| 91精品国产综合久久久久| 日韩一级大片在线| 久久一区二区视频| 国产精品久久精品日日| 亚洲三级在线观看| 亚洲va欧美va人人爽| 青青草97国产精品免费观看无弹窗版 | 97久久精品人人做人人爽50路| 99久久精品国产网站| 欧美色精品在线视频| 日韩欧美电影在线| 国产亚洲一二三区| 亚洲色图20p| 日本欧美一区二区| 国产成人免费视频网站| 色偷偷成人一区二区三区91 | 国产福利电影一区二区三区| 成人免费视频播放| 欧美私模裸体表演在线观看| 日韩美女在线视频| 日本一区二区成人在线| 玉足女爽爽91| 美女性感视频久久| 99视频精品全部免费在线| 欧美久久婷婷综合色| 久久影院午夜论| 亚洲综合色网站| 国产乱码精品一区二区三| 91在线视频18| 日韩一级成人av| 日韩理论片一区二区| 婷婷综合久久一区二区三区| 国产一区二区精品久久99 | 欧美片网站yy| 欧美激情一区二区三区| 亚洲高清久久久| 国产精品夜夜嗨| 欧美美女黄视频| 国产精品美女久久久久aⅴ国产馆| 亚洲成在人线免费| 不卡欧美aaaaa| 欧美大片免费久久精品三p| 亚洲欧美激情视频在线观看一区二区三区 | 国产精品久久久久一区| 婷婷综合另类小说色区| av网站免费线看精品| 日韩一区二区三区高清免费看看| 亚洲欧洲av一区二区三区久久| 麻豆精品一区二区三区| 91麻豆swag| 日本一区二区三区高清不卡| 日本午夜精品视频在线观看| 色八戒一区二区三区| 国产欧美日韩三区| 青青草成人在线观看| 欧美日韩一区二区三区四区五区 | 久久久久久99精品| 日韩av午夜在线观看| 一本色道久久综合亚洲精品按摩| www欧美成人18+| 捆绑紧缚一区二区三区视频| 欧美日韩免费电影| 亚洲伦理在线免费看| 95精品视频在线| 成人免费在线播放视频| 国产成人在线免费观看| 精品国产乱码久久久久久闺蜜| 日韩电影在线观看一区| 在线不卡免费欧美| 午夜精品久久久| 精品视频123区在线观看| 一区二区三区高清不卡| av一区二区三区四区| 欧美国产一区二区| 成人晚上爱看视频| 中文字幕第一区| 成人夜色视频网站在线观看| 久久久99久久| 高清成人免费视频| 国产精品毛片久久久久久| 丁香六月久久综合狠狠色| 久久久777精品电影网影网| 国产自产2019最新不卡| 久久久三级国产网站| 国产成人精品三级| 国产精品二区一区二区aⅴ污介绍| 国产91对白在线观看九色| 国产精品久久一级| 色综合久久88色综合天天| 亚洲一线二线三线视频| 欧美三电影在线| 蜜桃91丨九色丨蝌蚪91桃色| 精品卡一卡二卡三卡四在线| 国产成人亚洲精品狼色在线| 国产精品久久久久影视| 91色porny蝌蚪| 亚洲国产三级在线| 欧美一区二区三区视频在线 | 久久超碰97中文字幕| 久久久久99精品国产片| 成人av资源下载| 亚洲国产视频在线| 日韩限制级电影在线观看| 国产美女主播视频一区| 亚洲欧洲日韩女同| 欧美喷水一区二区| 国产精品夜夜爽| 国产福利一区在线| 亚洲欧美国产高清| 欧美精品一二三| 国产一区在线观看视频| 中文字幕综合网| 666欧美在线视频| 丰满少妇久久久久久久| 亚洲一区二区三区在线播放 | 日本一区二区三区高清不卡|