Changeset 2750
- Timestamp:
- 10/16/07 14:32:26 (1 year ago)
- Files:
-
- madwifi/trunk/tools/ath_info.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/trunk/tools/ath_info.c
r2707 r2750 692 692 int i; 693 693 694 fprintf(stderr, "%s [-w [-g N:M]] [-v] [-f] <base_address> "694 fprintf(stderr, "%s [-w [-g N:M]] [-v] [-f] [-d] <base_address> " 695 695 "[<name1> <val1> [<name2> <val2> ...]]\n\n", n); 696 696 fprintf(stderr, … … 699 699 "-v verbose output\n" 700 700 "-f force; suppress question before writing\n" 701 "-d dump eeprom (file 'ath-eeprom-dump.bin' and screen)\n" 701 702 "<base_address> device base address (see lspci output)\n\n"); 702 703 … … 729 730 u_int16_t eeprom_version, mac_version, regdomain, has_crystal, ee_magic; 730 731 u_int8_t error, has_a, has_b, has_g, has_rfkill, eeprom_size; 732 int byte_size=0; 731 733 void *mem; 732 734 int fd; 733 735 int i, anr=1; 734 736 int do_write=0; /* default: read only */ 737 int do_dump=0; 738 735 739 struct { 736 740 int valid; … … 774 778 break; 775 779 780 case 'd': 781 do_dump=1; 782 break; 783 776 784 case 'h': 777 785 usage(argv[0]); … … 950 958 printf("EEPROM Size: "); 951 959 952 if (eeprom_size == 0) 960 if (eeprom_size == 0) { 953 961 printf(" 4K\n"); 954 else if (eeprom_size == 1) 962 byte_size = 4096; 963 } 964 else if (eeprom_size == 1) { 955 965 printf(" 8K\n"); 956 else if (eeprom_size == 2) 966 byte_size = 8192; 967 } 968 else if (eeprom_size == 2) { 957 969 printf(" 16K\n"); 970 byte_size = 16384; 971 } 958 972 else 959 973 printf(" ??\n"); … … 1000 1014 AR5K_REG_READ(AR5K_GPIOCR), AR5K_REG_READ(AR5K_GPIODO), 1001 1015 AR5K_REG_READ(AR5K_GPIODI)); 1016 1017 if (do_dump) { 1018 printf("\nEEPROM dump (%d byte)\n", byte_size); 1019 printf("=============================================="); 1020 u_int16_t data; 1021 FILE* dumpfile = fopen("ath-eeprom-dump.bin", "w"); 1022 for (i=1; i<=(byte_size/2); i++) { 1023 error = ath5k_hw_eeprom_read(mem, i, &data, mac_version); 1024 if (error) { 1025 printf("\nUnable to read at %04x !\n", i); 1026 continue; 1027 } 1028 if (!((i-1)%8)) 1029 printf("\n%04x: ",i); 1030 printf("%04x ", data); 1031 fwrite(&data, 2, 1, dumpfile); 1032 } 1033 printf("\n==============================================\n"); 1034 fclose(dumpfile); 1035 } 1002 1036 1003 1037 if (do_write) {
