annotate ppc/timer.h @ 757:7562cfd794da libavutil

Check for __attribute__((packed)) support Not all compilers claiming to be gcc support this attribute.
author mru
date Fri, 17 Jul 2009 08:21:43 +0000
parents fa8c9944568f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
718
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
1 /*
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
2 * Copyright (c) 2005 Luca Barbato <lu_zero@gentoo.org>
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
3 *
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
5 *
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
10 *
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
15 *
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
19 */
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
20
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
21 #ifndef AVUTIL_PPC_TIMER_H
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
22 #define AVUTIL_PPC_TIMER_H
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
23
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
24 #include <stdint.h>
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
25
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
26 #define AV_READ_TIME read_time
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
27
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
28 static inline uint64_t read_time(void)
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
29 {
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
30 uint32_t tbu, tbl, temp;
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
31
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
32 /* from section 2.2.1 of the 32-bit PowerPC PEM */
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
33 __asm__ volatile(
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
34 "1:\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
35 "mftbu %2\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
36 "mftb %0\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
37 "mftbu %1\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
38 "cmpw %2,%1\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
39 "bne 1b\n"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
40 : "=r"(tbl), "=r"(tbu), "=r"(temp)
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
41 :
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
42 : "cc");
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
43
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
44 return (((uint64_t)tbu)<<32) | (uint64_t)tbl;
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
45 }
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
46
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents:
diff changeset
47 #endif /* AVUTIL_PPC_TIMER_H */