Create an enableccnt directory. Inside that directory, create Makefile with the following contents:
KERNELDIR := /usr/src/linux-headers-2.6.28-15-araneo obj-m := enableccnt.o all: $(MAKE) -C $(KERNELDIR) M=`pwd` modulesOn the last line, make sure to use a tab rather than eight spaces. Create enableccnt.c with the following contents:
#include <linux/module.h> #include <linux/kernel.h> MODULE_LICENSE("Dual BSD/GPL"); #define DEVICE_NAME "enableccnt" static int enableccnt_init(void) { printk(KERN_INFO DEVICE_NAME " starting\n"); asm volatile("mcr p15, 0, %0, c9, c14, 0" :: "r"(1)); return 0; } static void enableccnt_exit(void) { asm volatile("mcr p15, 0, %0, c9, c14, 0" :: "r"(0)); printk(KERN_INFO DEVICE_NAME " stopping\n"); } module_init(enableccnt_init); module_exit(enableccnt_exit);Type
maketo create enableccnt.ko. As root, type
insmod enableccnt.ko dmesg | grep enableccntso that the kernel runs enableccnt.ko. This should print enableccnt starting.
Now user programs can read the ARM Cortex A8 cycle counter for high-resolution timings. In particular, SUPERCOP (through its cortex module) will automatically use the ARM Cortex A8 cycle counter.
Rebooting will turn off access to the cycle counter. That probably isn't what you want, so edit /etc/rc.local to do the same insmod, but with a full path to enableccnt.ko.