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


C++ setreg函数代码示例

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


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

示例1: prelabel

static void prelabel(Node p) {
	if (p == NULL)
		return;
	prelabel(p->kids[0]);
	prelabel(p->kids[1]);
	if (NeedsReg[opindex(p->op)])
		setreg(p, (*IR->x.rmap)(opkind(p->op)));
	switch (generic(p->op)) {
	case ADDRF: case ADDRL:
		if (p->syms[0]->sclass == REGISTER)
			p->op = VREG+P;
		break;
	case INDIR:
		if (p->kids[0]->op == VREG+P)
			setreg(p, p->kids[0]->syms[0]);
		break;
	case ASGN:
		if (p->kids[0]->op == VREG+P)
			rtarget(p, 1, p->kids[0]->syms[0]);
		break;
	case CVI: case CVU: case CVP:
		if (optype(p->op) != F
		&&  opsize(p->op) <= p->syms[0]->u.c.v.i)
			p->op = LOAD + opkind(p->op);
		break;
	}
	(IR->x.target)(p);
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:28,代码来源:gen.c

示例2: omap_set_lcd_mode

static void
omap_set_lcd_mode(int w, int h)
{
    uint32 DISPC = DISPC_BASE;
    unsigned int i;
    struct video_mode *m;

    dprintf("omap3: set_lcd_mode %d,%d\n", w, h);

    for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++) {
        if (w <= modes[i].width
                && h <= modes[i].height)
            goto found;
    }
    i -= 1;
found:
    m = &modes[i];

    dprintf("omap3: found mode[%s]\n", m->name);

    setreg(DISPC, DISPC_SIZE_LCD, (m->width - 1) | ((m->height - 1) << 16));
    setreg(DISPC, DISPC_TIMING_H, m->dispc_timing_h);
    setreg(DISPC, DISPC_TIMING_V, m->dispc_timing_v);

    modreg(DISPC, DISPC_DIVISOR, 0xffff, m->dispc_divisor);
    modaddr(CM_CLKSEL_DSS, 0xffff, m->dss_divisor);

    // Tell hardware to update, and wait for it
    modreg(DISPC, DISPC_CONTROL,
           DISPC_GOLCD,
           DISPC_GOLCD);

    while ((readreg(DISPC, DISPC_CONTROL) & DISPC_GOLCD))
        ;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:35,代码来源:arch_framebuffer_omap3.cpp

示例3: if

//set the MOV
void MOV::set(int type1, intptr_t val1, int type2, intptr_t val2) {
	//MOV-exclusive specials
	if (val1 == EAX && isreg(type1) && type2 == ptrfromreg(type1)) {
		MEMPTR* memptr = (MEMPTR*)(val2);
		if (memptr->reg1 == -1) {
			if (type1 == TREG32)
				bytes.assign("\xA1").append(to4bytes(memptr->constant));
			else if (type1 == TREG16)
				bytes.assign("\x66\xA1").append(to4bytes(memptr->constant));
			else if (type1 == TREG8)
				bytes.assign("\xA0").append(to4bytes(memptr->constant));
			if (memptr->deletable)
				delete memptr;
			return;
		}
	} else if (val2 == EAX && isreg(type2) && type1 == ptrfromreg(type2)) {
		MEMPTR* memptr = (MEMPTR*)(val1);
		if (memptr->reg1 == -1) {
			if (type2 == TREG32)
				bytes.assign("\xA3").append(to4bytes(memptr->constant));
			else if (type2 == TREG16)
				bytes.assign("\x66\xA3").append(to4bytes(memptr->constant));
			else if (type2 == TREG8)
				bytes.assign("\xA2").append(to4bytes(memptr->constant));
			if (memptr->deletable)
				delete memptr;
			return;
		}
	}
	//move data addresses
	if (type2 == TDATAADDRESS) {
		set(type1, val1, TCONSTANT, IMAGEBASE);
		tag = TAGOPXDATAADDRESS;
		tag2 = val2;
		tag3 = type1;
		tag4 = val1;
	//move code addresses
	} else if (type2 == TCODEADDRESS) {
		set(type1, val1, TCONSTANT, IMAGEBASE);
		tag = TAGOPXCODEADDRESS;
		tagp = val2;
		tag3 = type1;
		tag4 = val1;
	//regular setting
	} else if (type1 == TREG32)
		setreg(type1, val1, type2, val2, "", "", 0xB8, "", "\x8B");
	else if (type1 == TREG16)
		setreg(type1, val1, type2, val2, "", "\x66", 0xB8, "", "\x66\x8B");
	else if (type1 == TREG8)
		setreg(type1, val1, type2, val2, "", "", 0xB0, "", "\x8A");
	else if (type1 == TDWORDPTR)
		setptr(type1, val1, type2, val2, "\x89", "", "\xC7", 0);
	else if (type1 == TWORDPTR)
		setptr(type1, val1, type2, val2, "\x66\x89", "", "\x66\xC7", 0);
	else if (type1 == TBYTEPTR)
		setptr(type1, val1, type2, val2, "\x88", "\xC6", "", 0);
	else if (isdataptr(type1))
		setdataptr(type1, val1, type2, val2);
}
开发者ID:gregoryloden,项目名称:coppercompiler,代码行数:60,代码来源:AssemblyInstruction.cpp

示例4: omap_dss_init

static void
omap_dss_init(void)
{
    setreg(DSS_BASE, DSS_SYSCONFIG, DSS_AUTOIDLE);
    // Select DSS1 ALWON as clock source
    setreg(DSS_BASE, DSS_CONTROL, DSS_VENC_OUT_SEL | DSS_DAC_POWERDN_BGZ
           | DSS_DAC_DEMEN | DSS_VENC_CLOCK_4X_ENABLE);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:8,代码来源:arch_framebuffer_omap3.cpp

示例5: omap_beagle_init

// init beagle gpio for video
static void
omap_beagle_init(void)
{
    // setup GPIO stuff, i can't find any references to these
    setreg(GPIO1_BASE, GPIO_OE, 0xfefffedf);
    setreg(GPIO1_BASE, GPIO_SETDATAOUT, 0x01000120);
    // DVI-D is enabled by GPIO 170?
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:9,代码来源:arch_framebuffer_omap3.cpp

示例6: tvoutc_setclk

static int tvoutc_setclk(int mode)
{
	const  reg_t *sd,*hd;
	int xtal;

	if(used_audio_pll==-1)
		used_audio_pll=(system_serial_low==0xA)?1:0;
	
	if(used_audio_pll)
	{
		printf("TEST:used audio pll for video out for test!!\n");
		sd=tvreg_aclk_sd;
		hd=tvreg_aclk_hd;
	}
	else
	{
		printf("used Video pll for video out!!\n");
		sd=tvreg_vclk_sd;
		hd=tvreg_vclk_hd;
	}
	xtal=get_xtal_clock();
	xtal=xtal/1000000;
	if(xtal>=24 && xtal <=25)/*current only support 24,25*/
	{
		xtal-=24;
	}
	else
	{
		printf("UNsupport xtal setting for vidoe xtal=%d,default to 24M\n",xtal);	
		xtal=0;
	}
	switch(mode)
	{
		case TVOUT_480I:
		case TVOUT_480CVBS:
		case TVOUT_480P:
		case TVOUT_576I:
		case TVOUT_576CVBS:
		case TVOUT_576P:
			  setreg(&sd[xtal]);
			  //clk_set_rate(clk,540);
			  break;
		case TVOUT_720P:
		case TVOUT_1080I:
		case TVOUT_1080P:
			  setreg(&hd[xtal]);
			  if(xtal == 1)
			  {
				WRITE_MPEG_REG(HHI_VID_CLK_DIV, 4);
			  }
			 // clk_set_rate(clk,297);
			  break;
		default:
			printf("unsupport tv mode,video clk is not set!!\n");	
	}

	return 0;
}
开发者ID:Doxlon,项目名称:buildroot-uboot,代码行数:58,代码来源:tv_out.c

示例7: tvoutc_setclk

int tvoutc_setclk(tvmode_t mode)
{
	struct clk *clk;
	const  reg_t *sd,*hd;
	int xtal;

	sd=tvreg_vclk_sd;
	hd=tvreg_vclk_hd;

	clk=clk_get_sys("clk_xtal", NULL);
	if(!clk)
	{
		printk(KERN_ERR "can't find clk %s for VIDEO PLL SETTING!\n\n","clk_xtal");
		return -1;
	}
	xtal=clk_get_rate(clk);
	xtal=xtal/1000000;
	if(xtal>=24 && xtal <=25)/*current only support 24,25*/
		{
		xtal-=24;
		}
	else
		{
		printk(KERN_WARNING "UNsupport xtal setting for vidoe xtal=%d,default to 24M\n",xtal);
		xtal=0;
		}
	switch(mode)
	{
		case TVMODE_480I:
		case TVMODE_480I_RPT:
		case TVMODE_480CVBS:
		case TVMODE_480P:
		case TVMODE_480P_RPT:
		case TVMODE_576I:
		case TVMODE_576I_RPT:
		case TVMODE_576CVBS:
		case TVMODE_576P:
			  setreg(&sd[xtal]);
			  break;
		case TVMODE_720P:
		case TVMODE_720P_50HZ:
		case TVMODE_1080I:
		case TVMODE_1080I_50HZ:
		case TVMODE_1080P:
		case TVMODE_1080P_50HZ:
			  setreg(&hd[xtal]);
			  if(xtal == 1)
			  {
				WRITE_MPEG_REG(HHI_VID_CLK_DIV, 4);
			  }
			  break;
		default:
			//printk(KERN_ERR "unsupport tv mode,video clk is not set!!\n");
            break;
	}

	return 0 ;
}
开发者ID:erdoukki,项目名称:linux-amlogic,代码行数:58,代码来源:tvoutc.c

示例8: tcpip_handler

static void
tcpip_handler(void)
{
 /*
    char *str;
    uip_ipaddr_t tadd;
    printf("In tcphandler\n");
    if(uip_newdata()) {
        str = uip_appdata;
        str[uip_datalen()] = '\0';
        printf("DATA recv '%s'\n", str);
        //uip_ip6addr(&tadd, 0xaaaa, 0, 0, 0, 0x0212, 0x7402, 0x0002, 0x0202);
        //uip_udp_packet_sendto(client_conn, "from client ", sizeof("from client "), &tadd, UIP_HTONS(12345));
    }
*/
    
        uint8_t *appdata=NULL,a;int code=0;
        if(uip_newdata()) {

    	appdata = (uint8_t *) uip_appdata;
    	MAPPER_GET_PACKETDATA(code,appdata);
    	switch(code)
    	{
    		case 1://helping packet
	    	printf("Helper message \n");
			help(appdata);
    		break;
    		case 2://adding neighbor info and ranks
    			forward_packet(appdata);
    		break;
		case 3://victim packet
    		printf("I am Victim\n");
			monitoring(appdata);
    		break;
		case 4://monitoring node
		
    		break;
		case 5://Selent packet
    		//upade_info(appdata);
    		break;
		case 7://Nbr info req
		snd_nbr_info();
    		break;
		case 8://nbr_info process
		if(!attacker_set)    		
			select_attacker(appdata); 
    		break;
		case 9://Wormhole deactive
		
    		MAPPER_GET_PACKETDATA(code,appdata);
		if(code==2)
		{printf("Attacker 2\n");attack_flag=1;attacker=2;setreg(17,0);}
		if(code==3)	
		{printf("Attacker 3\n");attack_flag=1;attacker=3;dis_output(NULL);setreg(17,0);}
    		break;
    	}
        }
}
开发者ID:alirezapourbahram,项目名称:IoT-Wormhole-IDS,代码行数:58,代码来源:2.c

示例9: cc2420_init

/*---------------------------------------------------------------------------*/
int
cc2420_init(void)
{
  uint16_t reg;
  {
    int s = splhigh();
    cc2420_arch_init();		/* Initalize ports and SPI. */
    DISABLE_FIFOP_INT();
    FIFOP_INT_INIT();
    splx(s);
  }

  /* Turn on voltage regulator and reset. */
  SET_VREG_ACTIVE();
  //clock_delay(250); OK
  SET_RESET_ACTIVE();
  clock_delay(127);
  SET_RESET_INACTIVE();
  //clock_delay(125); OK


  /* Turn on the crystal oscillator. */
  strobe(CC2420_SXOSCON);

  /* Turn on/off automatic packet acknowledgment and address decoding. */
  reg = getreg(CC2420_MDMCTRL0);

  reg |= 0x40; /* XXX CCA mode 1 */
  
#if CC2420_CONF_AUTOACK
  reg |= AUTOACK | ADR_DECODE;
#else
  reg &= ~(AUTOACK | ADR_DECODE);
#endif /* CC2420_CONF_AUTOACK */
  setreg(CC2420_MDMCTRL0, reg);

  /* Change default values as recomended in the data sheet, */
  /* correlation threshold = 20, RX bandpass filter = 1.3uA. */
  setreg(CC2420_MDMCTRL1, CORR_THR(20));
  reg = getreg(CC2420_RXCTRL1);
  reg |= RXBPF_LOCUR;
  setreg(CC2420_RXCTRL1, reg);

  /* Set the FIFOP threshold to maximum. */
  setreg(CC2420_IOCFG0, FIFOP_THR(127));

  /* Turn off "Security enable" (page 32). */
  reg = getreg(CC2420_SECCTRL0);
  reg &= ~RXFIFO_PROTECTION;
  setreg(CC2420_SECCTRL0, reg);

  cc2420_set_pan_addr(0xffff, 0x0000, NULL);
  cc2420_set_channel(26);

  process_start(&cc2420_process, NULL);
  return 1;
}
开发者ID:kincki,项目名称:contiki,代码行数:58,代码来源:cc2420.c

示例10: roach_late_iic_init

int roach_late_iic_init(void)
{
  if (!(roach_late_iic_base = ioremap64(EPX_IIC0_BASE, 0x100))){
    return -1;
  }

  setreg(IIC0_INTRMSK, 0);
  setreg(IIC0_MDCTRL, 0);
  return 0;
}
开发者ID:ska-sa,项目名称:borph_linux_devel,代码行数:10,代码来源:roach_late_iic.c

示例11: omap_attach_framebuffer

static void
omap_attach_framebuffer(addr_t data, int width, int height, int depth)
{
    uint32 DISPC = DISPC_BASE;
    uint32 gsize = ((height - 1) << 16) | (width - 1);

    dprintf("omap3: attach bitmap (%d,%d) to screen\n", width, height);

    setreg(DISPC, DISPC_GFX_BA0, (uint32)data);
    setreg(DISPC, DISPC_GFX_BA1, (uint32)data);
    setreg(DISPC, DISPC_GFX_POSITION, 0);
    setreg(DISPC, DISPC_GFX_SIZE, gsize);
    setreg(DISPC, DISPC_GFX_FIFO_THRESHOLD, (0x3ff << 16) | 0x3c0);
    setreg(DISPC, DISPC_GFX_ROW_INC, 1);
    setreg(DISPC, DISPC_GFX_PIXEL_INC, 1);
    setreg(DISPC, DISPC_GFX_WINDOW_SKIP, 0);
    setreg(DISPC, DISPC_GFX_ATTRIBUTES, DISPC_GFXFORMAT_RGB16
           | DISPC_GFXBURSTSIZE_16x32 | DISPC_GFXENABLE);

    // Tell hardware to update, and wait for it
    modreg(DISPC, DISPC_CONTROL, DISPC_GOLCD, DISPC_GOLCD);

    while ((readreg(DISPC, DISPC_CONTROL) & DISPC_GOLCD))
        ;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:25,代码来源:arch_framebuffer_omap3.cpp

示例12: setreg

//set the MOVSX
void MOVSX::set(int type1, intptr_t val1, int type2, intptr_t val2) {
	if (type1 == TREG32) {
		if (type2 == TREG16 || type2 == TWORDPTR)
			setreg(type1, val1, type2, val2, "", "", 0, "", "\x0F\xBF");
		else if (type2 == TREG8 || type2 == TBYTEPTR)
			setreg(type1, val1, type2, val2, "", "", 0, "", "\x0F\xBE");
	} else if (type1 == TREG16) {
		if (type2 == TREG8 || type2 == TBYTEPTR)
			setreg(type1, val1, type2, val2, "", "", 0, "", "\x66\x0F\xBE");
	}
}
开发者ID:gregoryloden,项目名称:coppercompiler,代码行数:12,代码来源:AssemblyInstruction.cpp

示例13: setreg

status_t
ArchFBArmOmap3::Init()
{
    gKernelArgs.frame_buffer.enabled = true;

    setreg(DISPC_BASE, DISPC_IRQENABLE, 0x00000);
    setreg(DISPC_BASE, DISPC_IRQSTATUS, 0x1ffff);

    omap_beagle_init();
    omap_clock_init();
    omap_dss_init();
    omap_dispc_init();

    return B_OK;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:15,代码来源:arch_framebuffer_omap3.cpp

示例14: lm78rdreg

static int
lm78rdreg(int reg)
{
	uchar val;

	if(waserror()){
		qunlock(&lm78);
		nexterror();
	}
	qlock(&lm78);

	switch(lm78.ifc){
	case Smbus:
		lm78.smbus->transact(lm78.smbus, SMBsend, Serialaddr, reg, nil);
		lm78.smbus->transact(lm78.smbus, SMBrecv, Serialaddr, 0, &val);
		break;
	case Parallel:
		setreg(reg);
		val = inb(lm78.port+Rpdata);
		break;
	default:
		error(Enodev);
		break;
	}

	qunlock(&lm78);
	poperror();
	return val;
}
开发者ID:8l,项目名称:inferno,代码行数:29,代码来源:devlm78.c

示例15: tv_out_open

int tv_out_open(int mode)
{
    const  reg_t *s;

    if (TVOUT_VALID(mode))
    {
        tvmode = mode;

        s = tvregsTab[mode];

        while (MREG_END_MARKER != s->reg)
            setreg(s++);

	chip_version_init();
	
	tvoutc_setclk(mode);
	enable_vsync_interrupt();

        WRITE_MPEG_REG(VPP_POSTBLEND_H_SIZE, tvinfoTab[mode].xres);

	change_vdac_setting(0x120120, mode);

	set_disp_mode_auto(mode );
        return 0;
    }

    return -1;
}
开发者ID:Doxlon,项目名称:buildroot-uboot,代码行数:28,代码来源:tv_out.c


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