1 | /* |
---|
2 | * Copyright (c) 2016 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifndef _RTEMS_SCORE_SPARCIMPL_H |
---|
16 | #define _RTEMS_SCORE_SPARCIMPL_H |
---|
17 | |
---|
18 | #include <rtems/score/cpu.h> |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif /* __cplusplus */ |
---|
23 | |
---|
24 | /* |
---|
25 | * Provides a mutable alias to _SPARC_Counter for use in |
---|
26 | * _SPARC_Counter_initialize(). The _SPARC_Counter and _SPARC_Counter_mutable |
---|
27 | * are defined via the SPARC_COUNTER_DEFINITION define. |
---|
28 | */ |
---|
29 | extern SPARC_Counter _SPARC_Counter_mutable; |
---|
30 | |
---|
31 | CPU_Counter_ticks _SPARC_Counter_read_address( void ); |
---|
32 | |
---|
33 | CPU_Counter_ticks _SPARC_Counter_read_asr23( void ); |
---|
34 | |
---|
35 | CPU_Counter_ticks _SPARC_Counter_difference_normal( |
---|
36 | CPU_Counter_ticks second, |
---|
37 | CPU_Counter_ticks first |
---|
38 | ); |
---|
39 | |
---|
40 | CPU_Counter_ticks _SPARC_Counter_difference_clock_period( |
---|
41 | CPU_Counter_ticks second, |
---|
42 | CPU_Counter_ticks first |
---|
43 | ); |
---|
44 | |
---|
45 | /* |
---|
46 | * Returns always a value of one regardless of the parameters. This prevents |
---|
47 | * an infinite loop in rtems_counter_delay_ticks(). Its only a reasonably safe |
---|
48 | * default. |
---|
49 | */ |
---|
50 | CPU_Counter_ticks _SPARC_Counter_difference_one( |
---|
51 | CPU_Counter_ticks second, |
---|
52 | CPU_Counter_ticks first |
---|
53 | ); |
---|
54 | |
---|
55 | static inline void _SPARC_Counter_initialize( |
---|
56 | SPARC_Counter_read counter_read, |
---|
57 | SPARC_Counter_difference counter_difference, |
---|
58 | volatile const CPU_Counter_ticks *counter_address |
---|
59 | ) |
---|
60 | { |
---|
61 | _SPARC_Counter_mutable.counter_read = counter_read; |
---|
62 | _SPARC_Counter_mutable.counter_difference = counter_difference; |
---|
63 | _SPARC_Counter_mutable.counter_address = counter_address; |
---|
64 | } |
---|
65 | |
---|
66 | /* |
---|
67 | * Defines the _SPARC_Counter and _SPARC_Counter_mutable global variables. |
---|
68 | * Place this define in the global file scope of the CPU counter support file |
---|
69 | * of the BSP. |
---|
70 | */ |
---|
71 | #define SPARC_COUNTER_DEFINITION \ |
---|
72 | __asm__ ( \ |
---|
73 | "\t.global\t_SPARC_Counter\n" \ |
---|
74 | "\t.global\t_SPARC_Counter_mutable\n" \ |
---|
75 | "\t.section\t.data._SPARC_Counter,\"aw\",@progbits\n" \ |
---|
76 | "\t.align\t4\n" \ |
---|
77 | "\t.type\t_SPARC_Counter, #object\n" \ |
---|
78 | "\t.size\t_SPARC_Counter, 12\n" \ |
---|
79 | "_SPARC_Counter:\n" \ |
---|
80 | "_SPARC_Counter_mutable:\n" \ |
---|
81 | "\t.long\t_SPARC_Counter_read_address\n" \ |
---|
82 | "\t.long\t_SPARC_Counter_difference_one\n" \ |
---|
83 | "\t.long\t_SPARC_Counter\n" \ |
---|
84 | ) |
---|
85 | |
---|
86 | #ifdef __cplusplus |
---|
87 | } |
---|
88 | #endif /* __cplusplus */ |
---|
89 | |
---|
90 | #endif /* _RTEMS_SCORE_SPARCIMPL_H */ |
---|