1 /*******************************************************************************
3 * (c) 1998 by Computone Corporation
5 ********************************************************************************
8 * PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
9 * serial I/O controllers.
11 * DESCRIPTION: Status display utility
13 *******************************************************************************/
16 #include <sys/types.h>
23 #include <linux/timer.h>
24 #include <linux/termios.h>
41 int main (int argc, char *argv[])
45 i2eBordStrPtr pB = Board;
46 i2ChanStrPtr pCh = Port;
50 printf ( "Usage: %s <port>\n", argv[0] );
53 i = sscanf ( argv[1], "/dev/ttyF%d", &dev );
55 if ( i != 1 ) exit(1);
57 //printf("%s: board %d, port %d\n", argv[1], dev / 64, dev % 64 );
59 sprintf ( devname, "/dev/ip2stat%d", dev / 64 );
60 if( 0 > ( fd = open ( devname, O_RDONLY ) ) ) {
61 // Conventional name failed - try devfs name
62 sprintf ( devname, "/dev/ip2/stat%d", dev / 64 );
63 if( 0 > ( fd = open ( devname, O_RDONLY ) ) ) {
64 // Where is our board???
65 printf( "Unable to open board %d to retrieve stats\n",
71 ioctl ( fd, 64, &Driver );
72 ioctl ( fd, 65, Board );
73 ioctl ( fd, dev % 64, Port );
75 printf ( "Driver statistics:-\n" );
76 printf ( " Reference Count: %d\n", Driver.ref_count );
77 printf ( " Interrupts to date: %ld\n", Driver.irq_counter );
78 printf ( " Bottom half to date: %ld\n", Driver.bh_counter );
80 printf ( "Board statistics(%d):-\n",dev/64 );
81 printf ( "FIFO: remains = %d%s\n", pB->i2eFifoRemains,
82 pB->i2eWaitingForEmptyFifo ? ", busy" : "" );
83 printf ( "Mail: out mail = %02x\n", pB->i2eOutMailWaiting );
84 printf ( " Input interrupts : %d\n", pB->i2eFifoInInts );
85 printf ( " Output interrupts: %d\n", pB->i2eFifoOutInts );
86 printf ( " Flow queued : %ld\n", pB->debugFlowQueued );
87 printf ( " Bypass queued : %ld\n", pB->debugBypassQueued );
88 printf ( " Inline queued : %ld\n", pB->debugInlineQueued );
89 printf ( " Data queued : %ld\n", pB->debugDataQueued );
90 printf ( " Flow packets : %ld\n", pB->debugFlowCount );
91 printf ( " Bypass packets : %ld\n", pB->debugBypassCount );
92 printf ( " Inline packets : %ld\n", pB->debugInlineCount );
93 printf ( " Mail status : %x\n", pB->i2eStatus );
94 printf ( " Output mail : %x\n", pB->i2eOutMailWaiting );
95 printf ( " Fatal flag : %d\n", pB->i2eFatal );
97 printf ( "Channel statistics(%s:%d):-\n",argv[1],dev%64 );
98 printf ( "ibuf: stuff = %d strip = %d\n", pCh->Ibuf_stuff, pCh->Ibuf_strip );
99 printf ( "obuf: stuff = %d strip = %d\n", pCh->Obuf_stuff, pCh->Obuf_strip );
100 printf ( "pbuf: stuff = %d\n", pCh->Pbuf_stuff );
101 printf ( "cbuf: stuff = %d strip = %d\n", pCh->Cbuf_stuff, pCh->Cbuf_strip );
102 printf ( "infl: count = %d room = %d\n", pCh->infl.asof, pCh->infl.room );
103 printf ( "outfl: count = %d room = %d\n", pCh->outfl.asof, pCh->outfl.room );
104 printf ( "throttled = %d ",pCh->throttled);
105 printf ( "bookmarks = %d ",pCh->bookMarks);
106 printf ( "flush_flags = %x\n",pCh->flush_flags);
108 if (pCh->channelNeeds & NEED_FLOW) printf("FLOW ");
109 if (pCh->channelNeeds & NEED_INLINE) printf("INLINE ");
110 if (pCh->channelNeeds & NEED_BYPASS) printf("BYPASS ");
111 if (pCh->channelNeeds & NEED_CREDIT) printf("CREDIT ");
113 printf ( "dss: in = %x, out = %x\n",pCh->dataSetIn,pCh->dataSetOut);