14 waitforCEC(
struct IsdnCardState *
cs,
int jade,
int reg)
28 waitforXFW(
struct IsdnCardState *cs,
int jade)
34 WriteJADECMDR(
struct IsdnCardState *cs,
int jade,
int reg,
u_char data)
36 waitforCEC(cs, jade, reg);
43 jade_empty_fifo(
struct BCState *bcs,
int count)
46 struct IsdnCardState *cs = bcs->cs;
48 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
52 if (cs->debug & L1_DEB_WARN)
53 debugl1(cs,
"jade_empty_fifo: incoming packet too large");
55 bcs->hw.hscx.rcvidx = 0;
58 ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
59 bcs->hw.hscx.rcvidx +=
count;
62 if (cs->debug & L1_DEB_HSCX_FIFO) {
65 t +=
sprintf(t,
"jade_empty_fifo %c cnt %d",
66 bcs->hw.hscx.hscx ?
'B' :
'A', count);
73 jade_fill_fifo(
struct BCState *bcs)
75 struct IsdnCardState *cs = bcs->cs;
80 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
85 if (bcs->tx_skb->len <= 0)
89 if (bcs->tx_skb->len > fifo_size) {
93 count = bcs->tx_skb->len;
95 waitforXFW(cs, bcs->hw.hscx.hscx);
96 ptr = bcs->tx_skb->data;
99 bcs->hw.hscx.count +=
count;
102 if (cs->debug & L1_DEB_HSCX_FIFO) {
105 t +=
sprintf(t,
"jade_fill_fifo %c cnt %d",
106 bcs->hw.hscx.hscx ?
'B' :
'A', count);
117 struct BCState *bcs = cs->bcs + jade;
121 int i_jade = (
int) jade;
123 if (!
test_bit(BC_FLG_INIT, &bcs->Flag))
128 if ((r & 0xf0) != 0xa0) {
130 if (cs->debug & L1_DEB_WARN)
131 debugl1(cs,
"JADE %s invalid frame", (jade ?
"B" :
"A"));
132 if ((r & 0x40) && bcs->mode)
133 if (cs->debug & L1_DEB_WARN)
134 debugl1(cs,
"JADE %c RDO mode=%d",
'A' + jade, bcs->mode);
136 if (cs->debug & L1_DEB_WARN)
137 debugl1(cs,
"JADE %c CRC error",
'A' + jade);
143 jade_empty_fifo(bcs, count);
144 if ((count = bcs->hw.hscx.rcvidx - 1) > 0) {
145 if (cs->debug & L1_DEB_HSCX_FIFO)
146 debugl1(cs,
"HX Frame %d", count);
147 if (!(skb = dev_alloc_skb(count)))
155 bcs->hw.hscx.rcvidx = 0;
159 jade_empty_fifo(bcs, fifo_size);
162 if (!(skb = dev_alloc_skb(fifo_size)))
165 memcpy(
skb_put(skb, fifo_size), bcs->hw.hscx.rcvbuf, fifo_size);
168 bcs->hw.hscx.rcvidx = 0;
174 if (bcs->tx_skb->len) {
178 if (
test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) &&
179 (PACKET_NOACK != bcs->tx_skb->pkt_type)) {
182 bcs->ackcnt += bcs->hw.hscx.count;
183 spin_unlock_irqrestore(&bcs->aclock, flags);
187 bcs->hw.hscx.count = 0;
192 bcs->hw.hscx.count = 0;
203 jade_int_main(
struct IsdnCardState *cs,
u_char val,
int jade)
206 bcs = cs->bcs + jade;
222 skb_push(bcs->tx_skb, bcs->hw.hscx.count);
223 bcs->tx_cnt += bcs->hw.hscx.count;
224 bcs->hw.hscx.count = 0;
227 if (cs->debug & L1_DEB_WARN)
228 debugl1(cs,
"JADE %c EXIR %x Lost TX",
'A' + jade, val);
232 if (cs->debug & L1_DEB_HSCX)
233 debugl1(cs,
"JADE %c interrupt %x",
'A' + jade, val);
234 jade_interrupt(cs, val, jade);