This code compiles ok, but on executon, my outportb() hangs on the last line (out %al,%dx).
For example
outportb(0x70, 0); // address RTC current second
hangs. What am I doing wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to read the CMOS RTC directly. I've written my own outportb() as following:
char RTCAddr, RTCData; // global variables
void outportb(int port, char data)
{
RTCAddr = port;
RTCData = data;
__asm ("mov _RTCAddr,%dx");
__asm ("mov _RTCData,%al");
__asm ("out %al,%dx");
}
This code compiles ok, but on executon, my outportb() hangs on the last line (out %al,%dx).
For example
outportb(0x70, 0); // address RTC current second
hangs. What am I doing wrong?
Oops, a made a typo.
The global variable definition should read:
int RTCAddr, RTCData; // global variables
Anyway, whats wrong with the code?
Just a wild guess, but you may need to make the asm section critical - ban interrupts 'till you finish out-ing ( lock the WC door ! ;-) )