diff libavutil/ppc/timer.h @ 2:897f711a7157

rearrange to work with autoconf
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 25 Sep 2012 15:55:33 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libavutil/ppc/timer.h	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,47 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005 Luca Barbato <lu_zero@gentoo.org>
     1.6 + *
     1.7 + * This file is part of FFmpeg.
     1.8 + *
     1.9 + * FFmpeg is free software; you can redistribute it and/or
    1.10 + * modify it under the terms of the GNU Lesser General Public
    1.11 + * License as published by the Free Software Foundation; either
    1.12 + * version 2.1 of the License, or (at your option) any later version.
    1.13 + *
    1.14 + * FFmpeg is distributed in the hope that it will be useful,
    1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 + * Lesser General Public License for more details.
    1.18 + *
    1.19 + * You should have received a copy of the GNU Lesser General Public
    1.20 + * License along with FFmpeg; if not, write to the Free Software
    1.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    1.22 + */
    1.23 +
    1.24 +#ifndef AVUTIL_PPC_TIMER_H
    1.25 +#define AVUTIL_PPC_TIMER_H
    1.26 +
    1.27 +#include <stdint.h>
    1.28 +
    1.29 +#define AV_READ_TIME read_time
    1.30 +
    1.31 +static inline uint64_t read_time(void)
    1.32 +{
    1.33 +    uint32_t tbu, tbl, temp;
    1.34 +
    1.35 +     /* from section 2.2.1 of the 32-bit PowerPC PEM */
    1.36 +     __asm__ volatile(
    1.37 +         "1:\n"
    1.38 +         "mftbu  %2\n"
    1.39 +         "mftb   %0\n"
    1.40 +         "mftbu  %1\n"
    1.41 +         "cmpw   %2,%1\n"
    1.42 +         "bne    1b\n"
    1.43 +     : "=r"(tbl), "=r"(tbu), "=r"(temp)
    1.44 +     :
    1.45 +     : "cc");
    1.46 +
    1.47 +     return (((uint64_t)tbu)<<32) | (uint64_t)tbl;
    1.48 +}
    1.49 +
    1.50 +#endif /* AVUTIL_PPC_TIMER_H */