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

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

?? m48t59.c

?? QEMU 0.91 source code, supports ARM processor including S3C24xx series
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * QEMU M48T59 and M48T08 NVRAM emulation for PPC PREP and Sparc platforms * * Copyright (c) 2003-2005, 2007 Jocelyn Mayer * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */#include "hw.h"#include "nvram.h"#include "isa.h"#include "qemu-timer.h"#include "sysemu.h"//#define DEBUG_NVRAM#if defined(DEBUG_NVRAM)#define NVRAM_PRINTF(fmt, args...) do { printf(fmt , ##args); } while (0)#else#define NVRAM_PRINTF(fmt, args...) do { } while (0)#endif/* * The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has * alarm and a watchdog timer and related control registers. In the * PPC platform there is also a nvram lock function. */struct m48t59_t {    /* Model parameters */    int type; // 2 = m48t02, 8 = m48t08, 59 = m48t59    /* Hardware parameters */    qemu_irq IRQ;    int mem_index;    target_phys_addr_t mem_base;    uint32_t io_base;    uint16_t size;    /* RTC management */    time_t   time_offset;    time_t   stop_time;    /* Alarm & watchdog */    time_t   alarm;    struct QEMUTimer *alrm_timer;    struct QEMUTimer *wd_timer;    /* NVRAM storage */    uint8_t  lock;    uint16_t addr;    uint8_t *buffer;};/* Fake timer functions *//* Generic helpers for BCD */static inline uint8_t toBCD (uint8_t value){    return (((value / 10) % 10) << 4) | (value % 10);}static inline uint8_t fromBCD (uint8_t BCD){    return ((BCD >> 4) * 10) + (BCD & 0x0F);}/* RTC management helpers */static void get_time (m48t59_t *NVRAM, struct tm *tm){    time_t t;    t = time(NULL) + NVRAM->time_offset;#ifdef _WIN32    memcpy(tm,localtime(&t),sizeof(*tm));#else    if (rtc_utc)        gmtime_r (&t, tm);    else        localtime_r (&t, tm) ;#endif}static void set_time (m48t59_t *NVRAM, struct tm *tm){    time_t now, new_time;    new_time = mktime(tm);    now = time(NULL);    NVRAM->time_offset = new_time - now;}/* Alarm management */static void alarm_cb (void *opaque){    struct tm tm, tm_now;    uint64_t next_time;    m48t59_t *NVRAM = opaque;    qemu_set_irq(NVRAM->IRQ, 1);    if ((NVRAM->buffer[0x1FF5] & 0x80) == 0 &&	(NVRAM->buffer[0x1FF4] & 0x80) == 0 &&	(NVRAM->buffer[0x1FF3] & 0x80) == 0 &&	(NVRAM->buffer[0x1FF2] & 0x80) == 0) {	/* Repeat once a month */	get_time(NVRAM, &tm_now);	memcpy(&tm, &tm_now, sizeof(struct tm));	tm.tm_mon++;	if (tm.tm_mon == 13) {	    tm.tm_mon = 1;	    tm.tm_year++;	}	next_time = mktime(&tm);    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF4] & 0x80) == 0 &&	       (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&	       (NVRAM->buffer[0x1FF2] & 0x80) == 0) {	/* Repeat once a day */	next_time = 24 * 60 * 60 + mktime(&tm_now);    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF4] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&	       (NVRAM->buffer[0x1FF2] & 0x80) == 0) {	/* Repeat once an hour */	next_time = 60 * 60 + mktime(&tm_now);    } else if ((NVRAM->buffer[0x1FF5] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF4] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF3] & 0x80) != 0 &&	       (NVRAM->buffer[0x1FF2] & 0x80) == 0) {	/* Repeat once a minute */	next_time = 60 + mktime(&tm_now);    } else {	/* Repeat once a second */	next_time = 1 + mktime(&tm_now);    }    qemu_mod_timer(NVRAM->alrm_timer, next_time * 1000);    qemu_set_irq(NVRAM->IRQ, 0);}static void get_alarm (m48t59_t *NVRAM, struct tm *tm){#ifdef _WIN32    memcpy(tm,localtime(&NVRAM->alarm),sizeof(*tm));#else    if (rtc_utc)        gmtime_r (&NVRAM->alarm, tm);    else        localtime_r (&NVRAM->alarm, tm);#endif}static void set_alarm (m48t59_t *NVRAM, struct tm *tm){    NVRAM->alarm = mktime(tm);    if (NVRAM->alrm_timer != NULL) {        qemu_del_timer(NVRAM->alrm_timer);        if (NVRAM->alarm - time(NULL) > 0)            qemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000);    }}/* Watchdog management */static void watchdog_cb (void *opaque){    m48t59_t *NVRAM = opaque;    NVRAM->buffer[0x1FF0] |= 0x80;    if (NVRAM->buffer[0x1FF7] & 0x80) {	NVRAM->buffer[0x1FF7] = 0x00;	NVRAM->buffer[0x1FFC] &= ~0x40;        /* May it be a hw CPU Reset instead ? */        qemu_system_reset_request();    } else {	qemu_set_irq(NVRAM->IRQ, 1);	qemu_set_irq(NVRAM->IRQ, 0);    }}static void set_up_watchdog (m48t59_t *NVRAM, uint8_t value){    uint64_t interval; /* in 1/16 seconds */    NVRAM->buffer[0x1FF0] &= ~0x80;    if (NVRAM->wd_timer != NULL) {        qemu_del_timer(NVRAM->wd_timer);        if (value != 0) {            interval = (1 << (2 * (value & 0x03))) * ((value >> 2) & 0x1F);            qemu_mod_timer(NVRAM->wd_timer, ((uint64_t)time(NULL) * 1000) +                           ((interval * 1000) >> 4));        }    }}/* Direct access to NVRAM */void m48t59_write (void *opaque, uint32_t addr, uint32_t val){    m48t59_t *NVRAM = opaque;    struct tm tm;    int tmp;    if (addr > 0x1FF8 && addr < 0x2000)	NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);    /* check for NVRAM access */    if ((NVRAM->type == 2 && addr < 0x7f8) ||        (NVRAM->type == 8 && addr < 0x1ff8) ||        (NVRAM->type == 59 && addr < 0x1ff0))        goto do_write;    /* TOD access */    switch (addr) {    case 0x1FF0:        /* flags register : read-only */        break;    case 0x1FF1:        /* unused */        break;    case 0x1FF2:        /* alarm seconds */        tmp = fromBCD(val & 0x7F);        if (tmp >= 0 && tmp <= 59) {            get_alarm(NVRAM, &tm);            tm.tm_sec = tmp;            NVRAM->buffer[0x1FF2] = val;            set_alarm(NVRAM, &tm);        }        break;    case 0x1FF3:        /* alarm minutes */        tmp = fromBCD(val & 0x7F);        if (tmp >= 0 && tmp <= 59) {            get_alarm(NVRAM, &tm);            tm.tm_min = tmp;            NVRAM->buffer[0x1FF3] = val;            set_alarm(NVRAM, &tm);        }        break;    case 0x1FF4:        /* alarm hours */        tmp = fromBCD(val & 0x3F);        if (tmp >= 0 && tmp <= 23) {            get_alarm(NVRAM, &tm);            tm.tm_hour = tmp;            NVRAM->buffer[0x1FF4] = val;            set_alarm(NVRAM, &tm);        }        break;    case 0x1FF5:        /* alarm date */        tmp = fromBCD(val & 0x1F);        if (tmp != 0) {            get_alarm(NVRAM, &tm);            tm.tm_mday = tmp;            NVRAM->buffer[0x1FF5] = val;            set_alarm(NVRAM, &tm);        }        break;    case 0x1FF6:        /* interrupts */        NVRAM->buffer[0x1FF6] = val;        break;    case 0x1FF7:        /* watchdog */        NVRAM->buffer[0x1FF7] = val;        set_up_watchdog(NVRAM, val);        break;    case 0x1FF8:    case 0x07F8:        /* control */       NVRAM->buffer[addr] = (val & ~0xA0) | 0x90;        break;    case 0x1FF9:    case 0x07F9:        /* seconds (BCD) */	tmp = fromBCD(val & 0x7F);	if (tmp >= 0 && tmp <= 59) {	    get_time(NVRAM, &tm);	    tm.tm_sec = tmp;	    set_time(NVRAM, &tm);	}       if ((val & 0x80) ^ (NVRAM->buffer[addr] & 0x80)) {	    if (val & 0x80) {		NVRAM->stop_time = time(NULL);	    } else {		NVRAM->time_offset += NVRAM->stop_time - time(NULL);		NVRAM->stop_time = 0;	    }	}       NVRAM->buffer[addr] = val & 0x80;        break;    case 0x1FFA:    case 0x07FA:        /* minutes (BCD) */	tmp = fromBCD(val & 0x7F);	if (tmp >= 0 && tmp <= 59) {	    get_time(NVRAM, &tm);	    tm.tm_min = tmp;	    set_time(NVRAM, &tm);	}        break;    case 0x1FFB:    case 0x07FB:        /* hours (BCD) */	tmp = fromBCD(val & 0x3F);	if (tmp >= 0 && tmp <= 23) {	    get_time(NVRAM, &tm);	    tm.tm_hour = tmp;	    set_time(NVRAM, &tm);	}        break;    case 0x1FFC:    case 0x07FC:        /* day of the week / century */	tmp = fromBCD(val & 0x07);	get_time(NVRAM, &tm);	tm.tm_wday = tmp;	set_time(NVRAM, &tm);        NVRAM->buffer[addr] = val & 0x40;        break;    case 0x1FFD:    case 0x07FD:        /* date */	tmp = fromBCD(val & 0x1F);	if (tmp != 0) {	    get_time(NVRAM, &tm);	    tm.tm_mday = tmp;	    set_time(NVRAM, &tm);	}        break;    case 0x1FFE:    case 0x07FE:        /* month */	tmp = fromBCD(val & 0x1F);	if (tmp >= 1 && tmp <= 12) {	    get_time(NVRAM, &tm);	    tm.tm_mon = tmp - 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲日本在线看| 欧美系列在线观看| 91看片淫黄大片一级| 日韩欧美久久一区| 亚洲激情校园春色| 国产成人精品影视| 91麻豆精品国产91久久久久| 精品成人一区二区| 国产精品亚洲综合一区在线观看| 91九色最新地址| 久久精品欧美一区二区三区麻豆| 午夜视频在线观看一区二区三区| 成人免费精品视频| 亚洲精品在线观看视频| 日本亚洲视频在线| 精品视频一区三区九区| 亚洲欧美日韩国产中文在线| 成人丝袜视频网| 一区二区三区不卡在线观看| 国产一区二区三区在线观看免费 | 色婷婷亚洲一区二区三区| 欧美videossexotv100| 日韩主播视频在线| 精品视频999| 天天综合色天天综合| 在线欧美日韩精品| 东方aⅴ免费观看久久av| 日本韩国欧美一区二区三区| 中文字幕第一区第二区| 国模套图日韩精品一区二区| 欧美大片在线观看一区| 免费成人在线影院| 日韩一区二区免费视频| 久久99精品久久只有精品| 日韩你懂的电影在线观看| 美女视频免费一区| 精品精品国产高清一毛片一天堂| 美女尤物国产一区| 精品美女在线播放| 国产一区二区精品久久91| 久久精品夜夜夜夜久久| 成人av免费在线观看| 亚洲婷婷国产精品电影人久久| 91日韩一区二区三区| 亚洲女性喷水在线观看一区| 欧美亚洲一区二区在线观看| 亚洲成av人综合在线观看| 在线看不卡av| 国产69精品久久久久毛片| 国产午夜亚洲精品羞羞网站| caoporn国产精品| 一区二区三区中文在线| 6080yy午夜一二三区久久| 另类人妖一区二区av| 国产欧美一区二区精品婷婷| 一本大道久久a久久综合| 亚洲成a人v欧美综合天堂下载| 欧美sm极限捆绑bd| 99在线精品观看| 天堂va蜜桃一区二区三区漫画版| 欧美大片在线观看一区二区| 99久久精品情趣| 三级不卡在线观看| 国产欧美日韩久久| 欧美日韩成人在线| 粉嫩蜜臀av国产精品网站| 亚洲午夜久久久久中文字幕久| 91精品国产欧美一区二区成人| 国产成人精品影视| 日韩精品一级二级| 国产欧美一区二区精品性色| 欧美日韩一区二区欧美激情| 国产精品123区| 天堂va蜜桃一区二区三区漫画版| 国产视频亚洲色图| 欧美二区在线观看| av成人老司机| 国产最新精品免费| 国产在线麻豆精品观看| 综合激情网...| 久久亚洲一区二区三区四区| 欧洲av一区二区嗯嗯嗯啊| 国产一区二区三区在线观看精品| 午夜精品一区二区三区电影天堂| 国产精品家庭影院| 久久亚洲精精品中文字幕早川悠里| 在线视频国内一区二区| 国产九色sp调教91| 免费在线视频一区| 亚洲午夜久久久久久久久久久| 国产精品久久久久精k8| 久久久国产午夜精品| 日韩午夜在线观看| 欧美三级资源在线| 91国产免费看| 91豆麻精品91久久久久久| 成人的网站免费观看| 国产不卡高清在线观看视频| 激情成人综合网| 精品一区二区在线播放| 蜜桃免费网站一区二区三区| 亚洲成人av中文| 亚洲男女一区二区三区| 中文字幕一区二区视频| 欧美国产欧美综合| 国产精品人妖ts系列视频| 国产亚洲成年网址在线观看| 久久精品夜色噜噜亚洲aⅴ| 欧美精品一区男女天堂| 精品久久久久久久久久久久久久久久久 | 日韩午夜在线观看| 在线播放中文一区| 在线观看91av| 在线电影欧美成精品| 欧美久久久久久蜜桃| 91麻豆精品国产自产在线观看一区| 欧美日韩成人综合天天影院 | 欧美曰成人黄网| 欧美亚洲愉拍一区二区| 欧美伊人久久久久久久久影院 | 久久精品国产99久久6| 蜜桃视频一区二区三区| 蜜臀久久久久久久| 国产一区二区三区综合| 国产成人av电影在线播放| 成人午夜又粗又硬又大| 色综合色综合色综合| 在线亚洲高清视频| 91精品午夜视频| 久久免费国产精品| 中文字幕日韩av资源站| 亚洲国产人成综合网站| 免费黄网站欧美| 国产成人啪免费观看软件| 99麻豆久久久国产精品免费 | 亚洲成a人v欧美综合天堂下载| 久久精品久久综合| 成人在线综合网| 欧美性受xxxx黑人xyx性爽| 制服丝袜亚洲网站| 337p粉嫩大胆噜噜噜噜噜91av | 国产福利精品一区| 99久精品国产| 91精品国产乱| 中文一区二区完整视频在线观看| 一区二区三区蜜桃| 久久精品国产亚洲一区二区三区| 国产成人av电影在线观看| 一本大道av伊人久久综合| 3d成人动漫网站| 国产精品久久777777| 午夜欧美2019年伦理| 国产精品中文字幕欧美| 欧美日韩综合色| 国产精品欧美一级免费| 三级久久三级久久久| av在线不卡免费看| 91精品一区二区三区久久久久久| 国产精品嫩草影院com| 日韩avvvv在线播放| 国产成人精品亚洲午夜麻豆| 91精品久久久久久久91蜜桃| 国产精品美女www爽爽爽| 日韩成人一区二区三区在线观看| 成人午夜视频网站| 日韩欧美你懂的| 性做久久久久久免费观看| 福利一区在线观看| 日韩美女视频一区二区在线观看| 亚洲免费观看视频| 国产很黄免费观看久久| 欧美久久久久免费| 一区二区视频在线| 国产福利一区二区三区视频在线| 91麻豆精品国产综合久久久久久| 亚洲色图欧美在线| 国产 欧美在线| 久久蜜桃av一区二区天堂| 美女网站色91| 欧美日本一区二区在线观看| 亚洲美女淫视频| 99在线视频精品| 久久精品欧美一区二区三区麻豆| 久久精品国产亚洲aⅴ| 欧美日韩国产经典色站一区二区三区| 亚洲人xxxx| 一本一道波多野结衣一区二区| 久久久另类综合| 国产一区二区三区日韩| 精品人在线二区三区| 免费的成人av| 欧美xxxxx牲另类人与| 麻豆一区二区三| 欧美电影免费观看高清完整版在线观看| 亚洲国产精品欧美一二99| 欧洲日韩一区二区三区| 亚洲欧美日韩中文字幕一区二区三区| av中文一区二区三区| 国产精品理论在线观看| 99热99精品|