OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [dos.h] - Blame information for rev 248

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
/*
2
    dos.h -- dos services (C-header file)
3
    Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
4
 
5
    This file is part of OpenRISC 1000 Reference Platform Monitor (ORPmon)
6
 
7
    This program is free software; you can redistribute it and/or modify
8
    it under the terms of the GNU General Public License as published by
9
    the Free Software Foundation; either version 2 of the License, or
10
    (at your option) any later version
11
 
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16
 
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
*/
21
 
22
/*
23
 * Definitions for the Opencores ATA Controller Core
24
 */
25
 
26
#ifndef __OC_DOS_H
27
#define __OC_DOS_H
28
 
29
#include "ata.h"
30
 
31
struct dosparam {
32
  unsigned short bytes_per_sector;
33
  unsigned char  fats;             // number of FATs
34
  unsigned char  sectors_per_cluster;
35
  unsigned short sectors_per_fat;
36
  unsigned short root_entries;     // number of entries in the root sector
37
 
38
  unsigned long ssector;           // startsector of current directory
39
  unsigned long csector;           // startsector of current cluster
40
  unsigned long sentry;            // startentry of current cluster
41
  unsigned char cbuf[8192];        // cluster buffer. This should be dynamically alocated
42
 
43
  /* ata driver structures */
44
  struct inode inode;
45
  struct file filp;
46
  struct request request;
47
};
48
 
49
 
50
struct dos_dir_entry {
51
  unsigned char name[8];
52
  unsigned char ext[3];
53
 
54
  unsigned char attribute;  // attributes
55
 
56
  unsigned char reserved[10];
57
 
58
  unsigned short time;      // time of creation/modification
59
  unsigned short date;      // date of creation/modification
60
 
61
  unsigned short sc;        // startcluster
62
  unsigned long  size;      // file size
63
};
64
 
65
 
66
#define ATT_ARC 0x20
67
#define ATT_DIR 0x10
68
#define ATT_LAB 0x08
69
#define ATT_SYS 0x04
70
#define ATT_HID 0x02
71
#define ATT_RW  0x01
72
 
73
 
74
/*
75
  macros
76
*/
77
#define bytes_per_cluster(param)   (unsigned long)(param->sectors_per_cluster * param->bytes_per_sector)
78
#define entries_per_cluster(param) (unsigned long)(bytes_per_cluster(param) / sizeof(struct dos_dir_entry) )
79
 
80
 
81
/*
82
  prototypes
83
*/
84
int dos_open(struct dosparam *params);
85
int dos_release(struct dosparam *params);
86
 
87
struct dos_dir_entry *dos_dir_get_entry(struct dosparam *params, unsigned long entry);
88
struct dos_dir_entry *dos_dir_find_entry(struct dosparam *params, const char *name);
89
 
90
char *dos_read_cluster(struct dosparam *params, unsigned long ssector);
91
char *dos_dir_cluster_read_nxt(struct dosparam *params);
92
char *dos_dir_cluster_reset(struct dosparam *params);
93
 
94
#endif

powered by: WebSVN 2.1.0

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