#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* 134.79.82.62, 134.79.81.133 */ typedef struct binfo { int SN; int rev; /* Rev from this database is UNUSED */ uint8_t e[6]; } *Binfo; /* SLAC OUI Numbers; obtained block 0x100..0x1ff from Charley Granieri * (7/28/2006) */ static struct binfo dbase[] = { /* 0 */ { 1, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x01} }, { 2, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x02} }, { 3, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x03} }, { 4, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x04} }, { 5, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x05} }, { 6, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x06} }, { 7, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x07} }, { 8, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x08} }, { 9, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x09} }, { 10, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0a} }, { 11, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0b} }, { 12, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0c} }, { 13, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0d} }, { 14, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0e} }, { 15, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x0f} }, { 16, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x10} }, { 17, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x11} }, { 18, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x12} }, { 19, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x13} }, { 20, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x14} }, { 21, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x15} }, { 22, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x16} }, { 23, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x17} }, { 24, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x18} }, { 25, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x19} }, { 26, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1a} }, { 27, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1b} }, { 28, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1c} }, { 29, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1d} }, { 30, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1e} }, { 31, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x1f} }, { 32, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x20} }, { 33, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x21} }, { 34, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x22} }, { 35, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x23} }, { 36, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x24} }, { 37, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x25} }, { 38, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x26} }, { 39, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x27} }, { 40, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x28} }, { 41, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x29} }, { 42, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2a} }, { 43, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2b} }, { 44, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2c} }, { 45, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2d} }, { 46, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2e} }, { 47, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x2f} }, { 48, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x30} }, { 49, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x31} }, { 50, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x32} }, { 51, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x33} }, { 52, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x34} }, { 53, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x35} }, { 54, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x36} }, { 55, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x37} }, { 56, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x38} }, { 57, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x39} }, { 58, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3a} }, { 59, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3b} }, { 60, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3c} }, { 61, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3d} }, { 62, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3e} }, { 63, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x3f} }, { 64, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x40} }, { 65, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x41} }, { 66, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x42} }, { 67, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x43} }, { 68, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x44} }, { 69, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x45} }, { 70, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x46} }, { 71, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x47} }, { 72, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x48} }, { 73, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x49} }, { 74, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4a} }, { 75, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4b} }, { 76, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4c} }, { 77, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4d} }, { 78, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4e} }, { 79, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x4f} }, { 80, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x50} }, { 81, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x51} }, { 82, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x52} }, { 83, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x53} }, { 84, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x54} }, { 85, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x55} }, { 86, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x56} }, { 87, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x57} }, { 88, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x58} }, { 89, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x59} }, { 90, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5a} }, { 91, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5b} }, { 92, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5c} }, { 93, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5d} }, { 94, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5e} }, { 95, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x5f} }, { 96, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x60} }, { 97, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x61} }, { 98, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x62} }, { 99, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x63} }, { 100, 2, {0x08, 0x00, 0x56, 0x00, 0x01, 0x64} }, /* 101 */ { 102, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x66} }, { 103, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x67} }, { 104, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x68} }, { 105, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x69} }, { 106, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6a} }, { 107, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6b} }, { 108, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6c} }, { 109, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6d} }, { 110, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6e} }, { 111, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x6f} }, { 112, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x70} }, { 113, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x71} }, { 114, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x72} }, { 115, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x73} }, { 116, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x74} }, { 117, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x75} }, { 118, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x76} }, { 119, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x77} }, { 120, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x78} }, { 121, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x79} }, { 122, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7a} }, { 123, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7b} }, { 124, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7c} }, { 125, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7d} }, { 126, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7e} }, { 127, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x7f} }, { 128, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x80} }, { 129, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x81} }, { 130, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x82} }, { 131, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x83} }, { 132, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x84} }, { 133, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x85} }, { 134, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x86} }, { 135, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x87} }, { 136, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x88} }, { 137, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x89} }, { 138, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8a} }, { 139, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8b} }, { 140, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8c} }, { 141, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8d} }, { 142, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8e} }, { 143, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x8f} }, { 144, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x90} }, { 145, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x91} }, { 146, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x92} }, { 147, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x93} }, { 148, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x94} }, { 149, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x95} }, { 150, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x96} }, { 151, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x97} }, { 152, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x98} }, { 153, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x99} }, { 154, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9a} }, { 155, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9b} }, { 156, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9c} }, { 157, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9d} }, { 158, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9e} }, { 159, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0x9f} }, { 160, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa0} }, { 161, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa1} }, { 162, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa2} }, { 163, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa3} }, { 164, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa4} }, { 165, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa5} }, { 166, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa6} }, { 167, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa7} }, { 168, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa8} }, { 169, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xa9} }, { 170, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xaa} }, { 171, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xab} }, { 172, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xac} }, { 173, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xad} }, { 174, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xae} }, { 175, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xaf} }, { 176, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb0} }, { 177, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb1} }, { 178, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb2} }, { 179, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb3} }, { 180, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb4} }, { 181, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb5} }, { 182, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb6} }, { 183, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb7} }, { 184, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb8} }, { 185, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xb9} }, { 186, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xba} }, { 187, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xbb} }, { 188, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xbc} }, { 189, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xbd} }, { 190, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xbe} }, { 191, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xbf} }, { 192, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc0} }, { 193, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc1} }, { 194, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc2} }, { 195, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc3} }, { 196, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc4} }, { 197, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc5} }, { 198, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc6} }, { 199, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc7} }, { 200, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xc8} }, /* 201 */ /* 202 */ /* 203 */ { 204, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xcc} }, { 205, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xcd} }, { 206, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xce} }, { 207, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xcf} }, { 208, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd0} }, { 209, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd1} }, { 210, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd2} }, { 211, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd3} }, { 212, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd4} }, { 213, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd5} }, { 214, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd6} }, { 215, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd7} }, { 216, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd8} }, { 217, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xd9} }, { 218, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xda} }, { 219, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xdb} }, { 220, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xdc} }, { 221, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xdd} }, { 222, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xde} }, { 223, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xdf} }, { 224, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe0} }, { 225, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe1} }, { 226, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe2} }, { 227, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe3} }, { 228, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe4} }, { 229, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe5} }, { 230, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe6} }, { 231, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe7} }, { 232, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe8} }, { 233, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xe9} }, { 234, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xea} }, { 235, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xeb} }, { 236, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xec} }, { 237, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xed} }, { 238, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xee} }, { 239, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xef} }, { 240, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf0} }, { 241, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf1} }, { 242, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf2} }, { 243, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf3} }, { 244, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf4} }, { 245, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf5} }, { 246, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf6} }, { 247, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf7} }, { 248, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf8} }, { 249, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xf9} }, { 250, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xfa} }, { 251, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xfb} }, { 252, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xfc} }, { 253, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xfd} }, { 254, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xfe} }, { 255, 3, {0x08, 0x00, 0x56, 0x00, 0x01, 0xff} }, { 256, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x00} }, { 257, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x01} }, { 258, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x02} }, { 259, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x03} }, { 260, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x04} }, { 261, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x05} }, { 262, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x06} }, { 263, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x07} }, { 264, 3, {0x08, 0x00, 0x56, 0x00, 0x03, 0x08} }, { -1, -1, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} } }; #define BLANK 0xff /* blank EEPROM byte */ #define NEEDED_FIRMWARE_VERSION 4 /* AFE firmware version we want */ extern char *getbenv(const char*); /* Extern declarations (no proper header [yet] :-( ) */ int lanIpSetup(char *ip, char *nmsk, int port, uint8_t *enaddr); void lanIpTakedown(); static FILE *logf = 0; static int show(FILE *f, char *fmt, ...) { va_list a; int rval; va_start(a, fmt); rval = vfprintf(f, fmt, a); va_end(a); if ( logf ) { va_start(a, fmt); vfprintf(logf, fmt, a); va_end(a); } return rval; } static Binfo findinfo(int SN) { Binfo i; for ( i=dbase; i->SN > 0 ; i++ ) if ( i->SN == SN ) return i; return 0; } static int getyno(char *prompt) { int ch; do { show(stdout,prompt); fflush(stdout); ch = toupper(getchar()); /* skip to EOL (assume they have line-buffered input) */ while ( '\n' != getchar() ) ; fputc('\n',stdout); if ( logf ) { fprintf(logf,"[entered]>>>%c (%i)\n", ch, ch); } } while ('Y'!=ch && 'N' != ch); return ch; } int padTest() { static uint8_t dummy[6]={0}; static uint8_t enadd[20]; uint8_t buf[100]; char netmask_a[30]; Binfo info; int rval = -1; int errs; DrvLan9118_tps pldrv; int err; int ch, SN, i, rev; char *ipaddr_a = getenv("IPADDR1"); struct sockaddr_in nm; struct ntptimeval now; if ( !ipaddr_a && !(ipaddr_a = getbenv("IPADDR1")) ) { show(stderr,"[E] FAILURE -- 'IPADDR1' environment varilable not set\n"); return -1; } nm.sin_len = sizeof(nm); nm.sin_family = AF_INET; if ( rtems_bsdnet_ifconfig("fs1", SIOCGIFNETMASK, &nm) ) { show(stderr,"[E] FAILURE -- unable to read netmask (%s)\n", strerror(errno)); return -1; } #ifdef DEBUG printf("sin_family %i (%i)\n", nm.sin_family, AF_INET); #endif if ( ! inet_ntop(AF_INET, &nm.sin_addr, netmask_a, sizeof(netmask_a)) ) { show(stderr,"[E] FAILURE -- unable to convert netmask (%s)\n", strerror(errno)); return -1; } #ifdef DEBUG printf("netmask: %s\n",netmask_a); #endif if ( nfsMount("tillpc","/remote/padlog","/tillpc") ) { show(stderr,"[W] Mounting Log File Server Failed -- NO LOG CAN BE KEPT\n"); } else { if ( !(logf=fopen("/tillpc/padTest.log","a+")) ) { show(stderr,"[W] Opening Log File Failed -- NO LOG CAN BE KEPT\n"); } fprintf(logf,"\n###################\n"); if ( (err=ntp_gettime(&now)) ) { show(stderr,"[W] ntp_gettime failed: %s\n",strerror(err)); } else { ctime_r(&now.time.tv_sec, (char*)buf); show(stdout,"[I] padTest started: %s\n",buf); } } show(stdout,"This is padTest $Id: padTest.c,v 1.14 2009/11/07 01:57:45 strauman Exp $\n"); if ( ! (pldrv = drvLan9118Setup(dummy, 0)) ) { show(stderr,"[E] FAILURE TO PROBE OR INITIALIZE 2ND ETHERNET IF\n"); goto bail; } /* can now access eeprom */ if ( (err = drvLan9118E2PRead(pldrv, enadd, 0, sizeof(enadd))) ) { show(stderr,"[E] FAILURE TO READ EEPROM: %s\n", strerror(-err)); goto bail; } ch = 'Y'; if ( enadd[0] == 0xa5 && enadd[1] != BLANK ) { show(stdout,"[W] Hmm - EEPROM already programmed: "); if ( enadd[7] && BLANK != enadd[7] ) show(stdout,"%s\n", enadd+7); show(stdout,"[I] MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", enadd[1], enadd[2], enadd[3], enadd[4], enadd[5], enadd[6]); if ( 2 != sscanf((char*)enadd+7,"R%iSN%i",&rev,&SN) ) { show(stderr,"[W] FAILURE TO READ EXISTING SERIAL NUMBER\n"); show(stderr," OVERWRITE ENFORCED.\n"); } else { show(stdout,"[I] Board Rev %i Serial Number %i\n", rev, SN); ch = getyno(" -- Do you want to overwrite? (Y/N) "); } } if ( 'Y'==ch ) { do { SN = -1; show(stdout,"Please enter PAD Board Serial Number [-1 to abort]:"); fflush(stdout); scanf("%i",&SN); if ( logf ) fprintf(logf,"[entered]>>>%i\n",SN); while ( '\n' != getchar() ) ; if ( -1 == SN ) { show(stderr,"[E] Test ABORTED\n"); goto bail; } if ( ! (info = findinfo(SN)) ) { show(stdout,"[W] S/N %i not found in database -- reenter\n", SN); SN = -1; } } while ( SN < 0 ); do { rev = -1; show(stdout,"Please enter PAD Board Revision Number [-1 to abort]:"); fflush(stdout); scanf("%i",&rev); if ( logf ) fprintf(logf,"[entered]>>>%i\n",SN); while ( '\n' != getchar() ) ; if ( -1 == rev ) { show(stderr,"[E] Test ABORTED\n"); goto bail; } if ( rev != info->rev ) { show(stderr,"[E] MISMATCH Rev %i found in database but you entered %i\n", info->rev, rev); #if 0 if ( 'N' == getyno(" -- Do you want to overwrite? (Y/N) ") ) #endif rev = -1; } } while ( rev < 0 ); show(stdout,"[I] OK, I'm going to program the following information:\n"); show(stdout,"[I]\n"); show(stdout,"[I] Serial No: %i, Board Rev: %i\n", SN, rev); show(stdout,"[I] MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", info->e[0], info->e[1], info->e[2], info->e[3], info->e[4], info->e[5]); show(stdout,"[I]\n"); ch = getyno("OK to proceed and write EEPROM? [Y/N] "); if ( 'Y' == ch ) { if ( (err = drvLan9118E2PWriteEnable(pldrv)) ) { fprintf(stderr,"[E] FAILURE: Unable to disable write-protection: %s\n",strerror(-err)); goto bail; } if ( (err = drvLan9118E2PWriteEnaddr(pldrv, info->e)) ) { fprintf(stderr,"[E] FAILURE: Writing MAC address failed: %s\n", strerror(-err)); goto bail; } sprintf((char*)buf,"R%iSN%i",rev,SN); if ( (err = drvLan9118E2PWrite(pldrv, buf, 7, strlen((char*)buf)+1)) ) { fprintf(stderr,"[E] FAILURE: Writing Serial Number failed: %s\n", strerror(-err)); goto bail; } if ( (err = drvLan9118E2PWriteDisable(pldrv)) ) { fprintf(stderr,"[E] FAILURE: Unable to engage write-protection: %s\n",strerror(-err)); goto bail; } } else { show(stderr,"[E] Test ABORTED\n"); goto bail; } } drvLan9118Shutdown(pldrv); pldrv = 0; show(stdout,"[I] Initializing 2nd Interface...\n"); if ( lanIpSetup(ipaddr_a, netmask_a, 0, 0) ) { fprintf(stderr,"[E] FAILURE initializing 2nd ethernet interface\n"); goto bail; } show(stdout,"[I] 2nd Interface should be running; trying to ping\n"); /* ping quietly a few times so the switch is trained */ for ( i=0; i<5; i++ ) { if ( rtems_ping(ipaddr_a, 0, 1) >= 0 ) break; } #define NPINGS 6 errs = rtems_ping(ipaddr_a, NPINGS-1, 0); if ( errs < -(NPINGS) ) { show(stderr,"[E] FAILURE TO PING\n"); goto bail; } else if ( -errs > 2 ) { show(stderr,"[E] FAILURE TO PING: Too many dropped pings\n"); show(stderr,"[I] Please try to ping from a secondary computer\n"); ch = getyno(" Did this work? [Y/N] "); if ( 'N' == ch ) goto bail; } show(stdout,"[I] TESTING QSPI\n"); if ( coldfQspiInit() ) { fprintf(stderr,"[E] FAILURE: initializing QSPI failed\n"); goto bail; } if ( coldfQspiSetup(0, 10000000, 0, 0, DRV5282_QSPI_SETUP_CS_ACTVLOW) ) { fprintf(stderr,"[E] FAILURE: setting up QSPI failed\n"); goto bail; } /* Try to read version register */ buf[0] = 0xc5; if ( 2 != coldfQspiWriteRead(buf, buf, 2, 0xe) ) { fprintf(stderr,"[E] FAILURE: reading AFE Firmware Version over QSPI failed\n"); goto bail; } if ( buf[1] < NEEDED_FIRMWARE_VERSION ) { fprintf(stderr,"[E] FAILURE: AFE Firmware Version incorrect; has %i but I need >= %i\n",buf[1], NEEDED_FIRMWARE_VERSION); goto bail; } show(stdout,"[I] AFE Firmware Version %i\n",buf[1]); show(stdout,"[I] Serial Number %i -- 2nd ethernet IF & QSPI Test PASSED\n", SN); show(stdout,"[I] Now testing watchdog reset\n"); if ( 'Y' == getyno(" -- OK to proceed? ") ) { extern rtems_id wdTaskId; extern int wdStart(int); if ( !wdTaskId && wdStart(20) ) { show(stderr,"[E] FAILURE: Watchdog not running\n"); goto bail; } show(stdout,"[I] Board should reset in a few seconds\n"); show(stdout," If it does, this means SUCCESS\n"); fflush(stdout); if ( logf ) fflush(logf); rtems_task_suspend(wdTaskId); sleep(7); /* If we ever get here then the watchdog is NOT working */ show(stderr,"[E] FAILURE: WATCHDOG DOES NOT RESET BOARD\n"); goto bail; } else { show(stderr,"[W] WATCHDOG TEST SKIPPED\n"); } rval = 0; bail: if ( logf ) { fprintf(logf,"\n**************************\n"); fclose(logf); unmount("/tillpc"); } if (pldrv) { drvLan9118E2PWriteDisable(pldrv); drvLan9118Shutdown(pldrv); } lanIpTakedown(); return rval; }