blob: ae6770c3586a2d0488839af0a0ac0c0b6b972213 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/* ckinit.c
*
* This file provides a template for the clock device driver initialization.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdlib.h>
#include <rtems.h>
#include <rtems/libio.h>
#include <bsp.h>
#include <rtems/tic4x/c4xio.h>
#define CLOCK_VECTOR 9
#define Clock_driver_support_at_tick()
#define Clock_driver_support_install_isr( _new, _old ) \
do { _old = 0; } while(0)
void Clock_driver_support_initialize_hardware()
{
extern int _ClockFrequency;
uint32_t Clock_counter_register_value;
float tmp;
int tmpi;
tmpi = ((int) &_ClockFrequency) * 1000000; /* ClockFrequency is in Mhz */
tmp = (float) tmpi / 2.0;
tmp = ((float) BSP_Configuration.microseconds_per_tick / 1000000.0) * (tmp);
Clock_counter_register_value = (unsigned int) tmp;
#if 0
Clock_counter_register_value =
(uint32_t) ((float) BSP_Configuration.microseconds_per_tick /
((float)_ClockFrequency / 2.0)));
#endif
c4x_timer_stop( C4X_TIMER_0 );
c4x_timer_set_counter( C4X_TIMER_0, 0 );
c4x_timer_set_period( C4X_TIMER_0, Clock_counter_register_value );
c4x_timer_start( C4X_TIMER_0 );
#if defined(_C4x)
c4x_set_iee( c4x_get_iie() | 0x1 ); /* should be ETINT0 */
#else
c3x_set_ie( c3x_get_ie() | 0x100 );
#endif
Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
}
#define Clock_driver_support_shutdown_hardware()
#include "../../../shared/clockdrv_shell.c"
|