diff options
Diffstat (limited to 'drivers/isdn/hisax/st5481_d.c')
-rw-r--r-- | drivers/isdn/hisax/st5481_d.c | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c index db247b7..e88c5c7 100644 --- a/drivers/isdn/hisax/st5481_d.c +++ b/drivers/isdn/hisax/st5481_d.c @@ -4,7 +4,7 @@ * Author Frode Isaksen * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com> * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -32,22 +32,22 @@ static char *strL1State[] = static char *strL1Event[] = { - "EV_IND_DP", - "EV_IND_1", - "EV_IND_2", - "EV_IND_3", - "EV_IND_RSY", - "EV_IND_5", - "EV_IND_6", - "EV_IND_7", - "EV_IND_AP", - "EV_IND_9", - "EV_IND_10", - "EV_IND_11", + "EV_IND_DP", + "EV_IND_1", + "EV_IND_2", + "EV_IND_3", + "EV_IND_RSY", + "EV_IND_5", + "EV_IND_6", + "EV_IND_7", + "EV_IND_AP", + "EV_IND_9", + "EV_IND_10", + "EV_IND_11", "EV_IND_AI8", "EV_IND_AI10", "EV_IND_AIL", - "EV_IND_DI", + "EV_IND_DI", "EV_PH_ACTIVATE_REQ", "EV_PH_DEACTIVATE_REQ", "EV_TIMER3", @@ -67,7 +67,7 @@ l1_go_f3(struct FsmInst *fi, int event, void *arg) if (fi->state == ST_L1_F7) ph_disconnect(adapter); - + FsmChangeState(fi, ST_L1_F3); D_L1L2(adapter, PH_DEACTIVATE | INDICATION, NULL); } @@ -168,11 +168,11 @@ static struct FsmNode L1FnList[] __initdata = }; static __printf(2, 3) -void l1m_debug(struct FsmInst *fi, char *fmt, ...) + void l1m_debug(struct FsmInst *fi, char *fmt, ...) { va_list args; char buf[256]; - + va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); DBG(8, "%s", buf); @@ -191,54 +191,54 @@ void l1m_debug(struct FsmInst *fi, char *fmt, ...) L1 FRAME D_OUT_STATE USB D CHANNEL -------- ----------- --- --------- - - FIXME - - -> [xx..xx] SHORT_INIT -> [7Exx..xxC1C27EFF] - SHORT_WAIT_DEN <> OUT_D_COUNTER=16 - - END_OF_SHORT <- DEN_EVENT -> 7Exx - xxxx - xxxx - xxxx - xxxx - xxxx - C1C1 - 7EFF - WAIT_FOR_RESET_IDLE <- D_UNDERRUN <- (8ms) - IDLE <> Reset pipe - - + + FIXME + + -> [xx..xx] SHORT_INIT -> [7Exx..xxC1C27EFF] + SHORT_WAIT_DEN <> OUT_D_COUNTER=16 + + END_OF_SHORT <- DEN_EVENT -> 7Exx + xxxx + xxxx + xxxx + xxxx + xxxx + C1C1 + 7EFF + WAIT_FOR_RESET_IDLE <- D_UNDERRUN <- (8ms) + IDLE <> Reset pipe + + Transmit long frame (>= 16 bytes of encoded data): L1 FRAME D_OUT_STATE USB D CHANNEL -------- ----------- --- --------- - -> [xx...xx] IDLE - WAIT_FOR_STOP <> OUT_D_COUNTER=0 - WAIT_FOR_RESET <> Reset pipe - STOP - INIT_LONG_FRAME -> [7Exx..xx] - WAIT_DEN <> OUT_D_COUNTER=16 - OUT_NORMAL <- DEN_EVENT -> 7Exx - END_OF_FRAME_BUSY -> [xxxx] xxxx - END_OF_FRAME_NOT_BUSY -> [xxxx] xxxx - -> [xxxx] xxxx - -> [C1C2] xxxx - -> [7EFF] xxxx - xxxx - xxxx - .... - xxxx - C1C2 - 7EFF - <- D_UNDERRUN <- (> 8ms) - WAIT_FOR_STOP <> OUT_D_COUNTER=0 - WAIT_FOR_RESET <> Reset pipe - STOP - -*/ + -> [xx...xx] IDLE + WAIT_FOR_STOP <> OUT_D_COUNTER=0 + WAIT_FOR_RESET <> Reset pipe + STOP + INIT_LONG_FRAME -> [7Exx..xx] + WAIT_DEN <> OUT_D_COUNTER=16 + OUT_NORMAL <- DEN_EVENT -> 7Exx + END_OF_FRAME_BUSY -> [xxxx] xxxx + END_OF_FRAME_NOT_BUSY -> [xxxx] xxxx + -> [xxxx] xxxx + -> [C1C2] xxxx + -> [7EFF] xxxx + xxxx + xxxx + .... + xxxx + C1C2 + 7EFF + <- D_UNDERRUN <- (> 8ms) + WAIT_FOR_STOP <> OUT_D_COUNTER=0 + WAIT_FOR_RESET <> Reset pipe + STOP + +*/ static struct Fsm dout_fsm; @@ -254,7 +254,7 @@ static char *strDoutState[] = "ST_DOUT_NORMAL", "ST_DOUT_WAIT_FOR_UNDERRUN", - "ST_DOUT_WAIT_FOR_NOT_BUSY", + "ST_DOUT_WAIT_FOR_NOT_BUSY", "ST_DOUT_WAIT_FOR_STOP", "ST_DOUT_WAIT_FOR_RESET", }; @@ -271,11 +271,11 @@ static char *strDoutEvent[] = }; static __printf(2, 3) -void dout_debug(struct FsmInst *fi, char *fmt, ...) + void dout_debug(struct FsmInst *fi, char *fmt, ...) { va_list args; char buf[256]; - + va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); DBG(0x2, "%s", buf); @@ -313,19 +313,19 @@ static void usb_d_out(struct st5481_adapter *adapter, int buf_nr) skb = d_out->tx_skb; buf_size = NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT; - + if (skb) { len = isdnhdlc_encode(&d_out->hdlc_state, skb->data, skb->len, &bytes_sent, urb->transfer_buffer, buf_size); - skb_pull(skb,bytes_sent); + skb_pull(skb, bytes_sent); } else { // Send flags or idle len = isdnhdlc_encode(&d_out->hdlc_state, NULL, 0, &bytes_sent, urb->transfer_buffer, buf_size); } - + if (len < buf_size) { FsmChangeState(&d_out->fsm, ST_DOUT_WAIT_FOR_UNDERRUN); } @@ -354,15 +354,15 @@ static void usb_d_out(struct st5481_adapter *adapter, int buf_nr) urb->dev = adapter->usb_dev; // Need to transmit the next buffer 2ms after the DEN_EVENT urb->transfer_flags = 0; - urb->start_frame = usb_get_current_frame_number(adapter->usb_dev)+2; + urb->start_frame = usb_get_current_frame_number(adapter->usb_dev) + 2; - DBG_ISO_PACKET(0x20,urb); + DBG_ISO_PACKET(0x20, urb); if (usb_submit_urb(urb, GFP_KERNEL) < 0) { // There is another URB queued up urb->transfer_flags = URB_ISO_ASAP; SUBMIT_URB(urb, GFP_KERNEL); - } + } } static void fifo_reseted(void *context) @@ -377,7 +377,7 @@ static void usb_d_out_complete(struct urb *urb) struct st5481_adapter *adapter = urb->context; struct st5481_d_out *d_out = &adapter->d_out; long buf_nr; - + DBG(2, ""); buf_nr = get_buf_nr(d_out->urb, urb); @@ -385,17 +385,17 @@ static void usb_d_out_complete(struct urb *urb) if (unlikely(urb->status < 0)) { switch (urb->status) { - case -ENOENT: - case -ESHUTDOWN: - case -ECONNRESET: - DBG(1,"urb killed status %d", urb->status); - break; - default: - WARNING("urb status %d",urb->status); - if (d_out->busy == 0) { - st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter); - } - break; + case -ENOENT: + case -ESHUTDOWN: + case -ECONNRESET: + DBG(1, "urb killed status %d", urb->status); + break; + default: + WARNING("urb status %d", urb->status); + if (d_out->busy == 0) { + st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter); + } + break; } return; // Give up } @@ -417,7 +417,7 @@ static void dout_start_xmit(struct FsmInst *fsm, int event, void *arg) skb = d_out->tx_skb; - DBG(2,"len=%d",skb->len); + DBG(2, "len=%d", skb->len); isdnhdlc_out_init(&d_out->hdlc_state, HDLC_DCHANNEL | HDLC_BITREVERSE); @@ -433,7 +433,7 @@ static void dout_start_xmit(struct FsmInst *fsm, int event, void *arg) urb->transfer_buffer, 16); skb_pull(skb, bytes_sent); - if(len < 16) + if (len < 16) FsmChangeState(&d_out->fsm, ST_DOUT_SHORT_INIT); else FsmChangeState(&d_out->fsm, ST_DOUT_LONG_INIT); @@ -455,7 +455,7 @@ static void dout_start_xmit(struct FsmInst *fsm, int event, void *arg) urb->dev = adapter->usb_dev; urb->transfer_flags = URB_ISO_ASAP; - DBG_ISO_PACKET(0x20,urb); + DBG_ISO_PACKET(0x20, urb); SUBMIT_URB(urb, GFP_KERNEL); } @@ -480,7 +480,7 @@ static void dout_long_enable_fifo(struct FsmInst *fsm, int event, void *arg) { struct st5481_adapter *adapter = fsm->userdata; struct st5481_d_out *d_out = &adapter->d_out; - + st5481_usb_device_ctrl_msg(adapter, OUT_D_COUNTER, 16, NULL, NULL); FsmChangeState(&d_out->fsm, ST_DOUT_LONG_WAIT_DEN); } @@ -619,8 +619,8 @@ static void ph_connect(struct st5481_adapter *adapter) struct st5481_d_out *d_out = &adapter->d_out; struct st5481_in *d_in = &adapter->d_in; - DBG(8,""); - + DBG(8, ""); + FsmChangeState(&d_out->fsm, ST_DOUT_NONE); // st5481_usb_device_ctrl_msg(adapter, FFMSK_D, OUT_UNDERRUN, NULL, NULL); @@ -644,7 +644,7 @@ static void ph_connect(struct st5481_adapter *adapter) */ static void ph_disconnect(struct st5481_adapter *adapter) { - DBG(8,""); + DBG(8, ""); st5481_in_mode(&adapter->d_in, L1_MODE_NULL); @@ -661,7 +661,7 @@ static int st5481_setup_d_out(struct st5481_adapter *adapter) struct usb_host_endpoint *endpoint; struct st5481_d_out *d_out = &adapter->d_out; - DBG(2,""); + DBG(2, ""); intf = usb_ifnum_to_if(dev, 0); if (intf) @@ -672,10 +672,10 @@ static int st5481_setup_d_out(struct st5481_adapter *adapter) // Allocate URBs and buffers for the D channel out endpoint = &altsetting->endpoint[EP_D_OUT-1]; - DBG(2,"endpoint address=%02x,packet size=%d", + DBG(2, "endpoint address=%02x,packet size=%d", endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize)); - return st5481_setup_isocpipes(d_out->urb, dev, + return st5481_setup_isocpipes(d_out->urb, dev, usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress), NUM_ISO_PACKETS_D, SIZE_ISO_PACKETS_D_OUT, NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT, @@ -686,7 +686,7 @@ static void st5481_release_d_out(struct st5481_adapter *adapter) { struct st5481_d_out *d_out = &adapter->d_out; - DBG(2,""); + DBG(2, ""); st5481_release_isocpipes(d_out->urb); } @@ -695,7 +695,7 @@ int st5481_setup_d(struct st5481_adapter *adapter) { int retval; - DBG(2,""); + DBG(2, ""); retval = st5481_setup_d_out(adapter); if (retval) @@ -726,15 +726,15 @@ int st5481_setup_d(struct st5481_adapter *adapter) return 0; - err_d_out: +err_d_out: st5481_release_d_out(adapter); - err: +err: return retval; } void st5481_release_d(struct st5481_adapter *adapter) { - DBG(2,""); + DBG(2, ""); st5481_release_in(&adapter->d_in); st5481_release_d_out(adapter); @@ -766,9 +766,9 @@ int __init st5481_d_init(void) return 0; - err_l1: +err_l1: FsmFree(&l1fsm); - err: +err: return retval; } |