⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 di.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 3 页
字号:
        /* call return code handler, if it is not our return code   */        /* the handler returns 2                                    */        /* for all return codes we process, we clear the Rc field   */        isdn_rc(a,                Rc,                a->ram_in(a, &RcIn->RcId),                a->ram_in(a, &RcIn->RcCh),                a->ram_inw(a, &RcIn->Reference),                tmp[0],  /* type of extended informtion */                tmp[1]); /* extended information        */        a->ram_out(a, &RcIn->Rc, 0);      }        /* get buffer address of next return code                   */      RcIn = (RC *)&PR_RAM->B[a->ram_inw(a, &RcIn->next)];    }        /* clear all return codes (no chaining!)                    */    a->ram_out(a, &PR_RAM->RcOutput ,0);        /* call output function                                     */    pr_out(a);  }        /* clear RNR flag                                           */  RNRId = 0;        /* if indications are available ...                         */  if((Count = a->ram_in(a, &PR_RAM->IndOutput)) != 0) {    dtrc(dprintf("#Ind=%x",Count));        /* get the buffer address of the first indication           */    IndIn = (IND *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextInd)];        /* for all indications do ...                               */    while(Count--) {        /* if the application marks an indication as RNR, all       */        /* indications from the same Id delivered in this interrupt */        /* are marked RNR                                           */      if(RNRId && RNRId==a->ram_in(a, &IndIn->IndId)) {        a->ram_out(a, &IndIn->Ind, 0);        a->ram_out(a, &IndIn->RNR, TRUE);      }      else {        Ind = a->ram_in(a, &IndIn->Ind);        if(Ind) {          RNRId = 0;        /* call indication handler, a return value of 2 means chain */        /* a return value of 1 means RNR                            */        /* for all indications we process, we clear the Ind field   */          c = isdn_ind(a,                       Ind,                       a->ram_in(a, &IndIn->IndId),                       a->ram_in(a, &IndIn->IndCh),                       &IndIn->RBuffer,                       a->ram_in(a, &IndIn->MInd),                       a->ram_inw(a, &IndIn->MLength));          if(c==1) {            dtrc(dprintf("RNR"));            a->ram_out(a, &IndIn->Ind, 0);            RNRId = a->ram_in(a, &IndIn->IndId);            a->ram_out(a, &IndIn->RNR, TRUE);          }        }      }        /* get buffer address of next indication                    */      IndIn = (IND *)&PR_RAM->B[a->ram_inw(a, &IndIn->next)];    }    a->ram_out(a, &PR_RAM->IndOutput, 0);  }  return FALSE;}byte scom_test_int(ADAPTER * a){  return a->ram_in(a,(void *)0x3fe);}void scom_clear_int(ADAPTER * a){  a->ram_out(a,(void *)0x3fe,0);}/*------------------------------------------------------------------*//* return code handler                                              *//*------------------------------------------------------------------*/byte isdn_rc(ADAPTER * a,             byte Rc,             byte Id,             byte Ch,             word Ref,             dword extended_info_type,             dword extended_info){  ENTITY  * this;  byte e_no;  word i;  int cancel_rc;#ifdef USE_EXTENDED_DEBUGS  {    DBG_TRC(("<A%d Id=0x%x Rc=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, Id, Rc))  }#else  dbug(dprintf("isdn_rc(Rc=%x,Id=%x,Ch=%x)",Rc,Id,Ch));#endif        /* check for ready interrupt                                */  if(Rc==READY_INT) {    xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 0, 0);    if(a->ReadyInt) {      a->ReadyInt--;      return 0;    }    return 2;  }        /* if we know this Id ...                                   */  e_no = a->IdTable[Id];  if(e_no) {    this = entity_ptr(a,e_no);    xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 0, a->IdTypeTable[this->No]);    this->RcCh = Ch;        /* if it is a return code to a REMOVE request, remove the   */        /* Id from our table                                        */    if ((a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_REMOVE_PENDING) &&        (Rc==OK)) {      if (a->IdTypeTable[e_no] == NL_ID) {        if (a->RcExtensionSupported &&            (extended_info_type != DIVA_RC_TYPE_REMOVE_COMPLETE)) {        dtrc(dprintf("XDI: N-REMOVE, A(%02x) Id:%02x, ignore RC=OK",                        XDI_A_NR(a),Id));          return (0);        }        if (extended_info_type == DIVA_RC_TYPE_REMOVE_COMPLETE)          a->RcExtensionSupported = TRUE;      }      a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_REMOVE_PENDING;      a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_NO_RC_CANCELLING;      free_entity(a, e_no);      for (i = 0; i < 256; i++)      {        if (a->FlowControlIdTable[i] == Id)          a->FlowControlIdTable[i] = 0;      }      a->IdTable[Id] = 0;      this->Id = 0;      /* ---------------------------------------------------------------        If we send N_DISC or N_DISK_ACK after we have received OK_FC        then the card will respond with OK_FC and later with RC==OK.        If we send N_REMOVE in this state we will receive only RC==OK        This will create the state in that the XDI is waiting for the        additional RC and does not delivery the RC to the client. This        code corrects the counter of outstanding RC's in this case.      --------------------------------------------------------------- */      if ((this->More & XMOREC) > 1) {        this->More &= ~XMOREC;        this->More |= 1;        dtrc(dprintf("XDI: correct MORE on REMOVE A(%02x) Id:%02x",                     XDI_A_NR(a),Id));      }    }    if (Rc==OK_FC) {      a->FlowControlIdTable[Ch] = Id;      a->FlowControlSkipTable[Ch] = FALSE;      this->Rc = Rc;      this->More &= ~(XBUSY | XMOREC);      this->complete=0xff;      xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);      CALLBACK(a, this);      return 0;    }    /*      New protocol code sends return codes that comes from release      of flow control condition marked with DIVA_RC_TYPE_OK_FC extended      information element type.      If like return code arrives then application is able to process      all return codes self and XDI should not cances return codes.      This return code does not decrement XMOREC partial return code      counter due to fact that it was no request for this return code,      also XMOREC was not incremented.      */    if (extended_info_type == DIVA_RC_TYPE_OK_FC) {      a->misc_flags_table[e_no] |= DIVA_MISC_FLAGS_NO_RC_CANCELLING;      this->Rc = Rc;      this->complete=0xff;      xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);      DBG_TRC(("XDI OK_FC A(%02x) Id:%02x Ch:%02x Rc:%02x",      XDI_A_NR(a), Id, Ch, Rc))      CALLBACK(a, this);      return 0;    }    cancel_rc = !(a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_NO_RC_CANCELLING);    if (cancel_rc && (a->FlowControlIdTable[Ch] == Id))    {      a->FlowControlIdTable[Ch] = 0;      if ((Rc != OK) || !a->FlowControlSkipTable[Ch])      {        this->Rc = Rc;        if (Ch == this->ReqCh)        {          this->More &=~(XBUSY | XMOREC);          this->complete=0xff;        }        xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);        CALLBACK(a, this);      }      return 0;    }    if (this->More &XMOREC)      this->More--;        /* call the application callback function                   */    if (((!cancel_rc) || (this->More & XMOREF)) && !(this->More & XMOREC)) {      this->Rc = Rc;      this->More &=~XBUSY;      this->complete=0xff;      xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);      CALLBACK(a, this);    }    return 0;  }        /* if it's an ASSIGN return code check if it's a return     */        /* code to an ASSIGN request from us                        */  if((Rc &0xf0)==ASSIGN_RC) {    e_no = get_assign(a, Ref);    if(e_no) {      this = entity_ptr(a,e_no);      this->Id = Id;      xdi_xlog_rc_event (XDI_A_NR(a), Id, Ch, Rc, 2, a->IdTypeTable[this->No]);        /* call the application callback function                   */      this->Rc = Rc;      this->More &=~XBUSY;      this->complete=0xff;#if defined(DIVA_ISTREAM) /* { */      if ((Rc == ASSIGN_OK) && a->ram_offset &&          (a->IdTypeTable[this->No] == NL_ID) &&          ((extended_info_type == DIVA_RC_TYPE_RX_DMA) ||          (extended_info_type == DIVA_RC_TYPE_CMA_PTR)) &&          extended_info) {        dword offset = (*(a->ram_offset)) (a);        dword tmp[2];        extended_info -= offset;#ifdef PLATFORM_GT_32BIT        a->ram_in_dw(a, (void*)ULongToPtr(extended_info), (dword*)&tmp[0], 2);#else        a->ram_in_dw(a, (void*)extended_info, (dword*)&tmp[0], 2);#endif        a->tx_stream[Id]  = tmp[0];        a->rx_stream[Id]  = tmp[1];        if (extended_info_type == DIVA_RC_TYPE_RX_DMA) {          DBG_TRC(("Id=0x%x RxDMA=%08x:%08x",                    Id, a->tx_stream[Id], a->rx_stream[Id]))          a->misc_flags_table[this->No] |= DIVA_MISC_FLAGS_RX_DMA;        } else {          DBG_TRC(("Id=0x%x CMA=%08x:%08x",                    Id, a->tx_stream[Id], a->rx_stream[Id]))          a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;          a->rx_pos[Id]     = 0;          a->rx_stream[Id] -= offset;        }        a->tx_pos[Id]     = 0;        a->tx_stream[Id] -= offset;      } else {        a->tx_stream[Id] = 0;        a->rx_stream[Id] = 0;        a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;      }#endif /* } */      CALLBACK(a, this);      if(Rc==ASSIGN_OK) {        a->IdTable[Id] = e_no;      }      else      {        free_entity(a, e_no);        for (i = 0; i < 256; i++)        {          if (a->FlowControlIdTable[i] == Id)            a->FlowControlIdTable[i] = 0;        }        a->IdTable[Id] = 0;        this->Id = 0;      }      return 1;    }  }  return 2;}/*------------------------------------------------------------------*//* indication handler                                               *//*------------------------------------------------------------------*/byte isdn_ind(ADAPTER * a,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -