本文整理汇总了C++中outsb函数的典型用法代码示例。如果您正苦于以下问题:C++ outsb函数的具体用法?C++ outsb怎么用?C++ outsb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outsb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ni5010_transmit
static void ni5010_transmit(struct nic *nic,
const char *d, /* Destination */
unsigned int t, /* Type */
unsigned int s, /* size */
const char *p) /* Packet */
{
unsigned int len;
int buf_offs, xmt_stat;
unsigned long time;
len = s + ETH_HLEN;
if (len < ETH_ZLEN)
len = ETH_ZLEN;
buf_offs = NI5010_BUFSIZE - len;
outb(0, EDLC_RMASK); /* Mask all receive interrupts */
outb(0, IE_MMODE); /* Put Xmit buffer on system bus */
outb(0xFF, EDLC_RCLR); /* Clear out pending rcv interrupts */
outw(buf_offs, IE_GP); /* Point GP at start of packet */
outsb(IE_XBUF, d, ETH_ALEN); /* Put dst in buffer */
outsb(IE_XBUF, nic->node_addr, ETH_ALEN);/* Put src in buffer */
outb(t >> 8, IE_XBUF);
outb(t, IE_XBUF);
outsb(IE_XBUF, p, s); /* Put data in buffer */
while (s++ < ETH_ZLEN - ETH_HLEN) /* Pad to min size */
outb(0, IE_XBUF);
outw(buf_offs, IE_GP); /* Rewrite where packet starts */
/* should work without that outb() (Crynwr used it) */
/*outb(MM_MUX, IE_MMODE);*/
/* Xmt buffer to EDLC bus */
outb(MM_EN_XMT | MM_MUX, IE_MMODE); /* Begin transmission */
/* wait for transmit complete */
while (((xmt_stat = inb(IE_ISTAT)) & IS_EN_XMT) != 0)
;
reset_receiver(); /* Immediately switch to receive */
}
示例2: snd_gf1_pcm_poke_block
static int snd_gf1_pcm_poke_block(struct snd_gus_card *gus, unsigned char *buf,
unsigned int pos, unsigned int count,
int w16, int invert)
{
unsigned int len;
unsigned long flags;
/*
printk(KERN_DEBUG
"poke block; buf = 0x%x, pos = %i, count = %i, port = 0x%x\n",
(int)buf, pos, count, gus->gf1.port);
*/
while (count > 0) {
len = count;
if (len > 512) /* limit, to allow IRQ */
len = 512;
count -= len;
if (gus->interwave) {
spin_lock_irqsave(&gus->reg_lock, flags);
snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, 0x01 | (invert ? 0x08 : 0x00));
snd_gf1_dram_addr(gus, pos);
if (w16) {
outb(SNDRV_GF1_GW_DRAM_IO16, GUSP(gus, GF1REGSEL));
outsw(GUSP(gus, GF1DATALOW), buf, len >> 1);
} else {
outsb(GUSP(gus, DRAM), buf, len);
}
spin_unlock_irqrestore(&gus->reg_lock, flags);
buf += 512;
pos += 512;
} else {
示例3: writefifo
static inline void
writefifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
{
/* fifo write without cli because it's allready done */
byteout(ale, off);
outsb(adr, data, size);
}
示例4: mcdx_playmsf
static int
mcdx_playmsf(struct s_drive_stuff *stuffp, const struct cdrom_msf *msf)
{
unsigned char cmd[7] = {
0, 0, 0, 0, 0, 0, 0
};
if (!stuffp->readcmd) {
xinfo("Can't play from missing disk.\n");
return -1;
}
cmd[0] = stuffp->playcmd;
cmd[1] = msf->cdmsf_min0;
cmd[2] = msf->cdmsf_sec0;
cmd[3] = msf->cdmsf_frame0;
cmd[4] = msf->cdmsf_min1;
cmd[5] = msf->cdmsf_sec1;
cmd[6] = msf->cdmsf_frame1;
xtrace(PLAYMSF, "ioctl(): play %x "
"%02x:%02x:%02x -- %02x:%02x:%02x\n",
cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6]);
outsb(stuffp->wreg_data, cmd, sizeof cmd);
if (-1 == mcdx_getval(stuffp, 3 * HZ, 0, NULL)) {
xwarn("playmsf() timeout\n");
return -1;
}
stuffp->audiostatus = CDROM_AUDIO_PLAY;
return 0;
}
示例5: snd_gus_dram_poke
static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer,
unsigned int address, unsigned int size)
{
unsigned long flags;
unsigned int size1, size2;
char buffer[512], *pbuffer;
while (size > 0) {
if (copy_from_user(buffer, _buffer, 512))
return -EFAULT;
size1 = size > 512 ? 512 : size;
if (gus->interwave) {
spin_lock_irqsave(&gus->reg_lock, flags);
snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, 0x01);
snd_gf1_dram_addr(gus, address);
outsb(GUSP(gus, DRAM), buffer, size1);
spin_unlock_irqrestore(&gus->reg_lock, flags);
address += size1;
} else {
pbuffer = buffer;
size2 = size1;
while (size2--)
snd_gf1_poke(gus, address++, *pbuffer++);
}
size -= size1;
_buffer += size1;
}
return 0;
}
示例6: WriteHSCXfifo
static inline void
WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
}
示例7: ne_pio_write
// sizeバイトのpacketをローカルバッファに書き込み、その後送信する
// sizeは適正([46, 1514])であること
int
ne_pio_write(ne_t* ne, uchar* packet, int size)
{
// sendqの先頭がちゃんと空いてる?
int q = ne->sendq_head % SENDQ_LEN;
if (ne->sendq[q].filled || ne->sendq_head > ne->sendq_tail) {
cprintf("%s: all transmitting buffers in NIC are busy.\n", ne->name);
return 0;
}
// 書き込み処理
ne_rdma_setup(ne, CR_DM_RW, ne->sendq[q].sendpage * DP_PAGESIZE, size);
if (ne->is16bit)
outsw(ne->base + NE_DATA, packet, size);
else
outsb(ne->base + NE_DATA, packet, size);
// ToDo: ここでISR_RDCのチェックは必要なのか?
ne->sendq[q].filled = TRUE;
ne_start_xmit(ne, ne->sendq[q].sendpage, size);
// ToDo: 多分算術オーバーフロー対策しないといけない。
ne->sendq_head++;
return size;
}
示例8: siemens_isurf_write_fifo
static void
siemens_isurf_write_fifo(void *base, const void *buf, size_t len)
{
if(((u_int)base & SIE_ISURF_OFF_MASK) == SIE_ISURF_IDHSCXB)
{
outb((u_int)((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_ALE, IPAC_HSCXB_OFF);
outsb((((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_RW), (const u_char *)buf, (u_int)len);
}
else if(((u_int)base & SIE_ISURF_OFF_MASK) == SIE_ISURF_IDHSCXA)
{
outb((u_int)((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_ALE, IPAC_HSCXA_OFF);
outsb((((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_RW), (const u_char *)buf, (u_int)len);
}
else /* if(((u_int)base & SIE_ISURF_OFF_MASK) == SIE_ISURF_IDISAC) */
{
outb((u_int)((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_ALE, IPAC_ISAC_OFF);
outsb((((u_int)base & SIE_ISURF_BASE_MASK) + SIE_ISURF_OFF_RW), (const u_char *)buf, (u_int)len);
}
}
示例9: itkix1_write_fifo
static void
itkix1_write_fifo(void *base, const void *buf, size_t len)
{
u_int port = (u_int)base & ~0x0003;
switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, 0);
outsb(port+ITK_ISAC_DATA, (u_char *)buf, (u_int)len);
break;
case 1: /* HSCXA */
outb(port+ITK_ALE, HSCXA);
outsb(port+ITK_HSCX_DATA, (u_char *)buf, (u_int)len);
break;
case 2: /* HSCXB */
outb(port+ITK_ALE, HSCXB);
outsb(port+ITK_HSCX_DATA, (u_char *)buf, (u_int)len);
break;
}
}
示例10: hdlc_fill_fifo
static void hdlc_fill_fifo(struct fritz_bcs *bcs)
{
struct fritz_adapter *adapter = bcs->adapter;
struct sk_buff *skb = bcs->tx_skb;
int count;
int fifo_size = 32;
unsigned long flags;
unsigned char *p;
DBG(0x40, "hdlc_fill_fifo");
if (!skb)
BUG();
if (skb->len == 0)
BUG();
bcs->ctrl.sr.cmd &= ~HDLC_CMD_XME;
if (bcs->tx_skb->len > fifo_size) {
count = fifo_size;
} else {
count = bcs->tx_skb->len;
if (bcs->mode != L1_MODE_TRANS)
bcs->ctrl.sr.cmd |= HDLC_CMD_XME;
}
DBG(0x40, "hdlc_fill_fifo %d/%d", count, bcs->tx_skb->len);
p = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count);
bcs->tx_cnt += count;
bcs->ctrl.sr.xml = ((count == fifo_size) ? 0 : count);
switch (adapter->type) {
case AVM_FRITZ_PCI:
spin_lock_irqsave(&adapter->hw_lock, flags);
// sets the correct AVM_INDEX, too
__fcpci_write_ctrl(bcs, 3);
outsl(adapter->io + AVM_DATA + HDLC_FIFO,
p, (count + 3) / 4);
spin_unlock_irqrestore(&adapter->hw_lock, flags);
break;
case AVM_FRITZ_PCIV2:
fcpci2_write_ctrl(bcs, 3);
outsl(adapter->io +
(bcs->channel ? AVM_HDLC_FIFO_2 : AVM_HDLC_FIFO_1),
p, (count + 3) / 4);
break;
case AVM_FRITZ_PNP:
spin_lock_irqsave(&adapter->hw_lock, flags);
// sets the correct AVM_INDEX, too
__fcpnp_write_ctrl(bcs, 3);
outsb(adapter->io + AVM_DATA, p, count);
spin_unlock_irqrestore(&adapter->hw_lock, flags);
break;
}
}
示例11: fcpci_write_isac_fifo
static void fcpci_write_isac_fifo(struct isac *isac, unsigned char * data,
int size)
{
struct fritz_adapter *adapter = isac->priv;
unsigned long flags;
spin_lock_irqsave(&adapter->hw_lock, flags);
outb(AVM_IDX_ISAC_FIFO, adapter->io + AVM_INDEX);
outsb(adapter->io + AVM_DATA, data, size);
spin_unlock_irqrestore(&adapter->hw_lock, flags);
}
示例12: WriteISACfifo
static inline void
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
long flags;
save_flags(flags);
cli();
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_FIFO_OFFSET);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
}
示例13: WriteHSCXfifo
static inline void
WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{
long flags;
save_flags(flags);
cli();
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
}
示例14: do_short_write
ssize_t do_short_write (struct inode *inode, struct file *filp, const char *buf,
size_t count, loff_t *f_pos)
{
int retval = count;
unsigned long address = short_base + (MINOR(inode->i_rdev)&0x0f);
int mode = (MINOR(inode->i_rdev)&0x70) >> 4;
unsigned char *kbuf=kmalloc(count, GFP_KERNEL), *ptr;
if (!kbuf) return -ENOMEM;
copy_from_user(kbuf, buf, count);
ptr=kbuf;
if (use_mem)
mode = SHORT_MEMORY;
switch(mode) {
case SHORT_PAUSE:
while (count--) {
outb_p(*(ptr++), address);
wmb();
}
break;
case SHORT_STRING:
outsb(address, ptr, count);
wmb();
break;
case SHORT_DEFAULT:
while (count--) {
outb(*(ptr++), address);
wmb();
}
break;
case SHORT_MEMORY:
while (count--) {
writeb(*(ptr++), address);
wmb();
}
break;
default: /* no more modes defined by now */
retval = -EINVAL;
break;
}
kfree(kbuf);
return retval;
}
示例15: __svgalib_port_rep_outb
void __svgalib_port_rep_outb(unsigned char* string, int length, int port)
{
if(__svgalib_nohelper)
{
outsb(port, string, length);
}
else
{
io_string_t iostr;
iostr.port = port;
iostr.string = string;
iostr.length = length;
ioctl(__svgalib_mem_fd,SVGAHELPER_REPOUTB,&iostr);
}
}