17 waitforCEC(
struct IsdnCardState *
cs,
int hscx)
31 waitforXFW(
struct IsdnCardState *cs,
int hscx)
44 WriteHSCXCMDR(
struct IsdnCardState *cs,
int hscx,
u_char data)
53 hscx_empty_fifo(
struct BCState *bcs,
int count)
56 struct IsdnCardState *cs = bcs->cs;
58 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
62 if (cs->debug & L1_DEB_WARN)
63 debugl1(cs,
"hscx_empty_fifo: incoming packet too large");
64 WriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x80);
65 bcs->hw.hscx.rcvidx = 0;
68 ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
69 bcs->hw.hscx.rcvidx +=
count;
71 WriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x80);
72 if (cs->debug & L1_DEB_HSCX_FIFO) {
75 t +=
sprintf(t,
"hscx_empty_fifo %c cnt %d",
76 bcs->hw.hscx.hscx ?
'B' :
'A', count);
83 hscx_fill_fifo(
struct BCState *bcs)
85 struct IsdnCardState *cs = bcs->cs;
90 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
95 if (bcs->tx_skb->len <= 0)
99 if (bcs->tx_skb->len > fifo_size) {
103 count = bcs->tx_skb->len;
105 waitforXFW(cs, bcs->hw.hscx.hscx);
106 ptr = bcs->tx_skb->data;
108 bcs->tx_cnt -=
count;
109 bcs->hw.hscx.count +=
count;
111 WriteHSCXCMDR(cs, bcs->hw.hscx.hscx, more ? 0x8 : 0xa);
112 if (cs->debug & L1_DEB_HSCX_FIFO) {
115 t +=
sprintf(t,
"hscx_fill_fifo %c cnt %d",
116 bcs->hw.hscx.hscx ?
'B' :
'A', count);
126 struct BCState *bcs = cs->bcs + hscx;
128 int fifo_size =
test_bit(HW_IPAC, &cs->HW_Flags) ? 64 : 32;
131 if (!
test_bit(BC_FLG_INIT, &bcs->Flag))
136 if ((r & 0xf0) != 0xa0) {
138 if (cs->debug & L1_DEB_WARN)
139 debugl1(cs,
"HSCX invalid frame");
140 #ifdef ERROR_STATISTIC
144 if ((r & 0x40) && bcs->mode) {
145 if (cs->debug & L1_DEB_WARN)
146 debugl1(cs,
"HSCX RDO mode=%d",
148 #ifdef ERROR_STATISTIC
153 if (cs->debug & L1_DEB_WARN)
155 #ifdef ERROR_STATISTIC
159 WriteHSCXCMDR(cs, hscx, 0x80);
162 test_bit(HW_IPAC, &cs->HW_Flags) ? 0x3f : 0x1f);
165 hscx_empty_fifo(bcs, count);
166 if ((count = bcs->hw.hscx.rcvidx - 1) > 0) {
167 if (cs->debug & L1_DEB_HSCX_FIFO)
168 debugl1(cs,
"HX Frame %d", count);
169 if (!(skb = dev_alloc_skb(count)))
177 bcs->hw.hscx.rcvidx = 0;
181 hscx_empty_fifo(bcs, fifo_size);
184 if (!(skb = dev_alloc_skb(fifo_size)))
187 memcpy(
skb_put(skb, fifo_size), bcs->hw.hscx.rcvbuf, fifo_size);
190 bcs->hw.hscx.rcvidx = 0;
196 if (bcs->tx_skb->len) {
200 if (
test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) &&
201 (PACKET_NOACK != bcs->tx_skb->pkt_type)) {
204 bcs->ackcnt += bcs->hw.hscx.count;
205 spin_unlock_irqrestore(&bcs->aclock, flags);
209 bcs->hw.hscx.count = 0;
214 bcs->hw.hscx.count = 0;
225 hscx_int_main(
struct IsdnCardState *cs,
u_char val)
238 #ifdef ERROR_STATISTIC
245 skb_push(bcs->tx_skb, bcs->hw.hscx.count);
246 bcs->tx_cnt += bcs->hw.hscx.count;
247 bcs->hw.hscx.count = 0;
249 WriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x01);
250 if (cs->debug & L1_DEB_WARN)
251 debugl1(cs,
"HSCX B EXIR %x Lost TX", exval);
253 }
else if (cs->debug & L1_DEB_HSCX)
254 debugl1(cs,
"HSCX B EXIR %x", exval);
257 if (cs->debug & L1_DEB_HSCX)
258 debugl1(cs,
"HSCX B interrupt %x", val);
259 hscx_interrupt(cs, val, 1);
271 #ifdef ERROR_STATISTIC
275 skb_push(bcs->tx_skb, bcs->hw.hscx.count);
276 bcs->tx_cnt += bcs->hw.hscx.count;
277 bcs->hw.hscx.count = 0;
279 WriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x01);
280 if (cs->debug & L1_DEB_WARN)
281 debugl1(cs,
"HSCX A EXIR %x Lost TX", exval);
283 }
else if (cs->debug & L1_DEB_HSCX)
284 debugl1(cs,
"HSCX A EXIR %x", exval);
288 if (cs->debug & L1_DEB_HSCX)
289 debugl1(cs,
"HSCX A interrupt %x", exval);
290 hscx_interrupt(cs, exval, 0);