static void xmbrs_flush_chars(struct tty_struct *tty)
{
	volatile unsigned int *uartp;
	struct xmb_serial	*info = (struct xmb_serial *)tty->driver_data;
	unsigned long		flags;

	if (serial_paranoia_check(info, tty->device, "xmbrs_flush_chars"))
		return;

	uartp = (volatile unsigned int *) info->addr;
	EnableInterrupts(uartp);

	/* If there are chars waiting in RX buffer then enable interrupt
	   to permit receiving them */
	save_flags_cli(flags);
	if ( (uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_RX_FIFO_VALID_DATA) &&
			(info->flags & ASYNC_INITIALIZED) ) {
		EnableInterrupts(uartp);
	}

	/* Any chars pending to go out (and tty not stopped etc)? */
	if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
	    !info->xmit_buf)
		return;

	/* Force remaining chars out */
	save_flags_cli(flags);
	EnableInterrupts(uartp);
	force_tx_fifo_fill(info);
	restore_flags(flags);
}
Ejemplo n.º 2
0
static ssize_t fsl_read(struct file *f, char *buf, 
				size_t count, loff_t *pos)
{
	struct fsl_fifo_t *fsl_fifo=(struct fsl_fifo_t *)f->private_data;
	unsigned flags;
	int total=0;

	if(!fsl_fifo->exists)
		return -ENODEV;

	save_flags_cli(flags);

	/* Block until there's some data in the buffer */
	while(!fsl_fifo->rx_cnt)
	{
		restore_flags(flags);
		tasklet_schedule(&fsl_read_tasklet);
		interruptible_sleep_on(&fsl_read_queue);
		if(current->sigpending)
		{
			return -EINTR;
		}
		save_flags_cli(flags);
	}
		
	while(1)
	{
		int c; 

		cli();
		c = MIN(count, MIN(fsl_fifo->rx_cnt,
				   FSLFIFO_BUF_SIZE - fsl_fifo->rx_tail));

		if(c<=0)
		{
			restore_flags(flags);
			break;
		}

		copy_to_user(buf, fsl_fifo->rx_buf+fsl_fifo->rx_tail,c);

		/* Update the buffer data structure */
		fsl_fifo->rx_cnt-=c;
		fsl_fifo->rx_tail+=c;
		fsl_fifo->rx_tail &= FSLFIFO_BUF_SIZE-1;

		restore_flags(flags);

		buf += c;
		count -= c;
		total += c;
	}

	if(count)
		tasklet_schedule(&fsl_read_tasklet);

	return total;
}
Ejemplo n.º 3
0
static int h3600_stowaway_startup(struct skbd_state *skbd)
{
	unsigned long flags;
	int retval = 0;

	SFDEBUG(1,"\n");
	save_flags_cli(flags);

	h3600_stowaway_reset_comm();

	/* Direction registers */
	GPDR |= GPIO_H3600_COM_RTS;
	GPDR &= ~GPIO_H3600_COM_DCD;
	set_GPIO_IRQ_edge( GPIO_H3600_COM_DCD, GPIO_RISING_EDGE );

	/* Timer structure */
	init_timer(&skbd->timer);
	skbd->timer.function = h3600_stowaway_timer_callback;
	skbd->timer.data = (unsigned long) skbd;

	retval = request_irq(IRQ_GPIO_H3600_COM_DCD,
			     h3600_stowaway_handshake_interrupt,
			     SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
			     "Stowaway DCD", (void *)skbd);

	if ( !retval )
		retval = request_irq( IRQ_Ser3UART, 
				      h3600_stowaway_data_interrupt,
				      SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
				      "Stowaway data", (void *)skbd);
				      
	restore_flags(flags);
	return retval;
}
Ejemplo n.º 4
0
/*
 * hacked from linux/include/asm-arm/arch-sa1100/time.h
 * static void sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 */
static void linux_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
#ifdef CONFIG_RTAI_ARM_OLD
	long flags;
	int next_match;

	do {
		//do_leds();
		save_flags_cli(flags);
		do_timer(regs);
		OSSR = OSSR_M0;
		next_match = (OSMR0 += LATCH);
		rthal.timer_match = next_match;
		restore_flags(flags);
	} while((signed long)(next_match - OSCR) <= 0);
#else
	int next_match;

	do {
		do_timer(regs);
		OSSR = OSSR_M0;
		next_match = (OSMR0 += LATCH);
	} while((signed long) (next_match - OSCR) <= 0);
#endif	
}
Ejemplo n.º 5
0
static void
ether3_timeout(struct net_device *dev)
{
	struct dev_priv *priv = (struct dev_priv *)dev->priv;
	unsigned long flags;

	del_timer(&priv->timer);

	save_flags_cli(flags);
	printk(KERN_ERR "%s: transmit timed out, network cable problem?\n", dev->name);
	printk(KERN_ERR "%s: state: { status=%04X cfg1=%04X cfg2=%04X }\n", dev->name,
		ether3_inw(REG_STATUS), ether3_inw(REG_CONFIG1), ether3_inw(REG_CONFIG2));
	printk(KERN_ERR "%s: { rpr=%04X rea=%04X tpr=%04X }\n", dev->name,
		ether3_inw(REG_RECVPTR), ether3_inw(REG_RECVEND), ether3_inw(REG_TRANSMITPTR));
	printk(KERN_ERR "%s: tx head=%X tx tail=%X\n", dev->name,
		priv->tx_head, priv->tx_tail);
	ether3_setbuffer(dev, buffer_read, priv->tx_tail);
	printk(KERN_ERR "%s: packet status = %08X\n", dev->name, ether3_readlong(dev));
	restore_flags(flags);

	priv->regs.config2 |= CFG2_CTRLO;
	priv->stats.tx_errors += 1;
	ether3_outw(priv->regs.config2, REG_CONFIG2);
	priv->tx_head = priv->tx_tail = 0;

	netif_wake_queue(dev);
}
Ejemplo n.º 6
0
static ssize_t state_write(struct file *filp, const char *source, size_t count,
		     loff_t *ppos)
{
	struct state_dev *dev = filp->private_data;
	unsigned long flags;
	unsigned char *temp;

	if (count > STATE_BLOCK_SIZE || count <= 0)
		return -EINVAL;

	copy_from_user_ret(dev->write_buffer, source, count, -EFAULT);

	if (hijack_force_pause_player) {
		dev->write_buffer[0x0c] &= ~0x02;
	}

	/* Now we've written, switch the buffers and copy */
	save_flags_cli(flags);
	temp = dev->read_buffer;
	dev->read_buffer = dev->write_buffer;
	dev->write_buffer = temp;

	/* Mark as dirty */
	dirty=1;

	restore_flags(flags);

	memcpy(dev->write_buffer, dev->read_buffer, count);
	return count;	
}
Ejemplo n.º 7
0
/*
 * Transmit a packet
 */
static int
ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)
{
	struct dev_priv *priv = (struct dev_priv *)dev->priv;
	unsigned long flags;
	unsigned int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
	unsigned int ptr, next_ptr;

	length = (length + 1) & ~1;

	if (priv->broken) {
		dev_kfree_skb(skb);
		priv->stats.tx_dropped ++;
		netif_start_queue(dev);
		return 0;
	}

	next_ptr = (priv->tx_head + 1) & 15;

	save_flags_cli(flags);

	if (priv->tx_tail == next_ptr) {
		restore_flags(flags);
		return 1;	/* unable to queue */
	}

	dev->trans_start = jiffies;
	ptr		 = 0x600 * priv->tx_head;
	priv->tx_head	 = next_ptr;
	next_ptr	*= 0x600;

#define TXHDR_FLAGS (TXHDR_TRANSMIT|TXHDR_CHAINCONTINUE|TXHDR_DATAFOLLOWS|TXHDR_ENSUCCESS)

	ether3_setbuffer(dev, buffer_write, next_ptr);
	ether3_writelong(dev, 0);
	ether3_setbuffer(dev, buffer_write, ptr);
	ether3_writelong(dev, 0);
	ether3_writebuffer(dev, skb->data, length);
	ether3_writeword(dev, htons(next_ptr));
	ether3_writeword(dev, TXHDR_CHAINCONTINUE >> 16);
	ether3_setbuffer(dev, buffer_write, ptr);
	ether3_writeword(dev, htons((ptr + length + 4)));
	ether3_writeword(dev, TXHDR_FLAGS >> 16);
	ether3_ledon(dev, priv);

	if (!(ether3_inw(REG_STATUS) & STAT_TXON)) {
		ether3_outw(ptr, REG_TRANSMITPTR);
		ether3_outw(priv->regs.command | CMD_TXON, REG_COMMAND);
	}

	next_ptr = (priv->tx_head + 1) & 15;
	restore_flags(flags);

	dev_kfree_skb(skb);

	if (priv->tx_tail == next_ptr)
		netif_stop_queue(dev);

	return 0;
}
void xmbrs_put_char(char ch)
{
	volatile unsigned int *uartp, out_word=ch;
	unsigned long		flags;
	int			i;

	uartp = (volatile unsigned int *) CONFIG_XILINX_UARTLITE_0_BASEADDR;

	save_flags_cli(flags);

	/* wait for tx buffer not full */
	for (i = 0; (i < 0x10000); i++) {
		if (!(uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_TX_FIFO_FULL))
			break;
	}

	/* Did it drain? */
	if (i < 0x10000) {
		/* Send the char */
		uartp[XUL_TX_FIFO_OFFSET/4]=out_word;

		/* Wait for it to go */
		for (i = 0; (i < 0x10000); i++)
			if (!(uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_TX_FIFO_FULL))
				break;
	}

	/* Was it sent? */
	if (i >= 0x10000)
		xmbrs_init_console(); /* try and get it back */

	restore_flags(flags);

	return;
}
/*
 * This routine will shutdown a serial port; interrupts are disabled, and
 * DTR is dropped if the hangup on close termio flag is on.
 */
static void shutdown(struct xmb_serial * info)
{
	volatile unsigned int *uartp;
	unsigned long		flags;

	if (!(info->flags & ASYNC_INITIALIZED))
		return;

#ifdef SERIAL_DEBUG_OPEN
	printk("Shutting down serial port %d (irq %d)....\n", info->line,
	       info->irq);
#endif
	
	uartp = (volatile unsigned int *) info->addr;
	save_flags_cli(flags); 		/* Disable interrupts */

	/* Disable interrupts and clear RX FIFO */
	DisableInterrupts(uartp);
	Reset_RX_FIFO(uartp);

	if (info->xmit_buf) {
		free_page((unsigned long) info->xmit_buf);
		info->xmit_buf = 0;
	}

	if (info->tty)
		set_bit(TTY_IO_ERROR, &info->tty->flags);
	
	info->flags &= ~ASYNC_INITIALIZED;
	restore_flags(flags);
}
Ejemplo n.º 10
0
static void powerfail_reenabled_timeout(unsigned long unused)
{
	/* If we get here then the power returned a while ago and we reenabled
	 * stuff.  */
	
	struct state_dev *dev = state_devices;
	unsigned long dis;
	save_flags_cli(dis);
	
	if (erroneous_interrupts) {
#if DEBUG
		  printk("The power interrupt is happening too often. Can't enable it.\n");
#endif
		if (timer_pending(&dev->powerfail_timer))
			del_timer(&dev->powerfail_timer);
		dev->powerfail_timer.expires = jiffies + POWERFAIL_TIMEOUT * HZ;
		dev->powerfail_timer.function = powerfail_reenabled_timeout;
		add_timer(&dev->powerfail_timer);
		erroneous_interrupts = 0;
	} else {
#if DEBUG
		  printk("The power hasn't failed for a while - reenabling actions.\n");
#endif

		if (timer_pending(&dev->powerfail_timer))
			del_timer(&dev->powerfail_timer);
		enable_powerfail(TRUE);
	}
	restore_flags(dis);
}
Ejemplo n.º 11
0
static int h3600_single_sleeve_pcmcia_configure_socket( const struct pcmcia_configure *configure )
{
    unsigned long flags;
    int sock = configure->sock;

    if(sock>1)
        return -1;


    if (0) printk(__FUNCTION__ ": socket=%d vcc=%d vpp=%d reset=%d\n",
                      sock, configure->vcc, configure->vpp, configure->reset);

    save_flags_cli(flags);
    switch (configure->vcc) {
    case 0:
        break;

    case 50:
    case 33:
        break;

    default:
        printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__,
               configure->vcc);
        restore_flags(flags);
        return -1;
    }

    assign_h3600_egpio( IPAQ_EGPIO_CARD_RESET, configure->reset );
    restore_flags(flags);
    return 0;
}
Ejemplo n.º 12
0
static void xmbrs_unthrottle(struct tty_struct * tty)
{
	struct xmb_serial *info = (struct xmb_serial *)tty->driver_data;
#ifdef SERIAL_DEBUG_THROTTLE
	char	buf[64];
	
	printk("unthrottle %s: %d....\n", _tty_name(tty, buf),
	       tty->ldisc.chars_in_buffer(tty));
#endif

	if (serial_paranoia_check(info, tty->device, "xmbrs_unthrottle"))
		return;
	
	if (I_IXOFF(tty)) {
		if (info->x_char)
			info->x_char = 0;
		else {
			/* Force START_CHAR (xon) out */
			volatile unsigned int *uartp;
			unsigned long		flags;
			info->x_char = START_CHAR(tty);
			uartp = (volatile unsigned int *) info->addr;
			save_flags_cli(flags);
			EnableInterrupts(uartp);
			force_tx_fifo_fill(info); 
			restore_flags(flags);
		}
	}

}
Ejemplo n.º 13
0
UINT32 intLock( void )
{
  // Disables ARM IRQ interrupt

  UINT32	irqlevel;
  save_flags_cli(irqlevel);
  return irqlevel;
}
Ejemplo n.º 14
0
void kfree(void *ptr)
{
    uint32_t flags;

    save_flags_cli(flags);
    tlsf_free(g_kheap, ptr);
    restore_flags(flags);
}
Ejemplo n.º 15
0
static void powerfail_disabled_timeout(unsigned long unused)
{
	/* If we get here then a powerfail interrupt happened but the
	 * power didn't actually go away within a sensible amount of
	 * time. So, if the voltage has gone back up above the
	 * threshold we reenable the interrupt and wait for a bit
	 * longer. If the voltage hasn't gone back up enough we just
	 * reschedule ourselves to take a look at it again in a little
	 * while.
         */
	
	struct state_dev *dev = state_devices;

	unsigned long dis;
#if DEBUG
	  printk("The power doesn't seem to have gone away after all.\n");
#endif

#ifdef CONFIG_EMPEG_DISPLAY
	/* Re-enable powerfail processing */
	display_powerreturn_action();
#endif
	save_flags_cli(dis);

	/* Reenable DACs */
	GPSR=EMPEG_DSPPOM;

	if (timer_pending(&dev->powerfail_timer))
		del_timer(&dev->powerfail_timer);
	
	if (GPLR & EMPEG_POWERFAIL) {
		/* It's high, so we're lower than 10 volts. Just
		 * reschedule ourselves to take another look at it
		 *  later.
		 */
		dev->powerfail_timer.expires = jiffies + POWERFAIL_TIMEOUT * HZ;
		dev->powerfail_timer.function = powerfail_disabled_timeout;
		add_timer(&dev->powerfail_timer);
#if DEBUG
		printk("The voltage is still too low, not reenabling powerfail.\n");
#endif
	} else {
#if DEBUG
		printk("The voltage has gone high enough, reenabling powerfail tentatitively.\n");
#endif
		/* It's low, so we've gone back to above 10 volts. Reenable the
		 *  interrupt and schedule the reenable function so that it can check
		 * we haven't had any spurious interrupts too often.
		 */
		dev->powerfail_timer.expires = jiffies + REENABLE_TIMEOUT * HZ;
		dev->powerfail_timer.function = powerfail_reenabled_timeout;
		add_timer(&dev->powerfail_timer);
		
		erroneous_interrupts = 0;
	}
	restore_flags(dis);
}
Ejemplo n.º 16
0
/* Forced cleanse routine, usually called just before a software-initiated
   powerdown */
extern void state_cleanse(void)
{
	/* Is the state dirty? Flush it if it is */
	if (dirty) {
		unsigned long flags;
		save_flags_cli(flags);
		state_store();
		restore_flags(flags);
	}
}
Ejemplo n.º 17
0
static void
anakin_stop_rx(struct uart_port *port)
{
	unsigned long flags;

	save_flags_cli(flags);
	while (anakin_in(port, 0x10) & RXRELEASE) 
	    anakin_in(port, 0x14);
	anakin_out(port, 0x18, anakin_in(port, 0x18) | BLOCKRX);
	restore_flags(flags);
}
Ejemplo n.º 18
0
static void
update_clk (int set, int mask)
{
	unsigned long flags;
	int val;
	
	save_flags_cli (flags);
	val = __raw_readl (S3C2410_CLKCON);
	val = (val & ~mask) ^ set;
	restore_flags (flags);
}
Ejemplo n.º 19
0
void *kmalloc(size_t bytes)
{
    uint32_t flags;
    void *ptr;

    save_flags_cli(flags);
    ptr = tlsf_malloc(g_kheap, bytes);
    restore_flags(flags);

    return ptr;
}
Ejemplo n.º 20
0
void *krealloc(void *oldptr, size_t bytes)
{
    uint32_t flags;
    void *ptr;

    save_flags_cli(flags);
    ptr = tlsf_realloc(g_kheap, oldptr, bytes);
    restore_flags(flags);

    return ptr;
}
Ejemplo n.º 21
0
void *kmemalign(size_t align, size_t bytes)
{
    uint32_t flags;
	void *ptr;

    save_flags_cli(flags);
    ptr = tlsf_memalign(g_kheap, align, bytes);
    restore_flags(flags);

	return ptr;
}
Ejemplo n.º 22
0
static void h3600_stowaway_shutdown(struct skbd_state * skbd)
{
	unsigned long	flags;
	
	SFDEBUG(1,"\n");
	del_timer(&skbd->timer);

	save_flags_cli(flags);
	free_irq(IRQ_GPIO_H3600_COM_DCD, (void *)skbd);
	free_irq(IRQ_Ser3UART, (void *)skbd);
	restore_flags(flags);
}
Ejemplo n.º 23
0
static int cerf_pcmcia_configure_socket(const struct pcmcia_configure
					   *configure)
{
  unsigned long flags;

  if(configure->sock>1)
    return -1;

#ifdef CONFIG_SA1100_CERF_CPLD
  if(configure->sock==1)
#else
  if(configure->sock==0)
#endif
    return 0;

  save_flags_cli(flags);

  switch(configure->vcc){
  case 0:
    break;

  case 50:
  case 33:
#ifdef CONFIG_SA1100_CERF_CPLD
     GPCR = GPIO_PWR_SHUTDOWN;
#endif
     break;

  default:
    printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__,
	   configure->vcc);
    restore_flags(flags);
    return -1;
  }

  if(configure->reset)
  {
#ifdef CONFIG_SA1100_CERF_CPLD
    GPSR = GPIO_CF_RESET;
#endif
  }
  else
  {
#ifdef CONFIG_SA1100_CERF_CPLD
    GPCR = GPIO_CF_RESET;
#endif
  }

  restore_flags(flags);

  return 0;
}
Ejemplo n.º 24
0
static void xmbrs_start(struct tty_struct *tty)
{
	volatile unsigned int *uartp;
	struct xmb_serial	*info = (struct xmb_serial *)tty->driver_data;
	unsigned long		flags;
	
	if (serial_paranoia_check(info, tty->device, "xmbrs_start"))
		return;
	uartp = (volatile unsigned int *) info->addr;
	save_flags_cli(flags);
	EnableInterrupts(uartp);
	restore_flags(flags);
}
static int pangolin_pcmcia_configure_socket(const struct pcmcia_configure
					   *configure)
{
  unsigned long value, flags;

  if(configure->sock>1) return -1;
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
  if(configure->sock==0) return 0;
#endif
  save_flags_cli(flags);

  /* Murphy: BUS_ON different from POWER ? */

  switch(configure->vcc){
  case 0:
    break;
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
  case 50:
    printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V...\n",
	   __FUNCTION__);
  case 33:  /* Can only apply 3.3V to the CF slot. */
    break;
#else
  case 50:
    printk(KERN_WARNING "%s(): CS asked for 5V, determinded by jumper setting...\n", __FUNCTION__);
    break;
  case 33:
    printk(KERN_WARNING "%s(): CS asked for 3.3V, determined by jumper setting...\n", __FUNCTION__);
    break;
#endif
  default:
    printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__,
	   configure->vcc);
    restore_flags(flags);
    return -1;
  }
#ifdef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
  /* reset & unreset request */
  if(configure->sock==0) {
	if(configure->reset) {
		GPSR |= GPIO_PCMCIA_RESET;
	} else {
		GPCR |= GPIO_PCMCIA_RESET;
	}
  }
#endif
  /* Silently ignore Vpp, output enable, speaker enable. */
  restore_flags(flags);
  return 0;
}
Ejemplo n.º 26
0
static void
anakin_change_speed(struct uart_port *port, u_int cflag, u_int iflag, u_int quot)
{
	unsigned int flags;

	save_flags_cli(flags);
	while (!(anakin_in(port, 0x10) & TXEMPTY));
	anakin_out(port, 0x10, (anakin_in(port, 0x10) & ~PRESCALER)
			| (quot << 3));

	//parity always set to none
	anakin_out(port, 0x18, anakin_in(port, 0x18) & ~PARITY);
	restore_flags(flags);
}
Ejemplo n.º 27
0
static int h3600_dual_sleeve_pcmcia_configure_socket( const struct pcmcia_configure *configure )
{
    unsigned long flags;
    unsigned int  prc;
    int sock = configure->sock;

    if(sock>1)
        return -1;

    if (0) printk(__FUNCTION__ ": socket=%d vcc=%d vpp=%d reset=%d\n",
                      sock, configure->vcc, configure->vpp, configure->reset);

    prc = (LINKUP_PRC_APOE | LINKUP_PRC_SOE | LINKUP_PRC_S1 | LINKUP_PRC_S2
           | (sock * LINKUP_PRC_SSP));

    save_flags_cli(flags);
    /* Linkup Systems L1110 with TI TPS2205 PCMCIA Power Switch */
    /* S1 is VCC5#, S2 is VCC3# */
    /* S3 is VPP_VCC, S4 is VPP_PGM */
    /* PWR_ON is wired to #SHDN */
    switch (configure->vcc) {
    case 0:
        break;
    case 50:
        prc &= ~LINKUP_PRC_S1;
        break;
    case 33:
        prc &= ~LINKUP_PRC_S2;
        break;
    default:
        printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__,
               configure->vcc);
        restore_flags(flags);
        return -1;
    }
    if (configure->vpp == 12) {
        prc |= LINKUP_PRC_S4;
    } else if (configure->vpp == configure->vcc) {
        prc |= LINKUP_PRC_S3;
    }

    if (configure->reset)
        prc |= LINKUP_PRC_RESET;

    writel(prc, &dual_pcmcia_sleeve[sock]->prc);

    restore_flags(flags);
    return 0;
}
Ejemplo n.º 28
0
/* Prototype: void eesoxscsi_terminator_ctl(*host, on_off)
 * Purpose  : Turn the EESOX SCSI terminators on or off
 * Params   : host   - card to turn on/off
 *          : on_off - !0 to turn on, 0 to turn off
 */
static void
eesoxscsi_terminator_ctl(struct Scsi_Host *host, int on_off)
{
	EESOXScsi_Info *info = (EESOXScsi_Info *)host->hostdata;
	unsigned long flags;

	save_flags_cli(flags);
	if (on_off)
		info->control.control |= EESOX_TERM_ENABLE;
	else
		info->control.control &= ~EESOX_TERM_ENABLE;
	restore_flags(flags);

	outb(info->control.control, info->control.io_port);
}
Ejemplo n.º 29
0
/*
 * get_lsr_info - get line status register info
 *
 * Purpose: Let user call ioctl() to get info when the UART physically
 * 	    is emptied.  On bus types like RS485, the transmitter must
 * 	    release the bus after transmitting. This must be done when
 * 	    the transmit shift register is empty, not be done when the
 * 	    transmit holding register is empty.  This functionality
 * 	    allows an RS485 driver to be written in user space. 
 */
static int get_lsr_info(struct xmb_serial * info, unsigned int *value)
{
	volatile unsigned int *uartp;
	unsigned long		flags;
	unsigned char		status;

	uartp = (volatile unsigned int *) info->addr;
	save_flags_cli(flags);
	/* FIXME */
	status = (uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_TX_FIFO_EMPTY) ? TIOCSER_TEMT : 0;
	restore_flags(flags);

	put_user(status,value);
	return 0;
}
Ejemplo n.º 30
0
static void console_printf(const char *fmt,...)
{
	static char buffer[2048];	/* Arbitary! */
	extern void console_print(const char *);
	unsigned long flags;
	va_list ap;

	save_flags_cli(flags);

	va_start(ap, fmt);
	vsprintf(buffer, fmt, ap);
	console_print(buffer);
	va_end(fmt);

	restore_flags(flags);
};	/* console_printf */