Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@lists.sourceforge.net
Subject: int typedefs in wavefront
Date: Thu, 14 Feb 2002 12:34:55 +0100	[thread overview]
Message-ID: <s5hlmdw47q8.wl@alsa2.suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

Hi,

looks like the acpi patch conflicts with the definitions of UINT* in
wavefront codes.

Paul, could you check the attached patch?  if it's ok for you, i'll
commit it to cvs.


Takashi

[-- Attachment #2: wavefront-acpi-fix.dif --]
[-- Type: application/octet-stream, Size: 12700 bytes --]

Index: alsa-kernel/include/wavefront.h
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/wavefront.h,v
retrieving revision 1.2
diff -u -r1.2 wavefront.h
--- alsa-kernel/include/wavefront.h	4 Jan 2002 15:44:15 -0000	1.2
+++ alsa-kernel/include/wavefront.h	14 Feb 2002 11:24:22 -0000
@@ -64,12 +64,21 @@
    between a 16-bit view of the world and a 32-bit one. 
  */   
 
-typedef short INT16;
-typedef unsigned short UINT16;
-typedef int INT32;
-typedef unsigned int UINT32;
-typedef char CHAR8;
-typedef unsigned char UCHAR8;
+#ifndef __KERNEL__
+/* keep them for compatibility */
+typedef short s16;
+typedef unsigned short u16;
+typedef int s32;
+typedef unsigned int u32;
+typedef char s8;
+typedef unsigned char u8;
+typedef s16 INT16;
+typedef u16 UINT16;
+typedef s32 INT32;
+typedef u32 UINT32;
+typedef s8 CHAR8;
+typedef u8 UCHAR8;
+#endif
 
 /* Pseudo-commands not part of the WaveFront command set.
    These are used for various driver controls and direct
@@ -197,111 +206,111 @@
 
 struct wf_envelope
 {
-    UCHAR8 attack_time:7;
-    UCHAR8 Unused1:1;
+    u8 attack_time:7;
+    u8 Unused1:1;
 
-    UCHAR8 decay1_time:7;
-    UCHAR8 Unused2:1;
+    u8 decay1_time:7;
+    u8 Unused2:1;
 
-    UCHAR8 decay2_time:7;
-    UCHAR8 Unused3:1;
+    u8 decay2_time:7;
+    u8 Unused3:1;
 
-    UCHAR8 sustain_time:7;
-    UCHAR8 Unused4:1;
+    u8 sustain_time:7;
+    u8 Unused4:1;
 
-    UCHAR8 release_time:7;
-    UCHAR8 Unused5:1;
+    u8 release_time:7;
+    u8 Unused5:1;
 
-    UCHAR8 release2_time:7;
-    UCHAR8 Unused6:1;
+    u8 release2_time:7;
+    u8 Unused6:1;
 
-    CHAR8 attack_level;
-    CHAR8 decay1_level;
-    CHAR8 decay2_level;
-    CHAR8 sustain_level;
-    CHAR8 release_level;
+    s8 attack_level;
+    s8 decay1_level;
+    s8 decay2_level;
+    s8 sustain_level;
+    s8 release_level;
 
-    UCHAR8 attack_velocity:7;
-    UCHAR8 Unused7:1;
+    u8 attack_velocity:7;
+    u8 Unused7:1;
 
-    UCHAR8 volume_velocity:7;
-    UCHAR8 Unused8:1;
+    u8 volume_velocity:7;
+    u8 Unused8:1;
 
-    UCHAR8 keyboard_scaling:7;
-    UCHAR8 Unused9:1;
+    u8 keyboard_scaling:7;
+    u8 Unused9:1;
 };
 typedef struct wf_envelope wavefront_envelope;
 
 struct wf_lfo
 {
-    UCHAR8 sample_number;
+    u8 sample_number;
 
-    UCHAR8 frequency:7;
-    UCHAR8 Unused1:1;
+    u8 frequency:7;
+    u8 Unused1:1;
 
-    UCHAR8 am_src:4;
-    UCHAR8 fm_src:4;
+    u8 am_src:4;
+    u8 fm_src:4;
 
-    CHAR8 fm_amount;
-    CHAR8 am_amount;
-    CHAR8 start_level;
-    CHAR8 end_level;
+    s8 fm_amount;
+    s8 am_amount;
+    s8 start_level;
+    s8 end_level;
 
-    UCHAR8 ramp_delay:7;
-    UCHAR8 wave_restart:1; /* for LFO2 only */
+    u8 ramp_delay:7;
+    u8 wave_restart:1; /* for LFO2 only */
 
-    UCHAR8 ramp_time:7;
-    UCHAR8 Unused2:1;
+    u8 ramp_time:7;
+    u8 Unused2:1;
 };
 typedef struct wf_lfo wavefront_lfo;
 
 struct wf_patch
 {
-    INT16  frequency_bias;         /*  ** THIS IS IN MOTOROLA FORMAT!! ** */
+    s16  frequency_bias;         /*  ** THIS IS IN MOTOROLA FORMAT!! ** */
 
-    UCHAR8 amplitude_bias:7;
-    UCHAR8 Unused1:1;
+    u8 amplitude_bias:7;
+    u8 Unused1:1;
 
-    UCHAR8 portamento:7;
-    UCHAR8 Unused2:1;
+    u8 portamento:7;
+    u8 Unused2:1;
 
-    UCHAR8 sample_number;
+    u8 sample_number;
 
-    UCHAR8 pitch_bend:4;
-    UCHAR8 sample_msb:1;
-    UCHAR8 Unused3:3;
+    u8 pitch_bend:4;
+    u8 sample_msb:1;
+    u8 Unused3:3;
 
-    UCHAR8 mono:1;
-    UCHAR8 retrigger:1;
-    UCHAR8 nohold:1;
-    UCHAR8 restart:1;
-    UCHAR8 filterconfig:2; /* SDK says "not used" */
-    UCHAR8 reuse:1;
-    UCHAR8 reset_lfo:1;    
+    u8 mono:1;
+    u8 retrigger:1;
+    u8 nohold:1;
+    u8 restart:1;
+    u8 filterconfig:2; /* SDK says "not used" */
+    u8 reuse:1;
+    u8 reset_lfo:1;    
 
-    UCHAR8 fm_src2:4;
-    UCHAR8 fm_src1:4;   
+    u8 fm_src2:4;
+    u8 fm_src1:4;   
 
-    CHAR8 fm_amount1;
-    CHAR8 fm_amount2;
+    s8 fm_amount1;
+    s8 fm_amount2;
 
-    UCHAR8 am_src:4;
-    UCHAR8 Unused4:4;
+    u8 am_src:4;
+    u8 Unused4:4;
 
-    CHAR8 am_amount;
+    s8 am_amount;
 
-    UCHAR8 fc1_mode:4;
-    UCHAR8 fc2_mode:4;
+    u8 fc1_mode:4;
+    u8 fc2_mode:4;
 
-    CHAR8 fc1_mod_amount;
-    CHAR8 fc1_keyboard_scaling;
-    CHAR8 fc1_bias;
-    CHAR8 fc2_mod_amount;
-    CHAR8 fc2_keyboard_scaling;
-    CHAR8 fc2_bias;
+    s8 fc1_mod_amount;
+    s8 fc1_keyboard_scaling;
+    s8 fc1_bias;
+    s8 fc2_mod_amount;
+    s8 fc2_keyboard_scaling;
+    s8 fc2_bias;
 
-    UCHAR8 randomizer:7;
-    UCHAR8 Unused5:1;
+    u8 randomizer:7;
+    u8 Unused5:1;
 
     struct wf_envelope envelope1;
     struct wf_envelope envelope2;
@@ -312,18 +321,18 @@
 
 struct wf_layer
 {
-    UCHAR8 patch_number;
+    u8 patch_number;
 
-    UCHAR8 mix_level:7;
-    UCHAR8 mute:1;
+    u8 mix_level:7;
+    u8 mute:1;
 
-    UCHAR8 split_point:7;
-    UCHAR8 play_below:1;
+    u8 split_point:7;
+    u8 play_below:1;
 
-    UCHAR8 pan_mod_src:2;
-    UCHAR8 pan_or_mod:1;
-    UCHAR8 pan:4;
-    UCHAR8 split_type:1;
+    u8 pan_mod_src:2;
+    u8 pan_or_mod:1;
+    u8 pan:4;
+    u8 split_type:1;
 };
 typedef struct wf_layer wavefront_layer;
 
@@ -335,9 +344,9 @@
 
 struct wf_sample_offset
 {
-    INT32 Fraction:4;
-    INT32 Integer:20;
-    INT32 Unused:8;
+    s32 Fraction:4;
+    s32 Integer:20;
+    s32 Unused:8;
 };
 typedef struct wf_sample_offset wavefront_sample_offset;          
      
@@ -429,38 +438,38 @@
     struct wf_sample_offset loopStartOffset;
     struct wf_sample_offset loopEndOffset;
     struct wf_sample_offset sampleEndOffset;
-    INT16 FrequencyBias;
-    UCHAR8 SampleResolution:2;  /* sample_format */
-    UCHAR8 Unused1:1;
-    UCHAR8 Loop:1;
-    UCHAR8 Bidirectional:1;
-    UCHAR8 Unused2:1;
-    UCHAR8 Reverse:1;
-    UCHAR8 Unused3:1;
+    s16 FrequencyBias;
+    u8 SampleResolution:2;  /* sample_format */
+    u8 Unused1:1;
+    u8 Loop:1;
+    u8 Bidirectional:1;
+    u8 Unused2:1;
+    u8 Reverse:1;
+    u8 Unused3:1;
 } wavefront_sample;
 
 typedef struct wf_multisample {
-    INT16 NumberOfSamples;   /* log2 of the number of samples */
-    INT16 SampleNumber[NUM_MIDIKEYS];
+    s16 NumberOfSamples;   /* log2 of the number of samples */
+    s16 SampleNumber[NUM_MIDIKEYS];
 } wavefront_multisample;
 
 typedef struct wf_alias {
-    INT16 OriginalSample __attribute__ ((packed));
+    s16 OriginalSample __attribute__ ((packed));
 
     struct wf_sample_offset sampleStartOffset __attribute__ ((packed));
     struct wf_sample_offset loopStartOffset __attribute__ ((packed));
     struct wf_sample_offset sampleEndOffset __attribute__ ((packed));
     struct wf_sample_offset loopEndOffset __attribute__ ((packed));
 
-    INT16  FrequencyBias __attribute__ ((packed));
+    s16  FrequencyBias __attribute__ ((packed));
 
-    UCHAR8 SampleResolution:2  __attribute__ ((packed));
-    UCHAR8 Unused1:1  __attribute__ ((packed));
-    UCHAR8 Loop:1 __attribute__ ((packed));
-    UCHAR8 Bidirectional:1  __attribute__ ((packed));
-    UCHAR8 Unused2:1 __attribute__ ((packed));
-    UCHAR8 Reverse:1 __attribute__ ((packed));
-    UCHAR8 Unused3:1 __attribute__ ((packed)); 
+    u8 SampleResolution:2  __attribute__ ((packed));
+    u8 Unused1:1  __attribute__ ((packed));
+    u8 Loop:1 __attribute__ ((packed));
+    u8 Bidirectional:1  __attribute__ ((packed));
+    u8 Unused2:1 __attribute__ ((packed));
+    u8 Reverse:1 __attribute__ ((packed));
+    u8 Unused3:1 __attribute__ ((packed)); 
     
     /* This structure is meant to be padded only to 16 bits on their
        original. Of course, whoever wrote their documentation didn't
@@ -471,19 +480,19 @@
        standard 16->32 bit issues.
     */
 
-    UCHAR8 sixteen_bit_padding __attribute__ ((packed));
+    u8 sixteen_bit_padding __attribute__ ((packed));
 } wavefront_alias;
 
 typedef struct wf_drum {
-    UCHAR8 PatchNumber;
-    UCHAR8 MixLevel:7;
-    UCHAR8 Unmute:1;
-    UCHAR8 Group:4;
-    UCHAR8 Unused1:4;
-    UCHAR8 PanModSource:2;
-    UCHAR8 PanModulated:1;
-    UCHAR8 PanAmount:4;
-    UCHAR8 Unused2:1;
+    u8 PatchNumber;
+    u8 MixLevel:7;
+    u8 Unmute:1;
+    u8 Group:4;
+    u8 Unused1:4;
+    u8 PanModSource:2;
+    u8 PanModulated:1;
+    u8 PanAmount:4;
+    u8 Unused2:1;
 } wavefront_drum;
 
 typedef struct wf_drumkit {
@@ -491,7 +500,7 @@
 } wavefront_drumkit;
 
 typedef struct wf_channel_programs {
-    UCHAR8 Program[NUM_MIDICHANNELS];
+    u8 Program[NUM_MIDICHANNELS];
 } wavefront_channel_programs;
 
 /* How to get MIDI channel status from the data returned by
@@ -522,15 +531,15 @@
        only, and are unused by the current user-level library.
     */
 
-    INT16   key;               /* Use WAVEFRONT_PATCH here */
-    UINT16  devno;             /* fill in when sending */
-    UCHAR8  subkey;            /* WF_ST_{SAMPLE,ALIAS,etc.} */
+    s16   key;               /* Use WAVEFRONT_PATCH here */
+    u16  devno;             /* fill in when sending */
+    u8  subkey;            /* WF_ST_{SAMPLE,ALIAS,etc.} */
 
 #define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999
 
-    UINT16  number;            /* patch/sample/prog number */
+    u16  number;            /* patch/sample/prog number */
 
-    UINT32  size;              /* size of any data included in 
+    u32  size;              /* size of any data included in 
 				  one of the fields in `hdrptr', or
 				  as `dataptr'.
 
@@ -546,7 +555,7 @@
 
 			       */
     wavefront_any *hdrptr;      /* user-space ptr to hdr bytes */
-    UINT16 *dataptr;            /* actual sample data */
+    u16 *dataptr;            /* actual sample data */
 
     wavefront_any hdr;          /* kernel-space copy of hdr bytes */         
 } wavefront_patch_info;
Index: alsa-kernel/isa/wavefront/wavefront_synth.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/isa/wavefront/wavefront_synth.c,v
retrieving revision 1.3
diff -u -r1.3 wavefront_synth.c
--- alsa-kernel/isa/wavefront/wavefront_synth.c	13 Feb 2002 11:00:58 -0000	1.3
+++ alsa-kernel/isa/wavefront/wavefront_synth.c	14 Feb 2002 11:26:40 -0000
@@ -905,7 +905,7 @@
 static int
 wavefront_send_sample (snd_wavefront_t *dev, 
 		       wavefront_patch_info *header,
-		       UINT16 *dataptr,
+		       u16 *dataptr,
 		       int data_is_unsigned)
 
 {
@@ -918,9 +918,9 @@
 	   divided by 2.
         */
 
-	UINT16 sample_short;
-	UINT32 length;
-	UINT16 *data_end = 0;
+	u16 sample_short;
+	u32 length;
+	u16 *data_end = 0;
 	unsigned int i;
 	const int max_blksize = 4096/2;
 	unsigned int written;
@@ -1070,13 +1070,13 @@
 	   but the offset only uses 24 bits.
 	*/
 
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleStartOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleStartOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopStartOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.loopStartOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopEndOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.loopEndOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleEndOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleEndOffset),
 			     shptr, 4);
 	
 	/* This one is truly wierd. What kind of wierdo decided that in
@@ -1482,11 +1482,11 @@
 ***********************************************************************/
 
 static void
-process_sample_hdr (UCHAR8 *buf)
+process_sample_hdr (u8 *buf)
 
 {
 	wavefront_sample s;
-	UCHAR8 *ptr;
+	u8 *ptr;
 
 	ptr = buf;
 
@@ -1497,11 +1497,11 @@
 	   something very similar in the reverse direction.
 	*/
 
-	*((UINT32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
+	*((u32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
 
 	s.SampleResolution = *ptr & 0x3;
 	s.Loop = *ptr & 0x8;
@@ -1568,7 +1568,7 @@
 		return 0;
 
 	case WFC_UPLOAD_PATCH:
-		munge_int32 (*((UINT32 *) wc->wbuf), patchnumbuf, 2);
+		munge_int32 (*((u32 *) wc->wbuf), patchnumbuf, 2);
 		memcpy (wc->wbuf, patchnumbuf, 2);
 		break;
 

                 reply	other threads:[~2002-02-14 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hlmdw47q8.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox