示例#1
0
文件: yam.c 项目: 383530895/linux
static enum uart yam_check_uart(unsigned int iobase)
{
	unsigned char b1, b2, b3;
	enum uart u;
	enum uart uart_tab[] =
	{c_uart_16450, c_uart_unknown, c_uart_16550, c_uart_16550A};

	b1 = inb(MCR(iobase));
	outb(b1 | 0x10, MCR(iobase));	/* loopback mode */
	b2 = inb(MSR(iobase));
	outb(0x1a, MCR(iobase));
	b3 = inb(MSR(iobase)) & 0xf0;
	outb(b1, MCR(iobase));		/* restore old values */
	outb(b2, MSR(iobase));
	if (b3 != 0x90)
		return c_uart_unknown;
	inb(RBR(iobase));
	inb(RBR(iobase));
	outb(0x01, FCR(iobase));	/* enable FIFOs */
	u = uart_tab[(inb(IIR(iobase)) >> 6) & 3];
	if (u == c_uart_16450) {
		outb(0x5a, SCR(iobase));
		b1 = inb(SCR(iobase));
		outb(0xa5, SCR(iobase));
		b2 = inb(SCR(iobase));
		if ((b1 != 0x5a) || (b2 != 0xa5))
			u = c_uart_8250;
	}
	return u;
}
示例#2
0
// Filter data through filter
static af_data_t* play(struct af_instance_s* af, af_data_t* data)
{
  af_data_t*    c   = data;	 // Current working data
  af_sub_t*  	s   = af->setup; // Setup for this instance
  float*   	a   = c->audio;	 // Audio data
  int		len = c->len/4;	 // Number of samples in current audio block 
  int		nch = c->nch;	 // Number of channels
  int		ch  = s->ch;	 // Channel in which to insert the sub audio
  register int  i;

  // Run filter
  for(i=0;i<len;i+=nch){
    // Average left and right
    register float x = 0.5 * (a[i] + a[i+1]);
    IIR(x * s->k, s->w[0], s->q[0], x);
    IIR(x , s->w[1], s->q[1], a[i+ch]);
  }

  return c;
}
示例#3
0
文件: yam.c 项目: 383530895/linux
static irqreturn_t yam_interrupt(int irq, void *dev_id)
{
	struct net_device *dev;
	struct yam_port *yp;
	unsigned char iir;
	int counter = 100;
	int i;
	int handled = 0;

	for (i = 0; i < NR_PORTS; i++) {
		dev = yam_devs[i];
		yp = netdev_priv(dev);

		if (!netif_running(dev))
			continue;

		while ((iir = IIR_MASK & inb(IIR(dev->base_addr))) != IIR_NOPEND) {
			unsigned char msr = inb(MSR(dev->base_addr));
			unsigned char lsr = inb(LSR(dev->base_addr));
			unsigned char rxb;

			handled = 1;

			if (lsr & LSR_OE)
				++dev->stats.rx_fifo_errors;

			yp->dcd = (msr & RX_DCD) ? 1 : 0;

			if (--counter <= 0) {
				printk(KERN_ERR "%s: too many irq iir=%d\n",
						dev->name, iir);
				goto out;
			}
			if (msr & TX_RDY) {
				++yp->nb_mdint;
				yam_tx_byte(dev, yp);
			}
			if (lsr & LSR_RXC) {
				++yp->nb_rxint;
				rxb = inb(RBR(dev->base_addr));
				if (msr & RX_FLAG)
					yam_rx_flag(dev, yp);
				else
					yam_rx_byte(dev, yp, rxb);
			}
		}
	}
out:
	return IRQ_RETVAL(handled);
}
bool SCFilter::Apply(AFSample* yt, AFSample* xt, const AFSampleCount length)
{
    if(int(length) < m_nOrder)
        return false;
        
    if(m_adbA == 0)
    {
        FIR(yt, xt, length);    
    }
    else
    {
        IIR(yt, xt, length);        
    }
  
    return true;    
}  
示例#5
0
irqreturn_t serial_interrupt_handle(int irq_no, void *dev_id)
{
	struct serial_dev *dev = (struct serial_dev *) dev_id;
	unsigned char iir, ch = 0, i;

	iir = inb(IIR(dev->base_port));	
	//printk(LOG_LEVEL "[serial interrupt handle] read IIR = %d", (int) iir);

	if (IIR_RDAI(iir))
	{
		// Dezactivez întreruperea RDAI - read
		outb(inb(IER(dev->base_port)) & ~IER_RDAI, IER(dev->base_port));
		//printk(LOG_LEVEL "[serial interrupt handle] reading data...");

		while (inb(LSR(dev->base_port)) & 0x01)
		{
			ch = inb(dev->base_port);
			dev->read_buffer[dev->read++] = ch;
		}

		atomic_set(&dev->read_ready, 1);
		wake_up(&dev->wq_reads);
		//printk(LOG_LEVEL "[serial interrupt handle] wake up read()");
	}

	if (IIR_THREI(iir))
	{
		// Dezactivez întreruperea THREI - write
		outb(inb(IER(dev->base_port)) & ~IER_THREI, IER(dev->base_port));
		//printk(LOG_LEVEL "[serial interrupt handle] writing data...");

		for (i = 0; i < dev->write; i++)
			outb(dev->write_buffer[i], dev->base_port);
		
		atomic_set(&dev->write_ready, 0);
		wake_up(&dev->wq_writes);
		//printk(LOG_LEVEL "[serial interrupt handle] wake up write()");
	}
	return IRQ_HANDLED;
}