Ejemplo n.º 1
0
static void hub_port_changed ()
{
	u8 data = 0;
	int i;
	int j = 0;
	
	for (i = 0; i < 6; i++) {
		if (port_change[i] != 0) {
			data |= 1 << (i+1);
			j++;
		}
	}

	if (data != 0) {
		int err = 0;

		if (hub_interrupt_queued) {
			printk("[%lu]hub_interrupt_transmit: Already queued a request\n", (jiffies-start_time)*10);
			return;
		}
		PRINTKI( "[%lu]Hub:Transmitting interrupt byte 0x%X\n", (jiffies-start_time)*10, data);
		hub_interrupt_queued = 1;
		memcpy (port_changed_buf, &data, 1);
		// Half delay before send
		if (port_delay)
			udelay(port_delay);
			
		err = sa1100_usb_send(port_changed_buf, 1, hub_interrupt_complete);
		if (err) {
			printk( "hub_port_changed .send_retcode %d\n", err);
		}
		// Unmask EP2 interrupts
		Ser0UDCCR = 0;
		// Ser0UDCCR = UDCCR_REM; // Errata 29
		// Half delay after send
		if (port_delay)
			udelay(port_delay);
	} else {
		if (hub_interrupt_queued)	{
			printk( "hub_interrupt_transmit: pendiente usb_ep_dequeue\n");
		}
	}

	// OJO
	if (j>1) {
		printk("[%lu]hub_interrupt_transmit: Se estropeo\n", (jiffies-start_time)*10);
		info = 0;
	}
}
Ejemplo n.º 2
0
static int
usb_eth_xmit(struct sk_buff *skb, struct net_device *dev)
{
	int ret;
	unsigned long flags;

	if (next_tx_skb) {
		printk("%s: called with next_tx_skb != NULL\n", __FUNCTION__);
		return 1;
	}

	if (skb_shared (skb)) {
		struct sk_buff  *skb2 = skb_unshare(skb, GFP_ATOMIC);
		if (!skb2) {
			usbe_info.stats.tx_dropped++;
			dev_kfree_skb(skb);
			return 1;
		}
		skb = skb2;
	}

	if ((skb->len % usb_wsize) == 0) {
		skb->len++; // other side will ignore this one, anyway.
	}

	local_irq_save(flags);
	if (cur_tx_skb) {
		next_tx_skb = skb;
		netif_stop_queue(dev);
	} else {
		cur_tx_skb = skb;
		dev->trans_start = jiffies;
		ret = sa1100_usb_send(skb->data, skb->len, usb_send_callback);
		if (ret) {
			/* If the USB core can't accept the packet, we drop it. */
			dev_kfree_skb(skb);
			cur_tx_skb = NULL;
			usbe_info.stats.tx_carrier_errors++;
		}
	}
	local_irq_restore(flags);
	return 0;
}
Ejemplo n.º 3
0
static void
usb_send_callback(int flag, int size)
{
	struct net_device *dev = usbe_info.dev;
	struct net_device_stats *stats;
	struct sk_buff *skb=cur_tx_skb;
	int ret;

	if (terminating)
		return;

	stats = &usbe_info.stats;
	switch (flag) {
	    case 0:
		stats->tx_packets++;
		stats->tx_bytes += size;
		break;
	    case -EIO:
		stats->tx_errors++;
		break;
	    default:
		stats->tx_dropped++;
		break;
	}

	cur_tx_skb = next_tx_skb;
	next_tx_skb = NULL;
	dev_kfree_skb_irq(skb);
	if (!cur_tx_skb)
		return;

	dev->trans_start = jiffies;
	ret = sa1100_usb_send(cur_tx_skb->data, cur_tx_skb->len, usb_send_callback);
	if (ret) {
		/* If the USB core can't accept the packet, we drop it. */
		dev_kfree_skb_irq(cur_tx_skb);
		cur_tx_skb = NULL;
		usbe_info.stats.tx_carrier_errors++;
	}
	netif_wake_queue(dev);
}