Coding style (thanks to phf).

This commit is contained in:
Frans Kaashoek 2016-08-18 21:02:05 -04:00
parent 5faed8ba64
commit 1fc87f367c

10
lapic.c
View file

@ -25,7 +25,7 @@
#define DEASSERT 0x00000000 #define DEASSERT 0x00000000
#define LEVEL 0x00008000 // Level triggered #define LEVEL 0x00008000 // Level triggered
#define BCAST 0x00080000 // Send to all APICs, including self. #define BCAST 0x00080000 // Send to all APICs, including self.
#define BUSY 0x00001000 /#define BUSY 0x00001000
#define FIXED 0x00000000 #define FIXED 0x00000000
#define ICRHI (0x0310/4) // Interrupt Command [63:32] #define ICRHI (0x0310/4) // Interrupt Command [63:32]
#define TIMER (0x0320/4) // Local Vector Table 0 (TIMER) #define TIMER (0x0320/4) // Local Vector Table 0 (TIMER)
@ -211,17 +211,17 @@ void cmostime(struct rtcdate *r)
bcd = (sb & (1 << 2)) == 0; bcd = (sb & (1 << 2)) == 0;
// make sure CMOS doesn't modify time while we read it // make sure CMOS doesn't modify time while we read it
for (;;) { for(;;) {
fill_rtcdate(&t1); fill_rtcdate(&t1);
if (cmos_read(CMOS_STATA) & CMOS_UIP) if(cmos_read(CMOS_STATA) & CMOS_UIP)
continue; continue;
fill_rtcdate(&t2); fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0) if(memcmp(&t1, &t2, sizeof(t1)) == 0)
break; break;
} }
// convert // convert
if (bcd) { if(bcd) {
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second); CONV(second);
CONV(minute); CONV(minute);