aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2017-10-03 12:01:40 +0200
committerMarc Schink <swo-dev@marcschink.de>2017-10-03 13:52:49 +0200
commitad61ac54ac52eeebfac0b81873cd8cb5a80057df (patch)
treeb6d7a47dfd76e2de162c2c4f79c91586944716ba
parent5a2e4c304782f9349f7548c9a5d743dd8a444ada (diff)
Some API consistency renames
-rw-r--r--bindings/cxx/context.cpp4
-rw-r--r--bindings/cxx/exceptiontrace.cpp6
-rw-r--r--bindings/cxx/include/libswocxx/libswocxx.h14
-rw-r--r--bindings/python/swopy.i12
-rw-r--r--examples/decoder.cpp6
-rw-r--r--examples/decoder.py12
-rw-r--r--libswo/decoder.c6
-rw-r--r--libswo/dwt.c30
-rw-r--r--libswo/libswo.h20
9 files changed, 55 insertions, 55 deletions
diff --git a/bindings/cxx/context.cpp b/bindings/cxx/context.cpp
index c8e3926..357c821 100644
--- a/bindings/cxx/context.cpp
+++ b/bindings/cxx/context.cpp
@@ -184,7 +184,7 @@ static int packet_callback(struct libswo_context *ctx,
case LIBSWO_PACKET_TYPE_SYNC:
tmp = new Synchronization(packet);
break;
- case LIBSWO_PACKET_TYPE_OVERFLOW:
+ case LIBSWO_PACKET_TYPE_OF:
tmp = new Overflow(packet);
break;
case LIBSWO_PACKET_TYPE_LTS:
@@ -211,7 +211,7 @@ static int packet_callback(struct libswo_context *ctx,
case LIBSWO_PACKET_TYPE_DWT_EVTCNT:
tmp = new EventCounter(packet);
break;
- case LIBSWO_PACKET_TYPE_DWT_EXCTRACE:
+ case LIBSWO_PACKET_TYPE_DWT_EXCTRC:
tmp = new ExceptionTrace(packet);
break;
case LIBSWO_PACKET_TYPE_DWT_PC_SAMPLE:
diff --git a/bindings/cxx/exceptiontrace.cpp b/bindings/cxx/exceptiontrace.cpp
index cf64855..dcb0104 100644
--- a/bindings/cxx/exceptiontrace.cpp
+++ b/bindings/cxx/exceptiontrace.cpp
@@ -25,7 +25,7 @@ namespace libswo
{
ExceptionTrace::ExceptionTrace(
- const struct libswo_packet_dwt_exctrace *packet) :
+ const struct libswo_packet_dwt_exctrc *packet) :
Hardware((const struct libswo_packet_hw *)packet)
{
}
@@ -37,12 +37,12 @@ ExceptionTrace::ExceptionTrace(const union libswo_packet *packet) :
uint16_t ExceptionTrace::get_exception(void) const
{
- return _packet.exctrace.exception;
+ return _packet.exctrc.exception;
}
ExceptionTraceFunction ExceptionTrace::get_function(void) const
{
- return static_cast<ExceptionTraceFunction>(_packet.exctrace.function);
+ return static_cast<ExceptionTraceFunction>(_packet.exctrc.function);
}
const std::string ExceptionTrace::to_string(void) const
diff --git a/bindings/cxx/include/libswocxx/libswocxx.h b/bindings/cxx/include/libswocxx/libswocxx.h
index cf36cff..7574325 100644
--- a/bindings/cxx/include/libswocxx/libswocxx.h
+++ b/bindings/cxx/include/libswocxx/libswocxx.h
@@ -44,7 +44,7 @@ enum class LogLevel {
enum class PacketType {
UNKNOWN = LIBSWO_PACKET_TYPE_UNKNOWN,
SYNC = LIBSWO_PACKET_TYPE_SYNC,
- OF = LIBSWO_PACKET_TYPE_OVERFLOW,
+ OF = LIBSWO_PACKET_TYPE_OF,
LTS = LIBSWO_PACKET_TYPE_LTS,
GTS1 = LIBSWO_PACKET_TYPE_GTS1,
GTS2 = LIBSWO_PACKET_TYPE_GTS2,
@@ -52,7 +52,7 @@ enum class PacketType {
INST = LIBSWO_PACKET_TYPE_INST,
HW = LIBSWO_PACKET_TYPE_HW,
DWT_EVTCNT = LIBSWO_PACKET_TYPE_DWT_EVTCNT,
- DWT_EXCTRACE = LIBSWO_PACKET_TYPE_DWT_EXCTRACE,
+ DWT_EXCTRC = LIBSWO_PACKET_TYPE_DWT_EXCTRC,
DWT_PC_SAMPLE = LIBSWO_PACKET_TYPE_DWT_PC_SAMPLE,
DWT_PC_VALUE = LIBSWO_PACKET_TYPE_DWT_PC_VALUE,
DWT_ADDR_OFFSET = LIBSWO_PACKET_TYPE_DWT_ADDR_OFFSET,
@@ -72,10 +72,10 @@ enum class ExtensionSource {
};
enum class ExceptionTraceFunction {
- RESERVED = LIBSWO_EXCTRACE_FUNC_RESERVED,
- ENTER = LIBSWO_EXCTRACE_FUNC_ENTER,
- EXIT = LIBSWO_EXCTRACE_FUNC_EXIT,
- RETURN = LIBSWO_EXCTRACE_FUNC_RETURN
+ RESERVED = LIBSWO_EXCTRC_FUNC_RESERVED,
+ ENTER = LIBSWO_EXCTRC_FUNC_ENTER,
+ EXIT = LIBSWO_EXCTRC_FUNC_EXIT,
+ RETURN = LIBSWO_EXCTRC_FUNC_RETURN
};
enum class DecoderFlags {
@@ -249,7 +249,7 @@ public:
class LIBSWO_API ExceptionTrace : public Hardware
{
public:
- ExceptionTrace(const struct libswo_packet_dwt_exctrace *packet);
+ ExceptionTrace(const struct libswo_packet_dwt_exctrc *packet);
ExceptionTrace(const union libswo_packet *packet);
uint16_t get_exception(void) const;
diff --git a/bindings/python/swopy.i b/bindings/python/swopy.i
index 89124a1..caf302a 100644
--- a/bindings/python/swopy.i
+++ b/bindings/python/swopy.i
@@ -73,7 +73,7 @@ static int swig_exception_code(int code)
%rename(PACKET_TYPE_INST) libswo::PacketType::INST;
%rename(PACKET_TYPE_HW) libswo::PacketType::HW;
%rename(PACKET_TYPE_DWT_EVTCNT) libswo::PacketType::DWT_EVTCNT;
-%rename(PACKET_TYPE_DWT_EXCTRACE) libswo::PacketType::DWT_EXCTRACE;
+%rename(PACKET_TYPE_DWT_EXCTRC) libswo::PacketType::DWT_EXCTRC;
%rename(PACKET_TYPE_DWT_PC_SAMPLE) libswo::PacketType::DWT_PC_SAMPLE;
%rename(PACKET_TYPE_DWT_PC_VALUE) libswo::PacketType::DWT_PC_VALUE;
%rename(PACKET_TYPE_DWT_ADDR_OFFSET) libswo::PacketType::DWT_ADDR_OFFSET;
@@ -87,10 +87,10 @@ static int swig_exception_code(int code)
%rename(EXT_SRC_ITM) libswo::ExtensionSource::ITM;
%rename(EXT_SRC_HW) libswo::ExtensionSource::HW;
-%rename(EXCTRACE_FUNC_RESERVED) libswo::ExceptionTraceFunction::RESERVED;
-%rename(EXCTRACE_FUNC_ENTER) libswo::ExceptionTraceFunction::ENTER;
-%rename(EXCTRACE_FUNC_EXIT) libswo::ExceptionTraceFunction::EXIT;
-%rename(EXCTRACE_FUNC_RETURN) libswo::ExceptionTraceFunction::RETURN;
+%rename(EXCTRC_FUNC_RESERVED) libswo::ExceptionTraceFunction::RESERVED;
+%rename(EXCTRC_FUNC_ENTER) libswo::ExceptionTraceFunction::ENTER;
+%rename(EXCTRC_FUNC_EXIT) libswo::ExceptionTraceFunction::EXIT;
+%rename(EXCTRC_FUNC_RETURN) libswo::ExceptionTraceFunction::RETURN;
%rename(DF_NONE) libswo::DecoderFlags::NONE;
%rename(DF_EOS) libswo::DecoderFlags::EOS;
@@ -240,7 +240,7 @@ static PyObject *packet_object(const libswo::Packet &packet)
ret = SWIG_NewPointerObj(tmp, SWIGTYPE_p_libswo__EventCounter,
0);
break;
- case libswo::PacketType::DWT_EXCTRACE:
+ case libswo::PacketType::DWT_EXCTRC:
ret = SWIG_NewPointerObj(tmp,
SWIGTYPE_p_libswo__ExceptionTrace, 0);
break;
diff --git a/examples/decoder.cpp b/examples/decoder.cpp
index 556f930..17220a5 100644
--- a/examples/decoder.cpp
+++ b/examples/decoder.cpp
@@ -121,7 +121,7 @@ static void handle_evtcnt_packet(const EventCounter &packet)
packet.get_cyc());
}
-static void handle_exctrace_packet(const ExceptionTrace &packet)
+static void handle_exctrc_packet(const ExceptionTrace &packet)
{
const char *function;
@@ -203,8 +203,8 @@ int packet_callback(const Packet &packet, void *user_data)
case PacketType::DWT_EVTCNT:
handle_evtcnt_packet(dynamic_cast<const EventCounter &>(packet));
break;
- case PacketType::DWT_EXCTRACE:
- handle_exctrace_packet(dynamic_cast<const ExceptionTrace &>(packet));
+ case PacketType::DWT_EXCTRC:
+ handle_exctrc_packet(dynamic_cast<const ExceptionTrace &>(packet));
break;
case PacketType::DWT_PC_SAMPLE:
handle_pc_sample_packet(dynamic_cast<const PCSample &>(packet));
diff --git a/examples/decoder.py b/examples/decoder.py
index bb359ed..9ae22bc 100644
--- a/examples/decoder.py
+++ b/examples/decoder.py
@@ -100,12 +100,12 @@ class Decoder:
packet.get_sleep(), packet.get_lsu(), packet.get_fold(),
packet.get_cyc()));
- def _handle_exctrace_packet(self, packet):
- if packet.get_function() == swopy.EXCTRACE_FUNC_ENTER:
+ def _handle_exctrc_packet(self, packet):
+ if packet.get_function() == swopy.EXCTRC_FUNC_ENTER:
func = 'enter'
- elif packet.get_function() == swopy.EXCTRACE_FUNC_EXIT:
+ elif packet.get_function() == swopy.EXCTRC_FUNC_EXIT:
func = 'exit'
- elif packet.get_function() == swopy.EXCTRACE_FUNC_RETURN:
+ elif packet.get_function() == swopy.EXCTRC_FUNC_RETURN:
func = 'return'
else:
func = 'reserved'
@@ -155,8 +155,8 @@ class Decoder:
self._handle_hw_packet(packet)
elif packet_type == swopy.PACKET_TYPE_DWT_EVTCNT:
self._handle_evtcnt_packet(packet)
- elif packet_type == swopy.PACKET_TYPE_DWT_EXCTRACE:
- self._handle_exctrace_packet(packet)
+ elif packet_type == swopy.PACKET_TYPE_DWT_EXCTRC:
+ self._handle_exctrc_packet(packet)
elif packet_type == swopy.PACKET_TYPE_DWT_PC_SAMPLE:
self._handle_pc_sample_packet(packet)
elif packet_type == swopy.PACKET_TYPE_DWT_PC_VALUE:
diff --git a/libswo/decoder.c b/libswo/decoder.c
index dc2af25..9dd1ad9 100644
--- a/libswo/decoder.c
+++ b/libswo/decoder.c
@@ -118,7 +118,7 @@ static int decode_packet_type(uint8_t header)
return LIBSWO_PACKET_TYPE_SYNC;
if (header == OVERFLOW_HEADER)
- return LIBSWO_PACKET_TYPE_OVERFLOW;
+ return LIBSWO_PACKET_TYPE_OF;
if (!(header & ~LTS2_TS_MASK))
return LIBSWO_PACKET_TYPE_LTS;
@@ -238,7 +238,7 @@ static bool decode_sync_packet(struct libswo_context *ctx)
static bool decode_overflow_packet(struct libswo_context *ctx)
{
- ctx->packet.type = LIBSWO_PACKET_TYPE_OVERFLOW;
+ ctx->packet.type = LIBSWO_PACKET_TYPE_OF;
ctx->packet.of.size = 1;
log_dbg(ctx, "Overflow packet decoded.");
@@ -563,7 +563,7 @@ LIBSWO_API int libswo_decode(struct libswo_context *ctx, uint32_t flags)
case LIBSWO_PACKET_TYPE_SYNC:
ret = decode_sync_packet(ctx);
break;
- case LIBSWO_PACKET_TYPE_OVERFLOW:
+ case LIBSWO_PACKET_TYPE_OF:
ret = decode_overflow_packet(ctx);
break;
case LIBSWO_PACKET_TYPE_LTS:
diff --git a/libswo/dwt.c b/libswo/dwt.c
index 75c436e..bab984d 100644
--- a/libswo/dwt.c
+++ b/libswo/dwt.c
@@ -47,22 +47,22 @@
#define EVTCNT_CYC_MASK 0x20
/* Exception trace packet discriminator ID. */
-#define EXCTRACE_ID 1
+#define EXCTRC_ID 1
/* Size of an exception trace packet in bytes. */
-#define EXCTRACE_SIZE 3
+#define EXCTRC_SIZE 3
/* Bitmask for the exception number of an exception trace packet. */
-#define EXCTRACE_EX_MASK 0x01
+#define EXCTRC_EX_MASK 0x01
/* Offset of the exception number of an exception trace packet. */
-#define EXCTRACE_EX_OFFSET 8
+#define EXCTRC_EX_OFFSET 8
/* Bitmask for the function of an exception trace packet. */
-#define EXCTRACE_FN_MASK 0x30
+#define EXCTRC_FN_MASK 0x30
/* Offset of the function of an exception trace packet. */
-#define EXCTRACE_FN_OFFSET 4
+#define EXCTRC_FN_OFFSET 4
/* Periodic PC sample packet discriminator ID. */
#define PC_SAMPLE_ID 2
@@ -130,27 +130,27 @@ static bool decode_evtcnt_packet(struct libswo_context *ctx,
return true;
}
-static bool decode_exctrace_packet(struct libswo_context *ctx,
+static bool decode_exctrc_packet(struct libswo_context *ctx,
const struct libswo_packet_hw *hw)
{
uint16_t exception;
uint8_t tmp;
- if (hw->size != EXCTRACE_SIZE) {
+ if (hw->size != EXCTRC_SIZE) {
log_warn(ctx, "Exception trace packet with invalid size of "
"%zu bytes.", hw->size);
return false;
}
ctx->packet.hw = *hw;
- ctx->packet.type = LIBSWO_PACKET_TYPE_DWT_EXCTRACE;
+ ctx->packet.type = LIBSWO_PACKET_TYPE_DWT_EXCTRC;
exception = hw->payload[0];
- exception |= (hw->payload[1] & EXCTRACE_EX_MASK) << EXCTRACE_EX_OFFSET;
- tmp = (hw->payload[1] & EXCTRACE_FN_MASK) >> EXCTRACE_FN_OFFSET;
+ exception |= (hw->payload[1] & EXCTRC_EX_MASK) << EXCTRC_EX_OFFSET;
+ tmp = (hw->payload[1] & EXCTRC_FN_MASK) >> EXCTRC_FN_OFFSET;
- ctx->packet.exctrace.exception = exception;
- ctx->packet.exctrace.function = tmp;
+ ctx->packet.exctrc.exception = exception;
+ ctx->packet.exctrc.function = tmp;
log_dbg(ctx, "Exception trace packet decoded.");
@@ -256,8 +256,8 @@ LIBSWO_PRIV bool dwt_decode_packet(struct libswo_context *ctx,
{
if (hw->address == EVTCNT_ID)
return decode_evtcnt_packet(ctx, hw);
- else if (hw->address == EXCTRACE_ID)
- return decode_exctrace_packet(ctx, hw);
+ else if (hw->address == EXCTRC_ID)
+ return decode_exctrc_packet(ctx, hw);
else if (hw->address == PC_SAMPLE_ID)
return decode_pc_sample_packet(ctx, hw);
else if ((hw->address & PC_VALUE_HEADER_MASK) == PC_VALUE_HEADER)
diff --git a/libswo/libswo.h b/libswo/libswo.h
index 3488f60..d83be2f 100644
--- a/libswo/libswo.h
+++ b/libswo/libswo.h
@@ -76,7 +76,7 @@ enum libswo_packet_type {
/** Synchronization packet. */
LIBSWO_PACKET_TYPE_SYNC = 1,
/** Overflow packet. */
- LIBSWO_PACKET_TYPE_OVERFLOW = 2,
+ LIBSWO_PACKET_TYPE_OF = 2,
/** Local timestamp packet. */
LIBSWO_PACKET_TYPE_LTS = 3,
/** Global timestamp (GTS1) packet. */
@@ -92,7 +92,7 @@ enum libswo_packet_type {
/** DWT: Event counter packet. */
LIBSWO_PACKET_TYPE_DWT_EVTCNT = 16,
/** DWT: Exception trace packet. */
- LIBSWO_PACKET_TYPE_DWT_EXCTRACE = 17,
+ LIBSWO_PACKET_TYPE_DWT_EXCTRC = 17,
/** DWT: Periodic PC sample packet. */
LIBSWO_PACKET_TYPE_DWT_PC_SAMPLE = 18,
/** DWT: Data trace PC value packet. */
@@ -135,15 +135,15 @@ enum libswo_decoder_flags {
};
/** Exception trace functions. */
-enum libswo_exctrace_function {
+enum libswo_exctrc_function {
/** Reserved. */
- LIBSWO_EXCTRACE_FUNC_RESERVED = 0,
+ LIBSWO_EXCTRC_FUNC_RESERVED = 0,
/** Enter exception. */
- LIBSWO_EXCTRACE_FUNC_ENTER = 1,
+ LIBSWO_EXCTRC_FUNC_ENTER = 1,
/** Exit exception. */
- LIBSWO_EXCTRACE_FUNC_EXIT = 2,
+ LIBSWO_EXCTRC_FUNC_EXIT = 2,
/** Return to exception. */
- LIBSWO_EXCTRACE_FUNC_RETURN = 3
+ LIBSWO_EXCTRC_FUNC_RETURN = 3
};
/** Maximum payload size of a packet in bytes. */
@@ -338,7 +338,7 @@ struct libswo_packet_dwt_evtcnt {
};
/** DWT: Exception trace packet. */
-struct libswo_packet_dwt_exctrace {
+struct libswo_packet_dwt_exctrc {
/** Packet type. */
enum libswo_packet_type type;
/** Packet size including the header in bytes. */
@@ -354,7 +354,7 @@ struct libswo_packet_dwt_exctrace {
/** Exception number. */
uint16_t exception;
/** Action taken by the processor. */
- enum libswo_exctrace_function function;
+ enum libswo_exctrc_function function;
};
/** DWT: Periodic PC sample packet. */
@@ -470,7 +470,7 @@ union libswo_packet {
/** DWT: Event counter packet. */
struct libswo_packet_dwt_evtcnt evtcnt;
/** DWT: Exception trace packet. */
- struct libswo_packet_dwt_exctrace exctrace;
+ struct libswo_packet_dwt_exctrc exctrc;
/** DWT: Periodic PC sample packet. */
struct libswo_packet_dwt_pc_sample pc_sample;
/** DWT: Data trace PC value packet. */