4.115
Last change
on this file since 250a867f was
250a867f,
checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/14 at 18:58:22
|
nios2/nios2_iss/clock/clock.c: Fix warnings
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * Use SYS_CLK as system clock |
---|
3 | * |
---|
4 | * Copyright (c) 2005-2006 Kolja Waschk, rtemsdev/ixo.de |
---|
5 | */ |
---|
6 | |
---|
7 | #include <rtems.h> |
---|
8 | #include <bsp.h> |
---|
9 | |
---|
10 | #define CLOCK_REGS ((altera_avalon_timer_regs*)NIOS2_IO_BASE(CLOCK_BASE)) |
---|
11 | |
---|
12 | /* |
---|
13 | * Periodic interval timer interrupt handler |
---|
14 | */ |
---|
15 | #define Clock_driver_support_at_tick() \ |
---|
16 | do { CLOCK_REGS->status = 0; } while(0) |
---|
17 | |
---|
18 | /* |
---|
19 | * Attach clock interrupt handler |
---|
20 | */ |
---|
21 | #define Clock_driver_support_install_isr(_new, _old) \ |
---|
22 | do { _old = (rtems_isr_entry)set_vector(_new, CLOCK_VECTOR, 1); } while(0) |
---|
23 | |
---|
24 | /* |
---|
25 | * Turn off the clock |
---|
26 | */ |
---|
27 | #define Clock_driver_support_shutdown_hardware() \ |
---|
28 | do { \ |
---|
29 | CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK; \ |
---|
30 | } while (0) |
---|
31 | |
---|
32 | /* |
---|
33 | * Set up the clock hardware |
---|
34 | */ |
---|
35 | static void Clock_driver_support_initialize_hardware(void) |
---|
36 | { |
---|
37 | uint32_t period; |
---|
38 | |
---|
39 | CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK; |
---|
40 | |
---|
41 | period = (CLOCK_FREQ/1000000L)*rtems_configuration_get_microseconds_per_tick() - 1; |
---|
42 | CLOCK_REGS->period_hi = period >> 16; |
---|
43 | CLOCK_REGS->period_lo = period & 0xFFFF; |
---|
44 | |
---|
45 | CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_ITO_MSK | |
---|
46 | ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | |
---|
47 | ALTERA_AVALON_TIMER_CONTROL_START_MSK; |
---|
48 | |
---|
49 | NIOS2_IENABLE(1 << CLOCK_VECTOR); |
---|
50 | } |
---|
51 | |
---|
52 | #include "../../../shared/clockdrv_shell.h" |
---|
53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.