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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [char/] [ftape/] [ftape-rw.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#ifndef _FTAPE_RW_H
2
#define _FTAPE_RW_H
3
 
4
/*
5
 * Copyright (C) 1993-1995 Bas Laarhoven.
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, or (at your option)
10
 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; see the file COPYING.  If not, write to
19
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
 
21
 *
22
 $Source: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/uclinux/uClinux-2.0.x/drivers/char/ftape/ftape-rw.h,v $
23
 $Author: simons $
24
 *
25
 $Revision: 1.1.1.1 $
26
 $Date: 2001-09-10 07:44:17 $
27
 $State: Exp $
28
 *
29
 *      This file contains the definitions for the read and write
30
 *      functions for the QIC-117 floppy-tape driver for Linux.
31
 *
32
 */
33
 
34
#include "fdc-io.h"
35
#include "kernel-interface.h"
36
 
37
#define GET2( address, offset) *(short*)(address + offset)
38
#define GET4( address, offset) *(long*)(address + offset)
39
#define PUT2( address, offset, value) *(short*)(address + offset) = value
40
#define PUT4( address, offset, value) *(long*)(address + offset) = value
41
 
42
enum runner_status_enum {
43
        idle = 0,
44
        running,
45
        do_abort,
46
        aborting,
47
        logical_eot,
48
        end_of_tape,
49
        buffer_overrun,
50
        buffer_underrun,
51
};
52
 
53
typedef struct {
54
        byte *address;
55
        volatile buffer_state_enum status;
56
        volatile byte *ptr;
57
        volatile unsigned bytes;
58
        volatile unsigned segment_id;
59
 
60
        /* bitmap for remainder of segment not yet handled.
61
         * one bit set for each bad sector that must be skipped.
62
         */
63
        volatile unsigned long bad_sector_map;
64
 
65
        /* bitmap with bad data blocks in data buffer.
66
         * the errors in this map may be retried.
67
         */
68
        volatile unsigned long soft_error_map;
69
 
70
        /* bitmap with bad data blocks in data buffer
71
         * the errors in this map may not be retried.
72
         */
73
        volatile unsigned long hard_error_map;
74
 
75
        /* retry counter for soft errors.
76
         */
77
        volatile int retry;
78
 
79
        /* sectors to skip on retry ???
80
         */
81
        volatile unsigned int skip;
82
 
83
        /* nr of data blocks in data buffer
84
         */
85
        volatile unsigned data_offset;
86
 
87
        /* offset in segment for first sector to be handled.
88
         */
89
        volatile unsigned sector_offset;
90
 
91
        /* size of cluster of good sectors to be handled.
92
         */
93
        volatile unsigned sector_count;
94
 
95
        /* size of remaining part of segment to be handled.
96
         */
97
        volatile unsigned remaining;
98
 
99
        /* points to next segment (contiguous) to be handled,
100
         * or is zero if no read-ahead is allowed.
101
         */
102
        volatile unsigned next_segment;
103
 
104
        /* flag being set if deleted data was read.
105
         */
106
        volatile int deleted;
107
 
108
        volatile byte head;
109
        volatile byte cyl;
110
        volatile byte sect;
111
} buffer_struct;
112
 
113
typedef struct {
114
        int active;
115
        int error;
116
        int offset;
117
} ftape_fast_start_struct;
118
 
119
typedef struct {
120
        int id;
121
        int size;
122
        int free;
123
} ftape_last_segment_struct;
124
 
125
typedef struct {
126
        int track;              /* tape head position */
127
        volatile int known;     /* validates bot, segment, sector */
128
        volatile int bot;       /* logical begin of track */
129
        volatile int eot;       /* logical end of track */
130
        volatile int segment;   /* current segment */
131
        volatile int sector;    /* sector offset within current segment */
132
} location_record;
133
 
134
typedef enum {
135
        fmt_normal = 2, fmt_1100ft = 3, fmt_wide = 4, fmt_425ft = 5
136
} format_type;
137
 
138
/*      ftape-rw.c defined global vars.
139
 */
140
extern int tracing;
141
extern byte trace_id;
142
extern buffer_struct buffer[];
143
extern location_record location;
144
extern volatile ftape_fast_start_struct ftape_fast_start;
145
extern byte deblock_buffer[(SECTORS_PER_SEGMENT - 3) * SECTOR_SIZE];
146
extern byte scratch_buffer[(SECTORS_PER_SEGMENT - 3) * SECTOR_SIZE];
147
extern ftape_last_segment_struct ftape_last_segment;
148
extern int header_segment_1;
149
extern int header_segment_2;
150
extern int used_header_segment;
151
extern unsigned int fast_seek_segment_time;
152
extern volatile int tape_running;
153
extern format_type format_code;
154
 
155
/*      ftape-rw.c defined global functions.
156
 */
157
extern int count_ones(unsigned long mask);
158
extern int valid_segment_no(unsigned segment);
159
extern int setup_new_segment(buffer_struct * buff, unsigned int segment_id,
160
                             int offset);
161
extern int calc_next_cluster(buffer_struct * buff);
162
extern buffer_struct *next_buffer(volatile int *x);
163
extern int ftape_read_id(void);
164
extern void ftape_tape_parameters(byte drive_configuration);
165
extern int wait_segment(buffer_state_enum state);
166
extern int ftape_dumb_stop(void);
167
extern int ftape_start_tape(int segment_id, int offset);
168
 
169
/*      fdc-io.c defined global functions.
170
 */
171
extern int setup_fdc_and_dma(buffer_struct * buff, byte operation);
172
 
173
#endif                          /* _FTAPE_RW_H */

powered by: WebSVN 2.1.0

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