本文整理汇总了C++中WAIT_4_SCB_CMD函数的典型用法代码示例。如果您正苦于以下问题:C++ WAIT_4_SCB_CMD函数的具体用法?C++ WAIT_4_SCB_CMD怎么用?C++ WAIT_4_SCB_CMD使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WAIT_4_SCB_CMD函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elmc_rnr_int
static void elmc_rnr_int(struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
dev->stats.rx_errors++;
WAIT_4_SCB_CMD(); /* wait for the last cmd */
p->scb->cmd = RUC_ABORT; /* usually the RU is in the 'no resource'-state .. abort it now. */
elmc_attn586();
WAIT_4_SCB_CMD(); /* wait for accept cmd. */
alloc_rfa(dev, (char *) p->rfd_first);
startrecv586(dev); /* restart RU */
printk(KERN_WARNING "%s: Receive-Unit restarted. Status: %04x\n", dev->name, p->scb->status);
}
示例2: startrecv586
static void startrecv586(struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
p->scb->rfa_offset = make16(p->rfd_first);
p->scb->cmd = RUC_START;
elmc_attn586(); /* start cmd. */
WAIT_4_SCB_CMD(); /* wait for accept cmd. (no timeout!!) */
}
示例3: startrecv586
static void startrecv586(struct net_device *dev)
{
struct priv *p = netdev_priv(dev);
WAIT_4_SCB_CMD();
WAIT_4_SCB_CMD_RUC();
p->scb->rfa_offset = make16(p->rfd_first);
p->scb->cmd_ruc = RUC_START;
sun3_attn586(); /* start cmd. */
WAIT_4_SCB_CMD_RUC(); /* wait for accept cmd. (no timeout!!) */
}
示例4: sun3_82586_rnr_int
static void sun3_82586_rnr_int(struct net_device *dev)
{
struct priv *p = netdev_priv(dev);
dev->stats.rx_errors++;
WAIT_4_SCB_CMD(); /* wait for the last cmd, WAIT_4_FULLSTAT?? */
p->scb->cmd_ruc = RUC_ABORT; /* usually the RU is in the 'no resource'-state .. abort it now. */
sun3_attn586();
WAIT_4_SCB_CMD_RUC(); /* wait for accept cmd. */
alloc_rfa(dev,(char *)p->rfd_first);
/* maybe add a check here, before restarting the RU */
startrecv586(dev); /* restart RU */
printk("%s: Receive-Unit restarted. Status: %04x\n",dev->name,p->scb->rus);
}
示例5: sun3_82586_rcv_int
static void sun3_82586_rcv_int(struct net_device *dev)
{
int status,cnt=0;
unsigned short totlen;
struct sk_buff *skb;
struct rbd_struct *rbd;
struct priv *p = netdev_priv(dev);
if(debuglevel > 0)
printk("R");
for(;(status = p->rfd_top->stat_high) & RFD_COMPL;)
{
rbd = (struct rbd_struct *) make32(p->rfd_top->rbd_offset);
if(status & RFD_OK) /* frame received without error? */
{
if( (totlen = swab16(rbd->status)) & RBD_LAST) /* the first and the last buffer? */
{
totlen &= RBD_MASK; /* length of this frame */
rbd->status = 0;
skb = (struct sk_buff *) dev_alloc_skb(totlen+2);
if(skb != NULL)
{
skb_reserve(skb,2);
skb_put(skb,totlen);
skb_copy_to_linear_data(skb,(char *) p->base+swab32((unsigned long) rbd->buffer),totlen);
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
dev->stats.rx_packets++;
}
else
dev->stats.rx_dropped++;
}
else
{
int rstat;
/* free all RBD's until RBD_LAST is set */
totlen = 0;
while(!((rstat=swab16(rbd->status)) & RBD_LAST))
{
totlen += rstat & RBD_MASK;
if(!rstat)
{
printk("%s: Whoops .. no end mark in RBD list\n",dev->name);
break;
}
rbd->status = 0;
rbd = (struct rbd_struct *) make32(rbd->next);
}
totlen += rstat & RBD_MASK;
rbd->status = 0;
printk("%s: received oversized frame! length: %d\n",dev->name,totlen);
dev->stats.rx_dropped++;
}
}
else /* frame !(ok), only with 'save-bad-frames' */
{
printk("%s: oops! rfd-error-status: %04x\n",dev->name,status);
dev->stats.rx_errors++;
}
p->rfd_top->stat_high = 0;
p->rfd_top->last = RFD_SUSP; /* maybe exchange by RFD_LAST */
p->rfd_top->rbd_offset = 0xffff;
p->rfd_last->last = 0; /* delete RFD_SUSP */
p->rfd_last = p->rfd_top;
p->rfd_top = (struct rfd_struct *) make32(p->rfd_top->next); /* step to next RFD */
p->scb->rfa_offset = make16(p->rfd_top);
if(debuglevel > 0)
printk("%d",cnt++);
}
if(automatic_resume)
{
WAIT_4_SCB_CMD();
p->scb->cmd_ruc = RUC_RESUME;
sun3_attn586();
WAIT_4_SCB_CMD_RUC();
}
#ifdef WAIT_4_BUSY
{
int i;
for(i=0;i<1024;i++)
{
if(p->rfd_top->status)
break;
DELAY_16();
if(i == 1023)
printk("%s: RU hasn't fetched next RFD (not busy/complete)\n",dev->name);
}
}
#endif
#if 0
if(!at_least_one)
{
int i;
volatile struct rfd_struct *rfds=p->rfd_top;
//.........这里部分代码省略.........
示例6: sun3_82586_interrupt
static irqreturn_t sun3_82586_interrupt(int irq,void *dev_id)
{
struct net_device *dev = dev_id;
unsigned short stat;
int cnt=0;
struct priv *p;
if (!dev) {
printk ("sun3_82586-interrupt: irq %d for unknown device.\n",irq);
return IRQ_NONE;
}
p = netdev_priv(dev);
if(debuglevel > 1)
printk("I");
WAIT_4_SCB_CMD(); /* wait for last command */
while((stat=p->scb->cus & STAT_MASK))
{
p->scb->cmd_cuc = stat;
sun3_attn586();
if(stat & STAT_FR) /* received a frame */
sun3_82586_rcv_int(dev);
if(stat & STAT_RNR) /* RU went 'not ready' */
{
printk("(R)");
if(p->scb->rus & RU_SUSPEND) /* special case: RU_SUSPEND */
{
WAIT_4_SCB_CMD();
p->scb->cmd_ruc = RUC_RESUME;
sun3_attn586();
WAIT_4_SCB_CMD_RUC();
}
else
{
printk("%s: Receiver-Unit went 'NOT READY': %04x/%02x.\n",dev->name,(int) stat,(int) p->scb->rus);
sun3_82586_rnr_int(dev);
}
}
if(stat & STAT_CX) /* command with I-bit set complete */
sun3_82586_xmt_int(dev);
#ifndef NO_NOPCOMMANDS
if(stat & STAT_CNA) /* CU went 'not ready' */
{
if(netif_running(dev))
printk("%s: oops! CU has left active state. stat: %04x/%02x.\n",dev->name,(int) stat,(int) p->scb->cus);
}
#endif
if(debuglevel > 1)
printk("%d",cnt++);
WAIT_4_SCB_CMD(); /* wait for ack. (sun3_82586_xmt_int can be faster than ack!!) */
if(p->scb->cmd_cuc) /* timed out? */
{
printk("%s: Acknowledge timed out.\n",dev->name);
sun3_disint();
break;
}
}
if(debuglevel > 1)
printk("i");
return IRQ_HANDLED;
}
示例7: init586
//.........这里部分代码省略.........
mc_cmd->cmd_link = 0xffff;
mc_cmd->mc_cnt = swab16(num_addrs * 6);
i = 0;
netdev_for_each_mc_addr(ha, dev)
memcpy((char *) mc_cmd->mc_list[i++],
ha->addr, ETH_ALEN);
p->scb->cbl_offset = make16(mc_cmd);
p->scb->cmd_cuc = CUC_START;
sun3_attn586();
WAIT_4_STAT_COMPL(mc_cmd);
if( (swab16(mc_cmd->cmd_status) & (STAT_COMPL|STAT_OK)) != (STAT_COMPL|STAT_OK) )
printk("%s: Can't apply multicast-address-list.\n",dev->name);
}
/*
* alloc nop/xmit-cmds
*/
#if (NUM_XMIT_BUFFS == 1)
for(i=0;i<2;i++)
{
p->nop_cmds[i] = (struct nop_cmd_struct *)ptr;
p->nop_cmds[i]->cmd_cmd = swab16(CMD_NOP);
p->nop_cmds[i]->cmd_status = 0;
p->nop_cmds[i]->cmd_link = make16((p->nop_cmds[i]));
ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
}
#else
for(i=0;i<NUM_XMIT_BUFFS;i++)
{
p->nop_cmds[i] = (struct nop_cmd_struct *)ptr;
p->nop_cmds[i]->cmd_cmd = swab16(CMD_NOP);
p->nop_cmds[i]->cmd_status = 0;
p->nop_cmds[i]->cmd_link = make16((p->nop_cmds[i]));
ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
}
#endif
ptr = alloc_rfa(dev,(void *)ptr); /* init receive-frame-area */
/*
* alloc xmit-buffs / init xmit_cmds
*/
for(i=0;i<NUM_XMIT_BUFFS;i++)
{
p->xmit_cmds[i] = (struct transmit_cmd_struct *)ptr; /*transmit cmd/buff 0*/
ptr = (char *) ptr + sizeof(struct transmit_cmd_struct);
p->xmit_cbuffs[i] = (char *)ptr; /* char-buffs */
ptr = (char *) ptr + XMIT_BUFF_SIZE;
p->xmit_buffs[i] = (struct tbd_struct *)ptr; /* TBD */
ptr = (char *) ptr + sizeof(struct tbd_struct);
if((void *)ptr > (void *)dev->mem_end)
{
printk("%s: not enough shared-mem for your configuration!\n",dev->name);
return 1;
}
memset((char *)(p->xmit_cmds[i]) ,0, sizeof(struct transmit_cmd_struct));
memset((char *)(p->xmit_buffs[i]),0, sizeof(struct tbd_struct));
p->xmit_cmds[i]->cmd_link = make16(p->nop_cmds[(i+1)%NUM_XMIT_BUFFS]);
p->xmit_cmds[i]->cmd_status = swab16(STAT_COMPL);
p->xmit_cmds[i]->cmd_cmd = swab16(CMD_XMIT | CMD_INT);
p->xmit_cmds[i]->tbd_offset = make16((p->xmit_buffs[i]));
p->xmit_buffs[i]->next = 0xffff;
p->xmit_buffs[i]->buffer = make24((p->xmit_cbuffs[i]));
}
p->xmit_count = 0;
p->xmit_last = 0;
#ifndef NO_NOPCOMMANDS
p->nop_point = 0;
#endif
/*
* 'start transmitter'
*/
#ifndef NO_NOPCOMMANDS
p->scb->cbl_offset = make16(p->nop_cmds[0]);
p->scb->cmd_cuc = CUC_START;
sun3_attn586();
WAIT_4_SCB_CMD();
#else
p->xmit_cmds[0]->cmd_link = make16(p->xmit_cmds[0]);
p->xmit_cmds[0]->cmd_cmd = swab16(CMD_XMIT | CMD_SUSPEND | CMD_INT);
#endif
/*
* ack. interrupts
*/
p->scb->cmd_cuc = p->scb->cus & STAT_MASK;
sun3_attn586();
DELAY_16();
sun3_enaint();
sun3_active();
return 0;
}
示例8: sun3_82586_send_packet
static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
{
int len,i;
#ifndef NO_NOPCOMMANDS
int next_nop;
#endif
struct priv *p = netdev_priv(dev);
if(skb->len > XMIT_BUFF_SIZE)
{
printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len);
return NETDEV_TX_OK;
}
netif_stop_queue(dev);
#if(NUM_XMIT_BUFFS > 1)
if(test_and_set_bit(0,(void *) &p->lock)) {
printk("%s: Queue was locked\n",dev->name);
return NETDEV_TX_BUSY;
}
else
#endif
{
len = skb->len;
if (len < ETH_ZLEN) {
memset((void *)p->xmit_cbuffs[p->xmit_count], 0,
ETH_ZLEN);
len = ETH_ZLEN;
}
skb_copy_from_linear_data(skb, (void *)p->xmit_cbuffs[p->xmit_count], skb->len);
#if (NUM_XMIT_BUFFS == 1)
# ifdef NO_NOPCOMMANDS
#ifdef DEBUG
if(p->scb->cus & CU_ACTIVE)
{
printk("%s: Hmmm .. CU is still running and we wanna send a new packet.\n",dev->name);
printk("%s: stat: %04x %04x\n",dev->name,p->scb->cus,swab16(p->xmit_cmds[0]->cmd_status));
}
#endif
p->xmit_buffs[0]->size = swab16(TBD_LAST | len);
for(i=0;i<16;i++)
{
p->xmit_cmds[0]->cmd_status = 0;
WAIT_4_SCB_CMD();
if( (p->scb->cus & CU_STATUS) == CU_SUSPEND)
p->scb->cmd_cuc = CUC_RESUME;
else
{
p->scb->cbl_offset = make16(p->xmit_cmds[0]);
p->scb->cmd_cuc = CUC_START;
}
sun3_attn586();
if(!i)
dev_kfree_skb(skb);
WAIT_4_SCB_CMD();
if( (p->scb->cus & CU_ACTIVE)) /* test it, because CU sometimes doesn't start immediately */
break;
if(p->xmit_cmds[0]->cmd_status)
break;
if(i==15)
printk("%s: Can't start transmit-command.\n",dev->name);
}
# else
next_nop = (p->nop_point + 1) & 0x1;
p->xmit_buffs[0]->size = swab16(TBD_LAST | len);
p->xmit_cmds[0]->cmd_link = p->nop_cmds[next_nop]->cmd_link
= make16((p->nop_cmds[next_nop]));
p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
p->nop_point = next_nop;
dev_kfree_skb(skb);
# endif
#else
p->xmit_buffs[p->xmit_count]->size = swab16(TBD_LAST | len);
if( (next_nop = p->xmit_count + 1) == NUM_XMIT_BUFFS )
next_nop = 0;
p->xmit_cmds[p->xmit_count]->cmd_status = 0;
/* linkpointer of xmit-command already points to next nop cmd */
p->nop_cmds[next_nop]->cmd_link = make16((p->nop_cmds[next_nop]));
p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
p->xmit_count = next_nop;
{
unsigned long flags;
local_irq_save(flags);
if(p->xmit_count != p->xmit_last)
netif_wake_queue(dev);
p->lock = 0;
local_irq_restore(flags);
}
//.........这里部分代码省略.........
示例9: elmc_interrupt
static void elmc_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr)
{
struct net_device *dev = (struct net_device *) dev_id;
unsigned short stat;
struct priv *p;
if (dev == NULL) {
printk(KERN_ERR "elmc-interrupt: irq %d for unknown device.\n", (int) -(((struct pt_regs *) reg_ptr)->orig_eax + 2));
return;
} else if (!netif_running(dev)) {
/* The 3c523 has this habit of generating interrupts during the
reset. I'm not sure if the ni52 has this same problem, but it's
really annoying if we haven't finished initializing it. I was
hoping all the elmc_id_* commands would disable this, but I
might have missed a few. */
elmc_id_attn586(); /* ack inter. and disable any more */
return;
} else if (!(ELMC_CTRL_INT & inb(dev->base_addr + ELMC_CTRL))) {
/* wasn't this device */
return;
}
/* reading ELMC_CTRL also clears the INT bit. */
p = (struct priv *) dev->priv;
while ((stat = p->scb->status & STAT_MASK))
{
p->scb->cmd = stat;
elmc_attn586(); /* ack inter. */
if (stat & STAT_CX) {
/* command with I-bit set complete */
elmc_xmt_int(dev);
}
if (stat & STAT_FR) {
/* received a frame */
elmc_rcv_int(dev);
}
#ifndef NO_NOPCOMMANDS
if (stat & STAT_CNA) {
/* CU went 'not ready' */
if (netif_running(dev)) {
printk(KERN_WARNING "%s: oops! CU has left active state. stat: %04x/%04x.\n", dev->name, (int) stat, (int) p->scb->status);
}
}
#endif
if (stat & STAT_RNR) {
/* RU went 'not ready' */
if (p->scb->status & RU_SUSPEND) {
/* special case: RU_SUSPEND */
WAIT_4_SCB_CMD();
p->scb->cmd = RUC_RESUME;
elmc_attn586();
} else {
printk(KERN_WARNING "%s: Receiver-Unit went 'NOT READY': %04x/%04x.\n", dev->name, (int) stat, (int) p->scb->status);
elmc_rnr_int(dev);
}
}
WAIT_4_SCB_CMD(); /* wait for ack. (elmc_xmt_int can be faster than ack!!) */
if (p->scb->cmd) { /* timed out? */
break;
}
}
}
示例10: init586
//.........这里部分代码省略.........
p->nop_cmds[i]->cmd_cmd = CMD_NOP;
p->nop_cmds[i]->cmd_status = 0;
p->nop_cmds[i]->cmd_link = make16((p->nop_cmds[i]));
ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
}
p->xmit_cmds[0] = (struct transmit_cmd_struct *) ptr; /* transmit cmd/buff 0 */
ptr = (char *) ptr + sizeof(struct transmit_cmd_struct);
#else
for (i = 0; i < NUM_XMIT_BUFFS; i++) {
p->nop_cmds[i] = (struct nop_cmd_struct *) ptr;
p->nop_cmds[i]->cmd_cmd = CMD_NOP;
p->nop_cmds[i]->cmd_status = 0;
p->nop_cmds[i]->cmd_link = make16((p->nop_cmds[i]));
ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
p->xmit_cmds[i] = (struct transmit_cmd_struct *) ptr; /*transmit cmd/buff 0 */
ptr = (char *) ptr + sizeof(struct transmit_cmd_struct);
}
#endif
ptr = alloc_rfa(dev, (void *) ptr); /* init receive-frame-area */
/*
* Multicast setup
*/
if (dev->mc_count) {
/* I don't understand this: do we really need memory after the init? */
int len = ((char *) p->iscp - (char *) ptr - 8) / 6;
if (len <= 0) {
printk(KERN_ERR "%s: Ooooops, no memory for MC-Setup!\n", dev->name);
} else {
if (len < num_addrs) {
num_addrs = len;
printk(KERN_WARNING "%s: Sorry, can only apply %d MC-Address(es).\n",
dev->name, num_addrs);
}
mc_cmd = (struct mcsetup_cmd_struct *) ptr;
mc_cmd->cmd_status = 0;
mc_cmd->cmd_cmd = CMD_MCSETUP | CMD_LAST;
mc_cmd->cmd_link = 0xffff;
mc_cmd->mc_cnt = num_addrs * 6;
for (i = 0; i < num_addrs; i++) {
memcpy((char *) mc_cmd->mc_list[i], dmi->dmi_addr, 6);
dmi = dmi->next;
}
p->scb->cbl_offset = make16(mc_cmd);
p->scb->cmd = CUC_START;
elmc_id_attn586();
s = jiffies;
while (!(mc_cmd->cmd_status & STAT_COMPL)) {
if (jiffies - s > 30*HZ/100)
break;
}
if (!(mc_cmd->cmd_status & STAT_COMPL)) {
printk(KERN_WARNING "%s: Can't apply multicast-address-list.\n", dev->name);
}
}
}
/*
* alloc xmit-buffs / init xmit_cmds
*/
for (i = 0; i < NUM_XMIT_BUFFS; i++) {
p->xmit_cbuffs[i] = (char *) ptr; /* char-buffs */
ptr = (char *) ptr + XMIT_BUFF_SIZE;
p->xmit_buffs[i] = (struct tbd_struct *) ptr; /* TBD */
ptr = (char *) ptr + sizeof(struct tbd_struct);
if ((void *) ptr > (void *) p->iscp) {
printk(KERN_ERR "%s: not enough shared-mem for your configuration!\n", dev->name);
return 1;
}
memset((char *) (p->xmit_cmds[i]), 0, sizeof(struct transmit_cmd_struct));
memset((char *) (p->xmit_buffs[i]), 0, sizeof(struct tbd_struct));
p->xmit_cmds[i]->cmd_status = STAT_COMPL;
p->xmit_cmds[i]->cmd_cmd = CMD_XMIT | CMD_INT;
p->xmit_cmds[i]->tbd_offset = make16((p->xmit_buffs[i]));
p->xmit_buffs[i]->next = 0xffff;
p->xmit_buffs[i]->buffer = make24((p->xmit_cbuffs[i]));
}
p->xmit_count = 0;
p->xmit_last = 0;
#ifndef NO_NOPCOMMANDS
p->nop_point = 0;
#endif
/*
* 'start transmitter' (nop-loop)
*/
#ifndef NO_NOPCOMMANDS
p->scb->cbl_offset = make16(p->nop_cmds[0]);
p->scb->cmd = CUC_START;
elmc_id_attn586();
WAIT_4_SCB_CMD();
#else
p->xmit_cmds[0]->cmd_link = 0xffff;
p->xmit_cmds[0]->cmd_cmd = CMD_XMIT | CMD_LAST | CMD_INT;
#endif
return 0;
}
示例11: elmc_send_packet
static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
{
int len;
int i;
#ifndef NO_NOPCOMMANDS
int next_nop;
#endif
struct priv *p = (struct priv *) dev->priv;
netif_stop_queue(dev);
len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN;
if(len != skb->len)
memset((char *) p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN);
memcpy((char *) p->xmit_cbuffs[p->xmit_count], (char *) (skb->data), skb->len);
#if (NUM_XMIT_BUFFS == 1)
#ifdef NO_NOPCOMMANDS
p->xmit_buffs[0]->size = TBD_LAST | len;
for (i = 0; i < 16; i++) {
p->scb->cbl_offset = make16(p->xmit_cmds[0]);
p->scb->cmd = CUC_START;
p->xmit_cmds[0]->cmd_status = 0;
elmc_attn586();
dev->trans_start = jiffies;
if (!i) {
dev_kfree_skb(skb);
}
WAIT_4_SCB_CMD();
if ((p->scb->status & CU_ACTIVE)) { /* test it, because CU sometimes doesn't start immediately */
break;
}
if (p->xmit_cmds[0]->cmd_status) {
break;
}
if (i == 15) {
printk(KERN_WARNING "%s: Can't start transmit-command.\n", dev->name);
}
}
#else
next_nop = (p->nop_point + 1) & 0x1;
p->xmit_buffs[0]->size = TBD_LAST | len;
p->xmit_cmds[0]->cmd_link = p->nop_cmds[next_nop]->cmd_link
= make16((p->nop_cmds[next_nop]));
p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
dev->trans_start = jiffies;
p->nop_point = next_nop;
dev_kfree_skb(skb);
#endif
#else
p->xmit_buffs[p->xmit_count]->size = TBD_LAST | len;
if ((next_nop = p->xmit_count + 1) == NUM_XMIT_BUFFS) {
next_nop = 0;
}
p->xmit_cmds[p->xmit_count]->cmd_status = 0;
p->xmit_cmds[p->xmit_count]->cmd_link = p->nop_cmds[next_nop]->cmd_link
= make16((p->nop_cmds[next_nop]));
p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
dev->trans_start = jiffies;
p->xmit_count = next_nop;
if (p->xmit_count != p->xmit_last)
netif_wake_queue(dev);
dev_kfree_skb(skb);
#endif
return 0;
}
示例12: ni52_send_packet
static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev)
{
int len,i;
#ifndef NO_NOPCOMMANDS
int next_nop;
#endif
struct priv *p = (struct priv *) dev->priv;
if(skb->len > XMIT_BUFF_SIZE)
{
printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len);
return 0;
}
netif_stop_queue(dev);
#if(NUM_XMIT_BUFFS > 1)
if(test_and_set_bit(0,(void *) &p->lock)) {
printk("%s: Queue was locked\n",dev->name);
return 1;
}
else
#endif
{
memcpy((char *)p->xmit_cbuffs[p->xmit_count],(char *)(skb->data),skb->len);
len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN;
#if (NUM_XMIT_BUFFS == 1)
# ifdef NO_NOPCOMMANDS
#ifdef DEBUG
if(p->scb->cus & CU_ACTIVE)
{
printk("%s: Hmmm .. CU is still running and we wanna send a new packet.\n",dev->name);
printk("%s: stat: %04x %04x\n",dev->name,p->scb->cus,p->xmit_cmds[0]->cmd_status);
}
#endif
p->xmit_buffs[0]->size = TBD_LAST | len;
for(i=0;i<16;i++)
{
p->xmit_cmds[0]->cmd_status = 0;
WAIT_4_SCB_CMD();
if( (p->scb->cus & CU_STATUS) == CU_SUSPEND)
p->scb->cmd_cuc = CUC_RESUME;
else
{
p->scb->cbl_offset = make16(p->xmit_cmds[0]);
p->scb->cmd_cuc = CUC_START;
}
ni_attn586();
dev->trans_start = jiffies;
if(!i)
dev_kfree_skb(skb);
WAIT_4_SCB_CMD();
if( (p->scb->cus & CU_ACTIVE)) /* test it, because CU sometimes doesn't start immediately */
break;
if(p->xmit_cmds[0]->cmd_status)
break;
if(i==15)
printk("%s: Can't start transmit-command.\n",dev->name);
}
# else
next_nop = (p->nop_point + 1) & 0x1;
p->xmit_buffs[0]->size = TBD_LAST | len;
p->xmit_cmds[0]->cmd_link = p->nop_cmds[next_nop]->cmd_link
= make16((p->nop_cmds[next_nop]));
p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
dev->trans_start = jiffies;
p->nop_point = next_nop;
dev_kfree_skb(skb);
# endif
#else
p->xmit_buffs[p->xmit_count]->size = TBD_LAST | len;
if( (next_nop = p->xmit_count + 1) == NUM_XMIT_BUFFS )
next_nop = 0;
p->xmit_cmds[p->xmit_count]->cmd_status = 0;
/* linkpointer of xmit-command already points to next nop cmd */
p->nop_cmds[next_nop]->cmd_link = make16((p->nop_cmds[next_nop]));
p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
dev->trans_start = jiffies;
p->xmit_count = next_nop;
{
unsigned long flags;
save_flags(flags);
cli();
if(p->xmit_count != p->xmit_last)
netif_wake_queue(dev);
p->lock = 0;
restore_flags(flags);
}
dev_kfree_skb(skb);
//.........这里部分代码省略.........
示例13: ni52_send_packet
static int ni52_send_packet(struct sk_buff *skb, struct device *dev)
{
int len,i;
#ifndef NO_NOPCOMMANDS
int next_nop;
#endif
struct priv *p = (struct priv *) dev->priv;
if(dev->tbusy)
{
int tickssofar = jiffies - dev->trans_start;
if (tickssofar < 5)
return 1;
if(p->scb->status & CU_ACTIVE) /* COMMAND-UNIT active? */
{
dev->tbusy = 0;
#ifdef DEBUG
printk("%s: strange ... timeout with CU active?!?\n",dev->name);
printk("%s: X0: %04x N0: %04x N1: %04x %d\n",dev->name,(int)p->xmit_cmds[0]->cmd_status,(int)p->nop_cmds[0]->cmd_status,(int)p->nop_cmds[1]->cmd_status,(int)p->nop_point);
#endif
p->scb->cmd = CUC_ABORT;
ni_attn586();
WAIT_4_SCB_CMD();
p->scb->cbl_offset = make16(p->nop_cmds[p->nop_point]);
p->scb->cmd = CUC_START;
ni_attn586();
WAIT_4_SCB_CMD();
dev->trans_start = jiffies;
return 0;
}
else
{
#ifdef DEBUG
printk("%s: xmitter timed out, try to restart! stat: %04x\n",dev->name,p->scb->status);
printk("%s: command-stats: %04x %04x\n",dev->name,p->xmit_cmds[0]->cmd_status,p->xmit_cmds[1]->cmd_status);
#endif
ni52_close(dev);
ni52_open(dev);
}
dev->trans_start = jiffies;
return 0;
}
if(skb == NULL)
{
dev_tint(dev);
return 0;
}
if (skb->len <= 0)
return 0;
if(skb->len > XMIT_BUFF_SIZE)
{
printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %ld bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len);
return 0;
}
if (set_bit(0, (void*)&dev->tbusy) != 0)
printk("%s: Transmitter access conflict.\n", dev->name);
else
{
memcpy((char *)p->xmit_cbuffs[p->xmit_count],(char *)(skb->data),skb->len);
len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN;
#if (NUM_XMIT_BUFFS == 1)
# ifdef NO_NOPCOMMANDS
p->xmit_buffs[0]->size = TBD_LAST | len;
for(i=0;i<16;i++)
{
p->scb->cbl_offset = make16(p->xmit_cmds[0]);
p->scb->cmd = CUC_START;
p->xmit_cmds[0]->cmd_status = 0;
ni_attn586();
dev->trans_start = jiffies;
if(!i)
dev_kfree_skb(skb,FREE_WRITE);
WAIT_4_SCB_CMD();
if( (p->scb->status & CU_ACTIVE)) /* test it, because CU sometimes doesn't start immediately */
break;
if(p->xmit_cmds[0]->cmd_status)
break;
if(i==15)
printk("%s: Can't start transmit-command.\n",dev->name);
}
# else
next_nop = (p->nop_point + 1) & 0x1;
p->xmit_buffs[0]->size = TBD_LAST | len;
p->xmit_cmds[0]->cmd_link = p->nop_cmds[next_nop]->cmd_link
= make16((p->nop_cmds[next_nop]));
p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
dev->trans_start = jiffies;
p->nop_point = next_nop;
dev_kfree_skb(skb,FREE_WRITE);
# endif
#else
//.........这里部分代码省略.........