31 #if !defined USE_EXTENDED_DEBUGS
38 #define PR_RAM ((struct pr_ram *)0)
39 #define RAM ((struct dual *)0)
57 #if defined(XDI_USE_XLOG)
58 #define XDI_A_NR(_x_) ((byte)(((ISDN_ADAPTER *)(_x_->io))->ANum))
60 static byte xdi_xlog_sec = 0;
62 #define XDI_A_NR(_x_) ((byte)0)
99 ReadyCount = pr_ready(a);
106 while (e_no && ReadyCount) {
109 #ifdef USE_EXTENDED_DEBUGS
112 DBG_FTL((
"XDI: [%02x] !A%d ==> NULL entity ptr - try to ignore",
122 dbug(
dprintf(
"out:Req=%x,Id=%x,Ch=%x", this->
Req, this->Id, this->ReqCh));
126 #if defined(DIVA_ISTREAM)
127 if (!(a->tx_stream[this->Id] &&
135 while (i < this->XNum && length < 270) {
136 clength =
min((
word)(270 - length), (
word)(X[i].PLength-this->XOffset));
139 PTR_P(a,
this, &X[i].
P[this->XOffset]),
142 this->XOffset += clength;
143 if (this->XOffset == X[i].PLength) {
144 this->XCurrent = (
byte)++i;
148 #if defined(DIVA_ISTREAM)
152 while (i < this->XNum) {
155 PTR_P(a,
this, &X[i].
P[0]),
157 ((i + 1) == this->XNum),
159 this->XCurrent = (
byte)++i;
168 if (this->Id & 0x1f) {
172 if (i < this->XNum && this->MInd) {
173 xdi_xlog_request(
XDI_A_NR(a), this->Id, this->ReqCh, this->MInd,
179 xdi_xlog_request(
XDI_A_NR(a), this->Id, this->ReqCh, this->
Req,
204 if (this->Id ==
NL_ID ||
210 xdi_xlog_request(
XDI_A_NR(a), this->Id, this->ReqCh, this->
Req, this->Id);
226 if (
this && (this->
Req ==
UREMOVE) && this->Id) {
230 for (i = 0; i < 256; i++)
271 if ((Rc = a->
ram_in(a, &RcIn->
Rc)) != 0) {
312 if (RNRId && RNRId == a->
ram_in(a, &IndIn->
IndId)) {
347 return a->
ram_in(a, (
void *)0x3fe);
351 a->
ram_out(a, (
void *)0x3fe, 0);
361 dword extended_info_type,
368 #ifdef USE_EXTENDED_DEBUGS
373 dbug(
dprintf(
"isdn_rc(Rc=%x,Id=%x,Ch=%x)", Rc, Id, Ch));
377 xdi_xlog_rc_event(
XDI_A_NR(a), Id, Ch, Rc, 0, 0);
397 dtrc(
dprintf(
"XDI: N-REMOVE, A(%02x) Id:%02x, ignore RC=OK",
407 for (i = 0; i < 256; i++)
422 if ((this->More &
XMOREC) > 1) {
423 this->More &= ~XMOREC;
425 dtrc(
dprintf(
"XDI: correct MORE on REMOVE A(%02x) Id:%02x",
454 DBG_TRC((
"XDI OK_FC A(%02x) Id:%02x Ch:%02x Rc:%02x",
460 if (cancel_rc && (a->FlowControlIdTable[Ch] == Id))
462 a->FlowControlIdTable[Ch] = 0;
463 if ((Rc !=
OK) || !a->FlowControlSkipTable[Ch])
466 if (Ch == this->ReqCh)
471 xdi_xlog_rc_event(
XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
476 if (this->More & XMOREC)
479 if (((!cancel_rc) || (this->More &
XMOREF)) && !(this->More & XMOREC)) {
481 this->More &= ~
XBUSY;
483 xdi_xlog_rc_event(
XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
495 xdi_xlog_rc_event(
XDI_A_NR(a), Id, Ch, Rc, 2, a->IdTypeTable[this->No]);
498 this->More &= ~
XBUSY;
500 #if defined(DIVA_ISTREAM)
501 if ((Rc ==
ASSIGN_OK) && a->ram_offset &&
502 (a->IdTypeTable[this->No] ==
NL_ID) &&
509 #ifdef PLATFORM_GT_32BIT
510 a->ram_in_dw(a, (
void *)ULongToPtr(extended_info), (
dword *)&tmp[0], 2);
512 a->ram_in_dw(a, (
void *)extended_info, (
dword *)&tmp[0], 2);
514 a->tx_stream[Id] = tmp[0];
515 a->rx_stream[Id] = tmp[1];
517 DBG_TRC((
"Id=0x%x RxDMA=%08x:%08x",
518 Id, a->tx_stream[Id], a->rx_stream[Id]))
521 DBG_TRC((
"Id=0x%x CMA=%08x:%08x",
522 Id, a->tx_stream[Id], a->rx_stream[Id]))
523 a->misc_flags_table[this->
No] &= ~DIVA_MISC_FLAGS_RX_DMA;
525 a->rx_stream[Id] -= offset;
528 a->tx_stream[Id] -= offset;
530 a->tx_stream[Id] = 0;
531 a->rx_stream[Id] = 0;
532 a->misc_flags_table[this->
No] &= ~DIVA_MISC_FLAGS_RX_DMA;
537 a->IdTable[Id] = e_no;
542 for (i = 0; i < 256; i++)
544 if (a->FlowControlIdTable[i] == Id)
545 a->FlowControlIdTable[
i] = 0;
571 #ifdef USE_EXTENDED_DEBUGS
576 dbug(
dprintf(
"isdn_ind(Ind=%x,Id=%x,Ch=%x)", Ind, Id, Ch));
581 xdi_xlog_ind(
XDI_A_NR(a), Id, Ch, Ind,
585 if (this->RCurrent == 0xff) {
587 if (Ind == this->MInd) {
597 this->RLength = MLength;
598 #if defined(DIVA_ISTREAM)
599 if ((a->rx_stream[this->Id] ||
605 #if defined(DIVA_IDI_RX_DMA)
609 (
int)a->rx_stream[this->Id], (
void **)&cma, &d);
612 cma[0] = cma[1] = cma[2] = cma[3] = 0;
614 this->RLength = MLength = (
word)*(
dword *)cma;
643 xdi_xlog_ind(
XDI_A_NR(a), Id, Ch, Ind,
646 if (this->
RNR == 1) {
653 if (!this->
RNR && !this->RNum) {
654 xdi_xlog_ind(
XDI_A_NR(a), Id, Ch, Ind,
662 if (this->
RNR == 2) {
663 if (Ind != this->MInd) {
664 this->RCurrent = 0xff;
674 if (this->ROffset == R[this->RCurrent].PLength) {
679 clength =
min(MLength, (
word)(R[this->RCurrent].PLength-this->ROffset));
682 R[this->RCurrent].
PLength-this->ROffset);
684 if (R[this->RCurrent].
P) {
686 memcpy(
PTR_P(a,
this, &R[this->RCurrent].P[this->ROffset]),
692 PTR_P(a,
this, &R[this->RCurrent].P[this->ROffset]),
697 this->ROffset += clength;
699 if (offset >= MLength) {
708 if (Ind != this->MInd) {
709 R[this->RCurrent].
PLength = this->ROffset;
710 if (this->ROffset) this->RCurrent++;
711 this->RNum = this->RCurrent;
712 this->RCurrent = 0xff;
715 xdi_xlog_ind(
XDI_A_NR(a), Id, Ch, Ind,
723 #if defined(XDI_USE_XLOG)
759 #if defined(XDI_USE_XLOG)
761 PUT_WORD(&LogInfo[0], ((
word)Adapter | (
word)(xdi_xlog_sec++ << 8)));
762 PUT_WORD(&LogInfo[1], ((
word)Id | (
word)(Ch << 8)));
763 PUT_WORD(&LogInfo[2], ((
word)Rc | (
word)(type << 8)));
764 PUT_WORD(&LogInfo[3], cb);
765 xdi_xlog((
byte *)&LogInfo[0], 221,
sizeof(LogInfo));
781 static void xdi_xlog_request(
byte Adapter,
byte Id,
783 #if defined(XDI_USE_XLOG)
785 PUT_WORD(&LogInfo[0], ((
word)Adapter | (
word)(xdi_xlog_sec++ << 8)));
786 PUT_WORD(&LogInfo[1], ((
word)Id | (
word)(Ch << 8)));
787 PUT_WORD(&LogInfo[2], ((
word)Req | (
word)(type << 8)));
788 xdi_xlog((
byte *)&LogInfo[0], 220,
sizeof(LogInfo));
820 static void xdi_xlog_ind(
byte Adapter,
827 #if defined(XDI_USE_XLOG)
829 PUT_WORD(&LogInfo[0], ((
word)Adapter | (
word)(xdi_xlog_sec++ << 8)));
830 PUT_WORD(&LogInfo[1], ((
word)Id | (
word)(Ch << 8)));
831 PUT_WORD(&LogInfo[2], ((
word)Ind | (
word)(type << 8)));
832 PUT_WORD(&LogInfo[3], ((
word)rnr | (
word)(rnr_valid << 8)));
833 xdi_xlog((
byte *)&LogInfo[0], 222,
sizeof(LogInfo));