From 43d046c97a20bc0e31e43dbb644035f79a8ecf1a Mon Sep 17 00:00:00 2001 From: adrian Date: Fri, 7 Oct 2011 06:13:38 +0000 Subject: Begin implementing correct MIPS24K sampling mode behaviour. * Add the interrupt bit in the configuration register * Correctly set the counter register for the sampling overflow interrupt. The interrupt is asserted when bit 31 is set. So set the overflow value at 0x80000000 and subtract the programmed value as appropriate. --- sys/dev/hwpmc/hwpmc_mips24k.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mips24k.h b/sys/dev/hwpmc/hwpmc_mips24k.h index 5944e45..876bbe8 100644 --- a/sys/dev/hwpmc/hwpmc_mips24k.h +++ b/sys/dev/hwpmc/hwpmc_mips24k.h @@ -35,7 +35,7 @@ PMC_CAP_WRITE | PMC_CAP_INVERT | \ PMC_CAP_QUALIFIER) - +#define MIPS24K_PMC_INTERRUPT_ENABLE 0x10 /* Enable interrupts */ #define MIPS24K_PMC_USER_ENABLE 0x08 /* Count in USER mode */ #define MIPS24K_PMC_SUPER_ENABLE 0x04 /* Count in SUPERVISOR mode */ #define MIPS24K_PMC_KERNEL_ENABLE 0x02 /* Count in KERNEL mode */ @@ -43,9 +43,12 @@ MIPS24K_PMC_SUPER_ENABLE | \ MIPS24K_PMC_KERNEL_ENABLE) - -#define MIPS24K_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) -#define MIPS24K_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) +/* + * Interrupts are posted when bit 31 of the relevant + * counter is set. + */ +#define MIPS24K_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (0x80000000 - (R)) +#define MIPS24K_PERFCTR_VALUE_TO_RELOAD_COUNT(P) ((P) - 0x80000000) #define MIPS24K_PMC_SELECT 0x4 /* Which bit position the event starts at. */ #define MIPS24K_PMC_OFFSET 2 /* Control registers are 0, 2, 4, etc. */ -- cgit v1.1