Lines Matching refs:ch

217 		struct bcm2835_audio_chinfo *ch = m.u.complete.cookie;
221 ch->callbacks++;
223 ch->underruns++;
226 if (ch->playback_state != PLAYBACK_IDLE) {
233 if (ch->playback_state != PLAYBACK_IDLE) {
235 if ((ch->available_space + count)> VCHIQ_AUDIO_BUFFER_SIZE) {
238 ch->available_space, count, perr);
241 ch->retrieved_samples, ch->submitted_samples);
243 ch->available_space += count;
244 ch->retrieved_samples += count;
246 if (perr || (ch->available_space >= VCHIQ_AUDIO_PACKET_SIZE))
310 bcm2835_audio_reset_channel(struct bcm2835_audio_chinfo *ch)
313 ch->available_space = VCHIQ_AUDIO_BUFFER_SIZE;
314 ch->unsubmittedptr = 0;
315 sndbuf_reset(ch->buffer);
319 bcm2835_audio_start(struct bcm2835_audio_chinfo *ch)
323 struct bcm2835_audio_info *sc = ch->parent;
336 bcm2835_audio_stop(struct bcm2835_audio_chinfo *ch)
340 struct bcm2835_audio_info *sc = ch->parent;
413 bcm2835_audio_buffer_should_sleep(struct bcm2835_audio_chinfo *ch)
416 if (ch->playback_state != PLAYBACK_PLAYING)
420 if (sndbuf_getready(ch->buffer) < VCHIQ_AUDIO_PACKET_SIZE) {
422 ch->starved++;
427 if (ch->available_space < VCHIQ_AUDIO_PACKET_SIZE) {
435 bcm2835_audio_write_samples(struct bcm2835_audio_chinfo *ch, void *buf, uint32_t count)
437 struct bcm2835_audio_info *sc = ch->parent;
449 m.u.write.cookie = ch;
474 struct bcm2835_audio_chinfo *ch = &sc->pch;
481 ch->playback_state = PLAYBACK_IDLE;
493 bcm2835_audio_buffer_should_sleep(ch)) {
504 speed = ch->spd;
505 format = ch->fmt;
509 if (ch->playback_state == PLAYBACK_IDLE)
516 (ch->playback_state == PLAYBACK_PLAYING)) {
517 bcm2835_audio_stop(ch);
520 ch->playback_state = PLAYBACK_IDLE;
527 (ch->playback_state == PLAYBACK_IDLE)) {
529 ch->playback_state = PLAYBACK_PLAYING;
531 bcm2835_audio_start(ch);
534 if (ch->playback_state == PLAYBACK_IDLE)
537 if (sndbuf_getready(ch->buffer) == 0)
540 count = sndbuf_getready(ch->buffer);
541 size = sndbuf_getsize(ch->buffer);
542 readyptr = sndbuf_getreadyptr(ch->buffer);
547 count = min(count, ch->available_space);
554 buf = (uint8_t*)sndbuf_getbuf(ch->buffer) + readyptr;
556 bcm2835_audio_write_samples(ch, buf, count);
558 ch->unsubmittedptr = (ch->unsubmittedptr + count) % sndbuf_getsize(ch->buffer);
559 ch->available_space -= count;
560 ch->submitted_samples += count;
561 KASSERT(ch->available_space >= 0, ("ch->available_space == %d\n", ch->available_space));
591 struct bcm2835_audio_chinfo *ch = &sc->pch;
597 ch->parent = sc;
598 ch->channel = c;
599 ch->buffer = b;
602 ch->spd = 44100;
603 ch->fmt = SND_FORMAT(AFMT_S16_LE, 2, 0);
604 ch->blksz = VCHIQ_AUDIO_PACKET_SIZE;
608 if (sndbuf_setup(ch->buffer, buffer, sc->bufsz) != 0) {
618 return ch;
624 struct bcm2835_audio_chinfo *ch = data;
627 buffer = sndbuf_getbuf(ch->buffer);
637 struct bcm2835_audio_chinfo *ch = data;
638 struct bcm2835_audio_info *sc = ch->parent;
641 ch->fmt = format;
651 struct bcm2835_audio_chinfo *ch = data;
652 struct bcm2835_audio_info *sc = ch->parent;
655 ch->spd = speed;
659 return ch->spd;
665 struct bcm2835_audio_chinfo *ch = data;
667 return ch->blksz;
673 struct bcm2835_audio_chinfo *ch = data;
674 struct bcm2835_audio_info *sc = ch->parent;
683 ch->submitted_samples = 0;
684 ch->retrieved_samples = 0;
702 struct bcm2835_audio_chinfo *ch = data;
703 struct bcm2835_audio_info *sc = ch->parent;
707 ret = ch->unsubmittedptr;