Ejemplo n.º 1
0
/*------------------------------------------------------------------*/
byte pr_dpc(ADAPTER *a)
{
	byte Count;
	RC *RcIn;
	IND *IndIn;
	byte c;
	byte RNRId;
	byte Rc;
	byte Ind;
	/* if return codes are available ...                        */
	if ((Count = a->ram_in(a, &PR_RAM->RcOutput)) != 0) {
		dtrc(dprintf("#Rc=%x", Count));
		/* get the buffer address of the first return code          */
		RcIn = (RC *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextRc)];
		/* for all return codes do ...                              */
		while (Count--) {
			if ((Rc = a->ram_in(a, &RcIn->Rc)) != 0) {
				dword tmp[2];
				/*
				  Get extended information, associated with return code
				*/
				a->ram_in_buffer(a,
						 &RcIn->Reserved2[0],
						 (byte *)&tmp[0],
						 8);
				/* 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 information */
					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;
}
Ejemplo n.º 2
0
byte DivasDpc(ADAPTER * a)
{
  byte Count;
  RC * RcIn;
  IND * IndIn;
  byte c;
  byte RNRId;
  byte Rc;
  byte Ind;

        /* if return codes are available ...                        */
  if((Count = a->ram_in(a, &PR_RAM->RcOutput))) {

    DPRINTF(("IDI: #Rc=%x",Count));

        /* get the buffer address of the first return code          */
    RcIn = (RC *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextRc)];

        /* for all return codes do ...                              */
    while(Count--) {

      if((Rc=a->ram_in(a, &RcIn->Rc))) {

        /* 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));

        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                                     */
    DivasOut(a);
  }

        /* clear RNR flag                                           */
  RNRId = 0;

        /* if indications are available ...                         */
  if((Count = a->ram_in(a, &PR_RAM->IndOutput))) {

    DPRINTF(("IDI: #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) {
            DPRINTF(("IDI: 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;
}