Beispiel #1
0
static void ep1_start(void)
{
	PRINTKD( "[%lu]ep1_start dma_len %d remain %d pkt %d\n", (jiffies-start_time)*10, ep1_curdmalen, ep1_remain,
		rx_pktsize);
	
	sa1100_clear_dma(dmachn_rx);
	
	if (!ep1_curdmalen) {
		// ep1_curdmalen is min (rx_pktsize , ep1_remain) 
	  	ep1_curdmalen = rx_pktsize;
		if (ep1_curdmalen > ep1_remain)
			ep1_curdmalen = ep1_remain;

		ep1_curdmapos = pci_map_single(NULL, ep1_curdmabuf, ep1_curdmalen, PCI_DMA_FROMDEVICE);
	}

	UDC_write( Ser0UDCOMP, ep1_curdmalen - 1);
	
	sa1100_start_dma(dmachn_rx, ep1_curdmapos, ep1_curdmalen);

	if ( naking ) {
		/* turn off NAK of OUT packets, if set */
		UDC_flip( Ser0UDCCS1, UDCCS1_RPC );
		naking = 0;
	}
}
Beispiel #2
0
/*
 * We want to get here as soon as possible, and get the receiver setup.
 * We use the existing buffer.
 */
static void sa1100_irda_rx_dma_start(struct sa1100_irda *si)
{
	if (!si->rxskb) {
		printk(KERN_ERR "sa1100_ir: rx buffer went missing\n");
		return;
	}

	/*
	 * First empty receive FIFO
	 */
	Ser2HSCR0 = si->hscr0 | HSCR0_HSSP;

	/*
	 * Enable the DMA, receiver and receive interrupt.
	 */
	sa1100_clear_dma(si->rxdma);
	sa1100_start_dma(si->rxdma, si->rxbuf_dma, HPSIR_MAX_RXLEN);
	Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_RXE;
}
Beispiel #3
0
/* set feature stall executing, async */
static void ep2_start(struct sausb_dev *usb)
{
	ep2_curdmalen = min(ep2_remain, usb->ep[1].maxpktsize);
	if (ep2_curdmalen == 0)
		return;

	/*
	 * must do this _before_ queue buffer..
	 * stop NAKing IN tokens
	 */
	udc_set_cs2(usb->ep[1].udccs | UDCCS2_TPC, UDCCS2_TPC, 0);

	UDC_write(Ser0UDCIMP, ep2_curdmalen - 1);

	/* Remove if never seen...8Mar01ww */
	{
		int massive_attack = 20;
		while (Ser0UDCIMP != ep2_curdmalen - 1 && massive_attack--) {
			printk("usbsnd: Oh no you don't! Let me spin...");
			udelay(500);
			printk("and try again...\n");
			UDC_write(Ser0UDCIMP, ep2_curdmalen - 1);
		}
		if (massive_attack != 20) {
			if (Ser0UDCIMP != ep2_curdmalen - 1)
				printk("usbsnd: Massive attack FAILED. %d\n",
				     20 - massive_attack);
			else
				printk("usbsnd: Massive attack WORKED. %d\n",
				     20 - massive_attack);
		}
	}
	/* End remove if never seen... 8Mar01ww */

	/*
	 * fight stupid silicon bug
	 */
	Ser0UDCAR = usb->ctl->address;

	sa1100_start_dma(usb->ep[1].dmach, usb->ep[1].pktdma, ep2_curdmalen);
}
Beispiel #4
0
static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct sa1100_irda *si = dev->priv;
	int speed = irda_get_next_speed(skb);

	/*
	 * Does this packet contain a request to change the interface
	 * speed?  If so, remember it until we complete the transmission
	 * of this frame.
	 */
	if (speed != si->speed && speed != -1)
		si->newspeed = speed;

	/*
	 * If this is an empty frame, we can bypass a lot.
	 */
	if (skb->len == 0) {
		if (si->newspeed) {
			si->newspeed = 0;
			sa1100_irda_set_speed(si, speed);
		}
		dev_kfree_skb(skb);
		return 0;
	}

	if (!IS_FIR(si)) {
		netif_stop_queue(dev);

		si->tx_buff.data = si->tx_buff.head;
		si->tx_buff.len  = async_wrap_skb(skb, si->tx_buff.data,
						  si->tx_buff.truesize);

		/*
		 * Set the transmit interrupt enable.  This will fire
		 * off an interrupt immediately.  Note that we disable
		 * the receiver so we won't get spurious characteres
		 * received.
		 */
		Ser2UTCR3 = UTCR3_TIE | UTCR3_TXE;

		dev_kfree_skb(skb);
	} else {
		int mtt = irda_get_mtt(skb);

		/*
		 * We must not be transmitting...
		 */
		if (si->txskb)
			BUG();

		netif_stop_queue(dev);

		si->txskb = skb;
		si->txbuf_dma = dma_map_single(si->dev, skb->data,
					 skb->len, DMA_TO_DEVICE);

		sa1100_start_dma(si->txdma, si->txbuf_dma, skb->len);

		/*
		 * If we have a mean turn-around time, impose the specified
		 * specified delay.  We could shorten this by timing from
		 * the point we received the packet.
		 */
		if (mtt)
			udelay(mtt);

		Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_TXE;
	}

	dev->trans_start = jiffies;

	return 0;
}