Subversion Repositories HelenOS

Rev

Rev 2927 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2927 Rev 3674
Line 43... Line 43...
43
#include <arch.h>
43
#include <arch.h>
44
#include <debug.h>
44
#include <debug.h>
45
 
45
 
46
#define TICK_RESTART_TIME   50  /* Worst case estimate. */
46
#define TICK_RESTART_TIME   50  /* Worst case estimate. */
47
 
47
 
48
/** Initialize tick interrupt. */
48
/** Initialize tick and stick interrupt. */
49
void tick_init(void)
49
void tick_init(void)
50
{
50
{
-
 
51
    /* initialize TICK interrupt */
51
    tick_compare_reg_t compare;
52
    tick_compare_reg_t compare;
52
   
53
 
53
    interrupt_register(14, "tick_int", tick_interrupt);
54
    interrupt_register(14, "tick_int", tick_interrupt);
54
    compare.int_dis = false;
55
    compare.int_dis = false;
55
    compare.tick_cmpr = CPU->arch.clock_frequency / HZ;
56
    compare.tick_cmpr = CPU->arch.clock_frequency / HZ;
56
    CPU->arch.next_tick_cmpr = compare.tick_cmpr;
57
    CPU->arch.next_tick_cmpr = compare.tick_cmpr;
57
    tick_compare_write(compare.value);
58
    tick_compare_write(compare.value);
58
    tick_write(0);
59
    tick_write(0);
-
 
60
 
-
 
61
#if defined (US3)
-
 
62
    /* disable STICK interrupts and clear any pending ones */
-
 
63
    tick_compare_reg_t stick_compare;
-
 
64
    softint_reg_t clear;
-
 
65
 
-
 
66
    stick_compare.value = stick_compare_read();
-
 
67
    stick_compare.int_dis = true;
-
 
68
    stick_compare.tick_cmpr = 0;
-
 
69
    stick_compare_write(stick_compare.value);
-
 
70
 
-
 
71
    clear.value = 0;
-
 
72
    clear.stick_int = 1;
-
 
73
    clear_softint_write(clear.value);
-
 
74
#endif
59
}
75
}
60
 
76
 
61
/** Process tick interrupt.
77
/** Process tick interrupt.
62
 *
78
 *
63
 * @param n Interrupt Level, 14,  (can be ignored)
79
 * @param n Interrupt Level, 14,  (can be ignored)
Line 65... Line 81...
65
 */
81
 */
66
void tick_interrupt(int n, istate_t *istate)
82
void tick_interrupt(int n, istate_t *istate)
67
{
83
{
68
    softint_reg_t softint, clear;
84
    softint_reg_t softint, clear;
69
    uint64_t drift;
85
    uint64_t drift;
70
   
86
 
71
    softint.value = softint_read();
87
    softint.value = softint_read();
72
   
88
   
73
    /*
89
    /*
74
     * Make sure we are servicing interrupt_level_14
90
     * Make sure we are servicing interrupt_level_14
75
     */
91
     */