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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11VirtTapeTap.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: Rw11VirtTapeTap.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: Rw11VirtTapeTap.hpp 686 2015-06-04 21:08:08Z mueller $
24
  \brief   Declaration of class Rw11VirtTapeTap.
25
*/
26
 
27
#ifndef included_Retro_Rw11VirtTapeTap
28
#define included_Retro_Rw11VirtTapeTap 1
29
 
30
#include "Rw11VirtTape.hpp"
31
 
32
namespace Retro {
33
 
34
  class Rw11VirtTapeTap : public Rw11VirtTape {
35
    public:
36
 
37
      explicit      Rw11VirtTapeTap(Rw11Unit* punit);
38
                   ~Rw11VirtTapeTap();
39
 
40
      bool          Open(const std::string& url, RerrMsg& emsg);
41
 
42
      virtual bool  ReadRecord(size_t nbyt, uint8_t* data, size_t& ndone,
43
                               int& opcode, RerrMsg& emsg);
44
      virtual bool  WriteRecord(size_t nbyt, const uint8_t* data,
45
                                int& opcode, RerrMsg& emsg);
46
      virtual bool  WriteEof(RerrMsg& emsg);
47
      virtual bool  SpaceForw(size_t nrec, size_t& ndone,
48
                              int& opcode, RerrMsg& emsg);
49
      virtual bool  SpaceBack(size_t nrec, size_t& ndone,
50
                              int& opcode, RerrMsg& emsg);
51
      virtual bool  Rewind(int& opcode, RerrMsg& emsg);
52
 
53
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
54
 
55
    // some constants (also defined in cpp)
56
      static const uint32_t kMetaEof = 0x00000000; //!< EOF marker
57
      static const uint32_t kMetaEom = 0xffffffff; //!< EOM marker
58
      static const uint32_t kMeta_M_Perr = 0x80000000;
59
      static const uint32_t kMeta_M_Mbz  = 0x7fff0000;
60
      static const uint32_t kMeta_B_Rlen = 0x0000ffff;
61
 
62
    protected:
63
      bool          Seek(size_t seekpos, int dir, RerrMsg& emsg);
64
      bool          Read(size_t nbyt, uint8_t* data, RerrMsg& emsg);
65
      bool          Write(size_t nbyt, const uint8_t* data, bool back,
66
                          RerrMsg& emsg);
67
      bool          CheckSizeForw(size_t nbyt, const char* text, RerrMsg& emsg);
68
      bool          CheckSizeBack(size_t nbyt, const char* text, RerrMsg& emsg);
69
      void          UpdatePos(size_t nbyt, int dir);
70
      bool          ParseMeta(uint32_t meta, size_t& rlen, bool& perr,
71
                              RerrMsg& emsg);
72
      size_t        BytePadding(size_t rlen);
73
      bool          SetBad();
74
      bool          BadTapeMsg(const char* meth, RerrMsg& emsg);
75
      void          IncPosRecord(int delta);
76
 
77
    protected:
78
      int           fFd;                    //!< file number
79
      size_t        fSize;                  //!< file size
80
      size_t        fPos;                   //!< file position
81
      bool          fBad;                   //!< BAD file format flag
82
      bool          fPadOdd;                //!< do odd byte padding
83
      bool          fTruncPend;             //!< truncate on next write
84
  };
85
 
86
} // end namespace Retro
87
 
88
#include "Rw11VirtTapeTap.ipp"
89
 
90
#endif

powered by: WebSVN 2.1.0

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