- 论坛徽章:
- 0
|
最近小弟在看linux代码的时候,遇上outb,outw,outsb,outb_p,inb_p,请问有什么区别呢,有什么作用呢?
- outw(0x00, RX_BUF_CLR);
- outw(gp_start, GP_LOW);
- outsb(DATAPORT,buf,len);
- if (pad) {
- while(pad--)
- outb(0, DATAPORT);
- }
- outw(gp_start, GP_LOW);
复制代码 还有在3c501网卡驱动代码中
- lp->loading = 1; /*疑问*/
- lp->txing = 1;
- /*
- * Turn interrupts back on while we spend a pleasant afternoon
- * loading bytes into the board
- */
- spin_unlock_irqrestore(&lp->lock, flags);
-
- outw(0x00, RX_BUF_CLR);
- outw(gp_start, GP_LOW);
- outsb(DATAPORT,buf,len);
- if (pad) {
- while(pad--) /* Zero fill buffer tail */
- outb(0, DATAPORT);
- }
- outw(gp_start, GP_LOW);
-
- if(lp->loading != 2) /*疑问*/
- {
- outb(AX_XMIT, AX_CMD);
- lp->loading=0;
- dev->trans_start = jiffies;
- if (el_debug > 2)
- printk(KERN_DEBUG " queued xmit.\n");
- dev_kfree_skb (skb);
- return 0;
- }
复制代码 之前给lp->loading赋值为1,那后面明显lp->loading != 2 成立,那为什么还要if呢?关键 这个在循环里面,return不就执行一次直接跳出循环了吗?
|
|