Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 1 | /* |
| 2 | * asm-blackfin/timex.h: cpu cycles! |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 4 | * Copyright 2004-2008 Analog Devices Inc. |
| 5 | * |
| 6 | * Licensed under the GPL-2 or later. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 9 | #ifndef _ASM_BLACKFIN_TIMEX_H |
| 10 | #define _ASM_BLACKFIN_TIMEX_H |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 11 | |
| 12 | #define CLOCK_TICK_RATE 1000000 /* Underlying HZ */ |
| 13 | |
Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 14 | typedef unsigned long long cycles_t; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 15 | |
| 16 | static inline cycles_t get_cycles(void) |
| 17 | { |
Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 18 | unsigned long tmp, tmp2; |
Mike Frysinger | 1390da4 | 2008-10-16 23:55:41 +0800 | [diff] [blame] | 19 | __asm__ __volatile__("%0 = cycles; %1 = cycles2;" : "=d"(tmp), "=d"(tmp2)); |
Mike Frysinger | 764cb81 | 2008-04-24 05:07:29 +0800 | [diff] [blame] | 20 | return tmp | ((cycles_t)tmp2 << 32); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | #endif |