fp@1126: /***************************************************************************** fp@1126: * fp@1126: * $Id$ fp@1126: * fp@1126: ****************************************************************************/ fp@1126: fp@1126: #include fp@1126: #include fp@1126: using namespace std; fp@1126: fp@1126: #include "globals.h" fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: const char *help_master = fp@1126: "[OPTIONS]\n" fp@1126: "\n" fp@1130: "Show master and Ethernet device information.\n" fp@1126: "\n" fp@1130: "Command-specific options:\n" fp@1130: " --master -m Index of the master to use. Default: 0\n"; fp@1126: fp@1126: /****************************************************************************/ fp@1126: fp@1126: void command_master(void) fp@1126: { fp@1126: ec_ioctl_master_t data; fp@1126: stringstream err; fp@1126: unsigned int i; fp@1126: fp@1126: masterDev.open(MasterDevice::Read); fp@1126: masterDev.getMaster(&data); fp@1126: fp@1126: cout fp@1126: << "Master" << masterIndex << endl fp@1126: << " Phase: "; fp@1126: fp@1126: switch (data.phase) { fp@1126: case 0: cout << "Waiting for device..."; break; fp@1126: case 1: cout << "Idle"; break; fp@1126: case 2: cout << "Operation"; break; fp@1126: default: fp@1126: err << "Invalid master phase " << data.phase; fp@1126: throw MasterDeviceException(err.str()); fp@1126: } fp@1126: fp@1126: cout << endl fp@1126: << " Slaves: " << data.slave_count << endl; fp@1126: fp@1126: for (i = 0; i < 2; i++) { fp@1126: cout << " Device" << i << ": "; fp@1126: if (data.devices[i].address[0] == 0x00 fp@1126: && data.devices[i].address[1] == 0x00 fp@1126: && data.devices[i].address[2] == 0x00 fp@1126: && data.devices[i].address[3] == 0x00 fp@1126: && data.devices[i].address[4] == 0x00 fp@1126: && data.devices[i].address[5] == 0x00) { fp@1126: cout << "None."; fp@1126: } else { fp@1126: cout << hex << setfill('0') fp@1126: << setw(2) << (unsigned int) data.devices[i].address[0] << ":" fp@1126: << setw(2) << (unsigned int) data.devices[i].address[1] << ":" fp@1126: << setw(2) << (unsigned int) data.devices[i].address[2] << ":" fp@1126: << setw(2) << (unsigned int) data.devices[i].address[3] << ":" fp@1126: << setw(2) << (unsigned int) data.devices[i].address[4] << ":" fp@1126: << setw(2) << (unsigned int) data.devices[i].address[5] << " (" fp@1126: << (data.devices[i].attached ? "attached" : "waiting...") fp@1126: << ")" << endl << dec fp@1126: << " Tx count: " << data.devices[i].tx_count << endl fp@1126: << " Rx count: " << data.devices[i].rx_count; fp@1126: } fp@1126: cout << endl; fp@1126: } fp@1126: } fp@1126: fp@1126: /*****************************************************************************/