From 90973e833d69a93525ef2c4eb5ab687ee13342df Mon Sep 17 00:00:00 2001 From: "Petteri.Aimonen" Date: Mon, 27 Feb 2012 16:40:45 +0000 Subject: Benchmark suite using simulators --- benchmarks/interface-arm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 benchmarks/interface-arm.c (limited to 'benchmarks/interface-arm.c') diff --git a/benchmarks/interface-arm.c b/benchmarks/interface-arm.c new file mode 100644 index 0000000..cd37979 --- /dev/null +++ b/benchmarks/interface-arm.c @@ -0,0 +1,32 @@ +#include "interface.h" +#include +#include + +// This targets an ARM Cortex M3 core using QEmu LM3S6965 emulation. +#define STBASE 0xE000E000 +#define STCTRL (*(volatile uint32_t*)(0x010 + STBASE)) +#define STRELOAD (*(volatile uint32_t*)(0x014 + STBASE)) +#define STCURRENT (*(volatile uint32_t*)(0x018 + STBASE)) + + +void interface_init() +{ + STRELOAD = 0x00FFFFFF; + STCTRL = 5; +} + +void start_timing() +{ + STCURRENT = 0; +} + +uint16_t end_timing() +{ + return 0x00FFFFFF - STCURRENT - 4; +} + +void print_value(const char *label, int32_t value) +{ + printf("%-20s %ld\n", label, value); +} + -- cgit v1.2.3