3 #include <linux/major.h>
14 static void ex_details(i2eBordStrPtr);
16 int main (int argc, char *argv[])
21 i2eBordStrPtr pB = Board;
23 // Remove all IP2 devices
25 for ( board = 0; board < 4; ++board )
27 sprintf ( nm, "/dev/ip2ipl%d", board );
29 sprintf ( nm, "/dev/ip2stat%d", board );
33 for ( port = 0; port < 256; ++port )
35 sprintf ( nm, "/dev/ttyF%d", port );
37 sprintf ( nm, "/dev/cuf%d", port );
41 // Now create management devices, and use the status device to determine how
42 // port devices need to exist, and then create them.
44 for ( board = 0; board < 4; ++board )
46 printf("Board %d: ", board );
48 sprintf ( nm, "/dev/ip2ipl%d", board );
49 mknod ( nm, S_IFCHR|0666, (IP2_IPL_MAJOR << 8) | board * 4 );
50 sprintf ( nm, "/dev/ip2stat%d", board );
51 mknod ( nm, S_IFCHR|0666, (IP2_IPL_MAJOR << 8) | board * 4 + 1 );
53 fd = open ( nm, O_RDONLY );
56 printf ( "Unable to open status device %s\n", nm );
59 if ( ioctl ( fd, 65, Board ) < 0 )
61 printf ( "not present\n" );
64 sprintf ( nm, "/dev/ip2ipl%d", board );
69 switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
71 case POR_ID_FIIEX: ex_details ( pB ); break;
72 case POR_ID_II_4: printf ( "ISA-4" ); break;
73 case POR_ID_II_8: printf ( "ISA-8 std" ); break;
74 case POR_ID_II_8R: printf ( "ISA-8 RJ11" ); break;
77 printf ( "Unknown board type, ID = %x", pB->i2ePom.e.porID );
80 for ( box = 0; box < ABS_MAX_BOXES; ++box )
82 for ( port = 0; port < ABS_BIGGEST_BOX; ++port )
84 if ( pB->i2eChannelMap[box] & ( 1 << port ) )
87 + box * ABS_BIGGEST_BOX
88 + board * ABS_BIGGEST_BOX * ABS_MAX_BOXES;
90 sprintf ( nm, "/dev/ttyF%d", dev );
91 mknod ( nm, S_IFCHR|0666, (IP2_TTY_MAJOR << 8) | dev );
92 sprintf ( nm, "/dev/cuf%d", dev );
93 mknod ( nm, S_IFCHR|0666, (IP2_CALLOUT_MAJOR << 8) | dev );
104 static void ex_details ( i2eBordStrPtr pB )
111 for( box = 0; box < ABS_MAX_BOXES; ++box )
113 if( pB->i2eChannelMap[box] != 0 ) ++boxes;
114 for( i = 0; i < ABS_BIGGEST_BOX; ++i )
116 if( pB->i2eChannelMap[box] & 1<< i ) ++ports;
120 printf("EX bx=%d pt=%d %d bit", boxes, ports, pB->i2eDataWidth16 ? 16 : 8 );