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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [dos.h] - Diff between revs 2 and 175

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 175
/*
/*
    dos.h -- dos services (C-header file)
    dos.h -- dos services (C-header file)
    Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
    Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
 
 
    This file is part of OpenRISC 1000 Reference Platform Monitor (ORPmon)
    This file is part of OpenRISC 1000 Reference Platform Monitor (ORPmon)
 
 
    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version
    (at your option) any later version
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
 
 
/*
/*
 * Definitions for the Opencores ATA Controller Core
 * Definitions for the Opencores ATA Controller Core
 */
 */
 
 
#ifndef __OC_DOS_H
#ifndef __OC_DOS_H
#define __OC_DOS_H
#define __OC_DOS_H
 
 
#include "ata.h"
#include "ata.h"
 
 
struct dosparam {
struct dosparam {
  unsigned short bytes_per_sector;
  unsigned short bytes_per_sector;
  unsigned char  fats;             // number of FATs
  unsigned char  fats;             // number of FATs
  unsigned char  sectors_per_cluster;
  unsigned char  sectors_per_cluster;
  unsigned short sectors_per_fat;
  unsigned short sectors_per_fat;
  unsigned short root_entries;     // number of entries in the root sector
  unsigned short root_entries;     // number of entries in the root sector
 
 
  unsigned long ssector;           // startsector of current directory
  unsigned long ssector;           // startsector of current directory
  unsigned long csector;           // startsector of current cluster
  unsigned long csector;           // startsector of current cluster
  unsigned long sentry;            // startentry of current cluster
  unsigned long sentry;            // startentry of current cluster
  unsigned char cbuf[8192];        // cluster buffer. This should be dynamically alocated
  unsigned char cbuf[8192];        // cluster buffer. This should be dynamically alocated
 
 
  /* ata driver structures */
  /* ata driver structures */
  struct inode inode;
  struct inode inode;
  struct file filp;
  struct file filp;
  struct request request;
  struct request request;
};
};
 
 
 
 
struct dos_dir_entry {
struct dos_dir_entry {
  unsigned char name[8];
  unsigned char name[8];
  unsigned char ext[3];
  unsigned char ext[3];
 
 
  unsigned char attribute;  // attributes
  unsigned char attribute;  // attributes
 
 
  unsigned char reserved[10];
  unsigned char reserved[10];
 
 
  unsigned short time;      // time of creation/modification
  unsigned short time;      // time of creation/modification
  unsigned short date;      // date of creation/modification
  unsigned short date;      // date of creation/modification
 
 
  unsigned short sc;        // startcluster
  unsigned short sc;        // startcluster
  unsigned long  size;      // file size
  unsigned long  size;      // file size
};
};
 
 
 
 
#define ATT_ARC 0x20
#define ATT_ARC 0x20
#define ATT_DIR 0x10
#define ATT_DIR 0x10
#define ATT_LAB 0x08
#define ATT_LAB 0x08
#define ATT_SYS 0x04
#define ATT_SYS 0x04
#define ATT_HID 0x02
#define ATT_HID 0x02
#define ATT_RW  0x01
#define ATT_RW  0x01
 
 
 
 
/*
/*
  macros
  macros
*/
*/
#define bytes_per_cluster(param)   (unsigned long)(param->sectors_per_cluster * param->bytes_per_sector)
#define bytes_per_cluster(param)   (unsigned long)(param->sectors_per_cluster * param->bytes_per_sector)
#define entries_per_cluster(param) (unsigned long)(bytes_per_cluster(param) / sizeof(struct dos_dir_entry) )
#define entries_per_cluster(param) (unsigned long)(bytes_per_cluster(param) / sizeof(struct dos_dir_entry) )
 
 
 
 
/*
/*
  prototypes
  prototypes
*/
*/
int dos_open(struct dosparam *params);
int dos_open(struct dosparam *params);
int dos_release(struct dosparam *params);
int dos_release(struct dosparam *params);
 
 
struct dos_dir_entry *dos_dir_get_entry(struct dosparam *params, unsigned long entry);
struct dos_dir_entry *dos_dir_get_entry(struct dosparam *params, unsigned long entry);
struct dos_dir_entry *dos_dir_find_entry(struct dosparam *params, const char *name);
struct dos_dir_entry *dos_dir_find_entry(struct dosparam *params, const char *name);
 
 
char *dos_read_cluster(struct dosparam *params, unsigned long ssector);
char *dos_read_cluster(struct dosparam *params, unsigned long ssector);
char *dos_dir_cluster_read_nxt(struct dosparam *params);
char *dos_dir_cluster_read_nxt(struct dosparam *params);
char *dos_dir_cluster_reset(struct dosparam *params);
char *dos_dir_cluster_reset(struct dosparam *params);
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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