aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2017-10-03 12:41:15 +0200
committerMarc Schink <swo-dev@marcschink.de>2017-10-03 13:08:55 +0200
commit2b6ef4797d8b056e294e9ed0f10dfae79e794fc1 (patch)
tree013538c93d9253e40343f83b9b6a6572a24dfb9e
parent46060352a91b69439876900b02e6d533ddaa8b22 (diff)
Minor code cleanups
-rw-r--r--src/main.c101
1 files changed, 50 insertions, 51 deletions
diff --git a/src/main.c b/src/main.c
index e54c98f..c22e1c2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -287,55 +287,6 @@ static GOptionEntry entries[] = {
{NULL, 0, 0, 0, NULL, NULL, NULL}
};
-static void handle_hw_packet(const union libswo_packet *packet)
-{
- printf("Hardware source (address = %u, value = %x, size = %zu bytes)\n",
- packet->hw.address, packet->hw.value, packet->hw.size - 1);
-}
-
-static void handle_inst_packet(const union libswo_packet *packet)
-{
- if (!(inst_address_filter & (1 << packet->inst.address)))
- return;
-
- if (opt_dump_inst) {
- fwrite(packet->inst.payload, packet->inst.size - 1, 1, stdout);
- fflush(stdout);
- return;
- }
-
- printf("Instrumentation (address = %u, value = %x, size = %zu bytes)\n",
- packet->inst.address, packet->inst.value,
- packet->inst.size - 1);
-}
-
-static void handle_overflow_packet(const union libswo_packet *packet)
-{
- (void)packet;
- printf("Overflow\n");
-}
-
-static void handle_ext_packet(const union libswo_packet *packet)
-{
- const char *src;
-
- switch (packet->ext.source) {
- case LIBSWO_EXT_SRC_ITM:
- src = "ITM";
- break;
- case LIBSWO_EXT_SRC_HW:
- src = "HW";
- break;
- default:
- g_warning("Extension packet with invalid source: %u.",
- packet->ext.source);
- return;
- }
-
- printf("Extension (source = %s, value = %x)\n", src,
- packet->ext.value);
-}
-
static void handle_unknown_packet(const union libswo_packet *packet)
{
printf("Unknown data (size = %zu bytes)\n", packet->unknown.size);
@@ -351,6 +302,12 @@ static void handle_sync_packet(const union libswo_packet *packet)
packet->sync.size / 8);
}
+static void handle_overflow_packet(const union libswo_packet *packet)
+{
+ (void)packet;
+ printf("Overflow\n");
+}
+
static void handle_lts_packet(const union libswo_packet *packet)
{
const char *tc;
@@ -389,6 +346,49 @@ static void handle_gts2_packet(const union libswo_packet *packet)
printf("Global timestamp (GTS2) (value = %x)\n", packet->gts2.value);
}
+static void handle_ext_packet(const union libswo_packet *packet)
+{
+ const char *src;
+
+ switch (packet->ext.source) {
+ case LIBSWO_EXT_SRC_ITM:
+ src = "ITM";
+ break;
+ case LIBSWO_EXT_SRC_HW:
+ src = "HW";
+ break;
+ default:
+ g_warning("Extension packet with invalid source: %u.",
+ packet->ext.source);
+ return;
+ }
+
+ printf("Extension (source = %s, value = %x)\n", src,
+ packet->ext.value);
+}
+
+static void handle_inst_packet(const union libswo_packet *packet)
+{
+ if (!(inst_address_filter & (1 << packet->inst.address)))
+ return;
+
+ if (opt_dump_inst) {
+ fwrite(packet->inst.payload, packet->inst.size - 1, 1, stdout);
+ fflush(stdout);
+ return;
+ }
+
+ printf("Instrumentation (address = %u, value = %x, size = %zu bytes)\n",
+ packet->inst.address, packet->inst.value,
+ packet->inst.size - 1);
+}
+
+static void handle_hw_packet(const union libswo_packet *packet)
+{
+ printf("Hardware source (address = %u, value = %x, size = %zu bytes)\n",
+ packet->hw.address, packet->hw.value, packet->hw.size - 1);
+}
+
static void handle_dwt_evtcnt_packet(const union libswo_packet *packet)
{
printf("Event counter (CPI = %u, exc = %u, sleep = %u, LSU = %u, "
@@ -517,8 +517,7 @@ static int packet_cb(struct libswo_context *ctx,
handle_dwt_data_value_packet(packet);
break;
default:
- g_warning("Invalid packet type: %u.", packet->type);
- break;
+ g_warning("Invalid packet type: %i.", packet->type);
}
return TRUE;