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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11VirtTape.hpp] - Blame information for rev 36

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

Line No. Rev Author Line
1 31 wfjm
// $Id: Rw11VirtTape.hpp 686 2015-06-04 21:08:08Z mueller $
2
//
3
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2015-06-04   686   1.0    Initial version
17
// 2015-05-17   683   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
 
21
/*!
22
  \file
23
  \version $Id: Rw11VirtTape.hpp 686 2015-06-04 21:08:08Z mueller $
24
  \brief   Declaration of class Rw11VirtTape.
25
*/
26
 
27
#ifndef included_Retro_Rw11VirtTape
28
#define included_Retro_Rw11VirtTape 1
29
 
30
#include "Rw11Virt.hpp"
31
 
32
namespace Retro {
33
 
34
  class Rw11VirtTape : public Rw11Virt {
35
    public:
36
      explicit      Rw11VirtTape(Rw11Unit* punit);
37
                   ~Rw11VirtTape();
38
 
39
      void          SetWProt(bool wprot);
40
      void          SetCapacity(size_t nbyte);
41
      bool          WProt() const;
42
      size_t        Capacity() const;
43
 
44
      virtual bool  ReadRecord(size_t nbyte, uint8_t* data, size_t& ndone,
45
                               int& opcode, RerrMsg& emsg) = 0;
46
      virtual bool  WriteRecord(size_t nbyte, const uint8_t* data,
47
                                int& opcode, RerrMsg& emsg) = 0;
48
      virtual bool  WriteEof(RerrMsg& emsg) = 0;
49
      virtual bool  SpaceForw(size_t nrec, size_t& ndone,
50
                              int& opcode, RerrMsg& emsg) = 0;
51
      virtual bool  SpaceBack(size_t nrec, size_t& ndone,
52
                              int& opcode, RerrMsg& emsg) = 0;
53
      virtual bool  Rewind(int& opcode, RerrMsg& emsg) = 0;
54
 
55
      void          SetPosFile(int posfile);
56
      void          SetPosRecord(int posrec);
57
 
58
      bool          Bot() const;
59
      bool          Eot() const;
60
      bool          Eom() const;
61
 
62
      int           PosFile() const;
63
      int           PosRecord() const;
64
 
65
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
66
 
67
      static Rw11VirtTape* New(const std::string& url, Rw11Unit* punit,
68
                               RerrMsg& emsg);
69
 
70
    // statistics counter indices
71
      enum stats {
72
        kStatNVTReadRec = Rw11Virt::kDimStat,
73
        kStatNVTReadByt,
74
        kStatNVTReadEof,
75
        kStatNVTReadEom,
76
        kStatNVTReadPErr,
77
        kStatNVTReadLErr,
78
        kStatNVTWriteRec,
79
        kStatNVTWriteByt,
80
        kStatNVTWriteEof,
81
        kStatNVTSpaForw,
82
        kStatNVTSpaBack,
83
        kStatNVTRewind,
84
        kDimStat
85
      };
86
 
87
    // operation code
88
      enum OpCode {
89
        kOpCodeOK = 0,                      //<! operation OK
90
        kOpCodeBot,                         //<! ended at BOT
91
        kOpCodeEof,                         //<! ended at EOF
92
        kOpCodeEom,                         //<! ended at EOM
93
        kOpCodeRecLenErr,                   //<! record length error
94
        kOpCodeBadParity,                   //<! record with parity error
95
        kOpCodeBadFormat                    //<! file format error
96
      };
97
 
98
    protected:
99
      bool          fWProt;                 //<! write protected
100
      size_t        fCapacity;              //<! capacity in byte (0=unlimited)
101
      bool          fBot;                   //<! tape at bot
102
      bool          fEot;                   //<! tape beyond eot
103
      bool          fEom;                   //<! tape beyond medium
104
      int           fPosFile;               //<! tape pos: #files  (-1=unknown)
105
      int           fPosRecord;             //<! tape pos: #record (-1=unknown)
106
  };
107
 
108
} // end namespace Retro
109
 
110
#include "Rw11VirtTape.ipp"
111
 
112
#endif

powered by: WebSVN 2.1.0

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