16 #include <linux/netdevice.h>
22 static struct Fsm l1fsm;
24 static char *strL1State[] =
33 static char *strL1Event[] =
52 "EV_PH_DEACTIVATE_REQ",
60 ifc->
l1l2(ifc, pr, arg);
69 ph_disconnect(adapter);
76 l1_go_f6(
struct FsmInst *fi,
int event,
void *arg)
81 ph_disconnect(adapter);
87 l1_go_f7(
struct FsmInst *fi,
int event,
void *arg)
98 l1_go_f8(
struct FsmInst *fi,
int event,
void *arg)
103 ph_disconnect(adapter);
109 l1_timer3(
struct FsmInst *fi,
int event,
void *arg)
119 l1_ignore(
struct FsmInst *fi,
int event,
void *arg)
124 l1_activate(
struct FsmInst *fi,
int event,
void *arg)
243 static struct Fsm dout_fsm;
245 static char *strDoutState[] =
249 "ST_DOUT_SHORT_INIT",
250 "ST_DOUT_SHORT_WAIT_DEN",
253 "ST_DOUT_LONG_WAIT_DEN",
256 "ST_DOUT_WAIT_FOR_UNDERRUN",
257 "ST_DOUT_WAIT_FOR_NOT_BUSY",
258 "ST_DOUT_WAIT_FOR_STOP",
259 "ST_DOUT_WAIT_FOR_RESET",
262 static char *strDoutEvent[] =
264 "EV_DOUT_START_XMIT",
285 static void dout_stop_event(
void *
context)
299 unsigned int num_packets, packet_offset;
302 struct usb_iso_packet_descriptor *
desc;
319 skb->
data, skb->
len, &bytes_sent,
320 urb->transfer_buffer, buf_size);
325 NULL, 0, &bytes_sent,
326 urb->transfer_buffer, buf_size);
329 if (len < buf_size) {
332 if (skb && !skb->
len) {
339 urb->transfer_buffer_length = len;
342 while (packet_offset < len) {
343 desc = &urb->iso_frame_desc[num_packets];
344 desc->offset = packet_offset;
346 if (len - packet_offset < desc->
length)
347 desc->length = len - packet_offset;
349 packet_offset += desc->length;
351 urb->number_of_packets = num_packets;
356 urb->transfer_flags = 0;
363 urb->transfer_flags = URB_ISO_ASAP;
368 static void fifo_reseted(
void *
context)
375 static void usb_d_out_complete(
struct urb *urb)
383 buf_nr = get_buf_nr(d_out->
urb, urb);
387 switch (urb->status) {
391 DBG(1,
"urb killed status %d", urb->status);
394 WARNING(
"urb status %d", urb->status);
395 if (d_out->
busy == 0) {
408 static void dout_start_xmit(
struct FsmInst *
fsm,
int event,
void *arg)
420 DBG(2,
"len=%d", skb->
len);
432 skb->
data, skb->
len, &bytes_sent,
433 urb->transfer_buffer, 16);
448 urb->transfer_buffer_length =
len;
450 urb->iso_frame_desc[0].offset = 0;
451 urb->iso_frame_desc[0].length =
len;
452 urb->number_of_packets = 1;
456 urb->transfer_flags = URB_ISO_ASAP;
462 static void dout_short_fifo(
struct FsmInst *fsm,
int event,
void *arg)
471 static void dout_end_short_frame(
struct FsmInst *fsm,
int event,
void *arg)
479 static void dout_long_enable_fifo(
struct FsmInst *fsm,
int event,
void *arg)
488 static void dout_long_den(
struct FsmInst *fsm,
int event,
void *arg)
494 usb_d_out(adapter, 0);
495 usb_d_out(adapter, 1);
498 static void dout_reset(
struct FsmInst *fsm,
int event,
void *arg)
507 static void dout_stop(
struct FsmInst *fsm,
int event,
void *arg)
516 static void dout_underrun(
struct FsmInst *fsm,
int event,
void *arg)
524 dout_stop(fsm, event, arg);
528 static void dout_check_busy(
struct FsmInst *fsm,
int event,
void *arg)
534 dout_stop(fsm, event, arg);
537 static void dout_reseted(
struct FsmInst *fsm,
int event,
void *arg)
548 static void dout_complete(
struct FsmInst *fsm,
int event,
void *arg)
551 long buf_nr = (
long) arg;
553 usb_d_out(adapter, buf_nr);
556 static void dout_ignore(
struct FsmInst *fsm,
int event,
void *arg)
560 static struct FsmNode DoutFnList[] __initdata =
600 DBG(2,
"PH_DATA REQUEST len %d", skb->
len);
660 struct usb_host_interface *altsetting =
NULL;
673 endpoint = &altsetting->endpoint[
EP_D_OUT-1];
675 DBG(2,
"endpoint address=%02x,packet size=%d",
676 endpoint->desc.bEndpointAddress,
le16_to_cpu(endpoint->desc.wMaxPacketSize));
679 usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress),
682 usb_d_out_complete, adapter);
700 retval = st5481_setup_d_out(adapter);
714 adapter->
l1m.fsm = &l1fsm;
718 adapter->
l1m.printdebug = l1m_debug;
721 adapter->
d_out.fsm.fsm = &dout_fsm;
725 adapter->
d_out.fsm.printdebug = dout_debug;
730 st5481_release_d_out(adapter);
740 st5481_release_d_out(adapter);
753 l1fsm.strEvent = strL1Event;
754 l1fsm.strState = strL1State;
761 dout_fsm.strEvent = strDoutEvent;
762 dout_fsm.strState = strDoutState;