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

📄 rtc.c

📁 开源的BIOS启动软件
💻 C
字号:
#include <bios/types.h>#include <bios/rtc.h>#include <bios/pci.h>#define RTC_INDEX_L	0x70#define RTC_DATA_L	0x71#define RTC_INDEX_H	0x72#define RTC_DATA_H	0x73int rtc_read_cmos(unsigned int reg){	int v;	if (reg >= 256 - 14)		return -1;	reg += 14;	if (reg >= 128) {		pci_io_write_byte(reg, RTC_INDEX_H);		v = pci_io_read_byte(RTC_DATA_H);	} else {		pci_io_write_byte(reg, RTC_INDEX_L);		v = pci_io_read_byte(RTC_DATA_L);	}	return v;}void rtc_write_cmos(u8 val, unsigned int reg){	if (reg >= 256 - 14)		return;	reg += 14;	if (reg >= 128) {		pci_io_write_byte(reg, RTC_INDEX_H);		pci_io_write_byte(val, RTC_DATA_H);	} else {		pci_io_write_byte(reg, RTC_INDEX_L);		pci_io_write_byte(val, RTC_DATA_L);	}}

⌨️ 快捷键说明

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