All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/26] Audio Cleanup
@ 2017-04-25 22:37 Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262 Juan Quintela
                   ` (27 more replies)
  0 siblings, 28 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Hi

This are an old series that were hidden on my harddisk.  To give you
one idea, I had a patch to remove this:

commit 8307c294a355bbf3c5352e00877365b0cda66d52
Author: Nutan Shinde <nutanshinde1992@gmail.com>
Date:   Wed Oct 7 22:02:54 2015 +0530

    Remove macros IO_READ_PROTO and IO_WRITE_PROTO

And somebody else removed it and got it upstream.

There are just cleanups of removing unused code, or moving audio to
c89 and int*_t types.

Please, review and consider them.

Later, Juan.


Juan Quintela (26):
  adlib: Remove support for YMF262
  audio: remove Y8950 configuration
  audio: Remove YM3526 support
  audio: YM3812 was always defined
  audio: Remove UINT8
  audio: remove UINT16
  audio: remove UINT32
  audio: Remove INT8
  audio: remove INT16
  audio: Remove INT32
  audio: Unfold OPLSAMPLE
  audio: Remove Unused OPL_TYPE_*
  audio: Remove type field
  audio: Remove unused fields
  audio: GUSbyte is uint8_t
  audio: remove GUSchar
  audio: GUSword is uint16_t
  audio: GUSword is uint16_t
  audio: GUSsample is int16_t
  audio: OPLSetIRQHandler is not used anywhere
  audio: OPLSetUpdateHandler is not used anywhere
  audio: IRQHandler is not used anymore
  audio: UpdateHandler is not used anymore
  audio: Remove unused typedefs
  audio: un-export OPLResetChip
  audio: Use ARRAY_SIZE from qemu/osdep.h

 hw/audio/Makefile.objs  |   2 -
 hw/audio/adlib.c        |  47 +-------
 hw/audio/fmopl.c        | 277 ++++++++----------------------------------------
 hw/audio/fmopl.h        | 175 +++++++++---------------------
 hw/audio/gus.c          |   2 +-
 hw/audio/gusemu.h       |  22 +---
 hw/audio/gusemu_hal.c   |  74 ++++++-------
 hw/audio/gusemu_mixer.c |  28 ++---
 8 files changed, 153 insertions(+), 474 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 02/26] audio: remove Y8950 configuration Juan Quintela
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Notice that the code was supposed to be in the file ymf262.h, that has
never been on qemu source tree.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/adlib.c | 45 +--------------------------------------------
 1 file changed, 1 insertion(+), 44 deletions(-)

diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 7836446..f9adcd7 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -33,11 +33,7 @@
 
 #define ADLIB_KILL_TIMERS 1
 
-#ifdef HAS_YMF262
-#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
-#else
 #define ADLIB_DESC "Yamaha YM3812 (OPL2)"
-#endif
 
 #ifdef DEBUG
 #include "qemu/timer.h"
@@ -50,14 +46,8 @@
 #define ldebug(...)
 #endif
 
-#ifdef HAS_YMF262
-#include "ymf262.h"
-void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
-#define SHIFT 2
-#else
 #include "fmopl.h"
 #define SHIFT 1
-#endif
 
 #define TYPE_ADLIB "adlib"
 #define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
@@ -80,9 +70,7 @@ typedef struct {
     SWVoiceOut *voice;
     int left, pos, samples;
     QEMUAudioTimeStamp ats;
-#ifndef HAS_YMF262
     FM_OPL *opl;
-#endif
     PortioList port_list;
 } AdlibState;
 
@@ -90,11 +78,7 @@ static AdlibState *glob_adlib;
 
 static void adlib_stop_opl_timer (AdlibState *s, size_t n)
 {
-#ifdef HAS_YMF262
-    YMF262TimerOver (0, n);
-#else
     OPLTimerOver (s->opl, n);
-#endif
     s->ticking[n] = 0;
 }
 
@@ -131,11 +115,7 @@ static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
 
     adlib_kill_timers (s);
 
-#ifdef HAS_YMF262
-    YMF262Write (0, a, val);
-#else
     OPLWrite (s->opl, a, val);
-#endif
 }
 
 static uint32_t adlib_read(void *opaque, uint32_t nport)
@@ -145,12 +125,8 @@ static uint32_t adlib_read(void *opaque, uint32_t nport)
     int a = nport & 3;
 
     adlib_kill_timers (s);
-
-#ifdef HAS_YMF262
-    data = YMF262Read (0, a);
-#else
     data = OPLRead (s->opl, a);
-#endif
+
     return data;
 }
 
@@ -240,11 +216,7 @@ static void adlib_callback (void *opaque, int free)
         return;
     }
 
-#ifdef HAS_YMF262
-    YMF262UpdateOneQEMU (0, s->mixbuf + s->pos * 2, samples);
-#else
     YM3812UpdateOne (s->opl, s->mixbuf + s->pos, samples);
-#endif
 
     while (samples) {
         written = write_audio (s, samples);
@@ -263,14 +235,10 @@ static void adlib_callback (void *opaque, int free)
 
 static void Adlib_fini (AdlibState *s)
 {
-#ifdef HAS_YMF262
-    YMF262Shutdown ();
-#else
     if (s->opl) {
         OPLDestroy (s->opl);
         s->opl = NULL;
     }
-#endif
 
     g_free(s->mixbuf);
 
@@ -297,16 +265,6 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
     }
     glob_adlib = s;
 
-#ifdef HAS_YMF262
-    if (YMF262Init (1, 14318180, s->freq)) {
-        error_setg (errp, "YMF262Init %d failed", s->freq);
-        return;
-    }
-    else {
-        YMF262SetTimerHandler (0, timer_handler, 0);
-        s->enabled = 1;
-    }
-#else
     s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
     if (!s->opl) {
         error_setg (errp, "OPLCreate %d failed", s->freq);
@@ -316,7 +274,6 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
         OPLSetTimerHandler (s->opl, timer_handler, 0);
         s->enabled = 1;
     }
-#endif
 
     as.freq = s->freq;
     as.nchannels = SHIFT;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 02/26] audio: remove Y8950 configuration
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 03/26] audio: Remove YM3526 support Juan Quintela
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Include file has never been on qemu and it has been undefined from the very beginning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/Makefile.objs |   2 -
 hw/audio/fmopl.c       | 146 -------------------------------------------------
 hw/audio/fmopl.h       |  20 -------
 3 files changed, 168 deletions(-)

diff --git a/hw/audio/Makefile.objs b/hw/audio/Makefile.objs
index 7ce85a2..bb6f07a 100644
--- a/hw/audio/Makefile.objs
+++ b/hw/audio/Makefile.objs
@@ -14,5 +14,3 @@ common-obj-$(CONFIG_PL041) += pl041.o lm4549.o
 common-obj-$(CONFIG_CS4231) += cs4231.o
 common-obj-$(CONFIG_MARVELL_88W8618) += marvell_88w8618.o
 common-obj-$(CONFIG_MILKYMIST) += milkymist-ac97.o
-
-$(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 731110f..29f6d3c 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -812,57 +812,6 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
 				}
 			}
 			return;
-#if BUILD_Y8950
-		case 0x06:		/* Key Board OUT */
-			if(OPL->type&OPL_TYPE_KEYBOARD)
-			{
-				if(OPL->keyboardhandler_w)
-					OPL->keyboardhandler_w(OPL->keyboard_param,v);
-				else
-					LOG(LOG_WAR,("OPL:write unmapped KEYBOARD port\n"));
-			}
-			return;
-		case 0x07:	/* DELTA-T control : START,REC,MEMDATA,REPT,SPOFF,x,x,RST */
-			if(OPL->type&OPL_TYPE_ADPCM)
-				YM_DELTAT_ADPCM_Write(OPL->deltat,r-0x07,v);
-			return;
-		case 0x08:	/* MODE,DELTA-T : CSM,NOTESEL,x,x,smpl,da/ad,64k,rom */
-			OPL->mode = v;
-			v&=0x1f;	/* for DELTA-T unit */
-		case 0x09:		/* START ADD */
-		case 0x0a:
-		case 0x0b:		/* STOP ADD  */
-		case 0x0c:
-		case 0x0d:		/* PRESCALE   */
-		case 0x0e:
-		case 0x0f:		/* ADPCM data */
-		case 0x10: 		/* DELTA-N    */
-		case 0x11: 		/* DELTA-N    */
-		case 0x12: 		/* EG-CTRL    */
-			if(OPL->type&OPL_TYPE_ADPCM)
-				YM_DELTAT_ADPCM_Write(OPL->deltat,r-0x07,v);
-			return;
-#if 0
-		case 0x15:		/* DAC data    */
-		case 0x16:
-		case 0x17:		/* SHIFT    */
-			return;
-		case 0x18:		/* I/O CTRL (Direction) */
-			if(OPL->type&OPL_TYPE_IO)
-				OPL->portDirection = v&0x0f;
-			return;
-		case 0x19:		/* I/O DATA */
-			if(OPL->type&OPL_TYPE_IO)
-			{
-				OPL->portLatch = v;
-				if(OPL->porthandler_w)
-					OPL->porthandler_w(OPL->port_param,v&OPL->portDirection);
-			}
-			return;
-		case 0x1a:		/* PCM data */
-			return;
-#endif
-#endif
 		}
 		break;
 	case 0x20:	/* am,vib,ksr,eg type,mul */
@@ -1097,68 +1046,6 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
 }
 #endif /* (BUILD_YM3812 || BUILD_YM3526) */
 
-#if BUILD_Y8950
-
-void Y8950UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
-{
-    int i;
-	int data;
-	OPLSAMPLE *buf = buffer;
-	UINT32 amsCnt  = OPL->amsCnt;
-	UINT32 vibCnt  = OPL->vibCnt;
-	UINT8 rhythm = OPL->rhythm&0x20;
-	OPL_CH *CH,*R_CH;
-	YM_DELTAT *DELTAT = OPL->deltat;
-
-	/* setup DELTA-T unit */
-	YM_DELTAT_DECODE_PRESET(DELTAT);
-
-	if( (void *)OPL != cur_chip ){
-		cur_chip = (void *)OPL;
-		/* channel pointers */
-		S_CH = OPL->P_CH;
-		E_CH = &S_CH[9];
-		/* rhythm slot */
-		SLOT7_1 = &S_CH[7].SLOT[SLOT1];
-		SLOT7_2 = &S_CH[7].SLOT[SLOT2];
-		SLOT8_1 = &S_CH[8].SLOT[SLOT1];
-		SLOT8_2 = &S_CH[8].SLOT[SLOT2];
-		/* LFO state */
-		amsIncr = OPL->amsIncr;
-		vibIncr = OPL->vibIncr;
-		ams_table = OPL->ams_table;
-		vib_table = OPL->vib_table;
-	}
-	R_CH = rhythm ? &S_CH[6] : E_CH;
-    for( i=0; i < length ; i++ )
-	{
-		/*            channel A         channel B         channel C      */
-		/* LFO */
-		ams = ams_table[(amsCnt+=amsIncr)>>AMS_SHIFT];
-		vib = vib_table[(vibCnt+=vibIncr)>>VIB_SHIFT];
-		outd[0] = 0;
-		/* deltaT ADPCM */
-		if( DELTAT->portstate )
-			YM_DELTAT_ADPCM_CALC(DELTAT);
-		/* FM part */
-		for(CH=S_CH ; CH < R_CH ; CH++)
-			OPL_CALC_CH(CH);
-		/* Rythn part */
-		if(rhythm)
-			OPL_CALC_RH(S_CH);
-		/* limit check */
-		data = Limit( outd[0] , OPL_MAXOUT, OPL_MINOUT );
-		/* store to sound buffer */
-		buf[i] = data >> OPL_OUTSB;
-	}
-	OPL->amsCnt = amsCnt;
-	OPL->vibCnt = vibCnt;
-	/* deltaT START flag */
-	if( !DELTAT->portstate )
-		OPL->status &= 0xfe;
-}
-#endif
-
 /* ---------- reset one of chip ---------- */
 void OPLResetChip(FM_OPL *OPL)
 {
@@ -1189,18 +1076,6 @@ void OPLResetChip(FM_OPL *OPL)
 			CH->SLOT[s].evs = 0;
 		}
 	}
-#if BUILD_Y8950
-	if(OPL->type&OPL_TYPE_ADPCM)
-	{
-		YM_DELTAT *DELTAT = OPL->deltat;
-
-		DELTAT->freqbase = OPL->freqbase;
-		DELTAT->output_pointer = outd;
-		DELTAT->portshift = 5;
-		DELTAT->output_range = DELTAT_MIXING_LEVEL<<TL_BITS;
-		YM_DELTAT_ADPCM_Reset(DELTAT,0);
-	}
-#endif
 }
 
 /* ----------  Create one of vietual YM3812 ----------       */
@@ -1216,9 +1091,6 @@ FM_OPL *OPLCreate(int type, int clock, int rate)
 	/* allocate OPL state space */
 	state_size  = sizeof(FM_OPL);
 	state_size += sizeof(OPL_CH)*max_ch;
-#if BUILD_Y8950
-	if(type&OPL_TYPE_ADPCM) state_size+= sizeof(YM_DELTAT);
-#endif
 	/* allocate memory block */
 	ptr = malloc(state_size);
 	if(ptr==NULL) return NULL;
@@ -1226,9 +1098,6 @@ FM_OPL *OPLCreate(int type, int clock, int rate)
 	memset(ptr,0,state_size);
 	OPL        = (FM_OPL *)ptr; ptr+=sizeof(FM_OPL);
 	OPL->P_CH  = (OPL_CH *)ptr; ptr+=sizeof(OPL_CH)*max_ch;
-#if BUILD_Y8950
-	if(type&OPL_TYPE_ADPCM) OPL->deltat = (YM_DELTAT *)ptr; ptr+=sizeof(YM_DELTAT);
-#endif
 	/* set channel state pointer */
 	OPL->type  = type;
 	OPL->clock = clock;
@@ -1290,21 +1159,6 @@ void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param)
 	OPL->UpdateHandler = UpdateHandler;
 	OPL->UpdateParam = param;
 }
-#if BUILD_Y8950
-void OPLSetPortHandler(FM_OPL *OPL,OPL_PORTHANDLER_W PortHandler_w,OPL_PORTHANDLER_R PortHandler_r,int param)
-{
-	OPL->porthandler_w = PortHandler_w;
-	OPL->porthandler_r = PortHandler_r;
-	OPL->port_param = param;
-}
-
-void OPLSetKeyboardHandler(FM_OPL *OPL,OPL_PORTHANDLER_W KeyboardHandler_w,OPL_PORTHANDLER_R KeyboardHandler_r,int param)
-{
-	OPL->keyboardhandler_w = KeyboardHandler_w;
-	OPL->keyboardhandler_r = KeyboardHandler_r;
-	OPL->keyboard_param = param;
-}
-#endif
 /* ---------- YM3812 I/O interface ---------- */
 int OPLWrite(FM_OPL *OPL,int a,int v)
 {
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index fdda7f9..96d958a 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -4,7 +4,6 @@
 /* --- select emulation chips --- */
 #define BUILD_YM3812 (HAS_YM3812)
 //#define BUILD_YM3526 (HAS_YM3526)
-//#define BUILD_Y8950  (HAS_Y8950)
 
 /* --- system optimize --- */
 /* select bit size of output : 8 or 16 */
@@ -28,11 +27,6 @@ typedef INT16 OPLSAMPLE;
 typedef unsigned char  OPLSAMPLE;
 #endif
 
-
-#if BUILD_Y8950
-#include "ymdeltat.h"
-#endif
-
 typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
 typedef void (*OPL_IRQHANDLER)(int param,int irq);
 typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
@@ -112,13 +106,6 @@ typedef struct fm_opl_f {
 	int	max_ch;			/* maximum channel                   */
 	/* Rhythm sention */
 	UINT8 rhythm;		/* Rhythm mode , key flag */
-#if BUILD_Y8950
-	/* Delta-T ADPCM unit (Y8950) */
-	YM_DELTAT *deltat;			/* DELTA-T ADPCM       */
-#endif
-	/* Keyboard / I/O interface unit (Y8950) */
-	UINT8 portDirection;
-	UINT8 portLatch;
 	OPL_PORTHANDLER_R porthandler_r;
 	OPL_PORTHANDLER_W porthandler_w;
 	int port_param;
@@ -150,16 +137,12 @@ typedef struct fm_opl_f {
 /* ---------- Generic interface section ---------- */
 #define OPL_TYPE_YM3526 (0)
 #define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
-#define OPL_TYPE_Y8950  (OPL_TYPE_ADPCM|OPL_TYPE_KEYBOARD|OPL_TYPE_IO)
 
 FM_OPL *OPLCreate(int type, int clock, int rate);
 void OPLDestroy(FM_OPL *OPL);
 void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
 void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param);
 void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param);
-/* Y8950 port handlers */
-void OPLSetPortHandler(FM_OPL *OPL,OPL_PORTHANDLER_W PortHandler_w,OPL_PORTHANDLER_R PortHandler_r,int param);
-void OPLSetKeyboardHandler(FM_OPL *OPL,OPL_PORTHANDLER_W KeyboardHandler_w,OPL_PORTHANDLER_R KeyboardHandler_r,int param);
 
 void OPLResetChip(FM_OPL *OPL);
 int OPLWrite(FM_OPL *OPL,int a,int v);
@@ -168,7 +151,4 @@ int OPLTimerOver(FM_OPL *OPL,int c);
 
 /* YM3626/YM3812 local section */
 void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length);
-
-void Y8950UpdateOne(FM_OPL *OPL, INT16 *buffer, int length);
-
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 03/26] audio: Remove YM3526 support
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262 Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 02/26] audio: remove Y8950 configuration Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 04/26] audio: YM3812 was always defined Juan Quintela
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It was never compiled in.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 4 ++--
 hw/audio/fmopl.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 29f6d3c..1e05efc 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -981,7 +981,7 @@ static void OPL_UnLockTable(void)
 	OPLCloseTable();
 }
 
-#if (BUILD_YM3812 || BUILD_YM3526)
+#if BUILD_YM3812
 /*******************************************************************************/
 /*		YM3812 local section                                                   */
 /*******************************************************************************/
@@ -1044,7 +1044,7 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
 	}
 #endif
 }
-#endif /* (BUILD_YM3812 || BUILD_YM3526) */
+#endif /* BUILD_YM3812 */
 
 /* ---------- reset one of chip ---------- */
 void OPLResetChip(FM_OPL *OPL)
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 96d958a..b254968 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -3,7 +3,6 @@
 
 /* --- select emulation chips --- */
 #define BUILD_YM3812 (HAS_YM3812)
-//#define BUILD_YM3526 (HAS_YM3526)
 
 /* --- system optimize --- */
 /* select bit size of output : 8 or 16 */
@@ -135,7 +134,6 @@ typedef struct fm_opl_f {
 } FM_OPL;
 
 /* ---------- Generic interface section ---------- */
-#define OPL_TYPE_YM3526 (0)
 #define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
 
 FM_OPL *OPLCreate(int type, int clock, int rate);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 04/26] audio: YM3812 was always defined
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (2 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 03/26] audio: Remove YM3526 support Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 05/26] audio: Remove UINT8 Juan Quintela
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

So, remove the ifdefs.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 4 ----
 hw/audio/fmopl.h | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 1e05efc..282662a 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -30,8 +30,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#define HAS_YM3812	1
-
 #include "qemu/osdep.h"
 #include <math.h>
 //#include "driver.h"		/* use M.A.M.E. */
@@ -981,7 +979,6 @@ static void OPL_UnLockTable(void)
 	OPLCloseTable();
 }
 
-#if BUILD_YM3812
 /*******************************************************************************/
 /*		YM3812 local section                                                   */
 /*******************************************************************************/
@@ -1044,7 +1041,6 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
 	}
 #endif
 }
-#endif /* BUILD_YM3812 */
 
 /* ---------- reset one of chip ---------- */
 void OPLResetChip(FM_OPL *OPL)
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index b254968..e476497 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -1,9 +1,6 @@
 #ifndef FMOPL_H
 #define FMOPL_H
 
-/* --- select emulation chips --- */
-#define BUILD_YM3812 (HAS_YM3812)
-
 /* --- system optimize --- */
 /* select bit size of output : 8 or 16 */
 #define OPL_OUTPUT_BIT 16
@@ -147,6 +144,5 @@ int OPLWrite(FM_OPL *OPL,int a,int v);
 unsigned char OPLRead(FM_OPL *OPL,int a);
 int OPLTimerOver(FM_OPL *OPL,int c);
 
-/* YM3626/YM3812 local section */
 void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length);
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 05/26] audio: Remove UINT8
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (3 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 04/26] audio: YM3812 was always defined Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-26  1:41   ` Philippe Mathieu-Daudé
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 06/26] audio: remove UINT16 Juan Quintela
                   ` (22 subsequent siblings)
  27 siblings, 1 reply; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

uint8_t has existed since ..... all this century?

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c |  8 ++++----
 hw/audio/fmopl.h | 39 ++++++++++++++++++++-------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 282662a..3d14b45 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -789,8 +789,8 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
 			}
 			else
 			{	/* set IRQ mask ,timer enable*/
-				UINT8 st1 = v&1;
-				UINT8 st2 = (v>>1)&1;
+				uint8_t st1 = v&1;
+				uint8_t st2 = (v>>1)&1;
 				/* IRQRST,T1MSK,t2MSK,EOSMSK,BRMSK,x,ST2,ST1 */
 				OPL_STATUS_RESET(OPL,v&0x78);
 				OPL_STATUSMASK_SET(OPL,((~v)&0x78)|0x01);
@@ -838,7 +838,7 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
 		case 0xbd:
 			/* amsep,vibdep,r,bd,sd,tom,tc,hh */
 			{
-			UINT8 rkey = OPL->rhythm^v;
+			uint8_t rkey = OPL->rhythm^v;
 			OPL->ams_table = &AMS_TABLE[v&0x80 ? AMS_ENT : 0];
 			OPL->vib_table = &VIB_TABLE[v&0x40 ? VIB_ENT : 0];
 			OPL->rhythm  = v&0x3f;
@@ -991,7 +991,7 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
 	OPLSAMPLE *buf = buffer;
 	UINT32 amsCnt  = OPL->amsCnt;
 	UINT32 vibCnt  = OPL->vibCnt;
-	UINT8 rhythm = OPL->rhythm&0x20;
+	uint8_t rhythm = OPL->rhythm&0x20;
 	OPL_CH *CH,*R_CH;
 
 	if( (void *)OPL != cur_chip ){
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index e476497..3df8942 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -1,6 +1,8 @@
 #ifndef FMOPL_H
 #define FMOPL_H
 
+#include <stdint.h>
+
 /* --- system optimize --- */
 /* select bit size of output : 8 or 16 */
 #define OPL_OUTPUT_BIT 16
@@ -8,7 +10,6 @@
 /* compiler dependence */
 #ifndef OSD_CPU_H
 #define OSD_CPU_H
-typedef unsigned char	UINT8;   /* unsigned  8bit */
 typedef unsigned short	UINT16;  /* unsigned 16bit */
 typedef unsigned int	UINT32;  /* unsigned 32bit */
 typedef signed char		INT8;    /* signed  8bit   */
@@ -41,19 +42,19 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
 typedef struct fm_opl_slot {
 	INT32 TL;		/* total level     :TL << 8            */
 	INT32 TLL;		/* adjusted now TL                     */
-	UINT8  KSR;		/* key scale rate  :(shift down bit)   */
+	uint8_t  KSR;		/* key scale rate  :(shift down bit)   */
 	INT32 *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
 	INT32 *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
 	INT32 SL;		/* sustin level    :SL_TALBE[SL]       */
 	INT32 *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
-	UINT8 ksl;		/* keyscale level  :(shift down bits)  */
-	UINT8 ksr;		/* key scale rate  :kcode>>KSR         */
+	uint8_t ksl;		/* keyscale level  :(shift down bits)  */
+	uint8_t ksr;		/* key scale rate  :kcode>>KSR         */
 	UINT32 mul;		/* multiple        :ML_TABLE[ML]       */
 	UINT32 Cnt;		/* frequency count :                   */
 	UINT32 Incr;	/* frequency step  :                   */
 	/* envelope generator state */
-	UINT8 eg_typ;	/* envelope type flag                  */
-	UINT8 evm;		/* envelope phase                      */
+	uint8_t eg_typ;	/* envelope type flag                  */
+	uint8_t evm;		/* envelope phase                      */
 	INT32 evc;		/* envelope counter                    */
 	INT32 eve;		/* envelope counter end point          */
 	INT32 evs;		/* envelope counter step               */
@@ -61,8 +62,8 @@ typedef struct fm_opl_slot {
 	INT32 evsd;	/* envelope step for DR :DR[ksr]           */
 	INT32 evsr;	/* envelope step for RR :RR[ksr]           */
 	/* LFO */
-	UINT8 ams;		/* ams flag                            */
-	UINT8 vib;		/* vibrate flag                        */
+	uint8_t ams;		/* ams flag                            */
+	uint8_t vib;		/* vibrate flag                        */
 	/* wave selector */
 	INT32 **wavetable;
 }OPL_SLOT;
@@ -70,38 +71,38 @@ typedef struct fm_opl_slot {
 /* ---------- OPL one of channel  ---------- */
 typedef struct fm_opl_channel {
 	OPL_SLOT SLOT[2];
-	UINT8 CON;			/* connection type                     */
-	UINT8 FB;			/* feed back       :(shift down bit)   */
+	uint8_t CON;			/* connection type                     */
+	uint8_t FB;			/* feed back       :(shift down bit)   */
 	INT32 *connect1;	/* slot1 output pointer                */
 	INT32 *connect2;	/* slot2 output pointer                */
 	INT32 op1_out[2];	/* slot1 output for selfeedback        */
 	/* phase generator state */
 	UINT32  block_fnum;	/* block+fnum      :                   */
-	UINT8 kcode;		/* key code        : KeyScaleCode      */
+	uint8_t kcode;		/* key code        : KeyScaleCode      */
 	UINT32  fc;			/* Freq. Increment base                */
 	UINT32  ksl_base;	/* KeyScaleLevel Base step             */
-	UINT8 keyon;		/* key on/off flag                     */
+	uint8_t keyon;		/* key on/off flag                     */
 } OPL_CH;
 
 /* OPL state */
 typedef struct fm_opl_f {
-	UINT8 type;			/* chip type                         */
+	uint8_t type;			/* chip type                         */
 	int clock;			/* master clock  (Hz)                */
 	int rate;			/* sampling rate (Hz)                */
 	double freqbase;	/* frequency base                    */
 	double TimerBase;	/* Timer base time (==sampling time) */
-	UINT8 address;		/* address register                  */
-	UINT8 status;		/* status flag                       */
-	UINT8 statusmask;	/* status mask                       */
+	uint8_t address;		/* address register                  */
+	uint8_t status;		/* status flag                       */
+	uint8_t statusmask;	/* status mask                       */
 	UINT32 mode;		/* Reg.08 : CSM , notesel,etc.       */
 	/* Timer */
 	int T[2];			/* timer counter                     */
-	UINT8 st[2];		/* timer enable                      */
+	uint8_t st[2];		/* timer enable                      */
 	/* FM channel slots */
 	OPL_CH *P_CH;		/* pointer of CH                     */
 	int	max_ch;			/* maximum channel                   */
 	/* Rhythm sention */
-	UINT8 rhythm;		/* Rhythm mode , key flag */
+	uint8_t rhythm;		/* Rhythm mode , key flag */
 	OPL_PORTHANDLER_R porthandler_r;
 	OPL_PORTHANDLER_W porthandler_w;
 	int port_param;
@@ -120,7 +121,7 @@ typedef struct fm_opl_f {
 	INT32 vibCnt;
 	INT32 vibIncr;
 	/* wave selector enable flag */
-	UINT8 wavesel;
+	uint8_t wavesel;
 	/* external event callback handler */
 	OPL_TIMERHANDLER  TimerHandler;		/* TIMER handler   */
 	int TimerParam;						/* TIMER parameter */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 06/26] audio: remove UINT16
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (4 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 05/26] audio: Remove UINT8 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 07/26] audio: remove UINT32 Juan Quintela
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

More modernitation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 3df8942..1891a22 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -10,7 +10,6 @@
 /* compiler dependence */
 #ifndef OSD_CPU_H
 #define OSD_CPU_H
-typedef unsigned short	UINT16;  /* unsigned 16bit */
 typedef unsigned int	UINT32;  /* unsigned 32bit */
 typedef signed char		INT8;    /* signed  8bit   */
 typedef signed short	INT16;   /* signed 16bit   */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 07/26] audio: remove UINT32
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (5 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 06/26] audio: remove UINT16 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 08/26] audio: Remove INT8 Juan Quintela
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 14 +++++++-------
 hw/audio/fmopl.h | 17 ++++++++---------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 3d14b45..47754e8 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -122,7 +122,7 @@ static const int slot_array[32]=
 /* key scale level */
 /* table is 3dB/OCT , DV converts this in TL step at 6dB/OCT */
 #define DV (EG_STEP/2)
-static const UINT32 KSL_TABLE[8*16]=
+static const uint32_t KSL_TABLE[8*16]=
 {
 	/* OCT 0 */
 	 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
@@ -195,7 +195,7 @@ static INT32 ENV_CURVE[2*EG_ENT+1];
 
 /* multiple table */
 #define ML 2
-static const UINT32 MUL_TABLE[16]= {
+static const uint32_t MUL_TABLE[16]= {
 /* 1/2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 */
    0.50*ML, 1.00*ML, 2.00*ML, 3.00*ML, 4.00*ML, 5.00*ML, 6.00*ML, 7.00*ML,
    8.00*ML, 9.00*ML,10.00*ML,10.00*ML,12.00*ML,12.00*ML,15.00*ML,15.00*ML
@@ -319,7 +319,7 @@ static inline void OPL_KEYOFF(OPL_SLOT *SLOT)
 
 /* ---------- calcrate Envelope Generator & Phase Generator ---------- */
 /* return : envelope output */
-static inline UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT )
+static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )
 {
 	/* calcrate envelope generator */
 	if( (SLOT->evc+=SLOT->evs) >= SLOT->eve )
@@ -451,7 +451,7 @@ static inline void set_sl_rr(FM_OPL *OPL,int slot,int v)
 /* ---------- calcrate one of channel ---------- */
 static inline void OPL_CALC_CH( OPL_CH *CH )
 {
-	UINT32 env_out;
+	uint32_t env_out;
 	OPL_SLOT *SLOT;
 
 	feedback2 = 0;
@@ -496,7 +496,7 @@ static inline void OPL_CALC_CH( OPL_CH *CH )
 #define WHITE_NOISE_db 6.0
 static inline void OPL_CALC_RH( OPL_CH *CH )
 {
-	UINT32 env_tam,env_sd,env_top,env_hh;
+	uint32_t env_tam,env_sd,env_top,env_hh;
 	int whitenoise = (rand()&1)*(WHITE_NOISE_db/EG_STEP);
 	INT32 tone8;
 
@@ -989,8 +989,8 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
     int i;
 	int data;
 	OPLSAMPLE *buf = buffer;
-	UINT32 amsCnt  = OPL->amsCnt;
-	UINT32 vibCnt  = OPL->vibCnt;
+	uint32_t amsCnt  = OPL->amsCnt;
+	uint32_t  vibCnt  = OPL->vibCnt;
 	uint8_t rhythm = OPL->rhythm&0x20;
 	OPL_CH *CH,*R_CH;
 
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 1891a22..b52f039 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -10,7 +10,6 @@
 /* compiler dependence */
 #ifndef OSD_CPU_H
 #define OSD_CPU_H
-typedef unsigned int	UINT32;  /* unsigned 32bit */
 typedef signed char		INT8;    /* signed  8bit   */
 typedef signed short	INT16;   /* signed 16bit   */
 typedef signed int		INT32;   /* signed 32bit   */
@@ -48,9 +47,9 @@ typedef struct fm_opl_slot {
 	INT32 *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
 	uint8_t ksl;		/* keyscale level  :(shift down bits)  */
 	uint8_t ksr;		/* key scale rate  :kcode>>KSR         */
-	UINT32 mul;		/* multiple        :ML_TABLE[ML]       */
-	UINT32 Cnt;		/* frequency count :                   */
-	UINT32 Incr;	/* frequency step  :                   */
+	uint32_t mul;		/* multiple        :ML_TABLE[ML]       */
+	uint32_t Cnt;		/* frequency count :                   */
+	uint32_t Incr;	/* frequency step  :                   */
 	/* envelope generator state */
 	uint8_t eg_typ;	/* envelope type flag                  */
 	uint8_t evm;		/* envelope phase                      */
@@ -76,10 +75,10 @@ typedef struct fm_opl_channel {
 	INT32 *connect2;	/* slot2 output pointer                */
 	INT32 op1_out[2];	/* slot1 output for selfeedback        */
 	/* phase generator state */
-	UINT32  block_fnum;	/* block+fnum      :                   */
+	uint32_t  block_fnum;	/* block+fnum      :                   */
 	uint8_t kcode;		/* key code        : KeyScaleCode      */
-	UINT32  fc;			/* Freq. Increment base                */
-	UINT32  ksl_base;	/* KeyScaleLevel Base step             */
+	uint32_t  fc;			/* Freq. Increment base                */
+	uint32_t  ksl_base;	/* KeyScaleLevel Base step             */
 	uint8_t keyon;		/* key on/off flag                     */
 } OPL_CH;
 
@@ -93,7 +92,7 @@ typedef struct fm_opl_f {
 	uint8_t address;		/* address register                  */
 	uint8_t status;		/* status flag                       */
 	uint8_t statusmask;	/* status mask                       */
-	UINT32 mode;		/* Reg.08 : CSM , notesel,etc.       */
+	uint32_t mode;		/* Reg.08 : CSM , notesel,etc.       */
 	/* Timer */
 	int T[2];			/* timer counter                     */
 	uint8_t st[2];		/* timer enable                      */
@@ -111,7 +110,7 @@ typedef struct fm_opl_f {
 	/* time tables */
 	INT32 AR_TABLE[75];	/* atttack rate tables */
 	INT32 DR_TABLE[75];	/* decay rate tables   */
-	UINT32 FN_TABLE[1024];  /* fnumber -> increment counter */
+	uint32_t FN_TABLE[1024];  /* fnumber -> increment counter */
 	/* LFO */
 	INT32 *ams_table;
 	INT32 *vib_table;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 08/26] audio: Remove INT8
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (6 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 07/26] audio: remove UINT32 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 09/26] audio: remove INT16 Juan Quintela
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index b52f039..bede671 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -10,7 +10,6 @@
 /* compiler dependence */
 #ifndef OSD_CPU_H
 #define OSD_CPU_H
-typedef signed char		INT8;    /* signed  8bit   */
 typedef signed short	INT16;   /* signed 16bit   */
 typedef signed int		INT32;   /* signed 32bit   */
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 09/26] audio: remove INT16
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (7 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 08/26] audio: Remove INT8 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 10/26] audio: Remove INT32 Juan Quintela
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 2 +-
 hw/audio/fmopl.h | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 47754e8..ebd3dbb 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -984,7 +984,7 @@ static void OPL_UnLockTable(void)
 /*******************************************************************************/
 
 /* ---------- update one of chip ----------- */
-void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
+void YM3812UpdateOne(FM_OPL *OPL, int16_t *buffer, int length)
 {
     int i;
 	int data;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index bede671..0bc3415 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -10,12 +10,11 @@
 /* compiler dependence */
 #ifndef OSD_CPU_H
 #define OSD_CPU_H
-typedef signed short	INT16;   /* signed 16bit   */
 typedef signed int		INT32;   /* signed 32bit   */
 #endif
 
 #if (OPL_OUTPUT_BIT==16)
-typedef INT16 OPLSAMPLE;
+typedef int16_t OPLSAMPLE;
 #endif
 #if (OPL_OUTPUT_BIT==8)
 typedef unsigned char  OPLSAMPLE;
@@ -142,5 +141,5 @@ int OPLWrite(FM_OPL *OPL,int a,int v);
 unsigned char OPLRead(FM_OPL *OPL,int a);
 int OPLTimerOver(FM_OPL *OPL,int c);
 
-void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length);
+void YM3812UpdateOne(FM_OPL *OPL, int16_t *buffer, int length);
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 10/26] audio: Remove INT32
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (8 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 09/26] audio: remove INT16 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-26  1:43   ` Philippe Mathieu-Daudé
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 11/26] audio: Unfold OPLSAMPLE Juan Quintela
                   ` (17 subsequent siblings)
  27 siblings, 1 reply; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 42 +++++++++++++++++++++---------------------
 hw/audio/fmopl.h | 54 ++++++++++++++++++++++++------------------------------
 2 files changed, 45 insertions(+), 51 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index ebd3dbb..8f935f6 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -170,7 +170,7 @@ static const uint32_t KSL_TABLE[8*16]=
 /* sustain lebel table (3db per step) */
 /* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
 #define SC(db) (db*((3/EG_STEP)*(1<<ENV_BITS)))+EG_DST
-static const INT32 SL_TABLE[16]={
+static const int32_t SL_TABLE[16]={
  SC( 0),SC( 1),SC( 2),SC(3 ),SC(4 ),SC(5 ),SC(6 ),SC( 7),
  SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)
 };
@@ -180,18 +180,18 @@ static const INT32 SL_TABLE[16]={
 /* TotalLevel : 48 24 12  6  3 1.5 0.75 (dB) */
 /* TL_TABLE[ 0      to TL_MAX          ] : plus  section */
 /* TL_TABLE[ TL_MAX to TL_MAX+TL_MAX-1 ] : minus section */
-static INT32 *TL_TABLE;
+static int32_t *TL_TABLE;
 
 /* pointers to TL_TABLE with sinwave output offset */
-static INT32 **SIN_TABLE;
+static int32_t **SIN_TABLE;
 
 /* LFO table */
-static INT32 *AMS_TABLE;
-static INT32 *VIB_TABLE;
+static int32_t *AMS_TABLE;
+static int32_t *VIB_TABLE;
 
 /* envelope output curve table */
 /* attack + decay + OFF */
-static INT32 ENV_CURVE[2*EG_ENT+1];
+static int32_t ENV_CURVE[2*EG_ENT+1];
 
 /* multiple table */
 #define ML 2
@@ -203,7 +203,7 @@ static const uint32_t MUL_TABLE[16]= {
 #undef ML
 
 /* dummy attack / decay rate ( when rate == 0 ) */
-static INT32 RATE_0[16]=
+static int32_t RATE_0[16]=
 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
 /* -------------------- static state --------------------- */
@@ -219,14 +219,14 @@ static OPL_CH *S_CH;
 static OPL_CH *E_CH;
 static OPL_SLOT *SLOT7_1, *SLOT7_2, *SLOT8_1, *SLOT8_2;
 
-static INT32 outd[1];
-static INT32 ams;
-static INT32 vib;
-static INT32 *ams_table;
-static INT32 *vib_table;
-static INT32 amsIncr;
-static INT32 vibIncr;
-static INT32 feedback2;		/* connect for SLOT 2 */
+static int32_t outd[1];
+static int32_t ams;
+static int32_t vib;
+static int32_t *ams_table;
+static int32_t *vib_table;
+static int32_t amsIncr;
+static int32_t vibIncr;
+static int32_t feedback2;		/* connect for SLOT 2 */
 
 /* log output level */
 #define LOG_ERR  3      /* ERROR       */
@@ -359,7 +359,7 @@ static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )
 /* set algorithm connection */
 static void set_algorithm( OPL_CH *CH)
 {
-	INT32 *carrier = &outd[0];
+	int32_t *carrier = &outd[0];
 	CH->connect1 = CH->CON ? carrier : &feedback2;
 	CH->connect2 = carrier;
 }
@@ -498,7 +498,7 @@ static inline void OPL_CALC_RH( OPL_CH *CH )
 {
 	uint32_t env_tam,env_sd,env_top,env_hh;
 	int whitenoise = (rand()&1)*(WHITE_NOISE_db/EG_STEP);
-	INT32 tone8;
+	int32_t tone8;
 
 	OPL_SLOT *SLOT;
 	int env_out;
@@ -616,20 +616,20 @@ static int OPLOpenTable( void )
 	double pom;
 
 	/* allocate dynamic tables */
-	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(INT32))) == NULL)
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
 		return 0;
-	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(INT32 *))) == NULL)
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)
 	{
 		free(TL_TABLE);
 		return 0;
 	}
-	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(INT32))) == NULL)
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)
 	{
 		free(TL_TABLE);
 		free(SIN_TABLE);
 		return 0;
 	}
-	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(INT32))) == NULL)
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)
 	{
 		free(TL_TABLE);
 		free(SIN_TABLE);
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 0bc3415..1e74019 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -7,12 +7,6 @@
 /* select bit size of output : 8 or 16 */
 #define OPL_OUTPUT_BIT 16
 
-/* compiler dependence */
-#ifndef OSD_CPU_H
-#define OSD_CPU_H
-typedef signed int		INT32;   /* signed 32bit   */
-#endif
-
 #if (OPL_OUTPUT_BIT==16)
 typedef int16_t OPLSAMPLE;
 #endif
@@ -36,13 +30,13 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
 /* Saving is necessary for member of the 'R' mark for suspend/resume */
 /* ---------- OPL one of slot  ---------- */
 typedef struct fm_opl_slot {
-	INT32 TL;		/* total level     :TL << 8            */
-	INT32 TLL;		/* adjusted now TL                     */
+	int32_t TL;		/* total level     :TL << 8            */
+	int32_t TLL;		/* adjusted now TL                     */
 	uint8_t  KSR;		/* key scale rate  :(shift down bit)   */
-	INT32 *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
-	INT32 *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
-	INT32 SL;		/* sustin level    :SL_TALBE[SL]       */
-	INT32 *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
+	int32_t *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
+	int32_t *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
+	int32_t SL;		/* sustin level    :SL_TALBE[SL]       */
+	int32_t *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
 	uint8_t ksl;		/* keyscale level  :(shift down bits)  */
 	uint8_t ksr;		/* key scale rate  :kcode>>KSR         */
 	uint32_t mul;		/* multiple        :ML_TABLE[ML]       */
@@ -51,17 +45,17 @@ typedef struct fm_opl_slot {
 	/* envelope generator state */
 	uint8_t eg_typ;	/* envelope type flag                  */
 	uint8_t evm;		/* envelope phase                      */
-	INT32 evc;		/* envelope counter                    */
-	INT32 eve;		/* envelope counter end point          */
-	INT32 evs;		/* envelope counter step               */
-	INT32 evsa;	/* envelope step for AR :AR[ksr]           */
-	INT32 evsd;	/* envelope step for DR :DR[ksr]           */
-	INT32 evsr;	/* envelope step for RR :RR[ksr]           */
+	int32_t evc;		/* envelope counter                    */
+	int32_t eve;		/* envelope counter end point          */
+	int32_t evs;		/* envelope counter step               */
+	int32_t evsa;	/* envelope step for AR :AR[ksr]           */
+	int32_t evsd;	/* envelope step for DR :DR[ksr]           */
+	int32_t evsr;	/* envelope step for RR :RR[ksr]           */
 	/* LFO */
 	uint8_t ams;		/* ams flag                            */
 	uint8_t vib;		/* vibrate flag                        */
 	/* wave selector */
-	INT32 **wavetable;
+	int32_t **wavetable;
 }OPL_SLOT;
 
 /* ---------- OPL one of channel  ---------- */
@@ -69,9 +63,9 @@ typedef struct fm_opl_channel {
 	OPL_SLOT SLOT[2];
 	uint8_t CON;			/* connection type                     */
 	uint8_t FB;			/* feed back       :(shift down bit)   */
-	INT32 *connect1;	/* slot1 output pointer                */
-	INT32 *connect2;	/* slot2 output pointer                */
-	INT32 op1_out[2];	/* slot1 output for selfeedback        */
+	int32_t *connect1;	/* slot1 output pointer                */
+	int32_t *connect2;	/* slot2 output pointer                */
+	int32_t op1_out[2];	/* slot1 output for selfeedback        */
 	/* phase generator state */
 	uint32_t  block_fnum;	/* block+fnum      :                   */
 	uint8_t kcode;		/* key code        : KeyScaleCode      */
@@ -106,16 +100,16 @@ typedef struct fm_opl_f {
 	OPL_PORTHANDLER_W keyboardhandler_w;
 	int keyboard_param;
 	/* time tables */
-	INT32 AR_TABLE[75];	/* atttack rate tables */
-	INT32 DR_TABLE[75];	/* decay rate tables   */
+	int32_t AR_TABLE[75];	/* atttack rate tables */
+	int32_t DR_TABLE[75];	/* decay rate tables   */
 	uint32_t FN_TABLE[1024];  /* fnumber -> increment counter */
 	/* LFO */
-	INT32 *ams_table;
-	INT32 *vib_table;
-	INT32 amsCnt;
-	INT32 amsIncr;
-	INT32 vibCnt;
-	INT32 vibIncr;
+	int32_t *ams_table;
+	int32_t *vib_table;
+	int32_t amsCnt;
+	int32_t amsIncr;
+	int32_t vibCnt;
+	int32_t vibIncr;
 	/* wave selector enable flag */
 	uint8_t wavesel;
 	/* external event callback handler */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 11/26] audio: Unfold OPLSAMPLE
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (9 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 10/26] audio: Remove INT32 Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 12/26] audio: Remove Unused OPL_TYPE_* Juan Quintela
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It was used only once, and now it was always int16_t.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c |  2 +-
 hw/audio/fmopl.h | 11 -----------
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 8f935f6..b1cb4b4 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -988,7 +988,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16_t *buffer, int length)
 {
     int i;
 	int data;
-	OPLSAMPLE *buf = buffer;
+	int16_t *buf = buffer;
 	uint32_t amsCnt  = OPL->amsCnt;
 	uint32_t  vibCnt  = OPL->vibCnt;
 	uint8_t rhythm = OPL->rhythm&0x20;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 1e74019..c236287 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -3,17 +3,6 @@
 
 #include <stdint.h>
 
-/* --- system optimize --- */
-/* select bit size of output : 8 or 16 */
-#define OPL_OUTPUT_BIT 16
-
-#if (OPL_OUTPUT_BIT==16)
-typedef int16_t OPLSAMPLE;
-#endif
-#if (OPL_OUTPUT_BIT==8)
-typedef unsigned char  OPLSAMPLE;
-#endif
-
 typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
 typedef void (*OPL_IRQHANDLER)(int param,int irq);
 typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 12/26] audio: Remove Unused OPL_TYPE_*
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (10 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 11/26] audio: Unfold OPLSAMPLE Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 13/26] audio: Remove type field Juan Quintela
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Since we removed the previous unused devices, they are not used anymore.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 16 ----------------
 hw/audio/fmopl.h |  3 ---
 2 files changed, 19 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index b1cb4b4..9171001 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1188,28 +1188,12 @@ unsigned char OPLRead(FM_OPL *OPL,int a)
 	switch(OPL->address)
 	{
 	case 0x05: /* KeyBoard IN */
-		if(OPL->type&OPL_TYPE_KEYBOARD)
-		{
-			if(OPL->keyboardhandler_r)
-				return OPL->keyboardhandler_r(OPL->keyboard_param);
-			else {
-				LOG(LOG_WAR,("OPL:read unmapped KEYBOARD port\n"));
-			}
-		}
 		return 0;
 #if 0
 	case 0x0f: /* ADPCM-DATA  */
 		return 0;
 #endif
 	case 0x19: /* I/O DATA    */
-		if(OPL->type&OPL_TYPE_IO)
-		{
-			if(OPL->porthandler_r)
-				return OPL->porthandler_r(OPL->port_param);
-			else {
-				LOG(LOG_WAR,("OPL:read unmapped I/O port\n"));
-			}
-		}
 		return 0;
 	case 0x1a: /* PCM-DATA    */
 		return 0;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index c236287..8ef0b3e 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -12,9 +12,6 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
 /* !!!!! here is private section , do not access there member direct !!!!! */
 
 #define OPL_TYPE_WAVESEL   0x01  /* waveform select    */
-#define OPL_TYPE_ADPCM     0x02  /* DELTA-T ADPCM unit */
-#define OPL_TYPE_KEYBOARD  0x04  /* keyboard interface */
-#define OPL_TYPE_IO        0x08  /* I/O port */
 
 /* Saving is necessary for member of the 'R' mark for suspend/resume */
 /* ---------- OPL one of slot  ---------- */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 13/26] audio: Remove type field
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (11 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 12/26] audio: Remove Unused OPL_TYPE_* Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 14/26] audio: Remove unused fields Juan Quintela
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It was not used anymore as now there is only one type of devices.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/adlib.c |  2 +-
 hw/audio/fmopl.c | 20 ++++++++------------
 hw/audio/fmopl.h |  7 +------
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index f9adcd7..09b8248 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -265,7 +265,7 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
     }
     glob_adlib = s;
 
-    s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
+    s->opl = OPLCreate (3579545, s->freq);
     if (!s->opl) {
         error_setg (errp, "OPLCreate %d failed", s->freq);
         return;
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 9171001..48db828 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -761,18 +761,15 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
 		{
 		case 0x01:
 			/* wave selector enable */
-			if(OPL->type&OPL_TYPE_WAVESEL)
+			OPL->wavesel = v&0x20;
+                        if(!OPL->wavesel)
 			{
-				OPL->wavesel = v&0x20;
-				if(!OPL->wavesel)
+				/* preset compatible mode */
+				int c;
+				for(c=0;c<OPL->max_ch;c++)
 				{
-					/* preset compatible mode */
-					int c;
-					for(c=0;c<OPL->max_ch;c++)
-					{
-						OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];
-						OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];
-					}
+					OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];
+					OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];
 				}
 			}
 			return;
@@ -1076,7 +1073,7 @@ void OPLResetChip(FM_OPL *OPL)
 
 /* ----------  Create one of vietual YM3812 ----------       */
 /* 'rate'  is sampling rate and 'bufsiz' is the size of the  */
-FM_OPL *OPLCreate(int type, int clock, int rate)
+FM_OPL *OPLCreate(int clock, int rate)
 {
 	char *ptr;
 	FM_OPL *OPL;
@@ -1095,7 +1092,6 @@ FM_OPL *OPLCreate(int type, int clock, int rate)
 	OPL        = (FM_OPL *)ptr; ptr+=sizeof(FM_OPL);
 	OPL->P_CH  = (OPL_CH *)ptr; ptr+=sizeof(OPL_CH)*max_ch;
 	/* set channel state pointer */
-	OPL->type  = type;
 	OPL->clock = clock;
 	OPL->rate  = rate;
 	OPL->max_ch = max_ch;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 8ef0b3e..df790a0 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -11,8 +11,6 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
 
 /* !!!!! here is private section , do not access there member direct !!!!! */
 
-#define OPL_TYPE_WAVESEL   0x01  /* waveform select    */
-
 /* Saving is necessary for member of the 'R' mark for suspend/resume */
 /* ---------- OPL one of slot  ---------- */
 typedef struct fm_opl_slot {
@@ -62,7 +60,6 @@ typedef struct fm_opl_channel {
 
 /* OPL state */
 typedef struct fm_opl_f {
-	uint8_t type;			/* chip type                         */
 	int clock;			/* master clock  (Hz)                */
 	int rate;			/* sampling rate (Hz)                */
 	double freqbase;	/* frequency base                    */
@@ -108,9 +105,7 @@ typedef struct fm_opl_f {
 } FM_OPL;
 
 /* ---------- Generic interface section ---------- */
-#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
-
-FM_OPL *OPLCreate(int type, int clock, int rate);
+FM_OPL *OPLCreate(int clock, int rate);
 void OPLDestroy(FM_OPL *OPL);
 void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
 void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 14/26] audio: Remove unused fields
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (12 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 13/26] audio: Remove type field Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 15/26] audio: GUSbyte is uint8_t Juan Quintela
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

These were used for the remove stuff.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index df790a0..8730ead 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -76,12 +76,6 @@ typedef struct fm_opl_f {
 	int	max_ch;			/* maximum channel                   */
 	/* Rhythm sention */
 	uint8_t rhythm;		/* Rhythm mode , key flag */
-	OPL_PORTHANDLER_R porthandler_r;
-	OPL_PORTHANDLER_W porthandler_w;
-	int port_param;
-	OPL_PORTHANDLER_R keyboardhandler_r;
-	OPL_PORTHANDLER_W keyboardhandler_w;
-	int keyboard_param;
 	/* time tables */
 	int32_t AR_TABLE[75];	/* atttack rate tables */
 	int32_t DR_TABLE[75];	/* decay rate tables   */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 15/26] audio: GUSbyte is uint8_t
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (13 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 14/26] audio: Remove unused fields Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 16/26] audio: remove GUSchar Juan Quintela
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/gusemu.h       |  6 ++---
 hw/audio/gusemu_hal.c   | 58 ++++++++++++++++++++++++-------------------------
 hw/audio/gusemu_mixer.c |  4 ++--
 3 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
index 9aec7bf..3a69222 100644
--- a/hw/audio/gusemu.h
+++ b/hw/audio/gusemu.h
@@ -28,14 +28,12 @@
 /* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */
 
 #if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
- typedef unsigned char GUSbyte;
  typedef unsigned short GUSword;
  typedef unsigned int GUSdword;
  typedef signed char GUSchar;
  typedef signed short GUSsample;
 #else
  typedef int8_t GUSchar;
- typedef uint8_t GUSbyte;
  typedef uint16_t GUSword;
  typedef uint32_t GUSdword;
  typedef int16_t GUSsample;
@@ -43,8 +41,8 @@
 
 typedef struct _GUSEmuState
 {
- GUSbyte *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */
- GUSbyte *gusdatapos; /* (gusdataend-gusdata) bytes used for storing emulated GF1/mixer register states (32*32+4 bytes in initial GUSemu32 version) */
+ uint8_t *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */
+ uint8_t *gusdatapos; /* (gusdataend-gusdata) bytes used for storing emulated GF1/mixer register states (32*32+4 bytes in initial GUSemu32 version) */
  uint32_t gusirq;
  uint32_t gusdma;
  unsigned int timer1fraction;
diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c
index 973d6b9..444a2bb 100644
--- a/hw/audio/gusemu_hal.c
+++ b/hw/audio/gusemu_hal.c
@@ -39,7 +39,7 @@ unsigned int gus_read(GUSEmuState * state, int port, int size)
 {
     int             value_read = 0;
 
-    GUSbyte        *gusptr;
+    uint8_t        *gusptr;
     gusptr = state->gusdatapos;
     GUSregd(portaccesses)++;
 
@@ -125,7 +125,7 @@ unsigned int gus_read(GUSEmuState * state, int port, int size)
                 if (!GUSregb(IRQStatReg2x6))
                     GUS_irqclear(state, state->gusirq);
             }
-            return (GUSbyte) value_read;
+            return (uint8_t) value_read;
             /* DramDMAmemPosReg */
             /* case 0x42: value_read=GUSregw(GUS42DMAStart); break;*/
             /* 43h+44h write only */
@@ -178,7 +178,7 @@ unsigned int gus_read(GUSEmuState * state, int port, int size)
         /*  return 0xff; */ /* Pre 3.6 boards, ICS mixer NOT present */
     case 0x307:                                     /* DRAMaccess */
         {
-            GUSbyte        *adr;
+            uint8_t        *adr;
             adr = state->himemaddr + (GUSregd(GUSDRAMPOS24bit) & 0xfffff);
             return *adr;
         }
@@ -189,14 +189,14 @@ unsigned int gus_read(GUSEmuState * state, int port, int size)
 
 void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
 {
-    GUSbyte        *gusptr;
+    uint8_t        *gusptr;
     gusptr = state->gusdatapos;
     GUSregd(portaccesses)++;
 
     switch (port & 0xff0f)
     {
     case 0x200:                 /* MixerCtrlReg */
-        GUSregb(MixerCtrlReg2x0) = (GUSbyte) data;
+        GUSregb(MixerCtrlReg2x0) = (uint8_t) data;
         break;
     case 0x206:                 /* IRQstatReg / SB2x6IRQ */
         if (GUSregb(GUS45TimerCtrl) & 0x20) /* SB IRQ enabled? -> set 2x6IRQ bit */
@@ -208,7 +208,7 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
         break;
     case 0x308:                /* AdLib 388h */
     case 0x208:                /* AdLibCommandReg */
-        GUSregb(AdLibCommand2xA) = (GUSbyte) data;
+        GUSregb(AdLibCommand2xA) = (uint8_t) data;
         break;
     case 0x309:                /* AdLib 389h */
     case 0x209:                /* AdLibDataReg */
@@ -217,11 +217,11 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
             if (data & 0x80)
                 GUSregb(TimerStatus2x8) &= 0x1f; /* AdLib IRQ reset? -> clear maskable adl. timer int regs */
             else
-                GUSregb(TimerDataReg2x9) = (GUSbyte) data;
+                GUSregb(TimerDataReg2x9) = (uint8_t) data;
         }
         else
         {
-            GUSregb(AdLibData2x9) = (GUSbyte) data;
+            GUSregb(AdLibData2x9) = (uint8_t) data;
             if (GUSregb(GUS45TimerCtrl) & 0x02)
             {
                 GUSregb(TimerStatus2x8) |= 0x01;
@@ -231,16 +231,16 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
         }
         break;
     case 0x20A:
-        GUSregb(AdLibStatus2x8) = (GUSbyte) data;
+        GUSregb(AdLibStatus2x8) = (uint8_t) data;
         break;                 /* AdLibStatus2x8 */
     case 0x20B:                /* GUS hidden registers */
         switch (GUSregb(RegCtrl_2xF) & 0x7)
         {
         case 0:
             if (GUSregb(MixerCtrlReg2x0) & 0x40)
-                GUSregb(IRQ_2xB) = (GUSbyte) data; /* control register select bit */
+                GUSregb(IRQ_2xB) = (uint8_t) data; /* control register select bit */
             else
-                GUSregb(DMA_2xB) = (GUSbyte) data;
+                GUSregb(DMA_2xB) = (uint8_t) data;
             break;
             /* case 1-4: general purpose emulation regs */
         case 5:                                    /* clear stat reg 2xF */
@@ -249,7 +249,7 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
                 GUS_irqclear(state, state->gusirq);
             break;
         case 6:                                    /* Jumper reg (Joystick/MIDI enable) */
-            GUSregb(Jumper_2xB) = (GUSbyte) data;
+            GUSregb(Jumper_2xB) = (uint8_t) data;
             break;
         default:;
         }
@@ -262,20 +262,20 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
             GUS_irqrequest(state, state->gusirq, 1);
         }
     case 0x20D:                /* SB2xCd no IRQ */
-        GUSregb(SB2xCd) = (GUSbyte) data;
+        GUSregb(SB2xCd) = (uint8_t) data;
         break;
     case 0x20E:                /* SB2xE */
-        GUSregb(SB2xE) = (GUSbyte) data;
+        GUSregb(SB2xE) = (uint8_t) data;
         break;
     case 0x20F:
-        GUSregb(RegCtrl_2xF) = (GUSbyte) data;
+        GUSregb(RegCtrl_2xF) = (uint8_t) data;
         break;                 /* CtrlReg2xF */
     case 0x302:                /* VoiceSelReg */
-        GUSregb(VoiceSelReg3x2) = (GUSbyte) data;
+        GUSregb(VoiceSelReg3x2) = (uint8_t) data;
         break;
     case 0x303:                /* FunkSelReg */
-        GUSregb(FunkSelReg3x3) = (GUSbyte) data;
-        if ((GUSbyte) data == 0x8f) /* set irqstatreg, get voicereg and clear IRQ */
+        GUSregb(FunkSelReg3x3) = (uint8_t) data;
+        if ((uint8_t) data == 0x8f) /* set irqstatreg, get voicereg and clear IRQ */
         {
             int             voice;
             if (GUSregd(voicewavetableirq)) /* WavetableIRQ */
@@ -358,12 +358,12 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
                 break;
                 /* voice unspecific functions */
             case 0x0e:         /* NumVoices */
-                GUSregb(NumVoices) = (GUSbyte) data;
+                GUSregb(NumVoices) = (uint8_t) data;
                 break;
             /* case 0x0f:      */ /* read only */
                 /* common functions */
             case 0x41:         /* DramDMAContrReg */
-                GUSregb(GUS41DMACtrl) = (GUSbyte) data;
+                GUSregb(GUS41DMACtrl) = (uint8_t) data;
                 if (data & 0x01)
                     GUS_dmarequest(state);
                 break;
@@ -380,7 +380,7 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
                     (GUSregd(GUSDRAMPOS24bit) & 0xffff) | ((data & 0x0f) << 16);
                 break;
             case 0x45:         /* TCtrlReg */
-                GUSregb(GUS45TimerCtrl) = (GUSbyte) data;
+                GUSregb(GUS45TimerCtrl) = (uint8_t) data;
                 if (!(data & 0x20))
                     GUSregb(TimerStatus2x8) &= 0xe7;    /* sb IRQ dis? -> clear 2x8/2xC sb IRQ flags */
                 if (!(data & 0x02))
@@ -434,18 +434,18 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
                     GUS_irqclear(state, state->gusirq);
                 break;
             case 0x46:          /* Counter1 */
-                GUSregb(GUS46Counter1) = (GUSbyte) data;
+                GUSregb(GUS46Counter1) = (uint8_t) data;
                 break;
             case 0x47:          /* Counter2 */
-                GUSregb(GUS47Counter2) = (GUSbyte) data;
+                GUSregb(GUS47Counter2) = (uint8_t) data;
                 break;
             /* case 0x48:       */ /* sampling freq reg not emulated (same as interwave) */
             case 0x49:          /* SampCtrlReg */
-                GUSregb(GUS49SampCtrl) = (GUSbyte) data;
+                GUSregb(GUS49SampCtrl) = (uint8_t) data;
                 break;
             /* case 0x4b:       */ /* joystick trim not emulated */
             case 0x4c:          /* GUSreset */
-                GUSregb(GUS4cReset) = (GUSbyte) data;
+                GUSregb(GUS4cReset) = (uint8_t) data;
                 if (!(GUSregb(GUS4cReset) & 1)) /* reset... */
                 {
                     GUSregd(voicewavetableirq) = 0;
@@ -471,9 +471,9 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
         break;
     case 0x307:                /* DRAMaccess */
         {
-            GUSbyte        *adr;
+            uint8_t        *adr;
             adr = state->himemaddr + (GUSregd(GUSDRAMPOS24bit) & 0xfffff);
-            *adr = (GUSbyte) data;
+            *adr = (uint8_t) data;
         }
         break;
     }
@@ -510,7 +510,7 @@ void gus_dma_transferdata(GUSEmuState * state, char *dma_addr, unsigned int coun
     char           *srcaddr;
     char           *destaddr;
     char            msbmask = 0;
-    GUSbyte        *gusptr;
+    uint8_t        *gusptr;
     gusptr = state->gusdatapos;
 
     srcaddr = dma_addr; /* system memory address */
@@ -522,7 +522,7 @@ void gus_dma_transferdata(GUSEmuState * state, char *dma_addr, unsigned int coun
     }
 
     GUSregw(GUS42DMAStart) += (GUSword)  (count >> 4);                           /* ToDo: add 16bit GUS page limit? */
-    GUSregb(GUS50DMAHigh)   = (GUSbyte) ((count + GUSregb(GUS50DMAHigh)) & 0xf); /* ToDo: add 16bit GUS page limit? */
+    GUSregb(GUS50DMAHigh)   = (uint8_t) ((count + GUSregb(GUS50DMAHigh)) & 0xf); /* ToDo: add 16bit GUS page limit? */
 
     if (GUSregb(GUS41DMACtrl) & 0x02)   /* direction, 0 := sysram->gusram */
     {
diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
index 701e8fb..d255ac8 100644
--- a/hw/audio/gusemu_mixer.c
+++ b/hw/audio/gusemu_mixer.c
@@ -37,7 +37,7 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
                    GUSsample *bufferpos)
 {
     /* note that byte registers are stored in the upper half of each voice register! */
-    GUSbyte        *gusptr;
+    uint8_t        *gusptr;
     int             Voice;
     GUSword        *voiceptr;
 
@@ -187,7 +187,7 @@ void gus_irqgen(GUSEmuState * state, unsigned int elapsed_time)
 /* time given in microseconds */
 {
     int             requestedIRQs = 0;
-    GUSbyte        *gusptr;
+    uint8_t        *gusptr;
     gusptr = state->gusdatapos;
     if (GUSregb(TimerDataReg2x9) & 1) /* start timer 1 (80us decrement rate) */
     {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 16/26] audio: remove GUSchar
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (14 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 15/26] audio: GUSbyte is uint8_t Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 17/26] audio: GUSword is uint16_t Juan Quintela
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/gusemu.h       | 2 --
 hw/audio/gusemu_mixer.c | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
index 3a69222..1c1a63c 100644
--- a/hw/audio/gusemu.h
+++ b/hw/audio/gusemu.h
@@ -30,10 +30,8 @@
 #if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
  typedef unsigned short GUSword;
  typedef unsigned int GUSdword;
- typedef signed char GUSchar;
  typedef signed short GUSsample;
 #else
- typedef int8_t GUSchar;
  typedef uint16_t GUSword;
  typedef uint32_t GUSdword;
  typedef int16_t GUSsample;
diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
index d255ac8..b189db9 100644
--- a/hw/audio/gusemu_mixer.c
+++ b/hw/audio/gusemu_mixer.c
@@ -85,16 +85,16 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
                 if (GUSvoice(wVSRControl) & 0x400)      /* 16bit */
                 {
                     int offset = ((CurrPos >> 9) & 0xc0000) + (((CurrPos >> 9) & 0x1ffff) << 1);
-                    GUSchar *adr;
-                    adr = (GUSchar *) state->himemaddr + offset;
+                    int8_t *adr;
+                    adr = (int8_t *) state->himemaddr + offset;
                     sample1 = (*adr & 0xff) + (*(adr + 1) * 256);
                     sample2 = (*(adr + 2) & 0xff) + (*(adr + 2 + 1) * 256);
                 }
                 else            /* 8bit */
                 {
                     int offset = (CurrPos >> 9) & 0xfffff;
-                    GUSchar *adr;
-                    adr = (GUSchar *) state->himemaddr + offset;
+                    int8_t *adr;
+                    adr = (int8_t *) state->himemaddr + offset;
                     sample1 = (*adr) * 256;
                     sample2 = (*(adr + 1)) * 256;
                 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 17/26] audio: GUSword is uint16_t
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (15 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 16/26] audio: remove GUSchar Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 18/26] " Juan Quintela
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/gusemu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
index 1c1a63c..69dadef 100644
--- a/hw/audio/gusemu.h
+++ b/hw/audio/gusemu.h
@@ -28,11 +28,9 @@
 /* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */
 
 #if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
- typedef unsigned short GUSword;
  typedef unsigned int GUSdword;
  typedef signed short GUSsample;
 #else
- typedef uint16_t GUSword;
  typedef uint32_t GUSdword;
  typedef int16_t GUSsample;
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 18/26] audio: GUSword is uint16_t
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (16 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 17/26] audio: GUSword is uint16_t Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t Juan Quintela
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/gusemu_hal.c   | 14 +++++++-------
 hw/audio/gusemu_mixer.c |  8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c
index 444a2bb..3dd7239 100644
--- a/hw/audio/gusemu_hal.c
+++ b/hw/audio/gusemu_hal.c
@@ -31,7 +31,7 @@
 #include "gusemu.h"
 
 #define GUSregb(position) (*            (gusptr+(position)))
-#define GUSregw(position) (*(GUSword *) (gusptr+(position)))
+#define GUSregw(position) (*(uint16_t *) (gusptr+(position)))
 #define GUSregd(position) (*(GUSdword *)(gusptr+(position)))
 
 /* size given in bytes */
@@ -173,7 +173,7 @@ unsigned int gus_read(GUSEmuState * state, int port, int size)
                 value_read = value_read >> 8;
             value_read &= 0xff;
         }
-        return (GUSword) value_read;
+        return (uint16_t) value_read;
     /* case 0x306:                                  */ /* Mixer/Version info */
         /*  return 0xff; */ /* Pre 3.6 boards, ICS mixer NOT present */
     case 0x307:                                     /* DRAMaccess */
@@ -318,15 +318,15 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
     case 0x304:
     case 0x305:
         {
-            GUSword         writedata = (GUSword) data;
-            GUSword         readmask = 0x0000;
+            uint16_t         writedata = (uint16_t) data;
+            uint16_t         readmask = 0x0000;
             if (size == 1)
             {
                 readmask = 0xff00;
                 writedata &= 0xff;
                 if ((port & 0xff0f) == 0x305)
                 {
-                    writedata = (GUSword) (writedata << 8);
+                    writedata = (uint16_t) (writedata << 8);
                     readmask = 0x00ff;
                 }
             }
@@ -353,7 +353,7 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
                         break;  /* reset flag active? */
                     offset = 2 * (GUSregb(FunkSelReg3x3) & 0x0f);
                     offset += (GUSregb(VoiceSelReg3x2) & 0x1f) << 5; /*  = Voice*32 + Funktion*2 */
-                    GUSregw(offset) = (GUSword) ((GUSregw(offset) & readmask) | writedata);
+                    GUSregw(offset) = (uint16_t) ((GUSregw(offset) & readmask) | writedata);
                 }
                 break;
                 /* voice unspecific functions */
@@ -521,7 +521,7 @@ void gus_dma_transferdata(GUSEmuState * state, char *dma_addr, unsigned int coun
         destaddr = (char *) state->himemaddr + offset; /* wavetable RAM address */
     }
 
-    GUSregw(GUS42DMAStart) += (GUSword)  (count >> 4);                           /* ToDo: add 16bit GUS page limit? */
+    GUSregw(GUS42DMAStart) += (uint16_t)  (count >> 4);                           /* ToDo: add 16bit GUS page limit? */
     GUSregb(GUS50DMAHigh)   = (uint8_t) ((count + GUSregb(GUS50DMAHigh)) & 0xf); /* ToDo: add 16bit GUS page limit? */
 
     if (GUSregb(GUS41DMACtrl) & 0x02)   /* direction, 0 := sysram->gusram */
diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
index b189db9..981a9ae 100644
--- a/hw/audio/gusemu_mixer.c
+++ b/hw/audio/gusemu_mixer.c
@@ -27,10 +27,10 @@
 #include "gustate.h"
 
 #define GUSregb(position)  (*            (gusptr+(position)))
-#define GUSregw(position)  (*(GUSword *) (gusptr+(position)))
+#define GUSregw(position)  (*(uint16_t *) (gusptr+(position)))
 #define GUSregd(position)  (*(GUSdword *)(gusptr+(position)))
 
-#define GUSvoice(position) (*(GUSword *)(voiceptr+(position)))
+#define GUSvoice(position) (*(uint16_t *)(voiceptr+(position)))
 
 /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */
 void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples,
@@ -39,14 +39,14 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
     /* note that byte registers are stored in the upper half of each voice register! */
     uint8_t        *gusptr;
     int             Voice;
-    GUSword        *voiceptr;
+    uint16_t       *voiceptr;
 
     unsigned int    count;
     for (count = 0; count < numsamples * 2; count++)
         *(bufferpos + count) = 0;       /* clear */
 
     gusptr = state->gusdatapos;
-    voiceptr = (GUSword *) gusptr;
+    voiceptr = (uint16_t *) gusptr;
     if (!(GUSregb(GUS4cReset) & 0x01))  /* reset flag active? */
         return;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (17 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 18/26] " Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-26  1:47   ` Philippe Mathieu-Daudé
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 20/26] audio: OPLSetIRQHandler is not used anywhere Juan Quintela
                   ` (8 subsequent siblings)
  27 siblings, 1 reply; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/gus.c          |  2 +-
 hw/audio/gusemu.h       | 12 +-----------
 hw/audio/gusemu_hal.c   |  2 +-
 hw/audio/gusemu_mixer.c |  8 ++++----
 4 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 3d08a65..ec103a4 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -53,7 +53,7 @@ typedef struct GUSState {
     uint32_t freq;
     uint32_t port;
     int pos, left, shift, irqs;
-    GUSsample *mixbuf;
+    int16_t *mixbuf;
     uint8_t himem[1024 * 1024 + 32 + 4096];
     int samples;
     SWVoiceOut *voice;
diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
index 69dadef..ab591ee 100644
--- a/hw/audio/gusemu.h
+++ b/hw/audio/gusemu.h
@@ -25,16 +25,6 @@
 #ifndef GUSEMU_H
 #define GUSEMU_H
 
-/* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */
-
-#if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
- typedef unsigned int GUSdword;
- typedef signed short GUSsample;
-#else
- typedef uint32_t GUSdword;
- typedef int16_t GUSsample;
-#endif
-
 typedef struct _GUSEmuState
 {
  uint8_t *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */
@@ -86,7 +76,7 @@ void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count
 /* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */
 /* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */
 
-void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos);
+void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, int16_t *bufferpos);
 /* recommended range: 10 < numsamples < 100 */
 /* lower values may result in increased rounding error, higher values often cause audible timing delays */
 
diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c
index 3dd7239..1150fc4 100644
--- a/hw/audio/gusemu_hal.c
+++ b/hw/audio/gusemu_hal.c
@@ -32,7 +32,7 @@
 
 #define GUSregb(position) (*            (gusptr+(position)))
 #define GUSregw(position) (*(uint16_t *) (gusptr+(position)))
-#define GUSregd(position) (*(GUSdword *)(gusptr+(position)))
+#define GUSregd(position) (*(uint16_t *)(gusptr+(position)))
 
 /* size given in bytes */
 unsigned int gus_read(GUSEmuState * state, int port, int size)
diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
index 981a9ae..00b9861 100644
--- a/hw/audio/gusemu_mixer.c
+++ b/hw/audio/gusemu_mixer.c
@@ -28,13 +28,13 @@
 
 #define GUSregb(position)  (*            (gusptr+(position)))
 #define GUSregw(position)  (*(uint16_t *) (gusptr+(position)))
-#define GUSregd(position)  (*(GUSdword *)(gusptr+(position)))
+#define GUSregd(position)  (*(uint16_t *)(gusptr+(position)))
 
 #define GUSvoice(position) (*(uint16_t *)(voiceptr+(position)))
 
 /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */
 void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples,
-                   GUSsample *bufferpos)
+                   int16_t *bufferpos)
 {
     /* note that byte registers are stored in the upper half of each voice register! */
     uint8_t        *gusptr;
@@ -171,8 +171,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
                 }
 
                 /* mix samples into buffer */
-                *(bufferpos + 2 * sample)     += (GUSsample) ((sample1 * PanningPos) >> 4);        /* right */
-                *(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */
+                *(bufferpos + 2 * sample)     += (int16_t) ((sample1 * PanningPos) >> 4);        /* right */
+                *(bufferpos + 2 * sample + 1) += (int16_t) ((sample1 * (15 - PanningPos)) >> 4); /* left */
             }
             /* write back voice and volume */
             GUSvoice(wVSRCurrVol)   = Volume32 / 32;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 20/26] audio: OPLSetIRQHandler is not used anywhere
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (18 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 21/26] audio: OPLSetUpdateHandler " Juan Quintela
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 5 -----
 hw/audio/fmopl.h | 1 -
 2 files changed, 6 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 48db828..f91e700 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1141,11 +1141,6 @@ void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOff
 	OPL->TimerHandler   = TimerHandler;
 	OPL->TimerParam = channelOffset;
 }
-void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param)
-{
-	OPL->IRQHandler     = IRQHandler;
-	OPL->IRQParam = param;
-}
 void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param)
 {
 	OPL->UpdateHandler = UpdateHandler;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 8730ead..375f971 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -102,7 +102,6 @@ typedef struct fm_opl_f {
 FM_OPL *OPLCreate(int clock, int rate);
 void OPLDestroy(FM_OPL *OPL);
 void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
-void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param);
 void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param);
 
 void OPLResetChip(FM_OPL *OPL);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 21/26] audio: OPLSetUpdateHandler is not used anywhere
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (19 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 20/26] audio: OPLSetIRQHandler is not used anywhere Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 22/26] audio: IRQHandler is not used anymore Juan Quintela
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 6 +-----
 hw/audio/fmopl.h | 1 -
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index f91e700..694a77b 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1141,11 +1141,7 @@ void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOff
 	OPL->TimerHandler   = TimerHandler;
 	OPL->TimerParam = channelOffset;
 }
-void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param)
-{
-	OPL->UpdateHandler = UpdateHandler;
-	OPL->UpdateParam = param;
-}
+
 /* ---------- YM3812 I/O interface ---------- */
 int OPLWrite(FM_OPL *OPL,int a,int v)
 {
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 375f971..446de08 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -102,7 +102,6 @@ typedef struct fm_opl_f {
 FM_OPL *OPLCreate(int clock, int rate);
 void OPLDestroy(FM_OPL *OPL);
 void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
-void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param);
 
 void OPLResetChip(FM_OPL *OPL);
 int OPLWrite(FM_OPL *OPL,int a,int v);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 22/26] audio: IRQHandler is not used anymore
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (20 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 21/26] audio: OPLSetUpdateHandler " Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 23/26] audio: UpdateHandler " Juan Quintela
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 4 ----
 hw/audio/fmopl.h | 2 --
 2 files changed, 6 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 694a77b..5b8a884 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -260,8 +260,6 @@ static inline void OPL_STATUS_SET(FM_OPL *OPL,int flag)
 		if(OPL->status & OPL->statusmask)
 		{	/* IRQ on */
 			OPL->status |= 0x80;
-			/* callback user interrupt handler (IRQ is OFF to ON) */
-			if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,1);
 		}
 	}
 }
@@ -276,8 +274,6 @@ static inline void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
 		if (!(OPL->status & OPL->statusmask) )
 		{
 			OPL->status &= 0x7f;
-			/* callback user interrupt handler (IRQ is ON to OFF) */
-			if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0);
 		}
 	}
 }
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 446de08..b1641f5 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -92,8 +92,6 @@ typedef struct fm_opl_f {
 	/* external event callback handler */
 	OPL_TIMERHANDLER  TimerHandler;		/* TIMER handler   */
 	int TimerParam;						/* TIMER parameter */
-	OPL_IRQHANDLER    IRQHandler;		/* IRQ handler    */
-	int IRQParam;						/* IRQ parameter  */
 	OPL_UPDATEHANDLER UpdateHandler;	/* stream update handler   */
 	int UpdateParam;					/* stream update parameter */
 } FM_OPL;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 23/26] audio: UpdateHandler is not used anymore
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (21 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 22/26] audio: IRQHandler is not used anymore Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 24/26] audio: Remove unused typedefs Juan Quintela
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 2 --
 hw/audio/fmopl.h | 2 --
 2 files changed, 4 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 5b8a884..99d09c5 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1147,7 +1147,6 @@ int OPLWrite(FM_OPL *OPL,int a,int v)
 	}
 	else
 	{	/* data port */
-		if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
 #ifdef OPL_OUTPUT_LOG
 	if(opl_dbg_fp)
 	{
@@ -1197,7 +1196,6 @@ int OPLTimerOver(FM_OPL *OPL,int c)
 		if( OPL->mode & 0x80 )
 		{	/* CSM mode total level latch and auto key on */
 			int ch;
-			if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
 			for(ch=0;ch<9;ch++)
 				CSMKeyControll( &OPL->P_CH[ch] );
 		}
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index b1641f5..8410275 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -92,8 +92,6 @@ typedef struct fm_opl_f {
 	/* external event callback handler */
 	OPL_TIMERHANDLER  TimerHandler;		/* TIMER handler   */
 	int TimerParam;						/* TIMER parameter */
-	OPL_UPDATEHANDLER UpdateHandler;	/* stream update handler   */
-	int UpdateParam;					/* stream update parameter */
 } FM_OPL;
 
 /* ---------- Generic interface section ---------- */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 24/26] audio: Remove unused typedefs
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (22 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 23/26] audio: UpdateHandler " Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip Juan Quintela
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index 8410275..f89af08 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -4,10 +4,6 @@
 #include <stdint.h>
 
 typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
-typedef void (*OPL_IRQHANDLER)(int param,int irq);
-typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
-typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
-typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
 
 /* !!!!! here is private section , do not access there member direct !!!!! */
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (23 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 24/26] audio: Remove unused typedefs Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-26  1:48   ` Philippe Mathieu-Daudé
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h Juan Quintela
                   ` (2 subsequent siblings)
  27 siblings, 1 reply; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 2 +-
 hw/audio/fmopl.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 99d09c5..dc9043c 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -1036,7 +1036,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16_t *buffer, int length)
 }
 
 /* ---------- reset one of chip ---------- */
-void OPLResetChip(FM_OPL *OPL)
+static void OPLResetChip(FM_OPL *OPL)
 {
 	int c,s;
 	int i;
diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
index f89af08..fc9f16b 100644
--- a/hw/audio/fmopl.h
+++ b/hw/audio/fmopl.h
@@ -95,7 +95,6 @@ FM_OPL *OPLCreate(int clock, int rate);
 void OPLDestroy(FM_OPL *OPL);
 void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
 
-void OPLResetChip(FM_OPL *OPL);
 int OPLWrite(FM_OPL *OPL,int a,int v);
 unsigned char OPLRead(FM_OPL *OPL,int a);
 int OPLTimerOver(FM_OPL *OPL,int c);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (24 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip Juan Quintela
@ 2017-04-25 22:37 ` Juan Quintela
  2017-04-26  1:48   ` Philippe Mathieu-Daudé
  2017-04-25 23:31 ` [Qemu-devel] [PATCH 00/26] Audio Cleanup no-reply
  2017-04-26  7:20 ` Juan Quintela
  27 siblings, 1 reply; 36+ messages in thread
From: Juan Quintela @ 2017-04-25 22:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/audio/fmopl.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index dc9043c..202f752 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -34,15 +34,11 @@
 #include <math.h>
 //#include "driver.h"		/* use M.A.M.E. */
 #include "fmopl.h"
-
+#include "qemu/osdep.h"
 #ifndef PI
 #define PI 3.14159265358979323846
 #endif
 
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
 /* -------------------- for debug --------------------- */
 /* #define OPL_OUTPUT_LOG */
 #ifdef OPL_OUTPUT_LOG
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 00/26] Audio Cleanup
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (25 preceding siblings ...)
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h Juan Quintela
@ 2017-04-25 23:31 ` no-reply
  2017-04-26  7:20 ` Juan Quintela
  27 siblings, 0 replies; 36+ messages in thread
From: no-reply @ 2017-04-25 23:31 UTC (permalink / raw)
  To: quintela; +Cc: famz, qemu-devel, lvivier, dgilbert, peterx

Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20170425223739.6703-1-quintela@redhat.com
Subject: [Qemu-devel] [PATCH 00/26] Audio Cleanup
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/1493161481-29595-1-git-send-email-mdroth@linux.vnet.ibm.com -> patchew/1493161481-29595-1-git-send-email-mdroth@linux.vnet.ibm.com
Switched to a new branch 'test'
426bc46 audio: Use ARRAY_SIZE from qemu/osdep.h
67f41a4 audio: un-export OPLResetChip
2928139 audio: Remove unused typedefs
c5bed44 audio: UpdateHandler is not used anymore
0f97e4e audio: IRQHandler is not used anymore
9be6fbb audio: OPLSetUpdateHandler is not used anywhere
17d4a87 audio: OPLSetIRQHandler is not used anywhere
331f9f0 audio: GUSsample is int16_t
eb7522b audio: GUSword is uint16_t
b6db066 audio: GUSword is uint16_t
4f2e7e5 audio: remove GUSchar
430732c audio: GUSbyte is uint8_t
5494808 audio: Remove unused fields
2f74da9 audio: Remove type field
91ee28c audio: Remove Unused OPL_TYPE_*
54a318a audio: Unfold OPLSAMPLE
ca7aa23 audio: Remove INT32
237513a audio: remove INT16
975980b audio: Remove INT8
1b97e08 audio: remove UINT32
7beb767 audio: remove UINT16
6699511 audio: Remove UINT8
4e01d17 audio: YM3812 was always defined
decafab audio: Remove YM3526 support
9ee2738 audio: remove Y8950 configuration
b24fc9b adlib: Remove support for YMF262

=== OUTPUT BEGIN ===
Checking PATCH 1/26: adlib: Remove support for YMF262...
Checking PATCH 2/26: audio: remove Y8950 configuration...
Checking PATCH 3/26: audio: Remove YM3526 support...
Checking PATCH 4/26: audio: YM3812 was always defined...
Checking PATCH 5/26: audio: Remove UINT8...
ERROR: code indent should never use tabs
#21: FILE: hw/audio/fmopl.c:792:
+^I^I^I^Iuint8_t st1 = v&1;$

ERROR: spaces required around that '&' (ctx:VxV)
#21: FILE: hw/audio/fmopl.c:792:
+				uint8_t st1 = v&1;
 				               ^

ERROR: code indent should never use tabs
#22: FILE: hw/audio/fmopl.c:793:
+^I^I^I^Iuint8_t st2 = (v>>1)&1;$

ERROR: spaces required around that '>>' (ctx:VxV)
#22: FILE: hw/audio/fmopl.c:793:
+				uint8_t st2 = (v>>1)&1;
 				                ^

ERROR: spaces required around that '&' (ctx:VxV)
#22: FILE: hw/audio/fmopl.c:793:
+				uint8_t st2 = (v>>1)&1;
 				                    ^

ERROR: code indent should never use tabs
#31: FILE: hw/audio/fmopl.c:841:
+^I^I^Iuint8_t rkey = OPL->rhythm^v;$

ERROR: spaces required around that '^' (ctx:VxV)
#31: FILE: hw/audio/fmopl.c:841:
+			uint8_t rkey = OPL->rhythm^v;
 			                          ^

ERROR: code indent should never use tabs
#40: FILE: hw/audio/fmopl.c:994:
+^Iuint8_t rhythm = OPL->rhythm&0x20;$

ERROR: spaces required around that '&' (ctx:VxV)
#40: FILE: hw/audio/fmopl.c:994:
+	uint8_t rhythm = OPL->rhythm&0x20;
 	                            ^

ERROR: code indent should never use tabs
#70: FILE: hw/audio/fmopl.h:45:
+^Iuint8_t  KSR;^I^I/* key scale rate  :(shift down bit)   */$

ERROR: code indent should never use tabs
#77: FILE: hw/audio/fmopl.h:50:
+^Iuint8_t ksl;^I^I/* keyscale level  :(shift down bits)  */$

ERROR: code indent should never use tabs
#78: FILE: hw/audio/fmopl.h:51:
+^Iuint8_t ksr;^I^I/* key scale rate  :kcode>>KSR         */$

ERROR: code indent should never use tabs
#85: FILE: hw/audio/fmopl.h:56:
+^Iuint8_t eg_typ;^I/* envelope type flag                  */$

ERROR: code indent should never use tabs
#86: FILE: hw/audio/fmopl.h:57:
+^Iuint8_t evm;^I^I/* envelope phase                      */$

ERROR: code indent should never use tabs
#96: FILE: hw/audio/fmopl.h:65:
+^Iuint8_t ams;^I^I/* ams flag                            */$

ERROR: code indent should never use tabs
#97: FILE: hw/audio/fmopl.h:66:
+^Iuint8_t vib;^I^I/* vibrate flag                        */$

WARNING: line over 80 characters
#107: FILE: hw/audio/fmopl.h:74:
+	uint8_t CON;			/* connection type                     */

ERROR: code indent should never use tabs
#107: FILE: hw/audio/fmopl.h:74:
+^Iuint8_t CON;^I^I^I/* connection type                     */$

WARNING: line over 80 characters
#108: FILE: hw/audio/fmopl.h:75:
+	uint8_t FB;			/* feed back       :(shift down bit)   */

ERROR: code indent should never use tabs
#108: FILE: hw/audio/fmopl.h:75:
+^Iuint8_t FB;^I^I^I/* feed back       :(shift down bit)   */$

ERROR: code indent should never use tabs
#115: FILE: hw/audio/fmopl.h:81:
+^Iuint8_t kcode;^I^I/* key code        : KeyScaleCode      */$

ERROR: code indent should never use tabs
#119: FILE: hw/audio/fmopl.h:84:
+^Iuint8_t keyon;^I^I/* key on/off flag                     */$

ERROR: code indent should never use tabs
#125: FILE: hw/audio/fmopl.h:89:
+^Iuint8_t type;^I^I^I/* chip type                         */$

ERROR: code indent should never use tabs
#133: FILE: hw/audio/fmopl.h:94:
+^Iuint8_t address;^I^I/* address register                  */$

ERROR: code indent should never use tabs
#134: FILE: hw/audio/fmopl.h:95:
+^Iuint8_t status;^I^I/* status flag                       */$

ERROR: code indent should never use tabs
#135: FILE: hw/audio/fmopl.h:96:
+^Iuint8_t statusmask;^I/* status mask                       */$

ERROR: code indent should never use tabs
#140: FILE: hw/audio/fmopl.h:100:
+^Iuint8_t st[2];^I^I/* timer enable                      */$

ERROR: code indent should never use tabs
#146: FILE: hw/audio/fmopl.h:105:
+^Iuint8_t rhythm;^I^I/* Rhythm mode , key flag */$

ERROR: code indent should never use tabs
#155: FILE: hw/audio/fmopl.h:124:
+^Iuint8_t wavesel;$

total: 27 errors, 2 warnings, 131 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 6/26: audio: remove UINT16...
Checking PATCH 7/26: audio: remove UINT32...
ERROR: spaces required around that '*' (ctx:VxV)
#18: FILE: hw/audio/fmopl.c:125:
+static const uint32_t KSL_TABLE[8*16]=
                                  ^

ERROR: spaces required around that '=' (ctx:VxE)
#18: FILE: hw/audio/fmopl.c:125:
+static const uint32_t KSL_TABLE[8*16]=
                                      ^

ERROR: spaces required around that '=' (ctx:VxW)
#27: FILE: hw/audio/fmopl.c:198:
+static const uint32_t MUL_TABLE[16]= {
                                    ^

ERROR: spaces required around that '*' (ctx:WxV)
#36: FILE: hw/audio/fmopl.c:322:
+static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )
                                                ^

ERROR: space prohibited after that open parenthesis '('
#36: FILE: hw/audio/fmopl.c:322:
+static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )

ERROR: space prohibited before that close parenthesis ')'
#36: FILE: hw/audio/fmopl.c:322:
+static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )

ERROR: code indent should never use tabs
#45: FILE: hw/audio/fmopl.c:454:
+^Iuint32_t env_out;$

ERROR: code indent should never use tabs
#54: FILE: hw/audio/fmopl.c:499:
+^Iuint32_t env_tam,env_sd,env_top,env_hh;$

ERROR: space required after that ',' (ctx:VxV)
#54: FILE: hw/audio/fmopl.c:499:
+	uint32_t env_tam,env_sd,env_top,env_hh;
 	                ^

ERROR: space required after that ',' (ctx:VxV)
#54: FILE: hw/audio/fmopl.c:499:
+	uint32_t env_tam,env_sd,env_top,env_hh;
 	                       ^

ERROR: space required after that ',' (ctx:VxV)
#54: FILE: hw/audio/fmopl.c:499:
+	uint32_t env_tam,env_sd,env_top,env_hh;
 	                               ^

ERROR: code indent should never use tabs
#64: FILE: hw/audio/fmopl.c:992:
+^Iuint32_t amsCnt  = OPL->amsCnt;$

ERROR: code indent should never use tabs
#65: FILE: hw/audio/fmopl.c:993:
+^Iuint32_t  vibCnt  = OPL->vibCnt;$

ERROR: code indent should never use tabs
#88: FILE: hw/audio/fmopl.h:50:
+^Iuint32_t mul;^I^I/* multiple        :ML_TABLE[ML]       */$

ERROR: code indent should never use tabs
#89: FILE: hw/audio/fmopl.h:51:
+^Iuint32_t Cnt;^I^I/* frequency count :                   */$

ERROR: code indent should never use tabs
#90: FILE: hw/audio/fmopl.h:52:
+^Iuint32_t Incr;^I/* frequency step  :                   */$

ERROR: code indent should never use tabs
#99: FILE: hw/audio/fmopl.h:78:
+^Iuint32_t  block_fnum;^I/* block+fnum      :                   */$

WARNING: line over 80 characters
#103: FILE: hw/audio/fmopl.h:80:
+	uint32_t  fc;			/* Freq. Increment base                */

ERROR: code indent should never use tabs
#103: FILE: hw/audio/fmopl.h:80:
+^Iuint32_t  fc;^I^I^I/* Freq. Increment base                */$

ERROR: code indent should never use tabs
#104: FILE: hw/audio/fmopl.h:81:
+^Iuint32_t  ksl_base;^I/* KeyScaleLevel Base step             */$

ERROR: code indent should never use tabs
#113: FILE: hw/audio/fmopl.h:95:
+^Iuint32_t mode;^I^I/* Reg.08 : CSM , notesel,etc.       */$

ERROR: code indent should never use tabs
#122: FILE: hw/audio/fmopl.h:113:
+^Iuint32_t FN_TABLE[1024];  /* fnumber -> increment counter */$

total: 21 errors, 1 warnings, 98 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 8/26: audio: Remove INT8...
Checking PATCH 9/26: audio: remove INT16...
Checking PATCH 10/26: audio: Remove INT32...
ERROR: spaces required around that '=' (ctx:VxV)
#18: FILE: hw/audio/fmopl.c:173:
+static const int32_t SL_TABLE[16]={
                                  ^

ERROR: spaces required around that '*' (ctx:VxV)
#42: FILE: hw/audio/fmopl.c:194:
+static int32_t ENV_CURVE[2*EG_ENT+1];
                           ^

ERROR: spaces required around that '+' (ctx:VxV)
#42: FILE: hw/audio/fmopl.c:194:
+static int32_t ENV_CURVE[2*EG_ENT+1];
                                  ^

ERROR: spaces required around that '=' (ctx:VxE)
#51: FILE: hw/audio/fmopl.c:206:
+static int32_t RATE_0[16]=
                          ^

ERROR: code indent should never use tabs
#74: FILE: hw/audio/fmopl.c:229:
+static int32_t feedback2;^I^I/* connect for SLOT 2 */$

ERROR: code indent should never use tabs
#83: FILE: hw/audio/fmopl.c:362:
+^Iint32_t *carrier = &outd[0];$

ERROR: code indent should never use tabs
#92: FILE: hw/audio/fmopl.c:501:
+^Iint32_t tone8;$

ERROR: code indent should never use tabs
#101: FILE: hw/audio/fmopl.c:619:
+^Iif( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)$

ERROR: spaces required around that '*' (ctx:VxV)
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
 	                             ^

ERROR: spaces required around that '*' (ctx:VxV)
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
 	                               ^

ERROR: space prohibited after that open parenthesis '('
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)

ERROR: space required before the open parenthesis '('
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)

ERROR: do not use assignment in if condition
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)

ERROR: braces {} are necessary for all arms of this statement
#101: FILE: hw/audio/fmopl.c:619:
+	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
[...]

ERROR: code indent should never use tabs
#104: FILE: hw/audio/fmopl.c:621:
+^Iif( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)$

ERROR: spaces required around that '*' (ctx:VxV)
#104: FILE: hw/audio/fmopl.c:621:
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)
 	                               ^

ERROR: spaces required around that '*' (ctx:WxV)
#104: FILE: hw/audio/fmopl.c:621:
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)
 	                                  ^

ERROR: space prohibited after that open parenthesis '('
#104: FILE: hw/audio/fmopl.c:621:
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)

ERROR: space required before the open parenthesis '('
#104: FILE: hw/audio/fmopl.c:621:
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)

ERROR: do not use assignment in if condition
#104: FILE: hw/audio/fmopl.c:621:
+	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)

ERROR: code indent should never use tabs
#110: FILE: hw/audio/fmopl.c:626:
+^Iif( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)$

ERROR: spaces required around that '*' (ctx:VxV)
#110: FILE: hw/audio/fmopl.c:626:
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)
 	                               ^

ERROR: spaces required around that '*' (ctx:WxV)
#110: FILE: hw/audio/fmopl.c:626:
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)
 	                                  ^

ERROR: space prohibited after that open parenthesis '('
#110: FILE: hw/audio/fmopl.c:626:
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: space required before the open parenthesis '('
#110: FILE: hw/audio/fmopl.c:626:
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: do not use assignment in if condition
#110: FILE: hw/audio/fmopl.c:626:
+	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: code indent should never use tabs
#117: FILE: hw/audio/fmopl.c:632:
+^Iif( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)$

ERROR: spaces required around that '*' (ctx:VxV)
#117: FILE: hw/audio/fmopl.c:632:
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)
 	                               ^

ERROR: spaces required around that '*' (ctx:WxV)
#117: FILE: hw/audio/fmopl.c:632:
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)
 	                                  ^

ERROR: space prohibited after that open parenthesis '('
#117: FILE: hw/audio/fmopl.c:632:
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: space required before the open parenthesis '('
#117: FILE: hw/audio/fmopl.c:632:
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: do not use assignment in if condition
#117: FILE: hw/audio/fmopl.c:632:
+	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)

ERROR: code indent should never use tabs
#144: FILE: hw/audio/fmopl.h:33:
+^Iint32_t TL;^I^I/* total level     :TL << 8            */$

ERROR: code indent should never use tabs
#145: FILE: hw/audio/fmopl.h:34:
+^Iint32_t TLL;^I^I/* adjusted now TL                     */$

ERROR: code indent should never use tabs
#151: FILE: hw/audio/fmopl.h:36:
+^Iint32_t *AR;^I^I/* attack rate     :&AR_TABLE[AR<<2]   */$

ERROR: code indent should never use tabs
#152: FILE: hw/audio/fmopl.h:37:
+^Iint32_t *DR;^I^I/* decay rate      :&DR_TALBE[DR<<2]   */$

ERROR: code indent should never use tabs
#153: FILE: hw/audio/fmopl.h:38:
+^Iint32_t SL;^I^I/* sustin level    :SL_TALBE[SL]       */$

ERROR: code indent should never use tabs
#154: FILE: hw/audio/fmopl.h:39:
+^Iint32_t *RR;^I^I/* release rate    :&DR_TABLE[RR<<2]   */$

ERROR: code indent should never use tabs
#168: FILE: hw/audio/fmopl.h:48:
+^Iint32_t evc;^I^I/* envelope counter                    */$

ERROR: code indent should never use tabs
#169: FILE: hw/audio/fmopl.h:49:
+^Iint32_t eve;^I^I/* envelope counter end point          */$

ERROR: code indent should never use tabs
#170: FILE: hw/audio/fmopl.h:50:
+^Iint32_t evs;^I^I/* envelope counter step               */$

ERROR: code indent should never use tabs
#171: FILE: hw/audio/fmopl.h:51:
+^Iint32_t evsa;^I/* envelope step for AR :AR[ksr]           */$

ERROR: code indent should never use tabs
#172: FILE: hw/audio/fmopl.h:52:
+^Iint32_t evsd;^I/* envelope step for DR :DR[ksr]           */$

ERROR: code indent should never use tabs
#173: FILE: hw/audio/fmopl.h:53:
+^Iint32_t evsr;^I/* envelope step for RR :RR[ksr]           */$

ERROR: code indent should never use tabs
#179: FILE: hw/audio/fmopl.h:58:
+^Iint32_t **wavetable;$

ERROR: code indent should never use tabs
#190: FILE: hw/audio/fmopl.h:66:
+^Iint32_t *connect1;^I/* slot1 output pointer                */$

ERROR: code indent should never use tabs
#191: FILE: hw/audio/fmopl.h:67:
+^Iint32_t *connect2;^I/* slot2 output pointer                */$

ERROR: code indent should never use tabs
#192: FILE: hw/audio/fmopl.h:68:
+^Iint32_t op1_out[2];^I/* slot1 output for selfeedback        */$

ERROR: code indent should never use tabs
#202: FILE: hw/audio/fmopl.h:103:
+^Iint32_t AR_TABLE[75];^I/* atttack rate tables */$

ERROR: code indent should never use tabs
#203: FILE: hw/audio/fmopl.h:104:
+^Iint32_t DR_TABLE[75];^I/* decay rate tables   */$

ERROR: code indent should never use tabs
#212: FILE: hw/audio/fmopl.h:107:
+^Iint32_t *ams_table;$

ERROR: code indent should never use tabs
#213: FILE: hw/audio/fmopl.h:108:
+^Iint32_t *vib_table;$

ERROR: code indent should never use tabs
#214: FILE: hw/audio/fmopl.h:109:
+^Iint32_t amsCnt;$

ERROR: code indent should never use tabs
#215: FILE: hw/audio/fmopl.h:110:
+^Iint32_t amsIncr;$

ERROR: code indent should never use tabs
#216: FILE: hw/audio/fmopl.h:111:
+^Iint32_t vibCnt;$

ERROR: code indent should never use tabs
#217: FILE: hw/audio/fmopl.h:112:
+^Iint32_t vibIncr;$

total: 56 errors, 0 warnings, 192 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/26: audio: Unfold OPLSAMPLE...
ERROR: code indent should never use tabs
#20: FILE: hw/audio/fmopl.c:991:
+^Iint16_t *buf = buffer;$

total: 1 errors, 0 warnings, 25 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 12/26: audio: Remove Unused OPL_TYPE_*...
Checking PATCH 13/26: audio: Remove type field...
ERROR: code indent should never use tabs
#33: FILE: hw/audio/fmopl.c:764:
+^I^I^IOPL->wavesel = v&0x20;$

ERROR: spaces required around that '&' (ctx:VxV)
#33: FILE: hw/audio/fmopl.c:764:
+			OPL->wavesel = v&0x20;
 			                ^

ERROR: space required before the open parenthesis '('
#34: FILE: hw/audio/fmopl.c:765:
+                        if(!OPL->wavesel)

ERROR: code indent should never use tabs
#38: FILE: hw/audio/fmopl.c:767:
+^I^I^I^I/* preset compatible mode */$

ERROR: code indent should never use tabs
#39: FILE: hw/audio/fmopl.c:768:
+^I^I^I^Iint c;$

ERROR: code indent should never use tabs
#40: FILE: hw/audio/fmopl.c:769:
+^I^I^I^Ifor(c=0;c<OPL->max_ch;c++)$

ERROR: spaces required around that '=' (ctx:VxV)
#40: FILE: hw/audio/fmopl.c:769:
+				for(c=0;c<OPL->max_ch;c++)
 				     ^

ERROR: space required after that ';' (ctx:VxV)
#40: FILE: hw/audio/fmopl.c:769:
+				for(c=0;c<OPL->max_ch;c++)
 				       ^

ERROR: spaces required around that '<' (ctx:VxV)
#40: FILE: hw/audio/fmopl.c:769:
+				for(c=0;c<OPL->max_ch;c++)
 				         ^

ERROR: space required after that ';' (ctx:VxV)
#40: FILE: hw/audio/fmopl.c:769:
+				for(c=0;c<OPL->max_ch;c++)
 				                     ^

ERROR: space required before the open parenthesis '('
#40: FILE: hw/audio/fmopl.c:769:
+				for(c=0;c<OPL->max_ch;c++)

ERROR: line over 90 characters
#49: FILE: hw/audio/fmopl.c:771:
+					OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];

ERROR: code indent should never use tabs
#49: FILE: hw/audio/fmopl.c:771:
+^I^I^I^I^IOPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];$

ERROR: line over 90 characters
#50: FILE: hw/audio/fmopl.c:772:
+					OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];

ERROR: code indent should never use tabs
#50: FILE: hw/audio/fmopl.c:772:
+^I^I^I^I^IOPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];$

total: 15 errors, 0 warnings, 73 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 14/26: audio: Remove unused fields...
Checking PATCH 15/26: audio: GUSbyte is uint8_t...
ERROR: line over 90 characters
#34: FILE: hw/audio/gusemu.h:44:
+ uint8_t *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */

ERROR: line over 90 characters
#35: FILE: hw/audio/gusemu.h:45:
+ uint8_t *gusdatapos; /* (gusdataend-gusdata) bytes used for storing emulated GF1/mixer register states (32*32+4 bytes in initial GUSemu32 version) */

WARNING: line over 80 characters
#123: FILE: hw/audio/gusemu_hal.c:241:
+                GUSregb(IRQ_2xB) = (uint8_t) data; /* control register select bit */

WARNING: line over 80 characters
#162: FILE: hw/audio/gusemu_hal.c:278:
+        if ((uint8_t) data == 0x8f) /* set irqstatreg, get voicereg and clear IRQ */

ERROR: line over 90 characters
#239: FILE: hw/audio/gusemu_hal.c:525:
+    GUSregb(GUS50DMAHigh)   = (uint8_t) ((count + GUSregb(GUS50DMAHigh)) & 0xf); /* ToDo: add 16bit GUS page limit? */

ERROR: space prohibited after that '&' (ctx:WxW)
#239: FILE: hw/audio/gusemu_hal.c:525:
+    GUSregb(GUS50DMAHigh)   = (uint8_t) ((count + GUSregb(GUS50DMAHigh)) & 0xf); /* ToDo: add 16bit GUS page limit? */
                                                                          ^

total: 4 errors, 2 warnings, 225 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 16/26: audio: remove GUSchar...
Checking PATCH 17/26: audio: GUSword is uint16_t...
Checking PATCH 18/26: audio: GUSword is uint16_t...
ERROR: spaces required around that '+' (ctx:VxV)
#18: FILE: hw/audio/gusemu_hal.c:34:
+#define GUSregw(position) (*(uint16_t *) (gusptr+(position)))
                                                 ^

ERROR: line over 90 characters
#55: FILE: hw/audio/gusemu_hal.c:356:
+                    GUSregw(offset) = (uint16_t) ((GUSregw(offset) & readmask) | writedata);

ERROR: line over 90 characters
#64: FILE: hw/audio/gusemu_hal.c:524:
+    GUSregw(GUS42DMAStart) += (uint16_t)  (count >> 4);                           /* ToDo: add 16bit GUS page limit? */

ERROR: spaces required around that '+' (ctx:VxV)
#77: FILE: hw/audio/gusemu_mixer.c:30:
+#define GUSregw(position)  (*(uint16_t *) (gusptr+(position)))
                                                  ^

ERROR: spaces required around that '+' (ctx:VxV)
#81: FILE: hw/audio/gusemu_mixer.c:33:
+#define GUSvoice(position) (*(uint16_t *)(voiceptr+(position)))
                                                   ^

total: 5 errors, 0 warnings, 78 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 19/26: audio: GUSsample is int16_t...
ERROR: line over 90 characters
#48: FILE: hw/audio/gusemu.h:79:
+void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, int16_t *bufferpos);

ERROR: spaces required around that '+' (ctx:VxV)
#61: FILE: hw/audio/gusemu_hal.c:35:
+#define GUSregd(position) (*(uint16_t *)(gusptr+(position)))
                                                ^

ERROR: spaces required around that '+' (ctx:VxV)
#74: FILE: hw/audio/gusemu_mixer.c:31:
+#define GUSregd(position)  (*(uint16_t *)(gusptr+(position)))
                                                 ^

ERROR: line over 90 characters
#91: FILE: hw/audio/gusemu_mixer.c:174:
+                *(bufferpos + 2 * sample)     += (int16_t) ((sample1 * PanningPos) >> 4);        /* right */

ERROR: line over 90 characters
#92: FILE: hw/audio/gusemu_mixer.c:175:
+                *(bufferpos + 2 * sample + 1) += (int16_t) ((sample1 * (15 - PanningPos)) >> 4); /* left */

total: 5 errors, 0 warnings, 65 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 20/26: audio: OPLSetIRQHandler is not used anywhere...
Checking PATCH 21/26: audio: OPLSetUpdateHandler is not used anywhere...
Checking PATCH 22/26: audio: IRQHandler is not used anymore...
Checking PATCH 23/26: audio: UpdateHandler is not used anymore...
Checking PATCH 24/26: audio: Remove unused typedefs...
Checking PATCH 25/26: audio: un-export OPLResetChip...
Checking PATCH 26/26: audio: Use ARRAY_SIZE from qemu/osdep.h...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 05/26] audio: Remove UINT8
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 05/26] audio: Remove UINT8 Juan Quintela
@ 2017-04-26  1:41   ` Philippe Mathieu-Daudé
  2017-04-26  7:22     ` Juan Quintela
  0 siblings, 1 reply; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-26  1:41 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

Hi Juan,

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> uint8_t has existed since ..... all this century?
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/audio/fmopl.c |  8 ++++----
>  hw/audio/fmopl.h | 39 ++++++++++++++++++++-------------------
>  2 files changed, 24 insertions(+), 23 deletions(-)
>
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index 282662a..3d14b45 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -789,8 +789,8 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
>  			}
>  			else
>  			{	/* set IRQ mask ,timer enable*/
> -				UINT8 st1 = v&1;
> -				UINT8 st2 = (v>>1)&1;
> +				uint8_t st1 = v&1;
> +				uint8_t st2 = (v>>1)&1;

Welcome to stdint! but since you're changing this code please make it 
more readable (at least spaces) so checkpatch don't reject your serie:

ERROR: spaces required around that '&'

>  				/* IRQRST,T1MSK,t2MSK,EOSMSK,BRMSK,x,ST2,ST1 */
>  				OPL_STATUS_RESET(OPL,v&0x78);
>  				OPL_STATUSMASK_SET(OPL,((~v)&0x78)|0x01);
> @@ -838,7 +838,7 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
>  		case 0xbd:
>  			/* amsep,vibdep,r,bd,sd,tom,tc,hh */
>  			{
> -			UINT8 rkey = OPL->rhythm^v;
> +			uint8_t rkey = OPL->rhythm^v;
>  			OPL->ams_table = &AMS_TABLE[v&0x80 ? AMS_ENT : 0];
>  			OPL->vib_table = &VIB_TABLE[v&0x40 ? VIB_ENT : 0];
>  			OPL->rhythm  = v&0x3f;
> @@ -991,7 +991,7 @@ void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length)
>  	OPLSAMPLE *buf = buffer;
>  	UINT32 amsCnt  = OPL->amsCnt;
>  	UINT32 vibCnt  = OPL->vibCnt;
> -	UINT8 rhythm = OPL->rhythm&0x20;
> +	uint8_t rhythm = OPL->rhythm&0x20;
>  	OPL_CH *CH,*R_CH;
>
>  	if( (void *)OPL != cur_chip ){
> diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
> index e476497..3df8942 100644
> --- a/hw/audio/fmopl.h
> +++ b/hw/audio/fmopl.h
> @@ -1,6 +1,8 @@
>  #ifndef FMOPL_H
>  #define FMOPL_H
>
> +#include <stdint.h>
> +
>  /* --- system optimize --- */
>  /* select bit size of output : 8 or 16 */
>  #define OPL_OUTPUT_BIT 16
> @@ -8,7 +10,6 @@
>  /* compiler dependence */
>  #ifndef OSD_CPU_H
>  #define OSD_CPU_H
> -typedef unsigned char	UINT8;   /* unsigned  8bit */
>  typedef unsigned short	UINT16;  /* unsigned 16bit */
>  typedef unsigned int	UINT32;  /* unsigned 32bit */
>  typedef signed char		INT8;    /* signed  8bit   */
> @@ -41,19 +42,19 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
>  typedef struct fm_opl_slot {
>  	INT32 TL;		/* total level     :TL << 8            */
>  	INT32 TLL;		/* adjusted now TL                     */
> -	UINT8  KSR;		/* key scale rate  :(shift down bit)   */
> +	uint8_t  KSR;		/* key scale rate  :(shift down bit)   */
>  	INT32 *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
>  	INT32 *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
>  	INT32 SL;		/* sustin level    :SL_TALBE[SL]       */
>  	INT32 *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
> -	UINT8 ksl;		/* keyscale level  :(shift down bits)  */
> -	UINT8 ksr;		/* key scale rate  :kcode>>KSR         */
> +	uint8_t ksl;		/* keyscale level  :(shift down bits)  */
> +	uint8_t ksr;		/* key scale rate  :kcode>>KSR         */
>  	UINT32 mul;		/* multiple        :ML_TABLE[ML]       */
>  	UINT32 Cnt;		/* frequency count :                   */
>  	UINT32 Incr;	/* frequency step  :                   */
>  	/* envelope generator state */
> -	UINT8 eg_typ;	/* envelope type flag                  */
> -	UINT8 evm;		/* envelope phase                      */
> +	uint8_t eg_typ;	/* envelope type flag                  */
> +	uint8_t evm;		/* envelope phase                      */
>  	INT32 evc;		/* envelope counter                    */
>  	INT32 eve;		/* envelope counter end point          */
>  	INT32 evs;		/* envelope counter step               */
> @@ -61,8 +62,8 @@ typedef struct fm_opl_slot {
>  	INT32 evsd;	/* envelope step for DR :DR[ksr]           */
>  	INT32 evsr;	/* envelope step for RR :RR[ksr]           */
>  	/* LFO */
> -	UINT8 ams;		/* ams flag                            */
> -	UINT8 vib;		/* vibrate flag                        */
> +	uint8_t ams;		/* ams flag                            */
> +	uint8_t vib;		/* vibrate flag                        */
>  	/* wave selector */
>  	INT32 **wavetable;
>  }OPL_SLOT;
> @@ -70,38 +71,38 @@ typedef struct fm_opl_slot {
>  /* ---------- OPL one of channel  ---------- */
>  typedef struct fm_opl_channel {
>  	OPL_SLOT SLOT[2];
> -	UINT8 CON;			/* connection type                     */
> -	UINT8 FB;			/* feed back       :(shift down bit)   */
> +	uint8_t CON;			/* connection type                     */
> +	uint8_t FB;			/* feed back       :(shift down bit)   */
>  	INT32 *connect1;	/* slot1 output pointer                */
>  	INT32 *connect2;	/* slot2 output pointer                */
>  	INT32 op1_out[2];	/* slot1 output for selfeedback        */
>  	/* phase generator state */
>  	UINT32  block_fnum;	/* block+fnum      :                   */
> -	UINT8 kcode;		/* key code        : KeyScaleCode      */
> +	uint8_t kcode;		/* key code        : KeyScaleCode      */
>  	UINT32  fc;			/* Freq. Increment base                */
>  	UINT32  ksl_base;	/* KeyScaleLevel Base step             */
> -	UINT8 keyon;		/* key on/off flag                     */
> +	uint8_t keyon;		/* key on/off flag                     */
>  } OPL_CH;
>
>  /* OPL state */
>  typedef struct fm_opl_f {
> -	UINT8 type;			/* chip type                         */
> +	uint8_t type;			/* chip type                         */
>  	int clock;			/* master clock  (Hz)                */
>  	int rate;			/* sampling rate (Hz)                */
>  	double freqbase;	/* frequency base                    */
>  	double TimerBase;	/* Timer base time (==sampling time) */
> -	UINT8 address;		/* address register                  */
> -	UINT8 status;		/* status flag                       */
> -	UINT8 statusmask;	/* status mask                       */
> +	uint8_t address;		/* address register                  */
> +	uint8_t status;		/* status flag                       */
> +	uint8_t statusmask;	/* status mask                       */
>  	UINT32 mode;		/* Reg.08 : CSM , notesel,etc.       */
>  	/* Timer */
>  	int T[2];			/* timer counter                     */
> -	UINT8 st[2];		/* timer enable                      */
> +	uint8_t st[2];		/* timer enable                      */
>  	/* FM channel slots */
>  	OPL_CH *P_CH;		/* pointer of CH                     */
>  	int	max_ch;			/* maximum channel                   */
>  	/* Rhythm sention */
> -	UINT8 rhythm;		/* Rhythm mode , key flag */
> +	uint8_t rhythm;		/* Rhythm mode , key flag */
>  	OPL_PORTHANDLER_R porthandler_r;
>  	OPL_PORTHANDLER_W porthandler_w;
>  	int port_param;
> @@ -120,7 +121,7 @@ typedef struct fm_opl_f {
>  	INT32 vibCnt;
>  	INT32 vibIncr;
>  	/* wave selector enable flag */
> -	UINT8 wavesel;
> +	uint8_t wavesel;
>  	/* external event callback handler */
>  	OPL_TIMERHANDLER  TimerHandler;		/* TIMER handler   */
>  	int TimerParam;						/* TIMER parameter */
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 10/26] audio: Remove INT32
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 10/26] audio: Remove INT32 Juan Quintela
@ 2017-04-26  1:43   ` Philippe Mathieu-Daudé
  2017-04-26  7:23     ` Juan Quintela
  0 siblings, 1 reply; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-26  1:43 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

Hi Juan, is there a benefit in not squashing the previous stdint commits?

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/audio/fmopl.c | 42 +++++++++++++++++++++---------------------
>  hw/audio/fmopl.h | 54 ++++++++++++++++++++++++------------------------------
>  2 files changed, 45 insertions(+), 51 deletions(-)
>
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index ebd3dbb..8f935f6 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -170,7 +170,7 @@ static const uint32_t KSL_TABLE[8*16]=
>  /* sustain lebel table (3db per step) */
>  /* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
>  #define SC(db) (db*((3/EG_STEP)*(1<<ENV_BITS)))+EG_DST
> -static const INT32 SL_TABLE[16]={
> +static const int32_t SL_TABLE[16]={
>   SC( 0),SC( 1),SC( 2),SC(3 ),SC(4 ),SC(5 ),SC(6 ),SC( 7),
>   SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)
>  };
> @@ -180,18 +180,18 @@ static const INT32 SL_TABLE[16]={
>  /* TotalLevel : 48 24 12  6  3 1.5 0.75 (dB) */
>  /* TL_TABLE[ 0      to TL_MAX          ] : plus  section */
>  /* TL_TABLE[ TL_MAX to TL_MAX+TL_MAX-1 ] : minus section */
> -static INT32 *TL_TABLE;
> +static int32_t *TL_TABLE;
>
>  /* pointers to TL_TABLE with sinwave output offset */
> -static INT32 **SIN_TABLE;
> +static int32_t **SIN_TABLE;
>
>  /* LFO table */
> -static INT32 *AMS_TABLE;
> -static INT32 *VIB_TABLE;
> +static int32_t *AMS_TABLE;
> +static int32_t *VIB_TABLE;
>
>  /* envelope output curve table */
>  /* attack + decay + OFF */
> -static INT32 ENV_CURVE[2*EG_ENT+1];
> +static int32_t ENV_CURVE[2*EG_ENT+1];
>
>  /* multiple table */
>  #define ML 2
> @@ -203,7 +203,7 @@ static const uint32_t MUL_TABLE[16]= {
>  #undef ML
>
>  /* dummy attack / decay rate ( when rate == 0 ) */
> -static INT32 RATE_0[16]=
> +static int32_t RATE_0[16]=
>  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
>
>  /* -------------------- static state --------------------- */
> @@ -219,14 +219,14 @@ static OPL_CH *S_CH;
>  static OPL_CH *E_CH;
>  static OPL_SLOT *SLOT7_1, *SLOT7_2, *SLOT8_1, *SLOT8_2;
>
> -static INT32 outd[1];
> -static INT32 ams;
> -static INT32 vib;
> -static INT32 *ams_table;
> -static INT32 *vib_table;
> -static INT32 amsIncr;
> -static INT32 vibIncr;
> -static INT32 feedback2;		/* connect for SLOT 2 */
> +static int32_t outd[1];
> +static int32_t ams;
> +static int32_t vib;
> +static int32_t *ams_table;
> +static int32_t *vib_table;
> +static int32_t amsIncr;
> +static int32_t vibIncr;
> +static int32_t feedback2;		/* connect for SLOT 2 */
>
>  /* log output level */
>  #define LOG_ERR  3      /* ERROR       */
> @@ -359,7 +359,7 @@ static inline uint32_t OPL_CALC_SLOT( OPL_SLOT *SLOT )
>  /* set algorithm connection */
>  static void set_algorithm( OPL_CH *CH)
>  {
> -	INT32 *carrier = &outd[0];
> +	int32_t *carrier = &outd[0];
>  	CH->connect1 = CH->CON ? carrier : &feedback2;
>  	CH->connect2 = carrier;
>  }
> @@ -498,7 +498,7 @@ static inline void OPL_CALC_RH( OPL_CH *CH )
>  {
>  	uint32_t env_tam,env_sd,env_top,env_hh;
>  	int whitenoise = (rand()&1)*(WHITE_NOISE_db/EG_STEP);
> -	INT32 tone8;
> +	int32_t tone8;
>
>  	OPL_SLOT *SLOT;
>  	int env_out;
> @@ -616,20 +616,20 @@ static int OPLOpenTable( void )
>  	double pom;
>
>  	/* allocate dynamic tables */
> -	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(INT32))) == NULL)
> +	if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
>  		return 0;
> -	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(INT32 *))) == NULL)
> +	if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)
>  	{
>  		free(TL_TABLE);
>  		return 0;
>  	}
> -	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(INT32))) == NULL)
> +	if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)
>  	{
>  		free(TL_TABLE);
>  		free(SIN_TABLE);
>  		return 0;
>  	}
> -	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(INT32))) == NULL)
> +	if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)
>  	{
>  		free(TL_TABLE);
>  		free(SIN_TABLE);
> diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
> index 0bc3415..1e74019 100644
> --- a/hw/audio/fmopl.h
> +++ b/hw/audio/fmopl.h
> @@ -7,12 +7,6 @@
>  /* select bit size of output : 8 or 16 */
>  #define OPL_OUTPUT_BIT 16
>
> -/* compiler dependence */
> -#ifndef OSD_CPU_H
> -#define OSD_CPU_H
> -typedef signed int		INT32;   /* signed 32bit   */
> -#endif
> -
>  #if (OPL_OUTPUT_BIT==16)
>  typedef int16_t OPLSAMPLE;
>  #endif
> @@ -36,13 +30,13 @@ typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
>  /* Saving is necessary for member of the 'R' mark for suspend/resume */
>  /* ---------- OPL one of slot  ---------- */
>  typedef struct fm_opl_slot {
> -	INT32 TL;		/* total level     :TL << 8            */
> -	INT32 TLL;		/* adjusted now TL                     */
> +	int32_t TL;		/* total level     :TL << 8            */
> +	int32_t TLL;		/* adjusted now TL                     */
>  	uint8_t  KSR;		/* key scale rate  :(shift down bit)   */
> -	INT32 *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
> -	INT32 *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
> -	INT32 SL;		/* sustin level    :SL_TALBE[SL]       */
> -	INT32 *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
> +	int32_t *AR;		/* attack rate     :&AR_TABLE[AR<<2]   */
> +	int32_t *DR;		/* decay rate      :&DR_TALBE[DR<<2]   */
> +	int32_t SL;		/* sustin level    :SL_TALBE[SL]       */
> +	int32_t *RR;		/* release rate    :&DR_TABLE[RR<<2]   */
>  	uint8_t ksl;		/* keyscale level  :(shift down bits)  */
>  	uint8_t ksr;		/* key scale rate  :kcode>>KSR         */
>  	uint32_t mul;		/* multiple        :ML_TABLE[ML]       */
> @@ -51,17 +45,17 @@ typedef struct fm_opl_slot {
>  	/* envelope generator state */
>  	uint8_t eg_typ;	/* envelope type flag                  */
>  	uint8_t evm;		/* envelope phase                      */
> -	INT32 evc;		/* envelope counter                    */
> -	INT32 eve;		/* envelope counter end point          */
> -	INT32 evs;		/* envelope counter step               */
> -	INT32 evsa;	/* envelope step for AR :AR[ksr]           */
> -	INT32 evsd;	/* envelope step for DR :DR[ksr]           */
> -	INT32 evsr;	/* envelope step for RR :RR[ksr]           */
> +	int32_t evc;		/* envelope counter                    */
> +	int32_t eve;		/* envelope counter end point          */
> +	int32_t evs;		/* envelope counter step               */
> +	int32_t evsa;	/* envelope step for AR :AR[ksr]           */
> +	int32_t evsd;	/* envelope step for DR :DR[ksr]           */
> +	int32_t evsr;	/* envelope step for RR :RR[ksr]           */
>  	/* LFO */
>  	uint8_t ams;		/* ams flag                            */
>  	uint8_t vib;		/* vibrate flag                        */
>  	/* wave selector */
> -	INT32 **wavetable;
> +	int32_t **wavetable;
>  }OPL_SLOT;
>
>  /* ---------- OPL one of channel  ---------- */
> @@ -69,9 +63,9 @@ typedef struct fm_opl_channel {
>  	OPL_SLOT SLOT[2];
>  	uint8_t CON;			/* connection type                     */
>  	uint8_t FB;			/* feed back       :(shift down bit)   */
> -	INT32 *connect1;	/* slot1 output pointer                */
> -	INT32 *connect2;	/* slot2 output pointer                */
> -	INT32 op1_out[2];	/* slot1 output for selfeedback        */
> +	int32_t *connect1;	/* slot1 output pointer                */
> +	int32_t *connect2;	/* slot2 output pointer                */
> +	int32_t op1_out[2];	/* slot1 output for selfeedback        */
>  	/* phase generator state */
>  	uint32_t  block_fnum;	/* block+fnum      :                   */
>  	uint8_t kcode;		/* key code        : KeyScaleCode      */
> @@ -106,16 +100,16 @@ typedef struct fm_opl_f {
>  	OPL_PORTHANDLER_W keyboardhandler_w;
>  	int keyboard_param;
>  	/* time tables */
> -	INT32 AR_TABLE[75];	/* atttack rate tables */
> -	INT32 DR_TABLE[75];	/* decay rate tables   */
> +	int32_t AR_TABLE[75];	/* atttack rate tables */
> +	int32_t DR_TABLE[75];	/* decay rate tables   */
>  	uint32_t FN_TABLE[1024];  /* fnumber -> increment counter */
>  	/* LFO */
> -	INT32 *ams_table;
> -	INT32 *vib_table;
> -	INT32 amsCnt;
> -	INT32 amsIncr;
> -	INT32 vibCnt;
> -	INT32 vibIncr;
> +	int32_t *ams_table;
> +	int32_t *vib_table;
> +	int32_t amsCnt;
> +	int32_t amsIncr;
> +	int32_t vibCnt;
> +	int32_t vibIncr;
>  	/* wave selector enable flag */
>  	uint8_t wavesel;
>  	/* external event callback handler */
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t Juan Quintela
@ 2017-04-26  1:47   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-26  1:47 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

Hi Juan,

Same here, why not squashing as "Use stdint instead of dead GUSEMU32"?

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/audio/gus.c          |  2 +-
>  hw/audio/gusemu.h       | 12 +-----------
>  hw/audio/gusemu_hal.c   |  2 +-
>  hw/audio/gusemu_mixer.c |  8 ++++----
>  4 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/hw/audio/gus.c b/hw/audio/gus.c
> index 3d08a65..ec103a4 100644
> --- a/hw/audio/gus.c
> +++ b/hw/audio/gus.c
> @@ -53,7 +53,7 @@ typedef struct GUSState {
>      uint32_t freq;
>      uint32_t port;
>      int pos, left, shift, irqs;
> -    GUSsample *mixbuf;
> +    int16_t *mixbuf;
>      uint8_t himem[1024 * 1024 + 32 + 4096];
>      int samples;
>      SWVoiceOut *voice;
> diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
> index 69dadef..ab591ee 100644
> --- a/hw/audio/gusemu.h
> +++ b/hw/audio/gusemu.h
> @@ -25,16 +25,6 @@
>  #ifndef GUSEMU_H
>  #define GUSEMU_H
>
> -/* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */
> -
> -#if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
> - typedef unsigned int GUSdword;
> - typedef signed short GUSsample;
> -#else
> - typedef uint32_t GUSdword;
> - typedef int16_t GUSsample;
> -#endif
> -
>  typedef struct _GUSEmuState
>  {
>   uint8_t *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */
> @@ -86,7 +76,7 @@ void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count
>  /* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */
>  /* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */
>
> -void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos);
> +void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, int16_t *bufferpos);
>  /* recommended range: 10 < numsamples < 100 */
>  /* lower values may result in increased rounding error, higher values often cause audible timing delays */
>
> diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c
> index 3dd7239..1150fc4 100644
> --- a/hw/audio/gusemu_hal.c
> +++ b/hw/audio/gusemu_hal.c
> @@ -32,7 +32,7 @@
>
>  #define GUSregb(position) (*            (gusptr+(position)))
>  #define GUSregw(position) (*(uint16_t *) (gusptr+(position)))
> -#define GUSregd(position) (*(GUSdword *)(gusptr+(position)))
> +#define GUSregd(position) (*(uint16_t *)(gusptr+(position)))
>
>  /* size given in bytes */
>  unsigned int gus_read(GUSEmuState * state, int port, int size)
> diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
> index 981a9ae..00b9861 100644
> --- a/hw/audio/gusemu_mixer.c
> +++ b/hw/audio/gusemu_mixer.c
> @@ -28,13 +28,13 @@
>
>  #define GUSregb(position)  (*            (gusptr+(position)))
>  #define GUSregw(position)  (*(uint16_t *) (gusptr+(position)))
> -#define GUSregd(position)  (*(GUSdword *)(gusptr+(position)))
> +#define GUSregd(position)  (*(uint16_t *)(gusptr+(position)))
>
>  #define GUSvoice(position) (*(uint16_t *)(voiceptr+(position)))
>
>  /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */
>  void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples,
> -                   GUSsample *bufferpos)
> +                   int16_t *bufferpos)
>  {
>      /* note that byte registers are stored in the upper half of each voice register! */
>      uint8_t        *gusptr;
> @@ -171,8 +171,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
>                  }
>
>                  /* mix samples into buffer */
> -                *(bufferpos + 2 * sample)     += (GUSsample) ((sample1 * PanningPos) >> 4);        /* right */
> -                *(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */
> +                *(bufferpos + 2 * sample)     += (int16_t) ((sample1 * PanningPos) >> 4);        /* right */
> +                *(bufferpos + 2 * sample + 1) += (int16_t) ((sample1 * (15 - PanningPos)) >> 4); /* left */
>              }
>              /* write back voice and volume */
>              GUSvoice(wVSRCurrVol)   = Volume32 / 32;
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip Juan Quintela
@ 2017-04-26  1:48   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-26  1:48 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  hw/audio/fmopl.c | 2 +-
>  hw/audio/fmopl.h | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index 99d09c5..dc9043c 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -1036,7 +1036,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16_t *buffer, int length)
>  }
>
>  /* ---------- reset one of chip ---------- */
> -void OPLResetChip(FM_OPL *OPL)
> +static void OPLResetChip(FM_OPL *OPL)
>  {
>  	int c,s;
>  	int i;
> diff --git a/hw/audio/fmopl.h b/hw/audio/fmopl.h
> index f89af08..fc9f16b 100644
> --- a/hw/audio/fmopl.h
> +++ b/hw/audio/fmopl.h
> @@ -95,7 +95,6 @@ FM_OPL *OPLCreate(int clock, int rate);
>  void OPLDestroy(FM_OPL *OPL);
>  void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
>
> -void OPLResetChip(FM_OPL *OPL);
>  int OPLWrite(FM_OPL *OPL,int a,int v);
>  unsigned char OPLRead(FM_OPL *OPL,int a);
>  int OPLTimerOver(FM_OPL *OPL,int c);
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h
  2017-04-25 22:37 ` [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h Juan Quintela
@ 2017-04-26  1:48   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 36+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-26  1:48 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  hw/audio/fmopl.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index dc9043c..202f752 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -34,15 +34,11 @@
>  #include <math.h>
>  //#include "driver.h"		/* use M.A.M.E. */
>  #include "fmopl.h"
> -
> +#include "qemu/osdep.h"
>  #ifndef PI
>  #define PI 3.14159265358979323846
>  #endif
>
> -#ifndef ARRAY_SIZE
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> -#endif
> -
>  /* -------------------- for debug --------------------- */
>  /* #define OPL_OUTPUT_LOG */
>  #ifdef OPL_OUTPUT_LOG
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 00/26] Audio Cleanup
  2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
                   ` (26 preceding siblings ...)
  2017-04-25 23:31 ` [Qemu-devel] [PATCH 00/26] Audio Cleanup no-reply
@ 2017-04-26  7:20 ` Juan Quintela
  27 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-26  7:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx, Gerd Hoffmann

Juan Quintela <quintela@redhat.com> wrote:
> Hi

Hi  Gerd

I forgot to CC'd you, sorry.

Later, Juan.

> This are an old series that were hidden on my harddisk.  To give you
> one idea, I had a patch to remove this:
>
> commit 8307c294a355bbf3c5352e00877365b0cda66d52
> Author: Nutan Shinde <nutanshinde1992@gmail.com>
> Date:   Wed Oct 7 22:02:54 2015 +0530
>
>     Remove macros IO_READ_PROTO and IO_WRITE_PROTO
>
> And somebody else removed it and got it upstream.
>
> There are just cleanups of removing unused code, or moving audio to
> c89 and int*_t types.
>
> Please, review and consider them.
>
> Later, Juan.
>
>
> Juan Quintela (26):
>   adlib: Remove support for YMF262
>   audio: remove Y8950 configuration
>   audio: Remove YM3526 support
>   audio: YM3812 was always defined
>   audio: Remove UINT8
>   audio: remove UINT16
>   audio: remove UINT32
>   audio: Remove INT8
>   audio: remove INT16
>   audio: Remove INT32
>   audio: Unfold OPLSAMPLE
>   audio: Remove Unused OPL_TYPE_*
>   audio: Remove type field
>   audio: Remove unused fields
>   audio: GUSbyte is uint8_t
>   audio: remove GUSchar
>   audio: GUSword is uint16_t
>   audio: GUSword is uint16_t
>   audio: GUSsample is int16_t
>   audio: OPLSetIRQHandler is not used anywhere
>   audio: OPLSetUpdateHandler is not used anywhere
>   audio: IRQHandler is not used anymore
>   audio: UpdateHandler is not used anymore
>   audio: Remove unused typedefs
>   audio: un-export OPLResetChip
>   audio: Use ARRAY_SIZE from qemu/osdep.h
>
>  hw/audio/Makefile.objs  |   2 -
>  hw/audio/adlib.c        |  47 +-------
>  hw/audio/fmopl.c        | 277 ++++++++----------------------------------------
>  hw/audio/fmopl.h        | 175 +++++++++---------------------
>  hw/audio/gus.c          |   2 +-
>  hw/audio/gusemu.h       |  22 +---
>  hw/audio/gusemu_hal.c   |  74 ++++++-------
>  hw/audio/gusemu_mixer.c |  28 ++---
>  8 files changed, 153 insertions(+), 474 deletions(-)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 05/26] audio: Remove UINT8
  2017-04-26  1:41   ` Philippe Mathieu-Daudé
@ 2017-04-26  7:22     ` Juan Quintela
  0 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-26  7:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, lvivier, dgilbert, peterx

Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Juan,
>
> On 04/25/2017 07:37 PM, Juan Quintela wrote:
>> uint8_t has existed since ..... all this century?
>>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  hw/audio/fmopl.c |  8 ++++----
>>  hw/audio/fmopl.h | 39 ++++++++++++++++++++-------------------
>>  2 files changed, 24 insertions(+), 23 deletions(-)
>>
>> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
>> index 282662a..3d14b45 100644
>> --- a/hw/audio/fmopl.c
>> +++ b/hw/audio/fmopl.c
>> @@ -789,8 +789,8 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
>>  			}
>>  			else
>>  			{	/* set IRQ mask ,timer enable*/
>> -				UINT8 st1 = v&1;
>> -				UINT8 st2 = (v>>1)&1;
>> +				uint8_t st1 = v&1;
>> +				uint8_t st2 = (v>>1)&1;
>
> Welcome to stdint! but since you're changing this code please make it
> more readable (at least spaces) so checkpatch don't reject your serie:
>
> ERROR: spaces required around that '&'

checkpatch reject because there are no spaces and there are tabs all
around.  I think that the only sane solution is to run indent on the
whole file, or maintain the "old" format.

Gerd, any prefferences?

Later, Juan.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [Qemu-devel] [PATCH 10/26] audio: Remove INT32
  2017-04-26  1:43   ` Philippe Mathieu-Daudé
@ 2017-04-26  7:23     ` Juan Quintela
  0 siblings, 0 replies; 36+ messages in thread
From: Juan Quintela @ 2017-04-26  7:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, lvivier, dgilbert, peterx

Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Juan, is there a benefit in not squashing the previous stdint commits?

Easier to commit/review/rebase.

I can do if you preffer.

Later, Juan.

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2017-04-26  7:23 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 02/26] audio: remove Y8950 configuration Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 03/26] audio: Remove YM3526 support Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 04/26] audio: YM3812 was always defined Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 05/26] audio: Remove UINT8 Juan Quintela
2017-04-26  1:41   ` Philippe Mathieu-Daudé
2017-04-26  7:22     ` Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 06/26] audio: remove UINT16 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 07/26] audio: remove UINT32 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 08/26] audio: Remove INT8 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 09/26] audio: remove INT16 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 10/26] audio: Remove INT32 Juan Quintela
2017-04-26  1:43   ` Philippe Mathieu-Daudé
2017-04-26  7:23     ` Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 11/26] audio: Unfold OPLSAMPLE Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 12/26] audio: Remove Unused OPL_TYPE_* Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 13/26] audio: Remove type field Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 14/26] audio: Remove unused fields Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 15/26] audio: GUSbyte is uint8_t Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 16/26] audio: remove GUSchar Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 17/26] audio: GUSword is uint16_t Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 18/26] " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t Juan Quintela
2017-04-26  1:47   ` Philippe Mathieu-Daudé
2017-04-25 22:37 ` [Qemu-devel] [PATCH 20/26] audio: OPLSetIRQHandler is not used anywhere Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 21/26] audio: OPLSetUpdateHandler " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 22/26] audio: IRQHandler is not used anymore Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 23/26] audio: UpdateHandler " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 24/26] audio: Remove unused typedefs Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip Juan Quintela
2017-04-26  1:48   ` Philippe Mathieu-Daudé
2017-04-25 22:37 ` [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h Juan Quintela
2017-04-26  1:48   ` Philippe Mathieu-Daudé
2017-04-25 23:31 ` [Qemu-devel] [PATCH 00/26] Audio Cleanup no-reply
2017-04-26  7:20 ` Juan Quintela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.