CMOS/RTC Problem - SOLVED!
Posted: Thu Aug 04, 2005 5:23 pm
Hi everyone,
I have a very strange problem (at least for me) and hope someone can help. After setting the RTC for a periodic int, everything works fine in Virtual PC. But when I boot a real pc, the cmos is messed up.
Here's the code:
void set_rtc(byte rate) {
byte buff;
buff = inport(0x70);
buff &= 0xe0;
buff |= 0x0a;
outport(0x70, buff);
buff = inport(0x71);
buff &= 0xf0;
buff |= lnibble(rate);
outport(0x71, buff);
}
void outport(word _port, byte _data)
{
__asm__ __volatile__ ("outb %b1, %w0" : : "d" ( _port) , "a" (_data));
}
byte inport(word _port)
{
byte ret;
__asm__ __volatile__ ("inb %w1, %b0" : "=a" (ret) : "d" ( _port));
return ret;
}
Anyone have an idea what can cause the problem?
Thanks
I have a very strange problem (at least for me) and hope someone can help. After setting the RTC for a periodic int, everything works fine in Virtual PC. But when I boot a real pc, the cmos is messed up.
Here's the code:
void set_rtc(byte rate) {
byte buff;
buff = inport(0x70);
buff &= 0xe0;
buff |= 0x0a;
outport(0x70, buff);
buff = inport(0x71);
buff &= 0xf0;
buff |= lnibble(rate);
outport(0x71, buff);
}
void outport(word _port, byte _data)
{
__asm__ __volatile__ ("outb %b1, %w0" : : "d" ( _port) , "a" (_data));
}
byte inport(word _port)
{
byte ret;
__asm__ __volatile__ ("inb %w1, %b0" : "=a" (ret) : "d" ( _port));
return ret;
}
Anyone have an idea what can cause the problem?
Thanks