annotate libavutil/ppc/timer.h @ 9:ea1ba68cf0ed

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