⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idedebug.c

📁 TI DSP系列读下CF卡程序,可用做图象存储产品的开发
💻 C
字号:
/*
 **************************************************************
 *
 *  hyperstone MS-DOS FAT File System Drivers
 *
 *  Diagnostic Tables Print
 *
 *  Christoph Baumhof 2000-03-21
 *  Reinhard K乭ne 2000-03-21
 *  Mihajlo Varga 2000-03-21
 *
 *  Copyright (C) 1997-2000 hyperstone electronics GmbH Konstanz
 *
 *  2000-03-21 initial release
 *
 * $Id$
 *
 * $Log$
 *
 **************************************************************
 *
 * Changes:
 *
 **************************************************************
 */


#include <stdio.h>
#include <string.h>
#include <string.h>
#include <io.h>
#include "hy_dos.h"
#include "idedebug.h"

static char *msg = "not specified";
int DisplayIdentifyStructure(struct hd_driveid *id) {

   char buf[sizeof(id->model)+1];

	printf("Configuration:              %04X\n", id->config);
	printf("Physical cyls:              %04X\n", id->cyls);
	printf("Physical heads:             %04X\n", id->heads);
	printf("Unformatted bytes/track:    %04X\n", id->track_bytes);
	printf("Unformatted bytes/sector:   %04X\n", id->sector_bytes);
	printf("Physical sectors/track:     %04X\n", id->sectors);
	printf("Vendor unique 0:            %02X\n", id->vendor0);
	printf("Vendor unique 1:            %02X\n", id->vendor1);
	printf("Vendor unique 2:            %02X\n", id->vendor2);

   if ( id->serial_no[0] != 0) {
      memcpy(buf, id->serial_no, sizeof(id->serial_no));
      buf[sizeof(id->serial_no)] = 0;
   }
   else
      strcpy(buf, msg);

	printf("Serial number:              %s\n", buf);

	printf("Buffer type:                %04X\n", id->buf_type);
	printf("Buffer size:                %04X\n", id->buf_size);
	printf("ECC bytes:                  %04X\n", id->ecc_bytes);


   if ( id->fw_rev[0] != 0) {
      memcpy(buf, id->fw_rev, sizeof(id->fw_rev));
      buf[sizeof(id->fw_rev)] = 0;
   }
   else
      strcpy(buf, msg);
	printf("Revision:                   %s\n", buf);

   if ( id->model[0] != 0) {
      memcpy(buf, id->model, sizeof(id->model));
      buf[sizeof(id->model)] = 0;
   }
   else
      strcpy(buf, msg);
	printf("Model:                      %s\n", buf);

	printf("Vendor unique 3:            %02X\n", id->vendor3);
	printf("Maximal multi sector:       %04X\n", id->max_multsect);
	printf("Word IO implemented:        %02X\n", id->vendor3);
	printf("Capability:                 %04X\n", id->capability);
	printf("Vendor unique 4:            %02X\n", id->vendor4);
	printf("Reserved:                   %04X\n", id->reserved50);
	printf("Timing PIO:                 %02X\n", id->tPIO);
	printf("Vendor unique 5:            %02X\n", id->vendor5);
	printf("DMA Timing:                 %02X\n", id->tDMA);
	printf("Vendor unique 6:            %02X\n", id->vendor6);
	printf("Current, EIDE ok:           %04X\n", id->field_valid);
	printf("Logical  cyls:              %04X\n", id->cur_cyls);
	printf("Logical  heads:             %04X\n", id->cur_heads);
	printf("Logical  sectptack:         %04X\n", id->cur_sectors);
	printf("Total sectors(0) on drive:  %04X\n", id->cur_capacity0);
	printf("Total sectors(1) on drive:  %04X\n", id->cur_capacity1);
	printf("Multi sector valid:         %02X\n", id->multsect_valid);
	printf("Curr. multi. sector count:  %04X\n", id->multsect);
	printf("LBA capacity:               %08X\n", id->lba_capacity);
   return 0;
}


int DisplayPartitionTable(struct PART_SECT *p_sect) {
      int i;
      int tmpval;

      if (0xAA55 != CvtByteOrder16(p_sect->id_code)) {
         printf("Identifier = %04X\n", CvtByteOrder16(p_sect->id_code));
         return -1;
      }

      for (i=0; i < 4; i++) {
         printf("\nPartition Table  [%d]\n", i);
         printf("Partition status                         %02X\n", p_sect->part_tab[i].partstatus);
         printf("Start head of the partition              %02X\n", p_sect->part_tab[i].RW_head_part_start);
         tmpval = p_sect->part_tab[i].sect_part_start;
         printf("Start sector of the partition            %02X\n", tmpval & 0x3F);
         tmpval = (tmpval << 2) & 0x300;
         printf("Start cylinder of the partition          %04X\n", tmpval | p_sect->part_tab[i].cyl_part_start);
         printf("Partition type                           %02X\n", p_sect->part_tab[i].sys_ind);
         printf("End   head of the partition              %02X\n", p_sect->part_tab[i].RW_head_part_end);
         tmpval = p_sect->part_tab[i].sect_part_end;
         printf("End   sector of the partition            %02X\n", tmpval & 0x3F);
         tmpval = (tmpval << 2) & 0x300;
         printf("End   cylynder of the partition          %04X\n", tmpval | p_sect->part_tab[i].cyl_part_end);
         printf("Sector distance (boot sect) -(part sect) %08X\n", CvtByteOrder32(p_sect->part_tab[i].dist));
         printf("Partition size (sectors)                 %08X\n", CvtByteOrder32(p_sect->part_tab[i].count_sect_part));
      }
      printf("\n\nIdentifier = %04X\n", CvtByteOrder16(p_sect->id_code));
      return  0;
}


int DisplayBootSector (struct BOOT_SECT *boot_sect ) {
     char str[12];


     if (testFAT(boot_sect) == -1) {
        fprintf(stderr, "Only FAT12 and FAT16 Systems are supported.\n");
        return -1;
     }
     printf("\nBoot Sector Information.\n\n");
     str[8] = 0;
     memcpy(str, boot_sect->oem, 8);
     printf("Vendor/Version:           %s\n", str);
     printf("Bytes per Sector:         %d\n", CvtByteOrder16(boot_sect->bytesPerSector));
     printf("Sectors per Cluster:      %d\n", boot_sect->sectPerCluster);
     printf("Reserved Sectors:         %d\n", CvtByteOrder16(boot_sect->resSectors));
     printf("Count of FATs:            %d\n", boot_sect->nFats);
     printf("Entries in ROOT:          %d\n", CvtByteOrder16(boot_sect->nRootDir));
     printf("Count of Sectors in Vol:  %d\n", CvtByteOrder16(boot_sect->nSectors));
     printf("Media:                    %02X\n", boot_sect->MID);
     printf("Sectors per FAT:          %d\n", CvtByteOrder16(boot_sect->sectPerFat));
     printf("Sectors per track:        %d\n", CvtByteOrder16(boot_sect->sectPerTrack));
     printf("Heads:                    %d\n", CvtByteOrder16(boot_sect->nHeads));
     printf("Hidden:                   %d\n", CvtByteOrder32(boot_sect->nHidden));
     printf("Sector Huge:              %d\n", CvtByteOrder32(boot_sect->nSectorHuge));
     printf("Drive:                    %d\n", boot_sect->drive);
     printf("Ext. Boot:                %d\n", boot_sect->extBoot);
     printf("Volume Id:                %08X\n", CvtByteOrder32(boot_sect->volid));
     str[11] = 0;
     memcpy(str, boot_sect->vollabel, 11);
     printf("Volume Label:             %s\n", str);
     memcpy(str, boot_sect->filesys, 8);
     str[8] = 0;
     printf("File system:              %s\n", str);
     return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -