本文整理汇总了C++中INB函数的典型用法代码示例。如果您正苦于以下问题:C++ INB函数的具体用法?C++ INB怎么用?C++ INB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INB函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: spic_call2
static u8 spic_call2(u8 dev, u8 fn)
{
u8 v1;
while (INB(SPIC_PORT2) & 2) ;
OUTB(dev, SPIC_PORT2);
while (INB(SPIC_PORT2) & 2) ;
OUTB(fn, SPIC_PORT1);
v1 = INB(SPIC_PORT1);
if (debug_level > 2)
printf("spic call2(%x, %x) -> %x\n", dev, fn, v1);
return v1;
}
开发者ID:emon,项目名称:emon,代码行数:15,代码来源:sonypi.c
示例17: ac97_read
static int
ac97_read (void *devc_, int index)
{
oss_native_word access;
unsigned int data;
unsigned i, N;
unsigned char byte;
oss_native_word flags;
als300_devc *devc = devc_;
MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
i = 0;
N = 1000;
do
{
byte = INB (devc->osdev, devc->base + 6) & 0x80;
if (byte == 0x00)
goto next;
oss_udelay (10);
i++;
}
while (i < N);
if (i >= N)
cmn_err (CE_WARN, "\n Write AC97 mixer index time out !!");
next:
access = index;
access <<= 24; /*index */
access |= 0x80000000;
OUTL (devc->osdev, access, devc->base);
i = 0;
N = 1000;
do
{
byte = INB (devc->osdev, devc->base + 6);
if ((byte & 0x40) != 0)
goto next1;
oss_udelay (10);
i++;
}
while (i < N);
if (i >= N)
cmn_err (CE_WARN, "Read AC97 mixer data time out !!");
next1:
data = INW (devc->osdev, devc->base + 0x04);
MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
return data;
}
开发者ID:Open-Sound-System,项目名称:Open-Sound-System,代码行数:48,代码来源:oss_als3xx.c
示例18: gfx_vga_set_graphics_bits
/*----------------------------------------------------------------------------
* gfx_vga_set_graphics_bits
*
* This routine sets the standard VGA sequencer, graphics controller, and
* attribute registers to appropriate values for a graphics mode (packed,
* 8 BPP or greater). This is also known as "VESA" modes. The timings for
* a particular mode are handled by the CRTC registers, which are set by
* the "gfx_vga_restore" routine. Most OSs that use VGA to set modes save
* and restore the standard VGA registers themselves, which is why these
* registers are not part of the save/restore paradigm.
*----------------------------------------------------------------------------
*/
int
gfx_vga_set_graphics_bits(void)
{
/* SET GRAPHICS BIT IN GRAPHICS CONTROLLER REG 0x06 */
OUTB(0x3CE, 0x06);
OUTB(0x3CF, 0x01);
/* SET GRAPHICS BIT IN ATTRIBUTE CONTROLLER REG 0x10 */
INB(0x3BA); /* Reset flip-flop */
INB(0x3DA);
OUTB(0x3C0, 0x10);
OUTB(0x3C0, 0x01);
return (GFX_STATUS_OK);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__driver__xf86-video-geode,代码行数:28,代码来源:vga_gu1.c
示例19: acc_i2c_request_master
/*---------------------------------------------------------------------------
* acc_i2c_request_master
*---------------------------------------------------------------------------
*/
int
acc_i2c_request_master(unsigned char busnum)
{
unsigned char reg;
unsigned short bus_base_address = base_address_array[busnum];
unsigned long timeout = 0;
acc_i2c_start(busnum);
while (1) {
reg = INB((unsigned short) (bus_base_address + ACBST));
if (reg & 0x60)
break;
if (timeout++ == ACC_I2C_TIMEOUT) {
acc_i2c_bus_recovery(busnum);
return (0);
}
}
/* CHECK FOR BUS ERROR */
if (reg & 0x20) {
acc_i2c_abort_data(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,代码行数:37,代码来源:i2c_acc.c
示例20: acc_i2c_write_byte
/*---------------------------------------------------------------------------
* acc_i2c_write_byte
*
* This routine writes a byte to the I2C bus
*---------------------------------------------------------------------------
*/
void
acc_i2c_write_byte(unsigned char busnum, unsigned char cData)
{
unsigned char reg;
unsigned short bus_base_address = base_address_array[busnum];
unsigned long timeout = 0;
while (1) {
reg = INB((unsigned short) (bus_base_address + ACBST));
if (reg & 0x70)
break;
if (timeout++ == ACC_I2C_TIMEOUT) {
acc_i2c_bus_recovery(busnum);
return;
}
}
/* CHECK FOR BUS ERROR */
if (reg & 0x20) {
acc_i2c_bus_recovery(busnum);
return;
}
/* CHECK NEGATIVE ACKNOWLEDGE */
if (reg & 0x10) {
acc_i2c_abort_data(busnum);
return;
}
/* WRITE THE DATA */
OUTB((unsigned short) (bus_base_address + ACBSDA), cData);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__driver__xf86-video-nsc,代码行数:41,代码来源:i2c_acc.c
注:本文中的INB函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论