hfcpci.c (8bfddfbe2100862fd39b97001d0559ccd4c77f19) | hfcpci.c (7206e659f689558b41aa058c3040b081cb281d03) |
---|---|
1/* 2 * 3 * hfcpci.c low level driver for CCD's hfc-pci based cards 4 * 5 * Author Werner Cornelius (werner@isdn4linux.de) 6 * based on existing driver for CCD hfc ISA cards 7 * type approval valid for HFC-S PCI A based card 8 * --- 563 unchanged lines hidden (view full) --- 572 573 fcnt_tx = le16_to_cpu(*z2t) - le16_to_cpu(*z1t); 574 if (fcnt_tx <= 0) 575 fcnt_tx += B_FIFO_SIZE; 576 /* fcnt_tx contains available bytes in tx-fifo */ 577 fcnt_tx = B_FIFO_SIZE - fcnt_tx; 578 /* remaining bytes to send (bytes in tx-fifo) */ 579 | 1/* 2 * 3 * hfcpci.c low level driver for CCD's hfc-pci based cards 4 * 5 * Author Werner Cornelius (werner@isdn4linux.de) 6 * based on existing driver for CCD hfc ISA cards 7 * type approval valid for HFC-S PCI A based card 8 * --- 563 unchanged lines hidden (view full) --- 572 573 fcnt_tx = le16_to_cpu(*z2t) - le16_to_cpu(*z1t); 574 if (fcnt_tx <= 0) 575 fcnt_tx += B_FIFO_SIZE; 576 /* fcnt_tx contains available bytes in tx-fifo */ 577 fcnt_tx = B_FIFO_SIZE - fcnt_tx; 578 /* remaining bytes to send (bytes in tx-fifo) */ 579 |
580 bch->rx_skb = mI_alloc_skb(fcnt_rx, GFP_ATOMIC); 581 if (bch->rx_skb) { | 580 maxlen = bchannel_get_rxbuf(bch, fcnt_rx); 581 if (maxlen < 0) { 582 pr_warning("B%d: No bufferspace for %d bytes\n", 583 bch->nr, fcnt_rx); 584 } else { |
582 ptr = skb_put(bch->rx_skb, fcnt_rx); 583 if (le16_to_cpu(*z2r) + fcnt_rx <= B_FIFO_SIZE + B_SUB_VAL) 584 maxlen = fcnt_rx; /* complete transfer */ 585 else 586 maxlen = B_FIFO_SIZE + B_SUB_VAL - le16_to_cpu(*z2r); 587 /* maximum */ 588 589 ptr1 = bdata + (le16_to_cpu(*z2r) - B_SUB_VAL); 590 /* start of data */ 591 memcpy(ptr, ptr1, maxlen); /* copy data */ 592 fcnt_rx -= maxlen; 593 594 if (fcnt_rx) { /* rest remaining */ 595 ptr += maxlen; 596 ptr1 = bdata; /* start of buffer */ 597 memcpy(ptr, ptr1, fcnt_rx); /* rest */ 598 } 599 recv_Bchannel(bch, fcnt_tx); /* bch, id */ | 585 ptr = skb_put(bch->rx_skb, fcnt_rx); 586 if (le16_to_cpu(*z2r) + fcnt_rx <= B_FIFO_SIZE + B_SUB_VAL) 587 maxlen = fcnt_rx; /* complete transfer */ 588 else 589 maxlen = B_FIFO_SIZE + B_SUB_VAL - le16_to_cpu(*z2r); 590 /* maximum */ 591 592 ptr1 = bdata + (le16_to_cpu(*z2r) - B_SUB_VAL); 593 /* start of data */ 594 memcpy(ptr, ptr1, maxlen); /* copy data */ 595 fcnt_rx -= maxlen; 596 597 if (fcnt_rx) { /* rest remaining */ 598 ptr += maxlen; 599 ptr1 = bdata; /* start of buffer */ 600 memcpy(ptr, ptr1, fcnt_rx); /* rest */ 601 } 602 recv_Bchannel(bch, fcnt_tx); /* bch, id */ |
600 } else 601 printk(KERN_WARNING "HFCPCI: receive out of memory\n"); 602 | 603 } |
603 *z2r = cpu_to_le16(new_z2); /* new position */ 604} 605 606/* 607 * B-channel main receive routine 608 */ 609static void 610main_rec_hfcpci(struct bchannel *bch) --- 1768 unchanged lines hidden --- | 604 *z2r = cpu_to_le16(new_z2); /* new position */ 605} 606 607/* 608 * B-channel main receive routine 609 */ 610static void 611main_rec_hfcpci(struct bchannel *bch) --- 1768 unchanged lines hidden --- |