X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fpcnt.h;h=9ddd50032033ab3671edef445d37b92e8b0b0ca8;hp=0213ca1210e66dc33b7076dc7806fe0a70801ad8;hb=603efa29ac7176c5dc27cab52007d4c9f61c3069;hpb=82ed88ebe25a0312aab83623b5a983bd96f3d830 diff --git a/frontend/pcnt.h b/frontend/pcnt.h index 0213ca12..9ddd5003 100644 --- a/frontend/pcnt.h +++ b/frontend/pcnt.h @@ -11,6 +11,13 @@ enum pcounters { #ifdef PCNT +#if defined(__ARM_ARCH_7A__) || defined(ARM1176) +#define PCNT_DIV 1000 +#else +#include +#define PCNT_DIV 1 +#endif + static const char *pcnt_names[PCNT_CNT] = { "", "gpu", "spu", "blit", "gte", "test" }; #define PCNT_FRAMES 10 @@ -33,7 +40,7 @@ static inline void pcnt_print(float fps) int i; for (i = 0; i < PCNT_CNT; i++) - pcounters[i] /= 1000 * PCNT_FRAMES; + pcounters[i] /= PCNT_DIV * PCNT_FRAMES; rem = total = pcounters[PCNT_ALL]; for (i = 1; i < PCNT_CNT; i++) @@ -78,8 +85,17 @@ static inline unsigned int pcnt_get(void) #ifdef __ARM_ARCH_7A__ __asm__ volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(val)); +#elif defined(ARM1176) + __asm__ volatile("mrc p15, 0, %0, c15, c12, 1" + : "=r"(val)); #else - val = 0; + // all slow on ARM :( + //struct timespec tv; + //clock_gettime(CLOCK_MONOTONIC_RAW, &tv); + //val = tv.tv_sec * 1000000000 + tv.tv_nsec; + struct timeval tv; + gettimeofday(&tv, NULL); + val = tv.tv_sec * 1000000 + tv.tv_usec; #endif return val; } @@ -94,6 +110,12 @@ static inline void pcnt_init(void) asm volatile("mcr p15, 0, %0, c9, c12, 0" :: "r"(v)); // enable cycle counter asm volatile("mcr p15, 0, %0, c9, c12, 1" :: "r"(1<<31)); +#elif defined(ARM1176) + int v; + asm volatile("mrc p15, 0, %0, c15, c12, 0" : "=r"(v)); + v |= 5; // master enable, ccnt reset + v &= ~8; // ccnt divider 0 + asm volatile("mcr p15, 0, %0, c15, c12, 0" :: "r"(v)); #endif }