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


C++ INB函数代码示例

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


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

示例1: iiReadWord8

//******************************************************************************
// Function:   iiReadWord8(pB)
// Parameters: pB      - pointer to board structure
//
// Returns:    True if everything appears copacetic.
//             False if there is any error: the pB->i2eError field has the error
//
// Description:
//
// Returns the word read from the data fifo specified by the board-structure
// pointer pB. Uses two 8-bit operations. Bytes are assumed to be LSB first. Is
// called indirectly through pB->i2eReadWord.
//
//******************************************************************************
static unsigned short
iiReadWord8(i2eBordStrPtr pB)
{
    unsigned short urs;

    urs = INB ( pB->i2eData );

    return ( ( INB ( pB->i2eData ) << 8 ) | urs );
}
开发者ID:niubl,项目名称:camera_project,代码行数:23,代码来源:i2ellis.c

示例2: getchar

int
getchar(void)
{
	uint8_t stat;

	while (!ISSET(stat = INB(com_lsr), LSR_RXRDY))
		/* spin */ ;
	return (INB(com_data));
}
开发者ID:MarginC,项目名称:kame,代码行数:9,代码来源:ns16550.c

示例3: spic_call1

static u_int8_t
spic_call1(struct spic_softc *sc, u_int8_t dev)
{
	u_int8_t v1, v2;

	SPIC_COMMAND(0, INB(sc, SPIC_PORT2) & 2);
	OUTB(sc, dev, SPIC_PORT2);
	v1 = INB(sc, SPIC_PORT2);
	v2 = INB(sc, SPIC_PORT1);
	return v2;
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:11,代码来源:spic.c

示例4: com_getc

int
com_getc(dev_t dev)
{
	uint8_t stat;

	if (dev & 0x80)
		return ISSET(stat = INB(com_lsr), LSR_RXRDY);

	while (!ISSET(stat = INB(com_lsr), LSR_RXRDY))
		/* spin */ ;
	return (INB(com_data));
}
开发者ID:avsm,项目名称:openbsd-xen-sys,代码行数:12,代码来源:ns16550.c

示例5: spic_call1

static u8 spic_call1(u8 dev)
{
	u8 v1, v2;
	spic_settle();

	OUTB(dev, SPIC_PORT2);
	v1 = INB(SPIC_PORT2);
	v2 = INB(SPIC_PORT1);
	if (debug_level > 2)
		printf("spic call1(%x) -> %x %x\n", dev, v1, v2);
	return v2;
}
开发者ID:emon,项目名称:emon,代码行数:12,代码来源:sonypi.c

示例6: get_status

static int get_status (elp_device * adapter)

{
    int timeout = jiffies + TIMEOUT;
    register int stat1;
    do {
        stat1 = INB(adapter->io_addr+PORT_STATUS);
    } while (stat1 != INB(adapter->io_addr+PORT_STATUS) && jiffies < timeout);
    if (jiffies >= timeout)
        TIMEOUT_MSG();
    return stat1;
}
开发者ID:Lakshmipathi,项目名称:Linux-historic,代码行数:12,代码来源:3c505.c

示例7: send_packet

static int send_packet (elp_device * adapter, unsigned char * ptr, int len)

{
    int i;

    /*
     * make sure the length is even and no shorter than 60 bytes
     */
    unsigned int nlen = (((len < 60) ? 60 : len) + 1) & (~1);

    CHECK_NULL(adapter);
    CHECK_NULL(ptr);

    if (nlen < len)
        printk("Warning, bad length nlen=%d len=%d %s(%d)\n",nlen,len,filename,__LINE__);

    /*
     * send the adapter a transmit packet command. Ignore segment and offset
     * and make sure the length is even
     */
    adapter->tx_pcb.command = CMD_TRANSMIT_PACKET;
    adapter->tx_pcb.length = sizeof(struct Xmit_pkt);
    adapter->tx_pcb.data.xmit_pkt.buf_ofs = adapter->tx_pcb.data.xmit_pkt.buf_seg = 0; /* Unused */
    adapter->tx_pcb.data.xmit_pkt.pkt_len = nlen;
    if (!send_pcb(adapter, &adapter->tx_pcb))
        return FALSE;

    /*
     * make sure the data register is going the right way
     */
    cli();
    OUTB(INB(adapter->io_addr+PORT_CONTROL)&(~CONTROL_DIR), adapter->io_addr+PORT_CONTROL);
    sti();

    /*
     * write data to the adapter
     */
    for (i = 0; i < (nlen/2); i++) {
        int timeout = jiffies + TIMEOUT;
        while ((INB(adapter->io_addr+PORT_STATUS)&STATUS_HRDY) == 0 && jiffies < timeout)
            ;
        if (jiffies >= timeout) {
            printk("*** timeout at %s(%d) writing word %d of %d ***\n",
                   filename,__LINE__, i, nlen/2);
            return FALSE;
        }

        outw(*(short *)ptr, adapter->io_addr+PORT_DATA);
        ptr +=2;
    }

    return TRUE;
}
开发者ID:Lakshmipathi,项目名称:Linux-historic,代码行数:53,代码来源:3c505.c

示例8: spic_call2

static u_int8_t
spic_call2(struct spic_softc *sc, u_int8_t dev, u_int8_t fn)
{
	u_int8_t v1;

	SPIC_COMMAND(0, INB(sc, SPIC_PORT2) & 2);
	OUTB(sc, dev, SPIC_PORT2);
	SPIC_COMMAND(0, INB(sc, SPIC_PORT2) & 2);
	OUTB(sc, fn, SPIC_PORT1);
	v1 = INB(sc, SPIC_PORT1);
	return v1;
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:12,代码来源:spic.c

示例9: saa9730_getDebugChar

char saa9730_getDebugChar(void)
{
	char c;

        if (!saa9730_kgdb_active) {     /* need to init device first */
                return 0;
        }
        while (!(INB(&kgdb_uart->Lsr) & SAA9730_LSR_DR))
                ;

	c = INB(&kgdb_uart->Thr_Rbr);
        return(c);
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:13,代码来源:gdb_hook.c

示例10: getchar

int
getchar(void)
{
	uint8_t stat;
	int c;

	while (!sscom_rxrdy())
		/* spin */ ;
	c = INB(SSCOM_URXH);
	stat = INB(SSCOM_UERSTAT);	/* XXX */

	return c;
}
开发者ID:MarginC,项目名称:kame,代码行数:13,代码来源:sscom.c

示例11: spic_jogger

int spic_jogger(void)
{
	u8 v1, v2, ov1=0, ov2=1;
	while (1) {
		v1 = INB(SPIC_PORT1);
		v2 = INB(SPIC_PORT2);
		if (v1 != ov1 || v2 != ov2) {
			printf("jogger %x %x\n", v1, v2);
		}
		ov1 = v1;
		ov2 = v2;
	}
}
开发者ID:emon,项目名称:emon,代码行数:13,代码来源:sonypi.c

示例12: kb_init

void kb_init(void)
{
	void key_int();
	char a;
	
	register_int(IRQ0 + IRQ_KEYBOARD, (ulong)key_int, KERNEL_CS, 0x8E);
	enable_irq(IRQ_KEYBOARD);

	INB(a, 0x64);
	while (a & 1) {
		INB(a, 0x60);
		INB(a, 0x64);
	}
}
开发者ID:sjrct,项目名称:Frosk64,代码行数:14,代码来源:keyboard.c

示例13: comc_setup

static void comc_setup(int speed)
{
    OUTB(com_cfcr, CFCR_DLAB | g_com_port.comc_fmt);
    OUTB(com_dlbl, COMC_BPS(speed) & 0xff);
    OUTB(com_dlbh, COMC_BPS(speed) >> 8);
    OUTB(com_cfcr, g_com_port.comc_fmt);
    OUTB(com_mcr, MCR_RTS | MCR_DTR);

    for ( int wait = COMC_TXWAIT; wait > 0; wait-- ) {
        INB(com_data);
        if ( !(INB(com_lsr) & LSR_RXRDY) )
            break;
    }
}
开发者ID:phoenix-frozen,项目名称:bottlecap,代码行数:14,代码来源:com.c

示例14: gfx_get_softvga_active

/*----------------------------------------------------------------------------
 * gfx_get_softvga_active
 *
 * This returns the active status of SoftVGA
 *----------------------------------------------------------------------------
 */
int
gfx_get_softvga_active(void)
{
    unsigned short crtcindex, crtcdata;

    if (gu1_detect_vsa2())
        return (gfx_get_vsa2_softvga_enable());

    crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4;
    crtcdata = crtcindex + 1;

    OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL);
    return (INB(crtcdata) & 0x1);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__driver__xf86-video-geode,代码行数:20,代码来源:vga_gu1.c

示例15: acc_i2c_ack

/*---------------------------------------------------------------------------
 * acc_i2c_ack
 *
 * This routine looks for acknowledge on the I2C bus.
 *---------------------------------------------------------------------------
 */
int
acc_i2c_ack(unsigned char busnum, int fPut, int negAck)
{
    unsigned char reg;
    unsigned short bus_base_address = base_address_array[busnum];
    unsigned long timeout = 0;

    if (fPut) {                 /* read operation */
        if (!negAck) {
            /* Push Ack onto I2C bus */
            reg = INB((unsigned short) (bus_base_address + ACBCTL1));
            reg &= 0xE7;
            OUTB((unsigned short) (bus_base_address + ACBCTL1), reg);
        }
        else {
            /* Push negAck onto I2C bus */
            reg = INB((unsigned short) (bus_base_address + ACBCTL1));
            reg |= 0x10;
            OUTB((unsigned short) (bus_base_address + ACBCTL1), reg);
        }
    }
    else {                      /* write operation */
        /* Receive Ack from I2C bus */
        while (1) {
            reg = INB((unsigned short) (bus_base_address + ACBST));
            if ((reg & 0x70) != 0)      /* check SDAST, BER and NEGACK */
                break;
            if (timeout++ == ACC_I2C_TIMEOUT) {
                acc_i2c_bus_recovery(busnum);
                return (0);
            }
        }

        /* CHECK FOR BUS ERROR */

        if (reg & 0x20) {
            acc_i2c_bus_recovery(busnum);
            return (0);
        }

        /* CHECK NEGATIVE ACKNOWLEDGE */

        if (reg & 0x10) {
            acc_i2c_abort_data(busnum);
            return (0);
        }
    }
    return (1);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__driver__xf86-video-nsc,代码行数:55,代码来源:i2c_acc.c


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