2010-09-22 15:10:42 +02:00
|
|
|
/*
|
2014-02-02 16:48:18 +01:00
|
|
|
* Copyright (C) 2014 INRIA
|
|
|
|
*
|
2014-07-31 20:15:03 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-02-02 16:48:18 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup msba2
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief msba2 benchmark functions
|
|
|
|
*
|
|
|
|
* @author Heiko Will <heiko.will@fu-berlin.de>
|
|
|
|
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "lpc2387.h"
|
|
|
|
|
|
|
|
void benchmark_init(void)
|
|
|
|
{
|
2014-07-31 20:34:28 +02:00
|
|
|
PCLKSEL1 = (PCLKSEL1 & ~(BIT14|BIT15)) | (1 << 14); // CCLK to PCLK divider
|
|
|
|
PCONP |= PCTIM3;
|
|
|
|
T3TCR = 0; // disable timer
|
|
|
|
T3MCR = 0; // disable interrupt
|
|
|
|
T3CCR = 0; // capture is disabled.
|
|
|
|
T3EMR = 0; // no external match output.
|
|
|
|
T3PR = 0; // set prescaler
|
|
|
|
T3TC = 0; // reset counter
|
2010-09-22 15:10:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void benchmark_reset_start(void)
|
|
|
|
{
|
2014-07-31 20:34:28 +02:00
|
|
|
T3TCR = 0; // disable timer
|
|
|
|
T3TC = 0; // reset counter
|
|
|
|
T3TCR = BIT0;
|
2010-09-22 15:10:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int benchmark_read_stop(void)
|
|
|
|
{
|
2014-07-31 20:34:28 +02:00
|
|
|
T3TCR = 0; // disable timer
|
|
|
|
return T3TC;
|
2010-09-22 15:10:42 +02:00
|
|
|
}
|