RTEMS
sparcimpl.h
1 /*
2  * Copyright (c) 2016, 2018 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 struct timecounter;
25 
26 /*
27  * Provides a mutable alias to _SPARC_Counter for use in
28  * _SPARC_Counter_initialize(). The _SPARC_Counter and _SPARC_Counter_mutable
29  * are defined via the SPARC_COUNTER_DEFINITION define.
30  */
31 extern SPARC_Counter _SPARC_Counter_mutable;
32 
33 void _SPARC_Counter_at_tick_clock( void );
34 
35 CPU_Counter_ticks _SPARC_Counter_read_default( void );
36 
37 CPU_Counter_ticks _SPARC_Counter_read_up( void );
38 
39 CPU_Counter_ticks _SPARC_Counter_read_down( void );
40 
41 CPU_Counter_ticks _SPARC_Counter_read_clock_isr_disabled( void );
42 
43 CPU_Counter_ticks _SPARC_Counter_read_clock( void );
44 
45 CPU_Counter_ticks _SPARC_Counter_read_asr23( void );
46 
47 uint32_t _SPARC_Get_timecount_up( struct timecounter * );
48 
49 uint32_t _SPARC_Get_timecount_down( struct timecounter * );
50 
51 uint32_t _SPARC_Get_timecount_clock( struct timecounter * );
52 
53 uint32_t _SPARC_Get_timecount_asr23( struct timecounter * );
54 
55 /*
56  * Defines the _SPARC_Counter and _SPARC_Counter_mutable global variables.
57  * Place this define in the global file scope of the CPU counter support file
58  * of the BSP.
59  */
60 #define SPARC_COUNTER_DEFINITION \
61  __asm__ ( \
62  "\t.global\t_SPARC_Counter\n" \
63  "\t.global\t_SPARC_Counter_mutable\n" \
64  "\t.section\t.data._SPARC_Counter,\"aw\",@progbits\n" \
65  "\t.align\t4\n" \
66  "\t.type\t_SPARC_Counter, #object\n" \
67  "\t.size\t_SPARC_Counter, 28\n" \
68  "_SPARC_Counter:\n" \
69  "_SPARC_Counter_mutable:\n" \
70  "\t.long\t_SPARC_Counter_read_default\n" \
71  "\t.long\t_SPARC_Counter_read_default\n" \
72  "\t.long\t0\n" \
73  "\t.long\t0\n" \
74  "\t.long\t0\n" \
75  "\t.long\t0\n" \
76  "\t.long\t0\n" \
77  "\t.previous\n" \
78  )
79 
80 #ifdef __cplusplus
81 }
82 #endif /* __cplusplus */
83 
84 #endif /* _RTEMS_SCORE_SPARCIMPL_H */
SPARC CPU Department Source.