- rename lt_debug => hal_debug; it's not only libtriple debugging

Signed-off-by: Thilo Graf <dbt@novatux.de>

- debuglevel fixed
This commit is contained in:
svenhoefer
2018-12-26 00:34:00 +01:00
committed by Thilo Graf
parent 8d4a39566a
commit 3da91b1463
48 changed files with 1380 additions and 1388 deletions

View File

@@ -31,7 +31,7 @@ endif
endif
libcommon_la_SOURCES += \
lt_debug.cpp \
hal_debug.cpp \
proc_tools.c \
pwrmngr.cpp \
version_hal.cpp

View File

@@ -1,8 +1,8 @@
#include <stdio.h>
#include "ca_hal.h"
#include "lt_debug.h"
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_CA, this, args)
#include "hal_debug.h"
#define hal_debug(args...) _hal_debug(HAL_DEBUG_CA, this, args)
static cCA *inst = NULL;
@@ -10,17 +10,17 @@ static cCA *inst = NULL;
/* those are all dummies for now.. */
cCA::cCA(void)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
}
cCA::~cCA()
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
}
cCA *cCA::GetInstance()
{
_lt_debug(TRIPLE_DEBUG_CA, NULL, "%s\n", __FUNCTION__);
_hal_debug(HAL_DEBUG_CA, NULL, "%s\n", __FUNCTION__);
if (inst == NULL)
inst = new cCA();
@@ -29,82 +29,82 @@ cCA *cCA::GetInstance()
void cCA::MenuEnter(enum CA_SLOT_TYPE, uint32_t p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
void cCA::MenuAnswer(enum CA_SLOT_TYPE, uint32_t p, uint32_t /*choice*/)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
void cCA::InputAnswer(enum CA_SLOT_TYPE, uint32_t p, uint8_t * /*Data*/, int /*Len*/)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
void cCA::MenuClose(enum CA_SLOT_TYPE, uint32_t p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
uint32_t cCA::GetNumberCISlots(void)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
return 0;
}
uint32_t cCA::GetNumberSmartCardSlots(void)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
return 0;
}
void cCA::ModuleName(enum CA_SLOT_TYPE, uint32_t p, char * /*Name*/)
{
/* TODO: waht to do with *Name? */
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
bool cCA::ModulePresent(enum CA_SLOT_TYPE, uint32_t p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
return false;
}
void cCA::ModuleReset(enum CA_SLOT_TYPE, uint32_t p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
bool cCA::SendPMT(int, unsigned char *, int, CA_SLOT_TYPE)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
return true;
}
bool cCA::SendMessage(const CA_MESSAGE *)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
return true;
}
bool cCA::Start(void)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
return true;
}
void cCA::Stop(void)
{
lt_debug("%s\n", __FUNCTION__);
hal_debug("%s\n", __FUNCTION__);
}
void cCA::Ready(bool p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}
void cCA::SetInitMask(enum CA_INIT_MASK p)
{
lt_debug("%s param:%d\n", __FUNCTION__, (int)p);
hal_debug("%s param:%d\n", __FUNCTION__, (int)p);
}

View File

@@ -17,7 +17,7 @@
#include <queue>
#include "ca_ci.h"
#include "lt_debug.h"
#include "hal_debug.h"
#include <cs_api.h>
#include <hardware_caps.h>
@@ -34,7 +34,7 @@
#define tsb_debug 0
#define wd_debug 0
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_CA, this, args)
#define hal_debug(args...) _hal_debug(HAL_DEBUG_CA, this, args)
static const char * FILENAME = "[ca_ci]";
#if HAVE_DUCKBOX_HARDWARE
@@ -477,7 +477,7 @@ void cCA::process_tpdu(eDVBCISlot* slot, unsigned char tpdu_tag, __u8* data, int
bool cCA::SendMessage(const CA_MESSAGE *msg)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
if(cam_messenger)
cam_messenger(EVT_CA_MESSAGE, (uint32_t) msg);
#if z_debug

View File

@@ -1,4 +1,4 @@
/* libtriple debug functions */
/* libstb-hal debug functions */
#include <stdarg.h>
#include <stdio.h>
@@ -12,7 +12,7 @@ int cnxt_debug = 0; /* compat, unused */
int debuglevel = -1;
static const char* lt_facility[] = {
static const char* hal_facility[] = {
"audio ",
"video ",
"demux ",
@@ -24,10 +24,10 @@ static const char* lt_facility[] = {
NULL
};
void _lt_info(int facility, const void *func, const char *fmt, ...)
void _hal_info(int facility, const void *func, const char *fmt, ...)
{
/* %p does print "(nil)" instead of 0x00000000 for NULL */
fprintf(stderr, "[LT:%08lx:%s] ", (long) func, lt_facility[facility]);
fprintf(stderr, "[LT:%08lx:%s] ", (long) func, hal_facility[facility]);
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
@@ -35,22 +35,22 @@ void _lt_info(int facility, const void *func, const char *fmt, ...)
}
void _lt_debug(int facility, const void *func, const char *fmt, ...)
void _hal_debug(int facility, const void *func, const char *fmt, ...)
{
if (debuglevel < 0)
fprintf(stderr, "lt_debug: debuglevel not initialized!\n");
fprintf(stderr, "hal_debug: debuglevel not initialized!\n");
if (! ((1 << facility) & debuglevel))
return;
fprintf(stderr, "[LT:%08lx:%s] ", (long)func, lt_facility[facility]);
fprintf(stderr, "[LT:%08lx:%s] ", (long)func, hal_facility[facility]);
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
void lt_debug_init(void)
void hal_debug_init(void)
{
int i = 0;
char *tmp = getenv("HAL_DEBUG");
@@ -65,16 +65,16 @@ void lt_debug_init(void)
{
fprintf(stderr, "libstb-hal debug options can be set by exporting HAL_DEBUG.\n");
fprintf(stderr, "The following values (or bitwise OR combinations) are valid:\n");
while (lt_facility[i]) {
fprintf(stderr, "\tcomponent: %s 0x%02x\n", lt_facility[i], 1 << i);
while (hal_facility[i]) {
fprintf(stderr, "\tcomponent: %s 0x%02x\n", hal_facility[i], 1 << i);
i++;
}
fprintf(stderr, "\tall components: 0x%02x\n", (1 << i) - 1);
} else {
fprintf(stderr, "libstb-hal debug is active for the following components:\n");
while (lt_facility[i]) {
while (hal_facility[i]) {
if (debuglevel & (1 << i))
fprintf(stderr, "%s ", lt_facility[i]);
fprintf(stderr, "%s ", hal_facility[i]);
i++;
}
fprintf(stderr, "\n");

22
common/hal_debug.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef __HAL_DEBUG_H__
#define __HAL_DEBUG_H__
#define HAL_DEBUG_AUDIO 0
#define HAL_DEBUG_VIDEO 1
#define HAL_DEBUG_DEMUX 2
#define HAL_DEBUG_PLAYBACK 3
#define HAL_DEBUG_PWRMNGR 4
#define HAL_DEBUG_INIT 5
#define HAL_DEBUG_CA 6
#define HAL_DEBUG_RECORD 7
#define HAL_DEBUG_ALL ((1<<8)-1)
extern int debuglevel;
void _hal_debug(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void _hal_info(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void hal_debug_init(void);
void hal_set_threadname(const char *name);
#endif // __HAL_DEBUG_H__

View File

@@ -1,30 +0,0 @@
#ifndef __LT_DEBUG_H
#define __LT_DEBUG_H
#define TRIPLE_DEBUG_AUDIO 0
#define TRIPLE_DEBUG_VIDEO 1
#define TRIPLE_DEBUG_DEMUX 2
#define TRIPLE_DEBUG_PLAYBACK 3
#define TRIPLE_DEBUG_PWRMNGR 4
#define TRIPLE_DEBUG_INIT 5
#define TRIPLE_DEBUG_CA 6
#define TRIPLE_DEBUG_RECORD 7
#define TRIPLE_DEBUG_ALL ((1<<8)-1)
#define HAL_DEBUG_AUDIO 0
#define HAL_DEBUG_VIDEO 1
#define HAL_DEBUG_DEMUX 2
#define HAL_DEBUG_PLAYBACK 3
#define HAL_DEBUG_PWRMNGR 4
#define HAL_DEBUG_INIT 5
#define HAL_DEBUG_CA 6
#define HAL_DEBUG_RECORD 7
#define HAL_DEBUG_ALL ((1<<8)-1)
extern int debuglevel;
void hal_set_threadname(const char *name);
void _lt_debug(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void _lt_info(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void lt_debug_init(void);
#endif

View File

@@ -17,7 +17,7 @@
#include <config.h>
#include "pwrmngr.h"
#include "lt_debug.h"
#include "hal_debug.h"
#include <stdio.h>
#include <cstdlib>
@@ -33,35 +33,35 @@
#include <tdpanel/lcdstuff.h>
#endif
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args)
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args)
#define hal_debug(args...) _hal_debug(HAL_DEBUG_PWRMNGR, this, args)
#define hal_info(args...) _hal_info(HAL_DEBUG_PWRMNGR, this, args)
/* cpufreqmanager */
void cCpuFreqManager::Up(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
void cCpuFreqManager::Down(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
void cCpuFreqManager::Reset(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
/* those function dummies return true or "harmless" values */
bool cCpuFreqManager::SetDelta(unsigned long)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
return true;
}
unsigned long cCpuFreqManager::GetDelta(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
return 0;
}
@@ -82,14 +82,14 @@ unsigned long cCpuFreqManager::GetCpuFreq(void) {
#else
unsigned long cCpuFreqManager::GetCpuFreq(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
return 0;
}
#endif
bool cCpuFreqManager::SetCpuFreq(unsigned long f)
{
lt_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false");
hal_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false");
#if HAVE_TRIPLEDRAGON
/* actually SetCpuFreq is used to determine if the system is in standby
this is an "elegant" hack, because:
@@ -113,11 +113,11 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f)
ioctl(fd, IOC_AVS_STANDBY_ENTER);
if (getenv("TRIPLE_LCDBACKLIGHT"))
{
lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__);
hal_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__);
close(fd);
fd = open("/dev/stb/tdlcd", O_RDONLY);
if (fd < 0)
lt_info("%s: open tdlcd error: %m\n", __func__);
hal_info("%s: open tdlcd error: %m\n", __func__);
else
ioctl(fd, IOC_LCD_BACKLIGHT_ON);
}
@@ -147,33 +147,33 @@ bool cCpuFreqManager::SetCpuFreq(unsigned long f)
cCpuFreqManager::cCpuFreqManager(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
/* powermanager */
bool cPowerManager::Open(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
return true;
}
void cPowerManager::Close(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
bool cPowerManager::SetStandby(bool Active, bool Passive)
{
lt_debug("%s(%d, %d)\n", __func__, Active, Passive);
hal_debug("%s(%d, %d)\n", __func__, Active, Passive);
return true;
}
cPowerManager::cPowerManager(void)
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}
cPowerManager::~cPowerManager()
{
lt_debug("%s\n", __func__);
hal_debug("%s\n", __func__);
}