RTC interruption
Posted: Mon Oct 09, 2017 8:19 pm
I am trying to set rtc interruptions, but it is not working(triple fault).
I have already setted PIC1 and PIC2 and their interruption masks.
This is the code that sets the rtc interruptions:
This is the rtc interruption handler:
I have already setted PIC1 and PIC2 and their interruption masks.
This is the code that sets the rtc interruptions:
Code: Select all
/* Ports
* PIC1 PIC2
*Command 0x20 0xA0
*Data 0x21 0xA1
*/
asm volatile ( "cli" );
uint8_t rate = 0x05;
outb(0x70, 0x8B);
char prev = inb(0x71);
outb(0x70, 0x8B);
outb(0x71, prev | 0x40);
outb(0x70, 0x8A);
prev = inb(0x71);
outb(0x70, 0x8A);
outb(0x71, (prev & 0xF0) | rate );
outb(0x70, 0x0C);
inb(0x71);
// PIC 2
/* 0xFE is 11111110 - enables IRQ0 (rtc)*/
uint8_t prevIrq = inb(0xA1);
outb(0xA1 , 0xFE & prevIrq );
// PIC 1
/* 0xFB is 11111011 - enables IRQ2 (rtc)*/
prevIrq = inb(0x21);
outb(0x21 , 0xFB & prevIrq );
asm volatile ( "sti" );
Code: Select all
/* Ports
* PIC1 PIC2
*Command 0x20 0xA0
*Data 0x21 0xA1
*/
outb(0xA1, 0x20);
outb(0x20, 0x20);
/*
do something
*/