summaryrefslogtreecommitdiff
path: root/cleopatre/hal/gidel/AHBMemory.h
blob: 7d1be68ecf8da265f29104550ef58069f2b39de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef AHBMemory_h
#define AHBMemory_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    AHBMemory.h
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */

#include <proc.h>
#include "Gidel.h"

/**
 * Declaration
 */
template <typename T> class AHBMemoryRef;

/**
 * Class AHBMemoryPtr
 */
template <typename T>
class AHBMemoryPtr
{
private:
    unsigned int current_addr;
    unsigned int current_offset;
    static int counter;
public:
    AHBMemoryRef<T> *ref;
public:
    AHBMemoryPtr(CGidel *gidel, unsigned int addr, unsigned int taille);
    AHBMemoryPtr(const AHBMemoryPtr<T>& p);
    virtual ~AHBMemoryPtr();
    unsigned int GetAddr(void);
    void GetDebugInfo(void);
    AHBMemoryRef<T>& operator* ();
    AHBMemoryPtr<T>& operator= (const AHBMemoryPtr<T>& p);
    AHBMemoryPtr<T>& operator+ (const unsigned int offset);
    AHBMemoryPtr<T>& operator- (const unsigned int offset);
    AHBMemoryPtr<T>& operator+= (const unsigned int offset);
    AHBMemoryPtr<T>& operator-= (const unsigned int offset);
    AHBMemoryPtr<T>& operator++ (void);
    AHBMemoryPtr<T> operator++ (int i);
    AHBMemoryPtr<T>& operator-- (void);
    AHBMemoryPtr<T> operator-- (int i);
};


/**
 * Class AHBMemoryRef
 */
template <typename T>
class AHBMemoryRef
{
private:
    ReadWriteRegister page;
    ReadWriteMemory<T> ahb;
    AHBMemoryPtr<T> *ptr;
    CGidel *thegidel;
public:
    unsigned int addr;
    unsigned int base_addr;
    unsigned int page_value;
    unsigned int size;
public:
    AHBMemoryRef(AHBMemoryPtr<T> *p, CGidel *gidel, unsigned int start_addr, unsigned int taille);
    virtual ~AHBMemoryRef();
    AHBMemoryRef<T>& operator= (const unsigned int val);
    operator unsigned int ();
};

#include "AHBMemory.tpp" //Needed with template

#endif /* AHBMemory_h */