X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fpcnt.h;h=3969aa4ec7688d17e3a6ab8db30c3d8aafea3da5;hp=232ae07766dc8db3815b528fd03ed57915c57f0a;hb=76d1d09c1224af8d663ce63dc5b32425bd62cb29;hpb=fc42805bfb38d33e23b4eddb115cf9ab88a4345a diff --git a/frontend/pcnt.h b/frontend/pcnt.h index 232ae077..3969aa4e 100644 --- a/frontend/pcnt.h +++ b/frontend/pcnt.h @@ -83,6 +83,19 @@ static inline unsigned int pcnt_get(void) return val; } +static inline void pcnt_init(void) +{ +#ifdef __ARM_ARCH_7A__ + int v; + asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r"(v)); + v |= 5; // master enable, ccnt reset + v &= ~8; // ccnt divider 0 + 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)); +#endif +} + #else #define pcnt_start(id)