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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [src/] [librw11/] [Rw11Rdma.hpp] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 wfjm
// $Id: Rw11Rdma.hpp 648 2015-02-20 20:16:21Z mueller $
2 28 wfjm
//
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 29 wfjm
// 2015-02-17   647   1.1    PreExecCB with nwdone and nwnext
17 28 wfjm
// 2015-01-04   627   1.0    Initial version
18
// ---------------------------------------------------------------------------
19
 
20
 
21
/*!
22
  \file
23 29 wfjm
  \version $Id: Rw11Rdma.hpp 648 2015-02-20 20:16:21Z mueller $
24 28 wfjm
  \brief   Declaration of class Rw11Rdma.
25
*/
26
 
27
#ifndef included_Retro_Rw11Rdma
28
#define included_Retro_Rw11Rdma 1
29
 
30
#include "boost/utility.hpp"
31
#include "boost/function.hpp"
32
 
33
#include "librtools/Rstats.hpp"
34
#include "librtools/RerrMsg.hpp"
35
 
36
#include "librtools/Rbits.hpp"
37
#include "Rw11Cntl.hpp"
38
 
39
namespace Retro {
40
 
41
  class Rw11Rdma : public Rbits, private boost::noncopyable {
42
    public:
43
 
44 29 wfjm
      typedef boost::function<void(int,size_t,size_t,
45
                                   RlinkCommandList&)>  precb_t;
46
      typedef boost::function<void(int,size_t,
47
                                   RlinkCommandList&,size_t)>  postcb_t;
48 28 wfjm
 
49
                    Rw11Rdma(Rw11Cntl* pcntl, const precb_t& precb,
50
                             const postcb_t& postcb);
51
      virtual      ~Rw11Rdma();
52
 
53
      Rw11Cntl&     CntlBase() const;
54
      Rw11Cpu&      Cpu() const;
55
      Rw11&         W11() const;
56
      RlinkServer&  Server() const;
57
      RlinkConnect& Connect() const;
58
      RlogFile&     LogFile() const;
59
 
60
      void          SetChunkSize(size_t chunk);
61
      size_t        ChunkSize() const;
62
 
63
      bool          IsActive() const;
64
 
65
      void          QueueRMem(uint32_t addr, uint16_t* block, size_t size,
66
                              uint16_t mode);
67
      void          QueueWMem(uint32_t addr, const uint16_t* block, size_t size,
68
                              uint16_t mode);
69
 
70
      const Rstats& Stats() const;
71
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
72
 
73
    // statistics counter indices
74
      enum stats {
75
        kStatNQueRMem,                      //!< RMem chains queued
76
        kStatNQueWMem,                      //!< WMem chains queued
77
        kStatNRdmaRMem,                     //!< RMem chunks done
78
        kStatNRdmaWMem,                     //!< WMem chunks done
79
        kStatNExtClist,                     //!< clist extended
80
        kStatNFailRdma,                     //!< Rdma failures
81
        kDimStat
82
      };
83
 
84
    // status values
85
      enum status {
86
        kStatusDone,                        //!< all chunks done and ok
87
        kStatusBusy,                        //!< more chunks to come
88
        kStatusBusyLast,                    //!< last chunk to come
89
        kStatusFailRdma                     //!< last rdma transfer failed
90
      };
91
 
92
    protected:
93
      void          SetupRdma(bool iswmem, uint32_t addr, uint16_t* block,
94
                              size_t size, uint16_t mode);
95
      int           RdmaHandler();
96
      virtual void  PreRdmaHook();
97 29 wfjm
      virtual void  PostRdmaHook(size_t nwdone);
98 28 wfjm
 
99
    protected:
100
      Rw11Cntl*     fpCntlBase;             //!< plain Rw11Cntl ptr
101
      precb_t       fPreExecCB;             //!< pre Exec callback
102
      postcb_t      fPostExecCB;            //!< post Exec callback
103
      size_t        fChunksize;             //!< channel chunk size
104
      enum status   fStatus;                //!< dma status
105
      bool          fIsWMem;                //!< is memory write
106
      uint32_t      fAddr;                  //!< current mem address
107
      uint16_t      fMode;                  //!< current mode
108
      size_t        fNWordMax;              //!< transfer chunk size
109
      size_t        fNWordRest;             //!< words to be done
110
      size_t        fNWordDone;             //!< words transfered
111
      uint16_t*     fpBlock;                //!< current buffer pointer
112
      Rstats        fStats;                 //!< statistics
113
  };
114
 
115
} // end namespace Retro
116
 
117
#include "Rw11Rdma.ipp"
118
 
119
#endif

powered by: WebSVN 2.1.0

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