source: rtems/bsps/bfin/shared/dev/clock.c @ a6b2080

5
Last change on this file since a6b2080 was a6b2080, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 5, 2019 at 2:51:17 PM

clock: Remove Clock_exit() from API

This function is no longer supported by the standard clock driver
implementation (clockimpl.h).

Update #3436.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*  RTEMS Clock Tick Driver for Blackfin.  Uses Blackfin Core Timer.
2 */
3
4/*
5 *  Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA
6 *             written by Allan Hessenflow <allanh@kallisti.com>
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13
14#include <rtems.h>
15#include <stdlib.h>
16#include <rtems/libio.h>
17#include <rtems/score/percpu.h>
18#include <rtems/score/thread.h>
19#include <bsp.h>
20#include <rtems/clockdrv.h>
21
22
23#include <libcpu/cecRegs.h>
24#include <libcpu/coreTimerRegs.h>
25
26#if (BFIN_ON_SKYEYE)
27#define CLOCK_DRIVER_USE_FAST_IDLE 1
28#endif
29
30volatile uint32_t Clock_driver_ticks;
31
32static rtems_isr clockISR(rtems_vector_number vector) {
33
34  Clock_driver_ticks += 1;
35
36#if CLOCK_DRIVER_USE_FAST_IDLE
37  do {
38    rtems_clock_tick();
39  } while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle );
40#else
41  rtems_clock_tick();
42#endif
43}
44
45/*
46 *  Clock_exit
47 *
48 *  This routine allows the clock driver to exit by masking the interrupt and
49 *  disabling the clock's counter.
50 */
51static void Clock_exit(void)
52{
53  *(uint32_t volatile *) TCNTL = 0;
54}
55
56/*
57 *  Clock_initialize
58 *
59 *  This routine initializes the clock driver.
60 */
61rtems_device_driver Clock_initialize(
62  rtems_device_major_number major,
63  rtems_device_minor_number minor,
64  void *pargp
65)
66{
67  Clock_driver_ticks = 0;
68
69  set_vector(clockISR, CEC_CORE_TIMER_VECTOR, 1);
70
71  *(uint32_t volatile *) TCNTL = TCNTL_TMPWR | TCNTL_TAUTORLD;
72  *(uint32_t volatile *) TSCALE = 0;
73  *(uint32_t volatile *) TPERIOD = CCLK / 1000000 *
74      rtems_configuration_get_microseconds_per_tick();
75  *(uint32_t volatile *) TCNTL = TCNTL_TMPWR | TCNTL_TAUTORLD | TCNTL_TMREN;
76
77  atexit(Clock_exit);
78
79  return RTEMS_SUCCESSFUL;
80}
Note: See TracBrowser for help on using the repository browser.