阅读:1458回复:3
my system halted! why?
#include <unistd.h>
#define extern static #include <asm/io.h> int main() { unsigned char ch, i, j; ioperm(0x70, 2, 1); for(i = 0; i < 16; i++) { printf(\"%4d: \", i * 8); for(j = 0; j < 8; j++) { outb(0x70, i * 8 + j); ch = inb(0x71); printf(\"%2d \", ch); } printf(\"\\n\"); } return 0; } #undef extern i want to read cmos data, so i write this program. then i run it under redhat 8.0\'s kde. when i press enter key, the system is halted. nothing happend! i press reset button to reset system... who can tell me why? thanks! :( |
|
最新喜欢:![]() |
沙发#
发布于:2003-03-08 11:19
几点参考:
1)CMOS的可读数据寄存器应该只有12个(可参考MOTOROLA146818 DATASHEET) 2)你的关键错误在于把OUTB理解错了, 应该改为 outb(i * 8 + j, 0x70) 我在REDHAT 6。2上测试过, 应该没有问题 :D |
|
|
板凳#
发布于:2003-03-13 12:03
i see!
thank you. ?? 146818 has y2k bug so i don\'t think it can used in new mainboard... |
|
地板#
发布于:2003-03-13 12:51
This chip is not used , it is a history. but you can refer to it to get the registers informations :D
|
|
|