RTEMS
6.1-rc1
bsps
powerpc
include
bsp
tictac.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
11
/*
12
* Copyright (c) 2008 embedded brains GmbH & Co. KG
13
* Redistribution and use in source and binary forms, with or without
14
* modification, are permitted provided that the following conditions
15
* are met:
16
* 1. Redistributions of source code must retain the above copyright
17
* notice, this list of conditions and the following disclaimer.
18
* 2. Redistributions in binary form must reproduce the above copyright
19
* notice, this list of conditions and the following disclaimer in the
20
* documentation and/or other materials provided with the distribution.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
* POSSIBILITY OF SUCH DAMAGE.
33
*/
34
38
static
inline
void
tic(
void
)
39
{
40
uint32_t tmp;
41
__asm__
volatile
(
42
"mftb 0;"
43
"stw 0, ppc_tic_tac@sdarel(13);"
44
:
"=r"
(tmp)
45
);
46
}
47
51
static
inline
uint32_t tac(
void
)
52
{
53
uint32_t ticks;
54
uint32_t tmp;
55
__asm__
volatile
(
56
"mftb %0;"
57
"lwz %1, ppc_tic_tac@sdarel(13);"
58
"subf %0, %1, %0;"
59
:
"=r"
(ticks),
"=r"
(tmp)
60
);
61
return
ticks;
62
}
63
67
static
inline
void
boom(
void
)
68
{
69
uint32_t tmp;
70
__asm__
volatile
(
71
"mftb 0;"
72
"stw 0, ppc_boom_bam@sdarel(13);"
73
:
"=r"
(tmp)
74
);
75
}
76
80
static
inline
uint32_t bam(
void
)
81
{
82
uint32_t ticks;
83
uint32_t tmp;
84
__asm__
volatile
(
85
"mftb %0;"
86
"lwz %1, ppc_boom_bam@sdarel(13);"
87
"subf %0, %1, %0;"
88
:
"=r"
(ticks),
"=r"
(tmp)
89
);
90
return
ticks;
91
}
__asm__
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.
Generated by
1.9.4