Subversion Repositories HelenOS

Rev

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

Rev 3343 Rev 3664
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
    interrupt_register(14, "tick_int", tick_interrupt);
53
    interrupt_register(14, "tick_int", tick_interrupt);
54
    compare.int_dis = false;
54
    compare.int_dis = false;
55
    compare.tick_cmpr = CPU->arch.clock_frequency / HZ;
55
    compare.tick_cmpr = CPU->arch.clock_frequency / HZ;
56
    CPU->arch.next_tick_cmpr = compare.tick_cmpr;
56
    CPU->arch.next_tick_cmpr = compare.tick_cmpr;
57
    tick_compare_write(compare.value);
57
    tick_compare_write(compare.value);
58
    tick_write(0);
58
    tick_write(0);
-
 
59
 
-
 
60
#if defined (US3)
-
 
61
    /* disable STICK interrupts and clear any pending ones */
-
 
62
    tick_compare_reg_t stick_compare;
-
 
63
    softint_reg_t clear;
-
 
64
 
-
 
65
    stick_compare.value = stick_compare_read();
-
 
66
    stick_compare.int_dis = true;
-
 
67
    stick_compare.tick_cmpr = 0;
-
 
68
    stick_compare_write(stick_compare.value);
-
 
69
 
-
 
70
    clear.value = 0;
-
 
71
    clear.stick_int = 1;
-
 
72
    clear_softint_write(clear.value);
-
 
73
#endif
59
}
74
}
60
 
75
 
61
/** Process tick interrupt.
76
/** Process tick interrupt.
62
 *
77
 *
63
 * @param n Interrupt Level, 14,  (can be ignored)
78
 * @param n Interrupt Level, 14,  (can be ignored)
64
 * @param istate Interrupted state.
79
 * @param istate Interrupted state.
65
 */
80
 */
66
void tick_interrupt(int n, istate_t *istate)
81
void tick_interrupt(int n, istate_t *istate)
67
{
82
{
-
 
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
     */