[BACK]Return to uaudio.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / usb

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/usb/uaudio.c between version 1.61 and 1.62

version 1.61, 2002/10/06 10:01:08 version 1.62, 2002/12/02 02:36:14
Line 145  struct chan {
Line 145  struct chan {
                 usbd_xfer_handle xfer;                  usbd_xfer_handle xfer;
                 u_char          *buffer;                  u_char          *buffer;
                 u_int16_t       sizes[UAUDIO_NFRAMES];                  u_int16_t       sizes[UAUDIO_NFRAMES];
                   u_int16_t       offsets[UAUDIO_NFRAMES];
                 u_int16_t       size;                  u_int16_t       size;
         } chanbufs[UAUDIO_NCHANBUFS];          } chanbufs[UAUDIO_NCHANBUFS];
   
Line 2076  uaudio_chan_rtransfer(struct chan *ch)
Line 2077  uaudio_chan_rtransfer(struct chan *ch)
                         residue -= USB_FRAMES_PER_SECOND;                          residue -= USB_FRAMES_PER_SECOND;
                 }                  }
                 cb->sizes[i] = size;                  cb->sizes[i] = size;
                   cb->offsets[i] = total;
                 total += size;                  total += size;
         }          }
         ch->residue = residue;          ch->residue = residue;
Line 2107  uaudio_chan_rintr(usbd_xfer_handle xfer,
Line 2109  uaudio_chan_rintr(usbd_xfer_handle xfer,
         struct chanbuf *cb = priv;          struct chanbuf *cb = priv;
         struct chan *ch = cb->chan;          struct chan *ch = cb->chan;
         u_int32_t count;          u_int32_t count;
         int s, n;          int s, i, n, frsize;
   
         /* Return if we are aborting. */          /* Return if we are aborting. */
         if (status == USBD_CANCELLED)          if (status == USBD_CANCELLED)
Line 2117  uaudio_chan_rintr(usbd_xfer_handle xfer,
Line 2119  uaudio_chan_rintr(usbd_xfer_handle xfer,
         DPRINTFN(5,("uaudio_chan_rintr: count=%d, transferred=%d\n",          DPRINTFN(5,("uaudio_chan_rintr: count=%d, transferred=%d\n",
                     count, ch->transferred));                      count, ch->transferred));
   
         if (count < cb->size) {          /* count < cb->size is normal for asynchronous source */
                 /* if the device fails to keep up, copy last byte */  
                 u_char b = count ? cb->buffer[count-1] : 0;  
                 while (count < cb->size)  
                         cb->buffer[count++] = b;  
         }  
   
 #ifdef DIAGNOSTIC  #ifdef DIAGNOSTIC
         if (count != cb->size) {          if (count > cb->size) {
                 printf("uaudio_chan_rintr: count(%d) != size(%d)\n",                  printf("uaudio_chan_rintr: count(%d) > size(%d)\n",
                        count, cb->size);                         count, cb->size);
         }          }
 #endif  #endif
Line 2135  uaudio_chan_rintr(usbd_xfer_handle xfer,
Line 2131  uaudio_chan_rintr(usbd_xfer_handle xfer,
          * Transfer data from channel buffer to upper layer buffer, taking           * Transfer data from channel buffer to upper layer buffer, taking
          * care of wrapping the upper layer buffer.           * care of wrapping the upper layer buffer.
          */           */
         n = min(count, ch->end - ch->cur);          for(i = 0; i < UAUDIO_NFRAMES; i++) {
         memcpy(ch->cur, cb->buffer, n);                  frsize = cb->sizes[i];
         ch->cur += n;                  n = min(frsize, ch->end - ch->cur);
         if (ch->cur >= ch->end)                  memcpy(ch->cur, cb->buffer + cb->offsets[i], n);
                 ch->cur = ch->start;                  ch->cur += n;
         if (count > n) {                  if (ch->cur >= ch->end)
                 memcpy(ch->cur, cb->buffer + n, count - n);                          ch->cur = ch->start;
                 ch->cur += count - n;                  if (frsize > n) {
                           memcpy(ch->cur, cb->buffer + cb->offsets[i] + n,
                               frsize - n);
                           ch->cur += frsize - n;
                   }
         }          }
   
         /* Call back to upper layer */          /* Call back to upper layer */
         ch->transferred += cb->size;          ch->transferred += count;
         s = splaudio();          s = splaudio();
         while (ch->transferred >= ch->blksize) {          while (ch->transferred >= ch->blksize) {
                 ch->transferred -= ch->blksize;                  ch->transferred -= ch->blksize;

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62

CVSweb <webmaster@jp.NetBSD.org>