mirror of https://github.com/thesofproject/sof.git
Merge pull request #126 from bkokoszx/logger-verbose-warnings
logger: added Werror and Wall and removed warnings
This commit is contained in:
commit
5894ed4cc5
|
@ -2,11 +2,19 @@ bin_PROGRAMS = sof-rmbox sof-logger
|
|||
|
||||
sof_rmbox_SOURCES = \
|
||||
rmbox.c \
|
||||
convert.c \
|
||||
rmbox_convert.c
|
||||
|
||||
sof_logger_SOURCES = \
|
||||
rmbox.c \
|
||||
convert.c \
|
||||
logger_convert.c
|
||||
|
||||
sof_rmbox_CFLAGS = \
|
||||
-Wall \
|
||||
-Werror
|
||||
|
||||
sof_logger_CFLAGS = \
|
||||
-DLOGGER_FORMAT
|
||||
-DLOGGER_FORMAT \
|
||||
-Wall \
|
||||
-Werror
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* debug log converter interface.
|
||||
*
|
||||
* Copyright (c) 2018, Intel Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
#include "convert.h"
|
||||
|
||||
double to_usecs(uint64_t time, double clk)
|
||||
{
|
||||
/* trace timestamp uses CPU system clock at default 25MHz ticks */
|
||||
// TODO: support variable clock rates
|
||||
return (double)time / clk;
|
||||
}
|
|
@ -18,12 +18,7 @@
|
|||
#define KNRM "\x1B[0m"
|
||||
#define KRED "\x1B[31m"
|
||||
|
||||
static double to_usecs(uint64_t time, double clk)
|
||||
{
|
||||
/* trace timestamp uses CPU system clock at default 25MHz ticks */
|
||||
// TODO: support variable clock rates
|
||||
return (double)time / clk;
|
||||
}
|
||||
double to_usecs(uint64_t time, double clk);
|
||||
|
||||
struct convert_config {
|
||||
const char *out_file;
|
||||
|
|
|
@ -157,10 +157,7 @@ static int fetch_entry(struct convert_config *config, uint32_t base_address,
|
|||
uint32_t data_offset, struct log_entry_header dma_log, uint64_t *last_timestamp)
|
||||
{
|
||||
struct ldc_entry entry;
|
||||
long int padding;
|
||||
|
||||
uint32_t entry_offset;
|
||||
uint32_t text_len;
|
||||
|
||||
int ret;
|
||||
|
||||
|
@ -307,7 +304,7 @@ int convert(struct convert_config *config) {
|
|||
return -ferror(config->ldc_fd);
|
||||
}
|
||||
|
||||
if (strncmp(snd.sig, SND_SOF_LOGS_SIG, SND_SOF_LOGS_SIG_SIZE)) {
|
||||
if (strncmp((char *) snd.sig, SND_SOF_LOGS_SIG, SND_SOF_LOGS_SIG_SIZE)) {
|
||||
fprintf(stderr, "Error: Invalid ldc file signature. \n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -315,7 +312,7 @@ int convert(struct convert_config *config) {
|
|||
/* fw verification */
|
||||
if (config->version_fd) {
|
||||
struct sof_ipc_fw_version ver;
|
||||
int i;
|
||||
|
||||
/* here fw verification should be exploited */
|
||||
count = fread(&ver, sizeof(ver), 1, config->version_fd);
|
||||
if (!count) {
|
||||
|
|
|
@ -111,10 +111,7 @@ static int snapshot(const char *name)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct convert_config config;
|
||||
int opt, count, ret = 0;
|
||||
FILE *in_fd = NULL, *out_fd = NULL;
|
||||
char c, tmp[8] = {0};
|
||||
uint64_t addr = 0, val, timestamp = 0, align = 4, i;
|
||||
int opt, ret = 0;
|
||||
|
||||
config.trace = 0;
|
||||
config.clock = 19.2;
|
||||
|
|
|
@ -115,7 +115,8 @@ static void show_trace(FILE *out_fd, uint64_t val, uint64_t addr,
|
|||
int convert(struct convert_config *config)
|
||||
{
|
||||
int count, i;
|
||||
char c, tmp[TRACE_BLOCK_SIZE] = { 0 };
|
||||
char c;
|
||||
uint64_t tmp[TRACE_BLOCK_SIZE / sizeof(uint64_t)] = { 0 };
|
||||
uint64_t addr = 0, val, timestamp = 0;
|
||||
|
||||
fprintf(stdout, "using %2.2fMHz timestamp clock\n", config->clock);
|
||||
|
@ -125,12 +126,12 @@ int convert(struct convert_config *config)
|
|||
if (count != TRACE_BLOCK_SIZE)
|
||||
break;
|
||||
|
||||
val = *((uint64_t*)tmp);
|
||||
|
||||
val = *tmp;
|
||||
for (i = 0; i < TRACE_BLOCK_SIZE / 2; i++) {
|
||||
c = tmp[i];
|
||||
tmp[i] = tmp[TRACE_BLOCK_SIZE - i - 1];
|
||||
tmp[TRACE_BLOCK_SIZE - i - 1] = c;
|
||||
c = ((char *) tmp)[i];
|
||||
((char *)tmp)[i] =
|
||||
((char *) tmp)[TRACE_BLOCK_SIZE - i - 1];
|
||||
((char *)tmp)[TRACE_BLOCK_SIZE - i - 1] = c;
|
||||
}
|
||||
|
||||
show_trace(config->out_fd, val, addr, ×tamp, config->clock);
|
||||
|
|
Loading…
Reference in New Issue