OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [stdalone/] [shpart/] [main.c] - Diff between revs 38 and 259

Show entire file | Details | Blame | View Log

Rev 38 Rev 259
Line 13... Line 13...
#define NPE             (SECTOR_SIZE / sizeof(PartEntry))
#define NPE             (SECTOR_SIZE / sizeof(PartEntry))
#define DESCR_SIZE      20
#define DESCR_SIZE      20
 
 
 
 
typedef struct {
typedef struct {
  unsigned long type;
  unsigned int type;
  unsigned long start;
  unsigned int start;
  unsigned long size;
  unsigned int size;
  char descr[DESCR_SIZE];
  char descr[DESCR_SIZE];
} PartEntry;
} PartEntry;
 
 
PartEntry ptr[NPE];
PartEntry ptr[NPE];
 
 
Line 40... Line 40...
 
 
 
 
/**************************************************************/
/**************************************************************/
 
 
 
 
unsigned long getNumber(unsigned char *p) {
unsigned int getNumber(unsigned char *p) {
  return (unsigned long) *(p + 0) << 24 |
  return (unsigned int) *(p + 0) << 24 |
         (unsigned long) *(p + 1) << 16 |
         (unsigned int) *(p + 1) << 16 |
         (unsigned long) *(p + 2) <<  8 |
         (unsigned int) *(p + 2) <<  8 |
         (unsigned long) *(p + 3) <<  0;
         (unsigned int) *(p + 3) <<  0;
}
}
 
 
 
 
void convertPartitionTable(PartEntry *e, int n) {
void convertPartitionTable(PartEntry *e, int n) {
  int i;
  int i;
Line 134... Line 134...
  }
  }
  return FALSE;
  return FALSE;
}
}
 
 
 
 
unsigned long getDiskSize(void) {
unsigned int getDiskSize(void) {
  return *DISK_CAP;
  return *DISK_CAP;
}
}
 
 
 
 
Bool readDisk(unsigned long sector,
Bool readDisk(unsigned int sector,
              unsigned int count,
              unsigned int count,
              unsigned int *addr) {
              unsigned int *addr) {
  unsigned int n;
  unsigned int n;
  unsigned int *p;
  unsigned int *p;
  unsigned int i;
  unsigned int i;
Line 170... Line 170...
 
 
/**************************************************************/
/**************************************************************/
 
 
 
 
void main(void) {
void main(void) {
  unsigned long numSectors;
  unsigned int numSectors;
  unsigned long partLast;
  unsigned int partLast;
  int i, j;
  int i, j;
  char c;
  char c;
 
 
  /* init interrupts */
  /* init interrupts */
  initInterrupts();
  initInterrupts();
Line 183... Line 183...
  if (!checkDiskReady()) {
  if (!checkDiskReady()) {
    error("disk not ready");
    error("disk not ready");
  }
  }
  /* determine disk size */
  /* determine disk size */
  numSectors = getDiskSize();
  numSectors = getDiskSize();
  printf("Disk has %lu (0x%lX) sectors.\n",
  printf("Disk has %u (0x%X) sectors.\n",
         numSectors, numSectors);
         numSectors, numSectors);
  if (numSectors < 32) {
  if (numSectors < 32) {
    error("disk is too small");
    error("disk is too small");
  }
  }
  /* read partition table record */
  /* read partition table record */
Line 202... Line 202...
    if (ptr[i].type != 0) {
    if (ptr[i].type != 0) {
      partLast = ptr[i].start + ptr[i].size - 1;
      partLast = ptr[i].start + ptr[i].size - 1;
    } else {
    } else {
      partLast = 0;
      partLast = 0;
    }
    }
    printf("%2d %s 0x%08lX 0x%08lX 0x%08lX 0x%08lX ",
    printf("%2d %s 0x%08X 0x%08X 0x%08X 0x%08X ",
           i,
           i,
           ptr[i].type & 0x80000000 ? "*" : " ",
           ptr[i].type & 0x80000000 ? "*" : " ",
           ptr[i].type & 0x7FFFFFFF,
           ptr[i].type & 0x7FFFFFFF,
           ptr[i].start,
           ptr[i].start,
           partLast,
           partLast,

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.