source: rtems/c/src/lib/libbsp/nios2/nios2_iss/clock/clock.c @ f3b29236

Last change on this file since f3b29236 was f3b29236, checked in by Sebastian Huber <sebastian.huber@…>, on Sep 18, 2017 at 6:22:38 AM

bsps: Clock_driver_support_install_isr()

Remove old ISR parameter since is not used by the clock driver shell.
Make an implementation optional.

Update #3139.

  • 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) \
22  set_vector(_new, CLOCK_VECTOR, 1)
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 */
35static 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#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
53
54#include "../../../shared/clockdrv_shell.h"
55
Note: See TracBrowser for help on using the repository browser.