static void b1dma_dispatch_tx(avmcard *card) { avmcard_dmainfo *dma = card->dma; struct sk_buff *skb; u8 cmd, subcmd; u16 len; u32 txlen; void *p; skb = skb_dequeue(&dma->send_queue); len = CAPIMSG_LEN(skb->data); if (len) { cmd = CAPIMSG_COMMAND(skb->data); subcmd = CAPIMSG_SUBCOMMAND(skb->data); p = dma->sendbuf.dmabuf; if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { u16 dlen = CAPIMSG_DATALEN(skb->data); _put_byte(&p, SEND_DATA_B3_REQ); _put_slice(&p, skb->data, len); _put_slice(&p, skb->data + len, dlen); } else { _put_byte(&p, SEND_MESSAGE); _put_slice(&p, skb->data, len); } txlen = (u8 *)p - (u8 *)dma->sendbuf.dmabuf; #ifdef AVM_B1DMA_DEBUG printk(KERN_DEBUG "tx: put msg len=%d\n", txlen); #endif } else { txlen = skb->len - 2; #ifdef AVM_B1DMA_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: send ack\n", card->name); #endif #ifdef AVM_B1DMA_DEBUG printk(KERN_DEBUG "tx: put 0x%x len=%d\n", skb->data[2], txlen); #endif skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, skb->len - 2); } txlen = (txlen + 3) & ~3; b1dma_writel(card, dma->sendbuf.dmaaddr, AMCC_TXPTR); b1dma_writel(card, txlen, AMCC_TXLEN); card->csr |= EN_TX_TC_INT; dev_kfree_skb_any(skb); }
static void c4_dispatch_tx(avmcard *card) { avmcard_dmainfo *dma = card->dma; struct sk_buff *skb; u8 cmd, subcmd; u16 len; u32 txlen; void *p; if (card->csr & DBELL_DOWN_ARM) { /* tx busy */ return; } skb = skb_dequeue(&dma->send_queue); if (!skb) { #ifdef AVM_C4_DEBUG printk(KERN_DEBUG "%s: tx underrun\n", card->name); #endif return; } len = CAPIMSG_LEN(skb->data); if (len) { cmd = CAPIMSG_COMMAND(skb->data); subcmd = CAPIMSG_SUBCOMMAND(skb->data); p = dma->sendbuf.dmabuf; if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { u16 dlen = CAPIMSG_DATALEN(skb->data); _put_byte(&p, SEND_DATA_B3_REQ); _put_slice(&p, skb->data, len); _put_slice(&p, skb->data + len, dlen); } else { _put_byte(&p, SEND_MESSAGE); _put_slice(&p, skb->data, len); } txlen = (u8 *)p - (u8 *)dma->sendbuf.dmabuf; #ifdef AVM_C4_DEBUG printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen); #endif } else { txlen = skb->len-2; #ifdef AVM_C4_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: ack to c4\n", card->name); #endif #ifdef AVM_C4_DEBUG printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", card->name, skb->data[2], txlen); #endif skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, skb->len - 2); } txlen = (txlen + 3) & ~3; c4outmeml(card->mbase+MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr); c4outmeml(card->mbase+MBOX_DOWN_LEN, txlen); card->csr |= DBELL_DOWN_ARM; c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM); dev_kfree_skb_any(skb); }
static void b1dma_dispatch_tx(avmcard *card) { avmcard_dmainfo *dma = card->dma; unsigned long flags; struct sk_buff *skb; __u8 cmd, subcmd; __u16 len; __u32 txlen; int inint; void *p; save_flags(flags); cli(); inint = card->interrupt; if (card->csr & EN_TX_TC_INT) { /* tx busy */ restore_flags(flags); return; } skb = skb_dequeue(&dma->send_queue); if (!skb) { #ifdef CONFIG_B1DMA_DEBUG printk(KERN_DEBUG "tx(%d): underrun\n", inint); #endif restore_flags(flags); return; } len = CAPIMSG_LEN(skb->data); if (len) { cmd = CAPIMSG_COMMAND(skb->data); subcmd = CAPIMSG_SUBCOMMAND(skb->data); p = dma->sendbuf; if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { __u16 dlen = CAPIMSG_DATALEN(skb->data); _put_byte(&p, SEND_DATA_B3_REQ); _put_slice(&p, skb->data, len); _put_slice(&p, skb->data + len, dlen); } else { _put_byte(&p, SEND_MESSAGE); _put_slice(&p, skb->data, len); } txlen = (__u8 *)p - (__u8 *)dma->sendbuf; #ifdef CONFIG_B1DMA_DEBUG printk(KERN_DEBUG "tx(%d): put msg len=%d\n", inint, txlen); #endif } else { txlen = skb->len-2; #ifdef CONFIG_B1DMA_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: send ack\n", card->name); #endif #ifdef CONFIG_B1DMA_DEBUG printk(KERN_DEBUG "tx(%d): put 0x%x len=%d\n", inint, skb->data[2], txlen); #endif memcpy(dma->sendbuf, skb->data+2, skb->len-2); } txlen = (txlen + 3) & ~3; b1dmaoutmeml(card->mbase+AMCC_TXPTR, virt_to_phys(dma->sendbuf)); b1dmaoutmeml(card->mbase+AMCC_TXLEN, txlen); card->csr |= EN_TX_TC_INT; if (!inint) b1dmaoutmeml(card->mbase+AMCC_INTCSR, card->csr); restore_flags(flags); dev_kfree_skb_any(skb); }
static void c4_dispatch_tx(avmcard *card) { avmcard_dmainfo *dma = card->dma; unsigned long flags; struct sk_buff *skb; __u8 cmd, subcmd; __u16 len; __u32 txlen; void *p; save_flags(flags); cli(); if (card->csr & DBELL_DOWN_ARM) { /* tx busy */ restore_flags(flags); return; } skb = skb_dequeue(&dma->send_queue); if (!skb) { #ifdef CONFIG_C4_DEBUG printk(KERN_DEBUG "%s: tx underrun\n", card->name); #endif restore_flags(flags); return; } len = CAPIMSG_LEN(skb->data); if (len) { cmd = CAPIMSG_COMMAND(skb->data); subcmd = CAPIMSG_SUBCOMMAND(skb->data); p = dma->sendbuf; if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { __u16 dlen = CAPIMSG_DATALEN(skb->data); _put_byte(&p, SEND_DATA_B3_REQ); _put_slice(&p, skb->data, len); _put_slice(&p, skb->data + len, dlen); } else { _put_byte(&p, SEND_MESSAGE); _put_slice(&p, skb->data, len); } txlen = (__u8 *)p - (__u8 *)dma->sendbuf; #ifdef CONFIG_C4_DEBUG printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen); #endif } else { txlen = skb->len-2; #ifdef CONFIG_C4_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: ack to c4\n", card->name); #endif #ifdef CONFIG_C4_DEBUG printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", card->name, skb->data[2], txlen); #endif memcpy(dma->sendbuf, skb->data+2, skb->len-2); } txlen = (txlen + 3) & ~3; c4outmeml(card->mbase+MBOX_DOWN_ADDR, virt_to_phys(dma->sendbuf)); c4outmeml(card->mbase+MBOX_DOWN_LEN, txlen); card->csr |= DBELL_DOWN_ARM; c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM); restore_flags(flags); dev_kfree_skb_any(skb); }