Subversion Repositories HelenOS

Rev

Rev 124 | Rev 319 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 124 Rev 125
Line 33... Line 33...
33
#include <time/clock.h>
33
#include <time/clock.h>
34
#include <panic.h>
34
#include <panic.h>
35
 
35
 
36
pri_t cpu_priority_high(void)
36
pri_t cpu_priority_high(void)
37
{
37
{
38
    pri_t pri = (pri_t) cp0_status_read();
38
    pri_t pri = (pri_t) cp0_status_read();
39
    cp0_status_write(pri & ~cp0_status_ie_enabled_bit);
39
    cp0_status_write(pri & ~cp0_status_ie_enabled_bit);
40
    return pri;
40
    return pri;
41
}
41
}
42
 
42
 
43
pri_t cpu_priority_low(void)
43
pri_t cpu_priority_low(void)
44
{
44
{
45
    pri_t pri = (pri_t) cp0_status_read();
45
    pri_t pri = (pri_t) cp0_status_read();
46
    cp0_status_write(pri | cp0_status_ie_enabled_bit);
46
    cp0_status_write(pri | cp0_status_ie_enabled_bit);
47
    return pri;
47
    return pri;
48
}
48
}
49
 
49
 
50
void cpu_priority_restore(pri_t pri)
50
void cpu_priority_restore(pri_t pri)
51
{
51
{
52
    cp0_status_write(cp0_status_read() | (pri & cp0_status_ie_enabled_bit));
52
    cp0_status_write(cp0_status_read() | (pri & cp0_status_ie_enabled_bit));
53
}
53
}
54
 
54
 
55
pri_t cpu_priority_read(void)
55
pri_t cpu_priority_read(void)
56
{
56
{
57
    return cp0_status_read();
57
    return cp0_status_read();
58
}
58
}
59
 
59
 
60
 
60
 
61
void interrupt(void)
61
void interrupt(void)
62
{
62
{
Line 82... Line 82...
82
                case 6: /* IRQ4 */
82
                case 6: /* IRQ4 */
83
                    panic("unhandled interrupt %d\n", i);
83
                    panic("unhandled interrupt %d\n", i);
84
                    break;
84
                    break;
85
                case 7: /* Timer Interrupt */
85
                case 7: /* Timer Interrupt */
86
                    cp0_compare_write(cp0_compare_value); /* clear timer interrupt */
86
                    cp0_compare_write(cp0_compare_value); /* clear timer interrupt */
87
                    /* start counting over again */
87
                    /* start counting over again */
88
                    cp0_count_write(0);                
88
                    cp0_count_write(0);
89
                    clock();
89
                    clock();
90
                    break;
90
                    break;
91
            }
91
            }
92
        }
92
        }
93
    }
93
    }