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


C++ IO_STATE函数代码示例

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


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

示例1: flush_tlb_page

void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
{
	struct mm_struct *mm = vma->vm_mm;
	int page_id = mm->context.page_id;
	int i;
	unsigned long flags;

	D(printk("tlb: flush page %p in context %d (%p)\n", addr, page_id, mm));

	if(page_id == NO_CONTEXT)
		return;

	addr &= PAGE_MASK; 


	local_irq_save(flags);
	for(i = 0; i < NUM_TLB_ENTRIES; i++) {
		unsigned long tlb_hi;
		*R_TLB_SELECT = IO_FIELD(R_TLB_SELECT, index, i);
		tlb_hi = *R_TLB_HI;
		if (IO_EXTRACT(R_TLB_HI, page_id, tlb_hi) == page_id &&
		    (tlb_hi & PAGE_MASK) == addr) {
			*R_TLB_HI = IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
				addr; 

			*R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no  ) |
				      IO_STATE(R_TLB_LO, valid, no  ) |
				      IO_STATE(R_TLB_LO, kernel,no  ) |
				      IO_STATE(R_TLB_LO, we,    no  ) |
				      IO_FIELD(R_TLB_LO, pfn,   0   ) );
		}
	}
	local_irq_restore(flags);
}
开发者ID:Blackburn29,项目名称:PsycoKernel,代码行数:34,代码来源:tlb.c

示例2: i2c_init

static int __init
i2c_init(void)
{
	int res;

	/* Setup and enable the Port B I2C interface */

#ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
	*R_PORT_PB_I2C = port_pb_i2c_shadow |= 
		IO_STATE(R_PORT_PB_I2C, i2c_en,  on) |
		IO_FIELD(R_PORT_PB_I2C, i2c_d,   1)  |
		IO_FIELD(R_PORT_PB_I2C, i2c_clk, 1)  |
		IO_STATE(R_PORT_PB_I2C, i2c_oe_, enable);
#endif

	port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir0);
	port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir1);

	*R_PORT_PB_DIR = (port_pb_dir_shadow |=
			  IO_STATE(R_PORT_PB_DIR, dir0, input)  |
			  IO_STATE(R_PORT_PB_DIR, dir1, output));

	/* register char device */

	res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
	if(res < 0) {
		printk(KERN_ERR "i2c: couldn't get a major number.\n");
		return res;
	}

	printk("I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
	
	return 0;
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:34,代码来源:i2c.c

示例3: ds1302_init

int __init
ds1302_init(void) 
{ 
	if (!ds1302_probe()) {
#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
#if CONFIG_ETRAX_DS1302_RSTBIT == 27
		/*
		 * The only way to set g27 to output is to enable ATA.
		 *
		 * Make sure that R_GEN_CONFIG is setup correct.
		 */
    		genconfig_shadow = ((genconfig_shadow &
				     ~IO_MASK(R_GEN_CONFIG, ata)) | 
				   (IO_STATE(R_GEN_CONFIG, ata, select)));    
    		*R_GEN_CONFIG = genconfig_shadow;
#elif CONFIG_ETRAX_DS1302_RSTBIT == 0
		
		/* Set the direction of this bit to out. */		
    		genconfig_shadow = ((genconfig_shadow &
				     ~IO_MASK(R_GEN_CONFIG, g0dir)) | 
				   (IO_STATE(R_GEN_CONFIG, g0dir, out)));    
    		*R_GEN_CONFIG = genconfig_shadow;
#endif
		if (!ds1302_probe())
      			return -1;
#else
    		return -1;
#endif
  	}
  
	/* Initialise trickle charger */
	ds1302_writereg(RTC_TRICKLECHARGER,
			RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F));
	return 0;
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:35,代码来源:ds1302.c

示例4: flush_tlb_all

void
flush_tlb_all(void)
{
	int i;
	unsigned long flags;

	/* the vpn of i & 0xf is so we dont write similar TLB entries
	 * in the same 4-way entry group. details.. 
	 */

	save_and_cli(flags); /* flush needs to be atomic */
	for(i = 0; i < NUM_TLB_ENTRIES; i++) {
		*R_TLB_SELECT = ( IO_FIELD(R_TLB_SELECT, index, i) );
		*R_TLB_HI = ( IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
			      IO_FIELD(R_TLB_HI, vpn,     i & 0xf ) );
		
		*R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no       ) |
			      IO_STATE(R_TLB_LO, valid, no       ) |
			      IO_STATE(R_TLB_LO, kernel,no	 ) |
			      IO_STATE(R_TLB_LO, we,    no       ) |
			      IO_FIELD(R_TLB_LO, pfn,   0        ) );
	}
	restore_flags(flags);
	D(printk("tlb: flushed all\n"));
}
开发者ID:Picture-Elements,项目名称:linux-2.4-peijse,代码行数:25,代码来源:tlb.c

示例5: flush_tlb_mm

void
flush_tlb_mm(struct mm_struct *mm)
{
	int i;
	int page_id = mm->context;
	unsigned long flags;

	D(printk("tlb: flush mm context %d (%p)\n", page_id, mm));

	if(page_id == NO_CONTEXT)
		return;
	
	/* mark the TLB entries that match the page_id as invalid.
	 * here we could also check the _PAGE_GLOBAL bit and NOT flush
	 * global pages. is it worth the extra I/O ? 
	 */

	save_and_cli(flags);  /* flush needs to be atomic */
	for(i = 0; i < NUM_TLB_ENTRIES; i++) {
		*R_TLB_SELECT = IO_FIELD(R_TLB_SELECT, index, i);
		if (IO_EXTRACT(R_TLB_HI, page_id, *R_TLB_HI) == page_id) {
			*R_TLB_HI = ( IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
				      IO_FIELD(R_TLB_HI, vpn,     i & 0xf ) );
			
			*R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no  ) |
				      IO_STATE(R_TLB_LO, valid, no  ) |
				      IO_STATE(R_TLB_LO, kernel,no  ) |
				      IO_STATE(R_TLB_LO, we,    no  ) |
				      IO_FIELD(R_TLB_LO, pfn,   0   ) );
		}
	}
	restore_flags(flags);
}
开发者ID:Picture-Elements,项目名称:linux-2.4-peijse,代码行数:33,代码来源:tlb.c

示例6: flush_tlb_mm

void
flush_tlb_mm(struct mm_struct *mm)
{
	int i;
	int page_id = mm->context.page_id;
	unsigned long flags;

	D(printk("tlb: flush mm context %d (%p)\n", page_id, mm));

	if(page_id == NO_CONTEXT)
		return;


	local_irq_save(flags);
	for(i = 0; i < NUM_TLB_ENTRIES; i++) {
		*R_TLB_SELECT = IO_FIELD(R_TLB_SELECT, index, i);
		if (IO_EXTRACT(R_TLB_HI, page_id, *R_TLB_HI) == page_id) {
			*R_TLB_HI = ( IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
				      IO_FIELD(R_TLB_HI, vpn,     i & 0xf ) );

			*R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no  ) |
				      IO_STATE(R_TLB_LO, valid, no  ) |
				      IO_STATE(R_TLB_LO, kernel,no  ) |
				      IO_STATE(R_TLB_LO, we,    no  ) |
				      IO_FIELD(R_TLB_LO, pfn,   0   ) );
		}
	}
	local_irq_restore(flags);
}
开发者ID:Blackburn29,项目名称:PsycoKernel,代码行数:29,代码来源:tlb.c

示例7: D

void *dma_memcpy(void *pdst,
         const void *psrc,
         unsigned int pn)
{
    static etrax_dma_descr indma, outdma;
    
    D(printk("dma_memcpy %d bytes... ", pn));

#if 0
    *R_GEN_CONFIG = genconfig_shadow = 
        (genconfig_shadow & ~0x3c0000) |
        IO_STATE(R_GEN_CONFIG, dma6, intdma7) |
        IO_STATE(R_GEN_CONFIG, dma7, intdma6);
#endif
    indma.sw_len = outdma.sw_len = pn;
    indma.ctrl = d_eol | d_eop;
    outdma.ctrl = d_eol;
    indma.buf = psrc;
    outdma.buf = pdst;

    *R_DMA_CH6_FIRST = &indma;
    *R_DMA_CH7_FIRST = &outdma;
    *R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, start);
    *R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, start);
    
    while(*R_DMA_CH7_CMD == 1) /* wait for completion */ ;

    D(printk("done\n"));

}
开发者ID:274914765,项目名称:C,代码行数:30,代码来源:dmacopy.c

示例8: enableDebugIRQ

void
enableDebugIRQ(void)
{
	*R_IRQ_MASK1_SET = port->irq;
	/* use R_VECT_MASK directly, since we really bypass Linux normal
	 * IRQ handling in kgdb anyway, we don't need to use enable_irq
	 */
	*R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);

	*port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:11,代码来源:debugport.c

示例9: enableDebugIRQ

void
enableDebugIRQ(void)
{
	if (!kgdb_port)
		return;

	*R_IRQ_MASK1_SET = kgdb_port->irq;
	/*                                                              
                                                                
  */
	*R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);

	*kgdb_port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:14,代码来源:debugport.c

示例10: ds1302_init

int __init
ds1302_init(void) 
{
#ifdef CONFIG_ETRAX_I2C
	i2c_init();
#endif

	if (!ds1302_probe()) {
#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
#if CONFIG_ETRAX_DS1302_RSTBIT == 27
		/*
		 * The only way to set g27 to output is to enable ATA.
		 *
		 * Make sure that R_GEN_CONFIG is setup correct.
		 */
		/* Allocating the ATA interface will grab almost all
		 * pins in I/O groups a, b, c and d.  A consequence of
		 * allocating the ATA interface is that the fixed
		 * interfaces shared RAM, parallel port 0, parallel
		 * port 1, parallel port W, SCSI-8 port 0, SCSI-8 port
		 * 1, SCSI-W, serial port 2, serial port 3,
		 * synchronous serial port 3 and USB port 2 and almost
		 * all GPIO pins on port g cannot be used.
		 */
		if (cris_request_io_interface(if_ata, "ds1302/ATA")) {
			printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
			return -1;
		}

#elif CONFIG_ETRAX_DS1302_RSTBIT == 0
		if (cris_io_interface_allocate_pins(if_gpio_grp_a,
						    'g',
						    CONFIG_ETRAX_DS1302_RSTBIT,
						    CONFIG_ETRAX_DS1302_RSTBIT)) {
			printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
			return -1;
		}

		/* Set the direction of this bit to out. */
		genconfig_shadow = ((genconfig_shadow &
 				     ~IO_MASK(R_GEN_CONFIG, g0dir)) |
 				   (IO_STATE(R_GEN_CONFIG, g0dir, out)));
		*R_GEN_CONFIG = genconfig_shadow;
#endif
		if (!ds1302_probe()) {
			printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
			return -1;
		}
#else
		printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
		return -1;
#endif
  	}
	/* Initialise trickle charger */
	ds1302_writereg(RTC_TRICKLECHARGER,
			RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F));
        /* Start clock by resetting CLOCK_HALT */
	ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F));
	return 0;
}
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:60,代码来源:ds1302.c

示例11: hard_reset_now

void hard_reset_now (void)
{
    /*
     * Don't declare this variable elsewhere.  We don't want any other
     * code to know about it than the watchdog handler in entry.S and
     * this code, implementing hard reset through the watchdog.
     */
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
    extern int cause_of_death;
#endif

    printk("*** HARD RESET ***\n");
    local_irq_disable();

#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
    cause_of_death = 0xbedead;
#else
    /* Since we dont plan to keep on resetting the watchdog,
       the key can be arbitrary hence three */
    *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, 3) |
                  IO_STATE(R_WATCHDOG, enable, start);
#endif

    while(1) /* waiting for RETRIBUTION! */ ;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:25,代码来源:process.c

示例12: ds1302_init

int __init
ds1302_init(void) 
{ 
	if (!ds1302_probe()) {
#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
		/*
		 * The only way to set g27 to output is to enable ATA.
		 *
		 * Make sure that R_GEN_CONFIG is setup correct.
		 */
    		genconfig_shadow = ((genconfig_shadow &
				     ~IO_MASK(R_GEN_CONFIG, ata))
				   | 
				   (IO_STATE(R_GEN_CONFIG, ata, select)));    
    		*R_GEN_CONFIG = genconfig_shadow;
    		if (!ds1302_probe())
      			return -1;
#else
    		return -1;
#endif
  	}
  
	if (register_chrdev(RTC_MAJOR_NR, ds1302_name, &rtc_fops)) {
		printk(KERN_INFO "%s: unable to get major %d for rtc\n", 
		       ds1302_name, RTC_MAJOR_NR);
		return -1;
	}
	return 0;
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:29,代码来源:ds1302.c

示例13: iobase_unsupported

/* Internal methods */
static PyObject *
iobase_unsupported(const char *message)
{
    _PyIO_State *state = IO_STATE();
    if (state != NULL)
        PyErr_SetString(state->unsupported_operation, message);
    return NULL;
}
开发者ID:Apoorvadabhere,项目名称:cpython,代码行数:9,代码来源:iobase.c

示例14: do_multiple_IRQ

/* Handle multiple IRQs */
void do_multiple_IRQ(struct pt_regs* regs)
{
	int bit;
	unsigned masked;
	unsigned mask;
	unsigned ethmask = 0;

	/* Get interrupts to mask and handle */
	mask = masked = *R_VECT_MASK_RD;

	/* Never mask timer IRQ */
	mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0));

	/*
	 * If either ethernet interrupt (rx or tx) is active then block
	 * the other one too. Unblock afterwards also.
	 */
	if (mask &
	    (IO_STATE(R_VECT_MASK_RD, dma0, active) |
	     IO_STATE(R_VECT_MASK_RD, dma1, active))) {
		ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) |
			   IO_MASK(R_VECT_MASK_RD, dma1));
	}

	/* Block them */
	*R_VECT_MASK_CLR = (mask | ethmask);

	/* An extra irq_enter here to prevent softIRQs to run after
	 * each do_IRQ. This will decrease the interrupt latency.
	 */
	irq_enter();

	/* Handle all IRQs */
	for (bit = 2; bit < 32; bit++) {
		if (masked & (1 << bit)) {
			do_IRQ(bit, regs);
		}
	}

	/* This irq_exit() will trigger the soft IRQs. */
	irq_exit();

	/* Unblock the IRQs again */
	*R_VECT_MASK_SET = (masked | ethmask);
}
开发者ID:10x-Amin,项目名称:nAa-kernel,代码行数:46,代码来源:irq.c

示例15: do_multiple_IRQ

void do_multiple_IRQ(struct pt_regs* regs)
{
	int bit;
	unsigned masked;
	unsigned mask;
	unsigned ethmask = 0;

	/*                                   */
	mask = masked = *R_VECT_MASK_RD;

	/*                      */
	mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0));

	/*
                                                                
                                               
  */
	if (mask &
	    (IO_STATE(R_VECT_MASK_RD, dma0, active) |
	     IO_STATE(R_VECT_MASK_RD, dma1, active))) {
		ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) |
			   IO_MASK(R_VECT_MASK_RD, dma1));
	}

	/*            */
	*R_VECT_MASK_CLR = (mask | ethmask);

	/*                                                         
                                                          
  */
	irq_enter();

	/*                 */
	for (bit = 2; bit < 32; bit++) {
		if (masked & (1 << bit)) {
			do_IRQ(bit, regs);
		}
	}

	/*                                             */
	irq_exit();

	/*                        */
	*R_VECT_MASK_SET = (masked | ethmask);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:45,代码来源:irq.c


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