RTEMS  5.0.0
tictac.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2008
11  * Embedded Brains GmbH
12  * Obere Lagerstr. 30
13  * D-82178 Puchheim
14  * Germany
15  * rtems@embedded-brains.de
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
25 static inline void tic(void)
26 {
27  uint32_t tmp;
28  asm volatile (
29  "mftb 0;"
30  "stw 0, ppc_tic_tac@sdarel(13);"
31  : "=r" (tmp)
32  );
33 }
34 
38 static inline uint32_t tac(void)
39 {
40  uint32_t ticks;
41  uint32_t tmp;
42  asm volatile (
43  "mftb %0;"
44  "lwz %1, ppc_tic_tac@sdarel(13);"
45  "subf %0, %1, %0;"
46  : "=r" (ticks), "=r" (tmp)
47  );
48  return ticks;
49 }
50 
54 static inline void boom(void)
55 {
56  uint32_t tmp;
57  asm volatile (
58  "mftb 0;"
59  "stw 0, ppc_boom_bam@sdarel(13);"
60  : "=r" (tmp)
61  );
62 }
63 
67 static inline uint32_t bam(void)
68 {
69  uint32_t ticks;
70  uint32_t tmp;
71  asm volatile (
72  "mftb %0;"
73  "lwz %1, ppc_boom_bam@sdarel(13);"
74  "subf %0, %1, %0;"
75  : "=r" (ticks), "=r" (tmp)
76  );
77  return ticks;
78 }