当前位置: 首页>>代码示例>>C++>>正文


C++ outl函数代码示例

本文整理汇总了C++中outl函数的典型用法代码示例。如果您正苦于以下问题:C++ outl函数的具体用法?C++ outl怎么用?C++ outl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了outl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nv_tco_ioctl


//.........这里部分代码省略.........
	val &= 0xffff;
	if (val == 0x0001 || val == 0x0000) {
		/* Something is wrong here, bar isn't setup */
		printk(KERN_ERR PFX "failed to get tcobase address\n");
		return 0;
	}
	val &= 0xff00;
	tcobase = val + 0x40;

	if (!request_region(tcobase, 0x10, "NV TCO")) {
		printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
		       tcobase);
		return 0;
	}

	/* Set a reasonable heartbeat before we stop the timer */
	tco_timer_set_heartbeat(30);

	/*
	 * Stop the TCO before we change anything so we don't race with
	 * a zeroed timer.
	 */
	tco_timer_keepalive();
	tco_timer_stop();

	/* Disable SMI caused by TCO */
	if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) {
		printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
		       MCP51_SMI_EN(tcobase));
		goto out;
	}
	val = inl(MCP51_SMI_EN(tcobase));
	val &= ~MCP51_SMI_EN_TCO;
	outl(val, MCP51_SMI_EN(tcobase));
	val = inl(MCP51_SMI_EN(tcobase));
	release_region(MCP51_SMI_EN(tcobase), 4);
	if (val & MCP51_SMI_EN_TCO) {
		printk(KERN_ERR PFX "Could not disable SMI caused by TCO\n");
		goto out;
	}

	/* Check chipset's NO_REBOOT bit */
	pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val);
	val |= MCP51_SMBUS_SETUP_B_TCO_REBOOT;
	pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val);
	pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val);
	if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) {
		printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot "
		       "disabled by hardware\n");
		goto out;
	}

	return 1;
out:
	release_region(tcobase, 0x10);
	return 0;
}

static int __devinit nv_tco_init(struct platform_device *dev)
{
	int ret;

	/* Check whether or not the hardware watchdog is there */
	if (!nv_tco_getdevice())
		return -ENODEV;
开发者ID:303750856,项目名称:linux-3.1,代码行数:66,代码来源:nv_tco.c

示例2: io_int_set

void  io_int_set(unsigned int u32addr, unsigned int u32data)
{
	ioperm(u32addr,4, 1); // ioperm(address from, byte num, enable or disable);
	outl(u32data, u32addr );
}
开发者ID:wupeiing,项目名称:lfdk1,代码行数:5,代码来源:lfdk.c

示例3: execute_release_code

static void execute_release_code(pci_list* x)
{
  int pos;
  u8* releasecode;

  if (!x->releasecode)
    return;
  pos=0;
  releasecode=x->releasecode;

  cli();
  while (1) {
    int basenum=releasecode[pos];
    int type=releasecode[pos+2];
    unsigned int base=x->dev->resource[basenum].start;
    int io=(x->dev->resource[basenum].flags&1);
    unsigned int offset;
    unsigned int val;
    int len;
    unsigned int i;
    int op=releasecode[pos+1];

    pos+=2; /* skip base/op */
    if (type&0x40) {
      offset=((u32)releasecode[pos+2]<<8)|
	((u32)releasecode[pos+3]<<0);
      pos+=2;
    }
    else {
      offset=releasecode[pos+1];
    }      
    pos+=2; /* skip type/offset */
    switch(type) {
    case 0x80:
    case 0xc0: len=4; break;
    case 0x90:
    case 0xd0: len=2; break;
    case 0xa0:
    case 0xe0: len=1; break;
    default:
      sti();
      return;
    }
    val=0;
    for (i=0;i<len;i++)
      val=(val<<8)+releasecode[pos+i];

    printk("op %d: base %x, offset %x, val %x, io=%d, len=%d\n",op,base,offset,val,io,len);

    switch(op) {
    case 0x00: 
      {/* write */
	if (io) {
	  switch(len) {
	  case 4: outl(val,base+offset); break;
	  case 2: outw(val,base+offset); break;
	  case 1: outb(val,base+offset); break;
	  }
	}
	else { /* memory */
	  unsigned long paddr=(unsigned long)bus_to_virt(base+offset);
	  void* addr=ioremap(paddr,4);

	  switch(len) {
	  case 4: *((u32*)addr)=val; break;
	  case 2: *((u16*)addr)=val; break;
	  case 1: *((u8*)addr)=val; break;
	  }
	  iounmap(addr);
	}
      }
      break;

    case 0x01: 
      { /* read */
	if (io) {
	  switch(len) {
	  case 4: dummy+=inl(base+offset); break;
	  case 2: dummy+=inw(base+offset); break;
	  case 1: dummy+=inb(base+offset); break;
	  }
	}
	else { /* memory */
	  unsigned long paddr=(unsigned long)bus_to_virt(base+offset);
	  void* addr=ioremap(paddr,4);

	  switch(len) {
	  case 4: dummy+=*((u32*)addr); break;
	  case 2: dummy+=*((u16*)addr); break;
	  case 1: dummy+=*((u8*)addr); break;
	  }
	  iounmap(addr);
	}
      }
      break;

    case 0x02: 
      { /* sleep */
	for (i=0;i<val;i++)
	  outb(0,0x80);
//.........这里部分代码省略.........
开发者ID:SnkBitten,项目名称:amithlon-revival,代码行数:101,代码来源:irq.c

示例4: w55fa93fb_stop_device

static void w55fa93fb_stop_device(void)
{
	outl((inl(REG_LCM_LCDCCtl)& 0xFFFEFFFE), REG_LCM_LCDCCtl);
}
开发者ID:me-oss,项目名称:me-linux,代码行数:4,代码来源:w55fa93_GOWORLD_GWMTF9360A.c

示例5: AROS_UFH3

static AROS_UFH3(void, Enumerator,
    AROS_UFHA(struct Hook *,    hook,   A0),
    AROS_UFHA(OOP_Object *,     device, A2),
    AROS_UFHA(APTR,             msg,    A1))
{
    AROS_USERFUNC_INIT

    ULONG VendorID,ProductID;
    int i;

    OOP_GetAttr(device, aHidd_PCIDevice_ProductID, &ProductID);
    OOP_GetAttr(device, aHidd_PCIDevice_VendorID, &VendorID);

    D(bug("[ac97] Found audio device %04x:%04x\n", VendorID, ProductID));

    for (i=0; support[i].VendorID; i++)
    {
	if (VendorID == support[i].VendorID && ProductID == support[i].ProductID)
	{
	    struct TagItem attrs[] = {
		{ aHidd_PCIDevice_isIO,	    TRUE },
		{ aHidd_PCIDevice_isMEM,    FALSE },
		{ aHidd_PCIDevice_isMaster, TRUE },
		{ TAG_DONE, 0UL },	
	    };
	    
	    D(bug("[ac97] Found supported '%s' card\n", support[i].Model));
	    ac97Base->cardfound = TRUE;
	    ac97Base->mixer_set_reg = i8x0_set_reg;
	    ac97Base->mixer_get_reg = i8x0_get_reg;

	    OOP_SetAttrs(device, (struct TagItem *)&attrs);

	    OOP_GetAttr(device, aHidd_PCIDevice_Base0, &ac97Base->mixerbase);
	    OOP_GetAttr(device, aHidd_PCIDevice_Base1, &ac97Base->dmabase);
	    OOP_GetAttr(device, aHidd_PCIDevice_INTLine, &ac97Base->irq_num);

	    D(bug("[ac97] Mixer IO base %x\n", ac97Base->mixerbase));
    	    D(bug("[ac97] DMA IO base %x\n", ac97Base->dmabase));

	    outl(2, ac97Base->dmabase + GLOB_CNT);
	    
	    ac97Base->mixer_set_reg(ac97Base, AC97_RESET, 0);
	    ac97Base->mixer_set_reg(ac97Base, AC97_POWERDOWN, 0);

	    /* Set master volume to no attenuation, mute off */
	    ac97Base->mixer_set_reg(ac97Base, AC97_MASTER_VOL,	    0x0000);
	    ac97Base->mixer_set_reg(ac97Base, AC97_HEADPHONE_VOL,   0x0000);
	    ac97Base->mixer_set_reg(ac97Base, AC97_TONE,	    0x0f0f);

	    D(bug("[ac97] Powerdown = %02x\n", ac97Base->mixer_get_reg(ac97Base, AC97_POWERDOWN)));
	    D(bug("[ac97] GLOB_CNT = %08x\n", inl(ac97Base->dmabase + GLOB_CNT)));
	    D(bug("[ac97] GLOB_STA = %08x\n", inl(ac97Base->dmabase + GLOB_STA)));
	    
/*
	    int i;
	    for (i=0; i < 64; i+=2)
	    {
		D(bug("[ac97] reg %02x = %04x\n", i, ac97Base->mixer_get_reg(ac97Base, i)));
	    }
*/
	    outl(ac97Base->PCM_out, ac97Base->dmabase + PO_BDBAR);
	    
	    D(bug("[ac97] PO_BDBAR=%08x\n", inl(ac97Base->dmabase + PO_BDBAR)));
	    D(bug("[ac97] PO_REGS=%08x\n", inl(ac97Base->dmabase + PO_CIV)));
	    D(bug("[ac97] PO_PICB=%04x\n", inw(ac97Base->dmabase + PO_PICB)));
	    D(bug("[ac97] PO_PIV=%02x\n", inb(ac97Base->dmabase + PO_PIV)));
	    D(bug("[ac97] PO_CR=%02x\n", inb(ac97Base->dmabase + PO_CR)));
	}
    }

    AROS_USERFUNC_EXIT
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:73,代码来源:ac97-init.c

示例6: hd64461_outsl

void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count)
{
	const unsigned long *buf=buffer;
	while(count--) outl(*buf++, port);
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:5,代码来源:io.c

示例7: w55fa93fb_init_device

static int w55fa93fb_init_device(struct w55fa93fb_info *fbi)
{
	unsigned int clock_div;
	

	// enable VPOST clock 	
	outl(inl(REG_AHBCLK) | VPOST_CKE | HCLK4_CKE , REG_AHBCLK);   // 27 MHz source
	
  	// Reset IP
	outl(inl(REG_AHBIPRST) | VPOSTRST, REG_AHBIPRST);
	outl(inl(REG_AHBIPRST) & ~VPOSTRST, REG_AHBIPRST);	

//	printk("w55fa93_upll_clock = 0x%x\n", w55fa93_upll_clock);		   	

//	w55fa93_upll_clock = 192000;
	clock_div = w55fa93_upll_clock / 28000;
	clock_div /= 2;
	clock_div &= 0xFF;
	
	// given clock divider for VPOST 
	outl((inl(REG_CLKDIV1) & ~VPOST_N0) | 1, REG_CLKDIV1);					// divider 2 in VPOST_N0
	outl((inl(REG_CLKDIV1) & ~VPOST_N1) | (clock_div << 8), REG_CLKDIV1);	
	
//	outl((inl(REG_CLKDIV1) & ~VPOST_S), REG_CLKDIV1);				// VPOST clock from UPLL
	outl((inl(REG_CLKDIV1) & ~VPOST_S) | (3<<3), REG_CLKDIV1);		// VPOST clock from UPLL

	// enable VPOST function pins
   	outl(inl(REG_GPBFUN) | MF_GPB15, REG_GPBFUN);						// enable LPCLK pin
   	outl(inl(REG_GPCFUN) | 0x0000FFFF, REG_GPCFUN);						// enable LVDATA[7:0] pins
   	outl(inl(REG_GPDFUN) | (MF_GPD10+MF_GPD9), REG_GPDFUN);	// enable HSYNC/VSYNC pins	   			
   	
	// configure LCD interface  // enable sync with TV, LCD type select 
   	outl(inl(REG_LCM_LCDCPrm)& ~LCDCPrm_LCDSynTv, REG_LCM_LCDCPrm);	// async with TV
   	outl((inl(REG_LCM_LCDCPrm)& ~LCDCPrm_LCDTYPE) | 0x01, REG_LCM_LCDCPrm);	// Sync-type TFT LCD
	/*
	0x0  // High Resolution mode
	0x1  // Sync-type TFT LCD
	0x2  // Sync-type Color STN LCD
	0x3  // MPU-type LCD
	*/
	outl((inl(REG_LCM_LCDCPrm)& ~LCDCPrm_LCDDataSel) | 0x0C, REG_LCM_LCDCPrm);	// RGB ThroughMode	

	GOWORLD_GWMTF9360A_Init();

	// configure LCD parallel data bus 
   	outl( (inl(REG_LCM_LCDCCtl)& ~LCDCCtl_PRDB_SEL) | (0x00 << 20), REG_LCM_LCDCCtl);	// 16-bit mode 
   	//outl( (inl(REG_LCM_LCDCCtl)& ~LCDCCtl_PRDB_SEL) | (0x01 << 20), REG_LCM_LCDCCtl);	// 18-bit mode 
	/*
	0x0  // 16-bit mode (RGB565 output)
	0x1  // 18-bit mode (RGB666 output)
	0x2  // 24-bit mode (RGB888 output)		
	*/
	
	// LCDSrc, TVSrc: Frame buffer; NotchE; enable TV encoder; NTSC; Frame Buffer Size:320x240; 
  	outl((inl(REG_LCM_TVCtl)& (~TVCtl_LCDSrc))|(0x00000400), REG_LCM_TVCtl);  

		  
	///outl((inl(REG_LCM_TVDisCtl)& 0xFE000000)|(0x00F016A0), REG_LCM_TVDisCtl);

   	// set Horizontal scanning line timing for Syn type LCD 
//	outl((inl(REG_LCM_TCON1)& 0xFF000000)|(0x00035555), REG_LCM_TCON1);
//	outl((inl(REG_LCM_TCON1)& 0xFF000000)|(0x000941D1), REG_LCM_TCON1);
	outl((inl(REG_LCM_TCON1)& 0xFF000000)|(0x0001C93B), REG_LCM_TCON1);	
	
	// set Vertical scanning line timing for Syn type LCD   
	outl((inl(REG_LCM_TCON2)& 0xFF000000)|(0x00001203), REG_LCM_TCON2);

	// set both "active pixel per line" and "active lines per screen" for Syn type LCD   
   	outl(0x03BF00F0, REG_LCM_TCON3);	// 320x240
   	
   	outl(0x01400102, REG_LCM_TCON4);	// signal polarity

	// set TV control register and LCD from frame buffer source
   	outl((inl(REG_LCM_TVCtl)& 0xFFFFF0DA)|(0x00000410), REG_LCM_TVCtl);   // DAC disable	
   	
	// enable LCD controller
	outl((inl(REG_LCM_LCDCCtl)& 0xFFFEFFF0)|(0x10003), REG_LCM_LCDCCtl);
	return 0;
}
开发者ID:me-oss,项目名称:me-linux,代码行数:79,代码来源:w55fa93_GOWORLD_GWMTF9360A.c

示例8: tulip_rx


//.........这里部分代码省略.........
#ifndef final_version
				if (tp->rx_buffers[entry].mapping !=
				    le32_to_cpu(tp->rx_ring[entry].buffer1)) {
					printk(KERN_ERR "%s: Internal fault: The skbuff addresses "
					       "do not match in tulip_rx: %08x vs. %Lx %p / %p.\n",
					       dev->name,
					       le32_to_cpu(tp->rx_ring[entry].buffer1),
					       (long long)tp->rx_buffers[entry].mapping,
					       skb->head, temp);
				}
#endif

				pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping,
						 PKT_BUF_SZ, PCI_DMA_FROMDEVICE);

				tp->rx_buffers[entry].skb = NULL;
				tp->rx_buffers[entry].mapping = 0;
			}
			skb->protocol = eth_type_trans(skb, dev);
#ifdef CONFIG_NET_HW_FLOWCONTROL
                        mit_sel =
#endif
			netif_rx(skb);

#ifdef CONFIG_NET_HW_FLOWCONTROL
                        switch (mit_sel) {
                        case NET_RX_SUCCESS:
                        case NET_RX_CN_LOW:
                        case NET_RX_CN_MOD:
                                break;

                        case NET_RX_CN_HIGH:
                                rx_work_limit -= NET_RX_CN_HIGH; /* additional*/
                                break;
                        case NET_RX_DROP:
                                rx_work_limit = -1;
                                break;
                        default:
                                printk("unknown feedback return code %d\n", mit_sel);
                                break;
                        }

                        drop = atomic_read(&netdev_dropping);
                        if (drop) {
throttle:
                                rx_work_limit = -1;
                                mit_sel = NET_RX_DROP;

                                if (tp->fc_bit) {
                                        long ioaddr = dev->base_addr;

                                        /* disable Rx & RxNoBuf ints. */
                                        outl(tulip_tbl[tp->chip_id].valid_intrs&RX_A_NBF_STOP, ioaddr + CSR7);
                                        set_bit(tp->fc_bit, &netdev_fc_xoff);
                                }
                        }
#endif
			dev->last_rx = jiffies;
			tp->stats.rx_packets++;
			tp->stats.rx_bytes += pkt_len;
		}
		received++;
		entry = (++tp->cur_rx) % RX_RING_SIZE;
	}
#ifdef CONFIG_NET_HW_FLOWCONTROL

        /* We use this simplistic scheme for IM. It's proven by
           real life installations. We can have IM enabled
           continuesly but this would cause unnecessary latency.
           Unfortunely we can't use all the NET_RX_* feedback here.
           This would turn on IM for devices that is not contributing
           to backlog congestion with unnecessary latency.

           We monitor the device RX-ring and have:

           HW Interrupt Mitigation either ON or OFF.

           ON:  More then 1 pkt received (per intr.) OR we are dropping
           OFF: Only 1 pkt received

           Note. We only use min and max (0, 15) settings from mit_table */


        if( tp->flags &  HAS_INTR_MITIGATION) {
                if((received > 1 || mit_sel == NET_RX_DROP)
                   && tp->mit_sel != 15 ) {
                        tp->mit_sel = 15;
                        tp->mit_change = 1; /* Force IM change */
                }
                if((received <= 1 && mit_sel != NET_RX_DROP) && tp->mit_sel != 0 ) {
                        tp->mit_sel = 0;
                        tp->mit_change = 1; /* Force IM change */
                }
        }

        return RX_RING_SIZE+1; /* maxrx+1 */
#else
	return received;
#endif
}
开发者ID:xricson,项目名称:knoppix,代码行数:101,代码来源:interrupt.c

示例9: tulip_interrupt

/* The interrupt handler does all of the Rx thread work and cleans up
   after the Tx thread. */
irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
{
	struct net_device *dev = (struct net_device *)dev_instance;
	struct tulip_private *tp = (struct tulip_private *)dev->priv;
	long ioaddr = dev->base_addr;
	int csr5;
	int entry;
	int missed;
	int rx = 0;
	int tx = 0;
	int oi = 0;
	int maxrx = RX_RING_SIZE;
	int maxtx = TX_RING_SIZE;
	int maxoi = TX_RING_SIZE;
	unsigned int work_count = tulip_max_interrupt_work;
	unsigned int handled = 0;

	/* Let's see whether the interrupt really is for us */
	csr5 = inl(ioaddr + CSR5);

        if (tp->flags & HAS_PHY_IRQ) 
	        handled = phy_interrupt (dev);
    
	if ((csr5 & (NormalIntr|AbnormalIntr)) == 0)
		return IRQ_RETVAL(handled);

	tp->nir++;

	do {
		/* Acknowledge all of the current interrupt sources ASAP. */
		outl(csr5 & 0x0001ffff, ioaddr + CSR5);

		if (tulip_debug > 4)
			printk(KERN_DEBUG "%s: interrupt  csr5=%#8.8x new csr5=%#8.8x.\n",
				   dev->name, csr5, inl(dev->base_addr + CSR5));

		if (csr5 & (RxIntr | RxNoBuf)) {
#ifdef CONFIG_NET_HW_FLOWCONTROL
                        if ((!tp->fc_bit) ||
			    (!test_bit(tp->fc_bit, &netdev_fc_xoff)))
#endif
				rx += tulip_rx(dev);
			tulip_refill_rx(dev);
		}

		if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) {
			unsigned int dirty_tx;

			spin_lock(&tp->lock);

			for (dirty_tx = tp->dirty_tx; tp->cur_tx - dirty_tx > 0;
				 dirty_tx++) {
				int entry = dirty_tx % TX_RING_SIZE;
				int status = le32_to_cpu(tp->tx_ring[entry].status);

				if (status < 0)
					break;			/* It still has not been Txed */

				/* Check for Rx filter setup frames. */
				if (tp->tx_buffers[entry].skb == NULL) {
					/* test because dummy frames not mapped */
					if (tp->tx_buffers[entry].mapping)
						pci_unmap_single(tp->pdev,
							 tp->tx_buffers[entry].mapping,
							 sizeof(tp->setup_frame),
							 PCI_DMA_TODEVICE);
					continue;
				}

				if (status & 0x8000) {
					/* There was an major error, log it. */
#ifndef final_version
					if (tulip_debug > 1)
						printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n",
							   dev->name, status);
#endif
					tp->stats.tx_errors++;
					if (status & 0x4104) tp->stats.tx_aborted_errors++;
					if (status & 0x0C00) tp->stats.tx_carrier_errors++;
					if (status & 0x0200) tp->stats.tx_window_errors++;
					if (status & 0x0002) tp->stats.tx_fifo_errors++;
					if ((status & 0x0080) && tp->full_duplex == 0)
						tp->stats.tx_heartbeat_errors++;
				} else {
					tp->stats.tx_bytes +=
						tp->tx_buffers[entry].skb->len;
					tp->stats.collisions += (status >> 3) & 15;
					tp->stats.tx_packets++;
				}

				pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping,
						 tp->tx_buffers[entry].skb->len,
						 PCI_DMA_TODEVICE);

				/* Free the original skb. */
				dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
				tp->tx_buffers[entry].skb = NULL;
				tp->tx_buffers[entry].mapping = 0;
//.........这里部分代码省略.........
开发者ID:xricson,项目名称:knoppix,代码行数:101,代码来源:interrupt.c

示例10: serial_out

static inline void serial_out(int offset, int value)
{
	outl(value,  uart_base + offset);
}
开发者ID:gonzopancho,项目名称:asuswrt,代码行数:4,代码来源:printf.c

示例11: serial_out

static __inline__ void serial_out(struct async_struct *info, int offset,
				int value)
{
	outl(value, info->port+(offset<<2));
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:5,代码来源:gdb_hook.c

示例12: t21142_timer

/* Handle the 21143 uniquely: do autoselect with NWay, not the EEPROM list
   of available transceivers.  */
void t21142_timer(unsigned long data)
{
#if 0
	/*RTnet*/struct rtnet_device *rtdev = (/*RTnet*/struct rtnet_device *)data;
	struct tulip_private *tp = (struct tulip_private *)rtdev->priv;
	long ioaddr = rtdev->base_addr;
	int csr12 = inl(ioaddr + CSR12);
	int next_tick = 60*HZ;
	int new_csr6 = 0;

	if (tulip_debug > 2)
		/*RTnet*/rtdm_printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n",
			   rtdev->name, csr12, medianame[rtdev->if_port]);
	if (tulip_media_cap[rtdev->if_port] & MediaIsMII) {
		tulip_check_duplex(dev);
		next_tick = 60*HZ;
	} else if (tp->nwayset) {
		/* Don't screw up a negotiated session! */
		if (tulip_debug > 1)
			/*RTnet*/rtdm_printk(KERN_INFO"%s: Using NWay-set %s media, csr12 %8.8x.\n",
				   rtdev->name, medianame[rtdev->if_port], csr12);
	} else if (tp->medialock) {
			;
	} else if (rtdev->if_port == 3) {
		if (csr12 & 2) {	/* No 100mbps link beat, revert to 10mbps. */
			if (tulip_debug > 1)
				/*RTnet*/rtdm_printk(KERN_INFO"%s: No 21143 100baseTx link beat, %8.8x, "
					   "trying NWay.\n", rtdev->name, csr12);
			t21142_start_nway(dev);
			next_tick = 3*HZ;
		}
	} else if ((csr12 & 0x7000) != 0x5000) {
		/* Negotiation failed.  Search media types. */
		if (tulip_debug > 1)
			/*RTnet*/rtdm_printk(KERN_INFO"%s: 21143 negotiation failed, status %8.8x.\n",
				   rtdev->name, csr12);
		if (!(csr12 & 4)) {		/* 10mbps link beat good. */
			new_csr6 = 0x82420000;
			rtdev->if_port = 0;
			outl(0, ioaddr + CSR13);
			outl(0x0003FFFF, ioaddr + CSR14);
			outw(t21142_csr15[rtdev->if_port], ioaddr + CSR15);
			outl(t21142_csr13[rtdev->if_port], ioaddr + CSR13);
		} else {
			/* Select 100mbps port to check for link beat. */
			new_csr6 = 0x83860000;
			rtdev->if_port = 3;
			outl(0, ioaddr + CSR13);
			outl(0x0003FF7F, ioaddr + CSR14);
			outw(8, ioaddr + CSR15);
			outl(1, ioaddr + CSR13);
		}
		if (tulip_debug > 1)
			/*RTnet*/rtdm_printk(KERN_INFO"%s: Testing new 21143 media %s.\n",
				   rtdev->name, medianame[rtdev->if_port]);
		if (new_csr6 != (tp->csr6 & ~0x00D5)) {
			tp->csr6 &= 0x00D5;
			tp->csr6 |= new_csr6;
			outl(0x0301, ioaddr + CSR12);
			tulip_restart_rxtx(tp);
		}
		next_tick = 3*HZ;
	}

	/* mod_timer synchronizes us with potential add_timer calls
	 * from interrupts.
	 */
	/*RTnet*/MUST_REMOVE_mod_timer(&tp->timer, RUN_AT(next_tick));
#endif
}
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:72,代码来源:21142.c

示例13: t21142_lnk_change

void t21142_lnk_change(/*RTnet*/struct rtnet_device *rtdev, int csr5)
{
	struct tulip_private *tp = (struct tulip_private *)rtdev->priv;
	long ioaddr = rtdev->base_addr;
	int csr12 = inl(ioaddr + CSR12);

	if (tulip_debug > 1)
		/*RTnet*/rtdm_printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, "
			   "%8.8x.\n", rtdev->name, csr12, csr5, inl(ioaddr + CSR14));

	/* If NWay finished and we have a negotiated partner capability. */
	if (tp->nway  &&  !tp->nwayset  &&  (csr12 & 0x7000) == 0x5000) {
		int setup_done = 0;
		int negotiated = tp->sym_advertise & (csr12 >> 16);
		tp->lpar = csr12 >> 16;
		tp->nwayset = 1;
		if (negotiated & 0x0100)		rtdev->if_port = 5;
		else if (negotiated & 0x0080)	rtdev->if_port = 3;
		else if (negotiated & 0x0040)	rtdev->if_port = 4;
		else if (negotiated & 0x0020)	rtdev->if_port = 0;
		else {
			tp->nwayset = 0;
			if ((csr12 & 2) == 0  &&  (tp->sym_advertise & 0x0180))
				rtdev->if_port = 3;
		}
		tp->full_duplex = (tulip_media_cap[rtdev->if_port] & MediaAlwaysFD) ? 1:0;

		if (tulip_debug > 1) {
			if (tp->nwayset)
				/*RTnet*/rtdm_printk(KERN_INFO "%s: Switching to %s based on link "
					   "negotiation %4.4x & %4.4x = %4.4x.\n",
					   rtdev->name, medianame[rtdev->if_port], tp->sym_advertise,
					   tp->lpar, negotiated);
			else
				/*RTnet*/rtdm_printk(KERN_INFO "%s: Autonegotiation failed, using %s,"
					   " link beat status %4.4x.\n",
					   rtdev->name, medianame[rtdev->if_port], csr12);
		}

		if (tp->mtable) {
			int i;
			for (i = 0; i < tp->mtable->leafcount; i++)
				if (tp->mtable->mleaf[i].media == rtdev->if_port) {
					int startup = ! ((tp->chip_id == DC21143 && tp->revision == 65));
					tp->cur_index = i;
					tulip_select_media(rtdev, startup);
					setup_done = 1;
					break;
				}
		}
		if ( ! setup_done) {
			tp->csr6 = (rtdev->if_port & 1 ? 0x838E0000 : 0x82420000) | (tp->csr6 & 0x20ff);
			if (tp->full_duplex)
				tp->csr6 |= 0x0200;
			outl(1, ioaddr + CSR13);
		}
#if 0							/* Restart shouldn't be needed. */
		outl(tp->csr6 | RxOn, ioaddr + CSR6);
		if (tulip_debug > 2)
			/*RTnet*/rtdm_printk(KERN_DEBUG "%s:  Restarting Tx and Rx, CSR5 is %8.8x.\n",
				   rtdev->name, inl(ioaddr + CSR5));
#endif
		tulip_start_rxtx(tp);
		if (tulip_debug > 2)
			/*RTnet*/rtdm_printk(KERN_DEBUG "%s:  Setting CSR6 %8.8x/%x CSR12 %8.8x.\n",
				   rtdev->name, tp->csr6, inl(ioaddr + CSR6),
				   inl(ioaddr + CSR12));
	} else if ((tp->nwayset  &&  (csr5 & 0x08000000)
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:68,代码来源:21142.c

示例14: dhahelper_port

static int dhahelper_port(dhahelper_port_t * arg)
{
	dhahelper_port_t port;
	if (copy_from_user(&port, arg, sizeof(dhahelper_port_t)))
	{
		if (dhahelper_verbosity > 0)
		    printk(KERN_ERR "dhahelper: failed copy from userspace\n");
		return -EFAULT;
	}
	switch(port.operation)
	{
		case PORT_OP_READ:
		{
		    switch(port.size)
		    {
			case 1:
			    port.value = inb(port.addr);
			    break;
			case 2:
			    port.value = inw(port.addr);
			    break;
			case 4:
			    port.value = inl(port.addr);
			    break;
			default:
			    if (dhahelper_verbosity > 0)
				printk(KERN_ERR "dhahelper: invalid port read size (%d)\n",
				    port.size);
			    return -EINVAL;
		    }
		    break;
		}
		case PORT_OP_WRITE:
		{
		    switch(port.size)
		    {
			case 1:
			    outb(port.value, port.addr);
			    break;
			case 2:
			    outw(port.value, port.addr);
			    break;
			case 4:
			    outl(port.value, port.addr);
			    break;
			default:
			    if (dhahelper_verbosity > 0)
				printk(KERN_ERR "dhahelper: invalid port write size (%d)\n",
				    port.size);
			    return -EINVAL;
		    }
		    break;
		}
		default:
		    if (dhahelper_verbosity > 0)
		        printk(KERN_ERR "dhahelper: invalid port operation (%d)\n",
		    	    port.operation);
		    return -EINVAL;
	}
	/* copy back only if read was performed */
	if (port.operation == PORT_OP_READ)
	if (copy_to_user(arg, &port, sizeof(dhahelper_port_t)))
	{
		if (dhahelper_verbosity > 0)
		    printk(KERN_ERR "dhahelper: failed copy to userspace\n");
		return -EFAULT;
	}
	return 0;
}
开发者ID:Caught,项目名称:openpliPC,代码行数:69,代码来源:dhahelper.c

示例15: rdc321x_conf_or

static inline void rdc321x_conf_or(unsigned addr, u32 value)
{
	outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR);
	value |= inl(RDC3210_CFGREG_DATA);
	outl(value, RDC3210_CFGREG_DATA);
}
开发者ID:10x-Amin,项目名称:x10_Th_kernel,代码行数:6,代码来源:gpio.c


注:本文中的outl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。