static int alschan_getptr(kobj_t obj, void *data) { struct sc_chinfo *ch = data; int32_t pos, sz; pos = als_gcr_rd(ch->parent, ch->gcr_fifo_status) & 0xffff; sz = sndbuf_getsize(ch->buffer); return (2 * sz - pos - 1) % sz; }
static u_int32_t alschan_getptr(kobj_t obj, void *data) { struct sc_chinfo *ch = data; struct sc_info *sc = ch->parent; int32_t pos, sz; snd_mtxlock(sc->lock); pos = als_gcr_rd(ch->parent, ch->gcr_fifo_status) & 0xffff; snd_mtxunlock(sc->lock); sz = sndbuf_getsize(ch->buffer); return (2 * sz - pos - 1) % sz; }