Page MenuHomeFreeBSD

D52509.id161973.diff
No OneTemporary

D52509.id161973.diff

Index: sys/dev/sound/pcm/dsp.c
===================================================================
--- sys/dev/sound/pcm/dsp.c
+++ sys/dev/sound/pcm/dsp.c
@@ -672,6 +672,51 @@
return (0);
}
+#ifdef COMPAT_FREEBSD32
+
+typedef struct _snd_chan_param32 {
+ u_int32_t play_rate; /* sampling rate */
+ u_int32_t rec_rate; /* sampling rate */
+ u_int32_t play_format; /* everything describing the format */
+ u_int32_t rec_format; /* everything describing the format */
+} snd_chan_param32;
+#define AIOGFMT32 _IOR('f', 12, snd_chan_param32) /* get format */
+#define AIOSFMT32 _IOWR('f', 12, snd_chan_param32) /* sets format */
+
+typedef struct _snd_sync_parm32 {
+ int32_t chan ; /* play or capture channel, plus modifier */
+ int32_t pos;
+} snd_sync_parm32;
+#define AIOSYNC32 _IOWR ('A', 15, snd_sync_parm32) /* misc. synchronization */
+
+typedef struct _snd_capabilities32 {
+ u_int32_t rate_min, rate_max; /* min-max sampling rate */
+ u_int32_t formats;
+ u_int32_t bufsize; /* DMA buffer size */
+ u_int32_t mixers; /* bitmap of available mixers */
+ u_int32_t inputs; /* bitmap of available inputs (per mixer) */
+ u_short left, right; /* how many levels are supported */
+} snd_capabilities32;
+#define AIOGCAP32 _IOWR('A', 15, snd_capabilities32) /* get capabilities */
+
+typedef struct audio_errinfo32
+{
+ int play_underruns;
+ int rec_overruns;
+ unsigned int play_ptradjust;
+ unsigned int rec_ptradjust;
+ int play_errorcount;
+ int rec_errorcount;
+ int play_lasterror;
+ int rec_lasterror;
+ int32_t play_errorparm;
+ int32_t rec_errorparm;
+ int filler[16];
+} audio_errinfo32;
+#define SNDCTL_DSP_GETERROR32 _IOR ('P', 25, audio_errinfo32)
+
+#endif
+
static int
dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
struct thread *td)
@@ -830,9 +875,24 @@
case AIOSFMT:
case AIOGFMT:
+#ifdef COMPAT_FREEBSD32
+ case AIOSFMT32:
+ case AIOGFMT32:
+#endif
{
snd_chan_param *p = (snd_chan_param *)arg;
-
+#ifdef COMPAT_FREEBSD32
+ snd_chan_param32 *p32 = (snd_chan_param32 *)arg;
+ snd_chan_param param;
+
+ if (cmd == AIOSFMT32 || cmd == AIOGFMT32) {
+ p = &param;
+ p->play_rate = p32->play_rate;
+ p->rec_rate = p32->rec_rate;
+ p->play_format = p32->play_format;
+ p->rec_format = p32->rec_format;
+ }
+#endif
if (cmd == AIOSFMT &&
((p->play_format != 0 && p->play_rate == 0) ||
(p->rec_format != 0 && p->rec_rate == 0))) {
@@ -873,15 +933,33 @@
p->rec_format = 0;
}
PCM_RELEASE_QUICK(d);
+#ifdef COMPAT_FREEBSD32
+ if (cmd == AIOSFMT32 || cmd == AIOGFMT32) {
+ p32->play_rate = p->play_rate;
+ p32->rec_rate = p->rec_rate;
+ p32->play_format = p->play_format;
+ p32->rec_format = p->rec_format;
+ }
+#endif
}
break;
case AIOGCAP: /* get capabilities */
+#ifdef COMPAT_FREEBSD32
+ case AIOGCAP32:
+#endif
{
snd_capabilities *p = (snd_capabilities *)arg;
struct pcmchan_caps *pcaps = NULL, *rcaps = NULL;
struct cdev *pdev;
+#ifdef COMPAT_FREEBSD32
+ snd_capabilities32 *p32 = (snd_capabilities32 *)arg;
+ snd_capabilities capabilities;
+ if (cmd == AIOGCAP32) {
+ p = &capabilities;
+ }
+#endif
PCM_LOCK(d);
if (rdch) {
CHN_LOCK(rdch);
@@ -914,6 +992,18 @@
if (rdch)
CHN_UNLOCK(rdch);
PCM_UNLOCK(d);
+#ifdef COMPAT_FREEBSD32
+ if (cmd == AIOGCAP32) {
+ p32->rate_min = p->rate_min;
+ p32->rate_max = p->rate_max;
+ p32->formats = p->formats;
+ p32->bufsize = p->bufsize;
+ p32->mixers = p->mixers;
+ p32->inputs = p->inputs;
+ p32->left = p->left;
+ p32->right = p->right;
+ }
+#endif
}
break;
@@ -933,6 +1023,9 @@
break;
case AIOSYNC:
+#ifdef COMPAT_FREEBSD32
+ case AIOSYNC32:
+#endif
printf("AIOSYNC chan 0x%03lx pos %lu unimplemented\n",
((snd_sync_parm *)arg)->chan, ((snd_sync_parm *)arg)->pos);
break;
@@ -1636,6 +1729,9 @@
break;
case SNDCTL_DSP_GETERROR:
+#ifdef COMPAT_FREEBSD32
+ case SNDCTL_DSP_GETERROR32:
+#endif
/*
* OSSv4 docs: "All errors and counters will automatically be
* cleared to zeroes after the call so each call will return only
@@ -1645,6 +1741,14 @@
*/
{
audio_errinfo *ei = (audio_errinfo *)arg;
+#ifdef COMPAT_FREEBSD32
+ audio_errinfo errinfo;
+ audio_errinfo32 *ei32 = (audio_errinfo32 *)arg;
+
+ if (cmd == SNDCTL_DSP_GETERROR32) {
+ ei = &errinfo;
+ }
+#endif
bzero((void *)ei, sizeof(*ei));
@@ -1660,6 +1764,13 @@
rdch->xruns = 0;
CHN_UNLOCK(rdch);
}
+#ifdef COMPAT_FREEBSD32
+ if (cmd == SNDCTL_DSP_GETERROR32) {
+ *ei32 = *(audio_errinfo32 *)ei;
+ ei32->play_errorparm = ei->play_errorparm;
+ ei32->rec_errorparm = ei->rec_errorparm;
+ }
+#endif
}
break;

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 5:30 AM (6 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28543150
Default Alt Text
D52509.id161973.diff (4 KB)

Event Timeline