/* apelc.c */ /* This program dumps a logical channel structure */ #include #include #include "atmxram.h" #include "ape25.h" #include "atmuser.h" int iobuf[1024]; short xram[8192]; struct lc5type *lc; void main( int argc, char **argv) { int fd; int base = 0; int len; FILE *xr; int regid; int i; int offset; int lcid; fd = open("/dev/ape25", O_RDWR); if (fd < 0) { printf("Device /dev/ape25 could not be opened. \n"); exit(1); } if (argc < 2) { printf("This program dumps an LC block.. \n"); printf("You must give vci number in decimal as parm 1. \n"); exit(1); } if (argc > 1) sscanf(argv[1], "%d", &base); lcid = ape_lcid(fd, base); base = lcid << 7; for (i = 0; i < 64; i++) { iobuf[0] = 0x08000000 + base + 2 * i; ioctl(fd, AIO_RDVSAP, iobuf); xram[i] = iobuf[1]; } lc = (struct lc5type *)xram; printf("Max SDU len. %04x \n", (unsigned short)lc->maxsdu); printf("First system start of %04x \n", (unsigned short)lc->fssfdhi); printf("first frame buf addr. %04x \n", (unsigned short)lc->fssfdlo); printf("Current system buffer %04x \n", (unsigned short)lc->csbdhi); printf("descriptor address. %04x \n", (unsigned short)lc->csdblo); printf("Length of current buf %04x \n", (unsigned short)lc->sbl); printf("Recvd total user cells %04x \n", (unsigned short)lc->rtuc); printf("Recv calc BIP-16. %04x \n", (unsigned short)lc->rcbip); printf("Idle, reasm, or abort %04x \n", (unsigned short)lc->aalstate); printf("Frame timeout ctr. %04x \n", (unsigned short)lc->ftoc); printf("RBC of crnt sys buf. %04x \n", (unsigned short)lc->rrbl); printf("CLP 0 cells received. %04x \n", (unsigned short)lc->rclp0); printf("AAL5 recv CRC.(HI) %04x \n", (unsigned short)lc->rcfchi); printf("AAL5 recv CRC (LO) %04x \n", (unsigned short)lc->rcfclo); printf("Current sys buf addr. %04x \n", (unsigned short)lc->csbahi); printf("Current SBA (low) %04x \n", (unsigned short)lc->csbalo); printf("Cumulative SDU len. %04x \n", (unsigned short)lc->rsdul); printf("# congestion notifies %04x \n", (unsigned short)lc->rcc); printf("Reserved. %04x \n", (unsigned short)lc->resvd1); printf("RcvRdy List ID for LC %04x \n", (unsigned short)lc->rrl); printf("OAM, CHM, PME, BLS %04x \n", (unsigned short)lc->lcflags); printf("Congestion rate div. %04x \n", (unsigned short)lc->crd); printf("Peak sustainable rate %04x \n", (unsigned short)lc->psr); printf("Burst tol. specifier. %04x \n", (unsigned short)lc->bts); printf("Transmit cong. count. %04x \n", (unsigned short)lc->tcc); printf("Xmit t prescaler %04x \n", (unsigned short)lc->ttp); printf("# cells xmitted at CCR %04x \n", (unsigned short)lc->trc); printf("Mon. cell seq. num. %04x \n", (unsigned short)lc->msn); printf("(20 bits) avg rate(hi) %04x \n", (unsigned short)lc->arthi); printf("avg rate (lo) timer. %04x \n", (unsigned short)lc->artlo); printf("New frame status. %04x \n", (unsigned short)lc->nfs); printf("Xmit prescaling ctr. %04x \n", (unsigned short)lc->tpc); printf("TMQ forward pointer. %04x \n", (unsigned short)lc->tfp); printf("AAL5 xmit CRC (HI) %04x \n", (unsigned short)lc->tcfchi); printf("AAL5 xmit CRC (LO) %04x \n", (unsigned short)lc->tcfclo); printf("Xmit calc BIP-16. %04x \n", (unsigned short)lc->tcbip); printf("Xmit resid buf count %04x \n", (unsigned short)lc->trbc); printf("# buffers crnt frm. %04x \n", (unsigned short)lc->tbc); printf("AAL5 Control field. %04x \n", (unsigned short)lc->alc); printf("Current SDU length. %04x \n", (unsigned short)lc->tsdul); printf("Current buf addr (hi) %04x \n", (unsigned short)lc->tscbhi); printf("Current buf addr (lo) %04x \n", (unsigned short)lc->tscblo); printf("Xmit resid length. %04x \n", (unsigned short)lc->trbl); printf("Total user cells sent. %04x \n", (unsigned short)lc->ttuc); printf("CLP 0 cells sent. %04x \n", (unsigned short)lc->tclp0); printf("SOM, lnk stat, TMQ %04x \n", (unsigned short)lc->tflags); printf("Current frm desc (hi) %04x \n", (unsigned short)lc->cfdhi); printf("Current frm desc (lo) %04x \n", (unsigned short)lc->cfdlo); printf("Last frm desc (hi) %04x \n", (unsigned short)lc->lfdhi); printf("Last frm desc (lo) %04x \n", (unsigned short)lc->lfdlo); printf("GFC, VPI, VCI (hi) %04x \n", (unsigned short)lc->chdr1); printf("VCI (low) PTI, CLP. %04x \n", (unsigned short)lc->chdr2); }