diff options
Diffstat (limited to 'drivers/isdn/gigaset/gigaset.h')
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 90 |
1 files changed, 27 insertions, 63 deletions
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index a2f6125739eb..1185da2dbf61 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <linux/isdnif.h> | ||
27 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
28 | #include <linux/skbuff.h> | 27 | #include <linux/skbuff.h> |
29 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
@@ -40,7 +39,6 @@ | |||
40 | 39 | ||
41 | #define MAX_REC_PARAMS 10 /* Max. number of params in response string */ | 40 | #define MAX_REC_PARAMS 10 /* Max. number of params in response string */ |
42 | #define MAX_RESP_SIZE 512 /* Max. size of a response string */ | 41 | #define MAX_RESP_SIZE 512 /* Max. size of a response string */ |
43 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ | ||
44 | 42 | ||
45 | #define MAX_EVENTS 64 /* size of event queue */ | 43 | #define MAX_EVENTS 64 /* size of event queue */ |
46 | 44 | ||
@@ -216,7 +214,6 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
216 | #define EV_START -110 | 214 | #define EV_START -110 |
217 | #define EV_STOP -111 | 215 | #define EV_STOP -111 |
218 | #define EV_IF_LOCK -112 | 216 | #define EV_IF_LOCK -112 |
219 | #define EV_PROTO_L2 -113 | ||
220 | #define EV_ACCEPT -114 | 217 | #define EV_ACCEPT -114 |
221 | #define EV_DIAL -115 | 218 | #define EV_DIAL -115 |
222 | #define EV_HUP -116 | 219 | #define EV_HUP -116 |
@@ -259,6 +256,11 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
259 | #define SM_LOCKED 0 | 256 | #define SM_LOCKED 0 |
260 | #define SM_ISDN 1 /* default */ | 257 | #define SM_ISDN 1 /* default */ |
261 | 258 | ||
259 | /* layer 2 protocols (AT^SBPR=...) */ | ||
260 | #define L2_BITSYNC 0 | ||
261 | #define L2_HDLC 1 | ||
262 | #define L2_VOICE 2 | ||
263 | |||
262 | struct gigaset_ops; | 264 | struct gigaset_ops; |
263 | struct gigaset_driver; | 265 | struct gigaset_driver; |
264 | 266 | ||
@@ -395,7 +397,7 @@ struct bc_state { | |||
395 | 397 | ||
396 | unsigned chstate; /* bitmap (CHS_*) */ | 398 | unsigned chstate; /* bitmap (CHS_*) */ |
397 | int ignore; | 399 | int ignore; |
398 | unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */ | 400 | unsigned proto2; /* layer 2 protocol (L2_*) */ |
399 | char *commands[AT_NUM]; /* see AT_XXXX */ | 401 | char *commands[AT_NUM]; /* see AT_XXXX */ |
400 | 402 | ||
401 | #ifdef CONFIG_GIGASET_DEBUG | 403 | #ifdef CONFIG_GIGASET_DEBUG |
@@ -456,12 +458,13 @@ struct cardstate { | |||
456 | 458 | ||
457 | unsigned running; /* !=0 if events are handled */ | 459 | unsigned running; /* !=0 if events are handled */ |
458 | unsigned connected; /* !=0 if hardware is connected */ | 460 | unsigned connected; /* !=0 if hardware is connected */ |
459 | unsigned isdn_up; /* !=0 after ISDN_STAT_RUN */ | 461 | unsigned isdn_up; /* !=0 after gigaset_isdn_start() */ |
460 | 462 | ||
461 | unsigned cidmode; | 463 | unsigned cidmode; |
462 | 464 | ||
463 | int myid; /* id for communication with LL */ | 465 | int myid; /* id for communication with LL */ |
464 | isdn_if iif; | 466 | void *iif; /* LL interface structure */ |
467 | unsigned short hw_hdr_len; /* headroom needed in data skbs */ | ||
465 | 468 | ||
466 | struct reply_t *tabnocid; | 469 | struct reply_t *tabnocid; |
467 | struct reply_t *tabcid; | 470 | struct reply_t *tabcid; |
@@ -616,7 +619,9 @@ struct gigaset_ops { | |||
616 | int (*baud_rate)(struct cardstate *cs, unsigned cflag); | 619 | int (*baud_rate)(struct cardstate *cs, unsigned cflag); |
617 | int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag); | 620 | int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag); |
618 | 621 | ||
619 | /* Called from i4l.c to put an skb into the send-queue. */ | 622 | /* Called from LL interface to put an skb into the send-queue. |
623 | * After sending is completed, gigaset_skb_sent() must be called | ||
624 | * with the first cs->hw_hdr_len bytes of skb->head preserved. */ | ||
620 | int (*send_skb)(struct bc_state *bcs, struct sk_buff *skb); | 625 | int (*send_skb)(struct bc_state *bcs, struct sk_buff *skb); |
621 | 626 | ||
622 | /* Called from ev-layer.c to process a block of data | 627 | /* Called from ev-layer.c to process a block of data |
@@ -638,8 +643,7 @@ struct gigaset_ops { | |||
638 | * Functions implemented in asyncdata.c | 643 | * Functions implemented in asyncdata.c |
639 | */ | 644 | */ |
640 | 645 | ||
641 | /* Called from i4l.c to put an skb into the send-queue. | 646 | /* Called from LL interface to put an skb into the send queue. */ |
642 | * After sending gigaset_skb_sent() should be called. */ | ||
643 | int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb); | 647 | int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb); |
644 | 648 | ||
645 | /* Called from ev-layer.c to process a block of data | 649 | /* Called from ev-layer.c to process a block of data |
@@ -650,8 +654,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf); | |||
650 | * Functions implemented in isocdata.c | 654 | * Functions implemented in isocdata.c |
651 | */ | 655 | */ |
652 | 656 | ||
653 | /* Called from i4l.c to put an skb into the send-queue. | 657 | /* Called from LL interface to put an skb into the send queue. */ |
654 | * After sending gigaset_skb_sent() should be called. */ | ||
655 | int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb); | 658 | int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb); |
656 | 659 | ||
657 | /* Called from ev-layer.c to process a block of data | 660 | /* Called from ev-layer.c to process a block of data |
@@ -674,36 +677,26 @@ void gigaset_isowbuf_init(struct isowbuf_t *iwb, unsigned char idle); | |||
674 | int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size); | 677 | int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size); |
675 | 678 | ||
676 | /* =========================================================================== | 679 | /* =========================================================================== |
677 | * Functions implemented in i4l.c/gigaset.h | 680 | * Functions implemented in LL interface |
678 | */ | 681 | */ |
679 | 682 | ||
680 | /* Called by gigaset_initcs() for setting up with the isdn4linux subsystem */ | 683 | /* Called from common.c for setting up/shutting down with the ISDN subsystem */ |
681 | int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid); | 684 | int gigaset_isdn_register(struct cardstate *cs, const char *isdnid); |
685 | void gigaset_isdn_unregister(struct cardstate *cs); | ||
682 | 686 | ||
683 | /* Called from xxx-gigaset.c to indicate completion of sending an skb */ | 687 | /* Called from hardware module to indicate completion of an skb */ |
684 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb); | 688 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb); |
689 | void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb); | ||
690 | void gigaset_isdn_rcv_err(struct bc_state *bcs); | ||
685 | 691 | ||
686 | /* Called from common.c/ev-layer.c to indicate events relevant to the LL */ | 692 | /* Called from common.c/ev-layer.c to indicate events relevant to the LL */ |
693 | void gigaset_isdn_start(struct cardstate *cs); | ||
694 | void gigaset_isdn_stop(struct cardstate *cs); | ||
687 | int gigaset_isdn_icall(struct at_state_t *at_state); | 695 | int gigaset_isdn_icall(struct at_state_t *at_state); |
688 | int gigaset_isdn_setup_accept(struct at_state_t *at_state); | 696 | void gigaset_isdn_connD(struct bc_state *bcs); |
689 | int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data); | 697 | void gigaset_isdn_hupD(struct bc_state *bcs); |
690 | 698 | void gigaset_isdn_connB(struct bc_state *bcs); | |
691 | void gigaset_i4l_cmd(struct cardstate *cs, int cmd); | 699 | void gigaset_isdn_hupB(struct bc_state *bcs); |
692 | void gigaset_i4l_channel_cmd(struct bc_state *bcs, int cmd); | ||
693 | |||
694 | |||
695 | static inline void gigaset_isdn_rcv_err(struct bc_state *bcs) | ||
696 | { | ||
697 | isdn_ctrl response; | ||
698 | |||
699 | /* error -> LL */ | ||
700 | gig_dbg(DEBUG_CMD, "sending L1ERR"); | ||
701 | response.driver = bcs->cs->myid; | ||
702 | response.command = ISDN_STAT_L1ERR; | ||
703 | response.arg = bcs->channel; | ||
704 | response.parm.errcode = ISDN_STAT_L1ERR_RECV; | ||
705 | bcs->cs->iif.statcallb(&response); | ||
706 | } | ||
707 | 700 | ||
708 | /* =========================================================================== | 701 | /* =========================================================================== |
709 | * Functions implemented in ev-layer.c | 702 | * Functions implemented in ev-layer.c |
@@ -816,35 +809,6 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs) | |||
816 | /* handling routines for sk_buff */ | 809 | /* handling routines for sk_buff */ |
817 | /* ============================= */ | 810 | /* ============================= */ |
818 | 811 | ||
819 | /* pass received skb to LL | ||
820 | * Warning: skb must not be accessed anymore! | ||
821 | */ | ||
822 | static inline void gigaset_rcv_skb(struct sk_buff *skb, | ||
823 | struct cardstate *cs, | ||
824 | struct bc_state *bcs) | ||
825 | { | ||
826 | cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb); | ||
827 | bcs->trans_down++; | ||
828 | } | ||
829 | |||
830 | /* handle reception of corrupted skb | ||
831 | * Warning: skb must not be accessed anymore! | ||
832 | */ | ||
833 | static inline void gigaset_rcv_error(struct sk_buff *procskb, | ||
834 | struct cardstate *cs, | ||
835 | struct bc_state *bcs) | ||
836 | { | ||
837 | if (procskb) | ||
838 | dev_kfree_skb(procskb); | ||
839 | |||
840 | if (bcs->ignore) | ||
841 | --bcs->ignore; | ||
842 | else { | ||
843 | ++bcs->corrupted; | ||
844 | gigaset_isdn_rcv_err(bcs); | ||
845 | } | ||
846 | } | ||
847 | |||
848 | /* append received bytes to inbuf */ | 812 | /* append received bytes to inbuf */ |
849 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 813 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
850 | unsigned numbytes); | 814 | unsigned numbytes); |