summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/arch/arduino-nano/driver/counter.h8
-rw-r--r--include/arch/esp8266/driver/counter.h8
-rw-r--r--include/arch/msp430fr5969lp/driver/counter.h15
-rw-r--r--include/arch/msp430fr5994lp/driver/counter.h8
-rw-r--r--include/arch/posix/driver/counter.h6
-rw-r--r--include/object/ptalog.h10
6 files changed, 34 insertions, 21 deletions
diff --git a/include/arch/arduino-nano/driver/counter.h b/include/arch/arduino-nano/driver/counter.h
index 43ddd15..5685136 100644
--- a/include/arch/arduino-nano/driver/counter.h
+++ b/include/arch/arduino-nano/driver/counter.h
@@ -2,7 +2,7 @@
#include <avr/interrupt.h>
typedef counter_value_t uint16_t;
-typedef counter_overflowed_t uint8_t;
+typedef counter_overflow_t uint8_t;
class Counter {
private:
@@ -10,12 +10,12 @@ class Counter {
public:
uint16_t value;
- volatile uint8_t overflowed;
+ volatile uint8_t overflow;
- Counter() : overflowed(0) {}
+ Counter() : overflow(0) {}
inline void start() {
- overflowed = 0;
+ overflow = 0;
TCNT1 = 0;
TCCR1A = 0;
TCCR1B = _BV(CS10); // no prescaler
diff --git a/include/arch/esp8266/driver/counter.h b/include/arch/esp8266/driver/counter.h
index 42f6f14..0b50c8e 100644
--- a/include/arch/esp8266/driver/counter.h
+++ b/include/arch/esp8266/driver/counter.h
@@ -8,7 +8,7 @@ extern "C" {
#include "c_types.h"
typedef counter_value_t uint32_t;
-typedef counter_overflowed_t uint32_t;
+typedef counter_overflow_t uint32_t;
class Counter {
private:
@@ -17,9 +17,9 @@ class Counter {
public:
uint32_t value;
- uint32_t overflowed;
+ uint32_t overflow;
- Counter() : start_cycles(0), value(0), overflowed(0) {}
+ Counter() : start_cycles(0), value(0), overflow(0) {}
inline void start() {
asm volatile ("esync; rsr %0,ccount":"=a" (start_cycles));
@@ -31,7 +31,7 @@ class Counter {
if (stop_cycles > start_cycles) {
value = stop_cycles - start_cycles;
} else {
- overflowed = 1;
+ overflow = 1;
}
}
};
diff --git a/include/arch/msp430fr5969lp/driver/counter.h b/include/arch/msp430fr5969lp/driver/counter.h
index 501808b..b95aba1 100644
--- a/include/arch/msp430fr5969lp/driver/counter.h
+++ b/include/arch/msp430fr5969lp/driver/counter.h
@@ -1,8 +1,11 @@
+#ifndef COUNTER_H
+#define COUNTER_H
+
#include <msp430.h>
#include <stdint.h>
-typedef counter_value_t uint16_t;
-typedef counter_overflowed_t uint8_t;
+typedef uint16_t counter_value_t;
+typedef uint8_t counter_overflow_t;
class Counter {
private:
@@ -10,12 +13,12 @@ class Counter {
public:
uint16_t value;
- uint8_t overflowed;
+ uint8_t overflow;
- Counter() : overflowed(0) {}
+ Counter() : overflow(0) {}
inline void start() {
- overflowed = 0;
+ overflow = 0;
TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS;
TA2EX0 = 0;
TA2CTL |= TACLR;
@@ -28,3 +31,5 @@ class Counter {
};
extern Counter counter;
+
+#endif
diff --git a/include/arch/msp430fr5994lp/driver/counter.h b/include/arch/msp430fr5994lp/driver/counter.h
index 21c5ec5..61f0ec1 100644
--- a/include/arch/msp430fr5994lp/driver/counter.h
+++ b/include/arch/msp430fr5994lp/driver/counter.h
@@ -2,7 +2,7 @@
#include <stdint.h>
typedef uint16_t counter_value_t;
-typedef uint8_t counter_overflowed_t;
+typedef uint8_t counter_overflow_t;
class Counter {
private:
@@ -10,12 +10,12 @@ class Counter {
public:
uint16_t value;
- uint8_t overflowed;
+ uint8_t overflow;
- Counter() : overflowed(0) {}
+ Counter() : overflow(0) {}
inline void start() {
- overflowed = 0;
+ overflow = 0;
TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS;
TA2EX0 = 0;
TA2CTL |= TACLR;
diff --git a/include/arch/posix/driver/counter.h b/include/arch/posix/driver/counter.h
index 4f575a8..88cb0cc 100644
--- a/include/arch/posix/driver/counter.h
+++ b/include/arch/posix/driver/counter.h
@@ -2,7 +2,7 @@
#include <time.h>
typedef uint64_t counter_value_t;
-typedef uint8_t counter_overflowed_t;
+typedef uint8_t counter_overflow_t;
class Counter {
private:
@@ -11,9 +11,9 @@ class Counter {
public:
uint64_t value;
- volatile uint8_t overflowed;
+ volatile uint8_t overflow;
- Counter() : overflowed(0) {}
+ Counter() : overflow(0) {}
inline void start() {
struct timespec ts;
diff --git a/include/object/ptalog.h b/include/object/ptalog.h
index 21aaa91..14ff2fd 100644
--- a/include/object/ptalog.h
+++ b/include/object/ptalog.h
@@ -41,6 +41,13 @@ class PTALog {
}
}
+#ifdef PTALOG_TIMING
+ inline void passNop(Counter& counter)
+ {
+ kout << "[PTA] nop=" << counter.value << "/" << counter.overflow << endl;
+ }
+#endif
+
inline void reset()
{
log_index = 0;
@@ -64,7 +71,8 @@ class PTALog {
kout << "[PTA] trace, count=" << dec << log_index << endl;
for (uint8_t i = 0; i < log_index; i++) {
#ifdef PTALOG_TIMING
- kout << "[PTA] transition=" << log[i].transition_id << endl;
+ kout << "[PTA] transition=" << log[i].transition_id;
+ kout << " cycles=" << log[i].timer << "/" << log[i].overflow << endl;
#else
kout << "[PTA] transition=" << log[i].transition_id << endl;
#endif