View | Details | Raw Unified | Return to bug 16709
Collapse All | Expand All

(-)es1370.c (-1 / +72 lines)
Lines 628-634 Link Here
628
static int
628
static int
629
es_select(dev_t i_dev, int rw, struct proc * p)
629
es_select(dev_t i_dev, int rw, struct proc * p)
630
{
630
{
631
	return (ENOSYS);
631
    int unit, c = 1;
632
    snddev_info *d ;
633
    u_long flags;
634
635
/*     dev = minor(i_dev); */
636
/*     d = get_snddev_info(dev, &unit); */
637
    unit = UNIT(minor(i_dev));
638
    d = &pcm_info[unit];
639
640
    if (d == NULL ) /* should not happen! */
641
        return (ENXIO) ;
642
643
    {
644
        /*
645
         * if the user selected a block size, then we want to use the
646
         * device as a block device, and select will return ready when
647
         * we have a full block.
648
         * In all other cases, select will return when 1 byte is ready.
649
         */
650
        int lim = 1;
651
652
        int revents = 0 ;
653
        if (rw & (POLLOUT | POLLWRNORM) ) {
654
            if ( d->flags & SND_F_HAS_SIZE )
655
                lim = d->play_blocksize ;
656
            /* XXX fix the test here for half duplex devices */
657
            if (1 /* write is compatible with current mode */) {
658
                flags = spltty();
659
                if (d->dbuf_out.dl) {
660
		    es_wr_dmaupdate(d);
661
                }
662
                c = d->dbuf_out.fl ;
663
                if (c < lim) /* no space available */
664
                    selrecord(p, & (d->wsel));
665
                else
666
                    revents |= rw & (POLLOUT | POLLWRNORM);
667
                splx(flags);
668
            }
669
        }
670
        if (rw & (POLLIN | POLLRDNORM)) {
671
            if ( d->flags & SND_F_HAS_SIZE )
672
                lim = d->rec_blocksize ;
673
            /* XXX fix the test here */
674
            if (1 /* read is compatible with current mode */) {
675
                flags = spltty();
676
                if ( d->dbuf_in.dl == 0 ) /* dma idle, restart it */
677
                    dma_rdintr(d);
678
                else {
679
		    es_rd_dmaupdate(d);
680
                }
681
                c = d->dbuf_in.rl ;
682
                if (c < lim) /* no data available */
683
                    selrecord(p, & (d->rsel));
684
                else
685
                    revents |= rw & (POLLIN | POLLRDNORM);
686
                splx(flags);
687
            }
688
            DEB(printf("sndselect on read: %d >= %d flags 0x%08x\n",
689
                c, lim, d->flags));
690
            return c < lim ? 0 : 1 ;
691
        }
692
        return revents;
693
    }
632
}
694
}
633
695
634
696
Lines 746-751 Link Here
746
808
747
	if(es_debug > 0) printf("es_callback reason %d speed %d \t",reason ,d->play_speed);
809
	if(es_debug > 0) printf("es_callback reason %d speed %d \t",reason ,d->play_speed);
748
	switch(reason & SND_CB_REASON_MASK) {
810
	switch(reason & SND_CB_REASON_MASK) {
811
	case SND_CB_DMAUPDATE:
812
	  if (reason & SND_CB_WR)
813
	    es_wr_dmaupdate(d);
814
	  else if (reason & SND_CB_RD)
815
	    es_rd_dmaupdate(d);
816
	  else return -1;
817
818
	  break;
819
	  
749
	case SND_CB_INIT:
820
	case SND_CB_INIT:
750
/* 	  if(es_debug > 0) printf("case SND_CB_INIT\n"); */
821
/* 	  if(es_debug > 0) printf("case SND_CB_INIT\n"); */
751
	  if (d->type == ES1371_PCI_ID){
822
	  if (d->type == ES1371_PCI_ID){

Return to bug 16709