rmbox: removing rmbox

fixes #127

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
This commit is contained in:
Bartosz Kokoszko 2018-11-19 11:40:05 +01:00
parent a01fd66665
commit ac7fb0060d
13 changed files with 23 additions and 218 deletions

4
.gitignore vendored
View File

@ -15,11 +15,9 @@ aclocal.m4
compile
ltmain.sh
rimage/rimage
rmbox/rmbox
rwav/rwav
*.tplg
topology/*.conf
topology/test/*.conf
eqctl/sof-eqctl
rmbox/sof-logger
rmbox/sof-rmbox
logger/sof-logger

View File

@ -1,4 +1,4 @@
SUBDIRS = rmbox topology eqctl
SUBDIRS = logger topology eqctl
TESTDIR = test/topology
tests:

View File

@ -2,7 +2,7 @@
AC_PREREQ([2.69])
AC_INIT([sof-tools], [1.0.1])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([rmbox/rmbox.c])
AC_CONFIG_SRCDIR([logger/logger.c])
AC_CONFIG_SRCDIR([eqctl/eqctl.c])
AC_CONFIG_HEADERS([config.h])
AC_CHECK_HEADER([sof/uapi/abi.h])
@ -18,7 +18,7 @@ AC_PROG_CC
AC_OUTPUT([
Makefile
rmbox/Makefile
logger/Makefile
eqctl/Makefile
topology/Makefile
topology/common/Makefile

9
logger/Makefile.am Normal file
View File

@ -0,0 +1,9 @@
bin_PROGRAMS = sof-logger
sof_logger_SOURCES = \
logger.c \
convert.c
sof_logger_CFLAGS = \
-Wall \
-Werror

View File

@ -62,6 +62,14 @@ struct ldc_entry {
uint32_t *params;
};
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;
}
static inline void print_table_header(FILE *out_fd)
{
fprintf(out_fd, "%5s %6s %12s %7s %16s %16s %24s\t%s\n",

View File

@ -18,8 +18,6 @@
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
double to_usecs(uint64_t time, double clk);
struct convert_config {
const char *out_file;
const char *in_file;
@ -27,14 +25,12 @@ struct convert_config {
FILE *in_fd;
double clock;
int trace;
#ifdef LOGGER_FORMAT
const char *ldc_file;
FILE* ldc_fd;
int input_std;
int version_fw;
char *version_file;
FILE *version_fd;
#endif
};
int convert(struct convert_config *config);

View File

@ -20,11 +20,7 @@
#include <ctype.h>
#include "convert.h"
#ifdef LOGGER_FORMAT
#define APP_NAME "sof-logger"
#else
#define APP_NAME "sof-rmbox"
#endif
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
@ -39,12 +35,10 @@ static void usage(void)
fprintf(stdout, "Usage %s <option(s)> <file(s)>\n", APP_NAME);
fprintf(stdout, "%s:\t \t\t\tDisplay mailbox contents\n", APP_NAME);
fprintf(stdout, "%s:\t -i infile -o outfile\tDump infile contents to outfile\n", APP_NAME);
#ifdef LOGGER_FORMAT
fprintf(stdout, "%s:\t -l *.ldc_file\t\t*.ldc files generated by rimage\n", APP_NAME);
fprintf(stdout, "%s:\t -p \t\t\tInput from stdin\n", APP_NAME);
fprintf(stdout, "%s:\t -e \t\t\tEnable checking firmware version with default verification file\n", APP_NAME);
fprintf(stdout, "%s:\t -v ver_file\t\tEnable checking firmware version with ver_file file\n", APP_NAME);
#endif
fprintf(stdout, "%s:\t -c\t\t\tSet timestamp clock in MHz\n", APP_NAME);
fprintf(stdout, "%s:\t -s\t\t\tTake a snapshot of state\n", APP_NAME);
fprintf(stdout, "%s:\t -t\t\t\tDisplay trace data\n", APP_NAME);
@ -119,7 +113,6 @@ int main(int argc, char *argv[])
config.out_file = NULL;
config.out_fd = NULL;
config.in_fd = NULL;
#ifdef LOGGER_FORMAT
config.ldc_file = NULL;
config.ldc_fd = NULL;
config.input_std = 0;
@ -127,13 +120,8 @@ int main(int argc, char *argv[])
config.version_file = NULL;
config.version_fd = NULL;
config.version_fw = 0;
#endif
#ifdef LOGGER_FORMAT
while ((opt = getopt(argc, argv, "ho:i:l:ps:m:c:tev:")) != -1) {
#else
while ((opt = getopt(argc, argv, "ho:i:s:m:c:t")) != -1) {
#endif
switch (opt) {
case 'o':
config.out_file = optarg;
@ -149,7 +137,6 @@ int main(int argc, char *argv[])
break;
case 's':
return snapshot(optarg);
#ifdef LOGGER_FORMAT
case 'l':
config.ldc_file = optarg;
break;
@ -168,14 +155,11 @@ int main(int argc, char *argv[])
config.version_fw = 1;
config.version_file = optarg;
break;
#endif
case 'h':
default: /* '?' */
usage();
}
}
#ifdef LOGGER_FORMAT
if (!config.ldc_file) {
fprintf(stderr, "error: Missing ldc file\n");
@ -199,7 +183,6 @@ int main(int argc, char *argv[])
goto out;
}
}
#endif
if (config.out_file) {
config.out_fd = fopen(config.out_file, "w");
@ -221,12 +204,9 @@ int main(int argc, char *argv[])
if (!config.in_file)
config.in_file = "/sys/kernel/debug/sof/etrace";
#ifdef LOGGER_FORMAT
if (config.input_std) {
config.in_fd = stdin;
} else
#endif
{
} else {
config.in_fd = fopen(config.in_file, "r");
if (!config.in_fd) {
fprintf(stderr, "error: Unable to open in file %s\n",
@ -246,12 +226,11 @@ out:
if (config.in_fd)
fclose(config.in_fd);
#ifdef LOGGER_FORMAT
if (config.ldc_fd)
fclose(config.ldc_fd);
if (config.version_fd)
fclose(config.version_fd);
#endif
return ret;
}

View File

@ -1,20 +0,0 @@
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 \
-Wall \
-Werror

View File

@ -1,22 +0,0 @@
/*
* 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;
}

View File

@ -1,143 +0,0 @@
/*
* debug log converter, using old rmbox format.
*
* 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 <stdint.h>
#include <string.h>
#include <ctype.h>
#include "convert.h"
#define TRACE_BLOCK_SIZE 8
#define CASE(x) case(TRACE_CLASS_##x): trace = #x; break
static void show_trace(FILE *out_fd, uint64_t val, uint64_t addr,
uint64_t *timestamp, double clk)
{
const char *trace;
uint32_t class;
uint64_t delta = val - *timestamp;
double fdelta = to_usecs(delta, clk);
double us = 0.0f;
/* timestamp or value ? */
if ((addr % (TRACE_BLOCK_SIZE * 2)) == 0) {
delta = val - *timestamp;
fdelta = to_usecs(delta, clk);
/* 64-bit timestamp */
us = to_usecs(val, clk);
/* empty data ? */
if (val == 0) {
*timestamp = 0;
return;
}
/* detect wrap around */
if (fdelta < 1000.0 * 1000.0 * 1000.0)
fprintf(out_fd, "0x%lx [%6.6f]\tdelta [%6.6f]\t", addr,
us / 1000000.0, fdelta / 1000000.0);
else
fprintf(out_fd, "0x%lx [%6.6f]\tdelta [********]\t", addr,
us / 1000000.0);
*timestamp = val;
return;
}
else if (*timestamp == 0)
return;
/* check for printable values - otherwise it's a value */
if (!isprint((char)(val >> 16)) || !isprint((char)(val >> 8)) || !isprint((char)val)) {
fprintf(out_fd, "value 0x%16.16lx\n", val);
return;
}
class = val & 0xff000000;
switch (class)
{
CASE(IRQ);
CASE(IPC);
CASE(PIPE);
CASE(HOST);
CASE(DAI);
CASE(DMA);
CASE(SSP);
CASE(COMP);
CASE(WAIT);
CASE(LOCK);
CASE(MEM);
CASE(MIXER);
CASE(BUFFER);
CASE(VOLUME);
CASE(SWITCH);
CASE(MUX);
CASE(SRC);
CASE(TONE);
CASE(EQ_FIR);
CASE(EQ_IIR);
CASE(SA);
CASE(DMIC);
CASE(POWER);
default:
fprintf(out_fd, "value 0x%8.8x\n", (uint32_t)val);
return;
}
switch ((char)(val >> 16)) {
case 'e':
case 'E':
case 'x':
case 'X':
fprintf(out_fd, "%s%s %c%c%c%s\n", KRED, trace,
(char)(val >> 16), (char)(val >> 8), (char)val, KNRM);
break;
default:
fprintf(out_fd, "%s %c%c%c\n", trace,
(char)(val >> 16), (char)(val >> 8), (char)val);
break;
}
}
int convert(struct convert_config *config)
{
int count, i;
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);
while (1) {
count = fread(&tmp[0], 1, TRACE_BLOCK_SIZE, config->in_fd);
if (count != TRACE_BLOCK_SIZE)
break;
val = *tmp;
for (i = 0; i < TRACE_BLOCK_SIZE / 2; i++) {
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, &timestamp, config->clock);
addr += TRACE_BLOCK_SIZE;
}
return 0;
}