replace a line erroneously removed in 1.28, should fix xmms

make buf_clear handle unaligned lengths
This commit is contained in:
Cameron Grant 2000-06-17 19:29:40 +00:00
parent 7ebe1c3acf
commit fa5e422d98
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61753

View file

@ -35,6 +35,7 @@
#define ISA_DMA(b) (((b)->chan >= 0 && (b)->chan != 4 && (b)->chan < 8))
#define CANCHANGE(c) (!(c)->buffer.dl)
#define ROUND(x) ((x) & DMA_ALIGN_MASK)
/*
#define DEB(x) x
*/
@ -828,8 +829,6 @@ buf_clear(snd_dbuf *b, u_int32_t fmt, int length)
int i;
u_int16_t data, *p;
/* rely on length & DMA_ALIGN_MASK == 0 */
length &= DMA_ALIGN_MASK;
if (length == 0)
return;
@ -848,7 +847,7 @@ buf_clear(snd_dbuf *b, u_int32_t fmt, int length)
i = b->fp;
p = (u_int16_t *)(b->buf + b->fp);
while (length > 0) {
while (length > 1) {
*p++ = data;
length -= 2;
i += 2;
@ -857,6 +856,8 @@ buf_clear(snd_dbuf *b, u_int32_t fmt, int length)
i = 0;
}
}
if (length == 1)
*(b->buf + i) = data & 0xff;
}
void
@ -1220,6 +1221,7 @@ chn_setblocksize(pcm_channel *c, int blkcnt, int blksz)
buf_clear(bs, bs->fmt, bs->bufsize);
bs->blkcnt = blkcnt;
bs->blksz = blksz;
RANGE(blksz, 16, b->bufsize / 2);
b->blksz = c->setblocksize(c->devinfo, blksz);
splx(s);