hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot
Replace the #ifdef ES1370_DEBUG code with code that the compiler can optimize away to avoid bit rot. While at it, replace strcat() with pstrcat(). Tested-by: Rene Engel <ReneEngel80@emailn.de> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <20230917065813.6692-4-vr_qemu@t-online.de>
This commit is contained in:
parent
190514258c
commit
480e4c7abc
@ -22,7 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* #define DEBUG_ES1370 */
|
#define DEBUG_ES1370 0
|
||||||
/* #define VERBOSE_ES1370 */
|
/* #define VERBOSE_ES1370 */
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include "audio/audio.h"
|
#include "audio/audio.h"
|
||||||
#include "hw/pci/pci_device.h"
|
#include "hw/pci/pci_device.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
@ -164,14 +165,13 @@ static void es1370_dac1_callback (void *opaque, int free);
|
|||||||
static void es1370_dac2_callback (void *opaque, int free);
|
static void es1370_dac2_callback (void *opaque, int free);
|
||||||
static void es1370_adc_callback (void *opaque, int avail);
|
static void es1370_adc_callback (void *opaque, int avail);
|
||||||
|
|
||||||
#ifdef DEBUG_ES1370
|
|
||||||
|
|
||||||
static void print_ctl(uint32_t val)
|
static void print_ctl(uint32_t val)
|
||||||
{
|
{
|
||||||
|
if (DEBUG_ES1370) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
#define a(n) if (val & CTRL_##n) strcat (buf, " "#n)
|
#define a(n) if (val & CTRL_##n) pstrcat(buf, sizeof(buf), " "#n)
|
||||||
a(ADC_STOP);
|
a(ADC_STOP);
|
||||||
a(XCTL1);
|
a(XCTL1);
|
||||||
a(OPEN);
|
a(OPEN);
|
||||||
@ -196,16 +196,18 @@ static void print_ctl (uint32_t val)
|
|||||||
dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL],
|
dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL],
|
||||||
buf);
|
buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void print_sctl(uint32_t val)
|
static void print_sctl(uint32_t val)
|
||||||
{
|
{
|
||||||
|
if (DEBUG_ES1370) {
|
||||||
static const char *fmt_names[] = {"8M", "8S", "16M", "16S"};
|
static const char *fmt_names[] = {"8M", "8S", "16M", "16S"};
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
||||||
#define a(n) if (val & SCTRL_##n) strcat (buf, " "#n)
|
#define a(n) if (val & SCTRL_##n) pstrcat(buf, sizeof(buf), " "#n)
|
||||||
#define b(n) if (!(val & SCTRL_##n)) strcat (buf, " "#n)
|
#define b(n) if (!(val & SCTRL_##n)) pstrcat(buf, sizeof(buf), " "#n)
|
||||||
b(R1LOOPSEL);
|
b(R1LOOPSEL);
|
||||||
b(P2LOOPSEL);
|
b(P2LOOPSEL);
|
||||||
b(P1LOOPSEL);
|
b(P1LOOPSEL);
|
||||||
@ -217,29 +219,24 @@ static void print_sctl (uint32_t val)
|
|||||||
a(P1SCTRLD);
|
a(P1SCTRLD);
|
||||||
a(P2DACSEN);
|
a(P2DACSEN);
|
||||||
if (buf[0]) {
|
if (buf[0]) {
|
||||||
strcat (buf, "\n ");
|
pstrcat(buf, sizeof(buf), "\n ");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
buf[0] = ' ';
|
buf[0] = ' ';
|
||||||
buf[1] = '\0';
|
buf[1] = '\0';
|
||||||
}
|
}
|
||||||
#undef b
|
#undef b
|
||||||
#undef a
|
#undef a
|
||||||
AUD_log("es1370",
|
AUD_log("es1370",
|
||||||
"%s"
|
"%s p2_end_inc %d, p2_st_inc %d,"
|
||||||
"p2_end_inc %d, p2_st_inc %d, r1_fmt %s, p2_fmt %s, p1_fmt %s\n",
|
" r1_fmt %s, p2_fmt %s, p1_fmt %s\n",
|
||||||
buf,
|
buf,
|
||||||
(val & SCTRL_P2ENDINC) >> SCTRL_SH_P2ENDINC,
|
(val & SCTRL_P2ENDINC) >> SCTRL_SH_P2ENDINC,
|
||||||
(val & SCTRL_P2STINC) >> SCTRL_SH_P2STINC,
|
(val & SCTRL_P2STINC) >> SCTRL_SH_P2STINC,
|
||||||
fmt_names[(val >> SCTRL_SH_R1FMT) & 3],
|
fmt_names[(val >> SCTRL_SH_R1FMT) & 3],
|
||||||
fmt_names[(val >> SCTRL_SH_P2FMT) & 3],
|
fmt_names[(val >> SCTRL_SH_P2FMT) & 3],
|
||||||
fmt_names [(val >> SCTRL_SH_P1FMT) & 3]
|
fmt_names[(val >> SCTRL_SH_P1FMT) & 3]);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define print_ctl(...)
|
|
||||||
#define print_sctl(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VERBOSE_ES1370
|
#ifdef VERBOSE_ES1370
|
||||||
#define lwarn(...) AUD_log ("es1370: warning", __VA_ARGS__)
|
#define lwarn(...) AUD_log ("es1370: warning", __VA_ARGS__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user