summaryrefslogtreecommitdiff
path: root/cleopatre/hal
diff options
context:
space:
mode:
authorsave2008-05-29 13:07:36 +0000
committersave2008-05-29 13:07:36 +0000
commitbe51b633411f4d76def5b1f1524b8b0b74acd87d (patch)
tree5e67227fd3ebf374220a278e9eee739ac9b6e02a /cleopatre/hal
parent8186dceb068d03b7b5cdf83b1b2f0d1ced2d383b (diff)
Adapt AHBRegister class with cache + cleaned and reorganized init prodecure for Gidel class
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2150 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cleopatre/hal')
-rw-r--r--cleopatre/hal/gidel/AHBRegister.cpp38
-rw-r--r--cleopatre/hal/gidel/AHBRegister.h3
-rw-r--r--cleopatre/hal/gidel/Gidel.cpp37
-rw-r--r--cleopatre/hal/gidel/Gidel.h48
-rw-r--r--cleopatre/hal/gidel/test/src/start2.cpp95
5 files changed, 59 insertions, 162 deletions
diff --git a/cleopatre/hal/gidel/AHBRegister.cpp b/cleopatre/hal/gidel/AHBRegister.cpp
index 469ed25c6a..b0105ebffe 100644
--- a/cleopatre/hal/gidel/AHBRegister.cpp
+++ b/cleopatre/hal/gidel/AHBRegister.cpp
@@ -17,23 +17,6 @@
#include <unistd.h>
#include "AHBRegister.h"
-static unsigned int getAHBRegister(ReadWriteRegister reg)
-{
- unsigned int one, two, three, result;
- one = reg;
- two = reg;
- three = reg;
-
- if((one == two) || (one == three))
- result = one;
- else if(two == three)
- result = two;
- else
- result = three;
- return result;
-}
-
-
/**
* Class AHBRegister
*/
@@ -44,14 +27,29 @@ AHBRegister::AHBRegister(CGidel *gidel, unsigned int addr)
page.Create(0x01014 + FPGA_EXTENT(num_fpga), gidel);
page_value = (addr & 0xFFF00000);
reg.Create((addr&0x000FFFFC) + FPGA_EXTENT(num_fpga) + (0x100000), gidel);
- //Wait after Memroy creation we don't know why
+ dummy.Create((0xC&0x000FFFFC) + FPGA_EXTENT(num_fpga) + (0x100000), gidel);
+
+ //Wait after Memory creation we don't know why
usleep(250);
+
+ //Active AHB cache
+ gidel->f_AHBcache_enable = 1;
}
AHBRegister::~AHBRegister()
{
}
+unsigned int AHBRegister::getAHBRegister(ReadWriteRegister reg)
+{
+ unsigned int one, two, three;
+ three = dummy;
+ one = reg;
+ two = reg;
+ two = reg;
+ return two;
+}
+
AHBRegister& AHBRegister::operator= (const unsigned int val)
{
page = page_value;
@@ -106,7 +104,9 @@ AHBRegister& AHBRegister::operator-= (const unsigned int val)
AHBRegister::operator unsigned int ()
{
+ unsigned int tmp;
page = page_value;
- return getAHBRegister(reg);
+ tmp = getAHBRegister(reg);
+ return tmp;
}
diff --git a/cleopatre/hal/gidel/AHBRegister.h b/cleopatre/hal/gidel/AHBRegister.h
index 08e5ea27a5..c029b457d1 100644
--- a/cleopatre/hal/gidel/AHBRegister.h
+++ b/cleopatre/hal/gidel/AHBRegister.h
@@ -30,10 +30,13 @@ class AHBRegister
{
private:
ReadWriteRegister page;
+ ReadRegister dummy;
unsigned int size;
unsigned int page_value;
public:
ReadWriteRegister reg;
+private:
+ unsigned int getAHBRegister(ReadWriteRegister reg);
public:
AHBRegister(CGidel *gidel, unsigned int addr);
virtual ~AHBRegister();
diff --git a/cleopatre/hal/gidel/Gidel.cpp b/cleopatre/hal/gidel/Gidel.cpp
index 214b02374a..c8040df0b4 100644
--- a/cleopatre/hal/gidel/Gidel.cpp
+++ b/cleopatre/hal/gidel/Gidel.cpp
@@ -31,10 +31,17 @@ CGidel::CGidel(const char file[_MAX_PATH], unsigned int fpga_num):Proc(0xc00000)
r_RBF_Info.Create(FPGA_EXTENT(num_fpga), this);
f_rbf_version.Create(r_RBF_Info, this, 0xFF, 0);
- r_Pciit.Create(FPGA_EXTENT(num_fpga) + 0x01004, this);
- f_pciit_to_leon.Create(r_Pciit, this, 0x02, 1);
- f_pciit_from_leon.Create(r_Pciit, this, 0x04, 2);
- f_pciit_force.Create(r_Pciit, this, 0x08, 3);
+ r_Reset.Create(FPGA_EXTENT(num_fpga) + 0x0101C, this);
+ f_rst_ahb.Create(r_Reset, this, 0x01, 0);
+ f_rst_proc.Create(r_Reset, this, 0x02, 1);
+
+ r_AHBCache.Create(FPGA_EXTENT(num_fpga) + 0x0102C, this);
+ f_AHBcache_enable.Create(r_AHBCache, this, 0x01, 0);
+ f_AHBcache_trig.Create(r_AHBCache, this, 0x02, 1);
+
+ r_AHBLatencyTrig.Create(FPGA_EXTENT(num_fpga) + 0x01020, this);
+ r_AHBLatencyMax.Create(FPGA_EXTENT(num_fpga) + 0x01024, this);
+ r_AHBLatencyLast.Create(FPGA_EXTENT(num_fpga) + 0x01028, this);
r_Leds.Create(FPGA_EXTENT(num_fpga) + 0x01008, this);
f_led_0.Create(r_Leds, this, 0x01, 0);
@@ -47,24 +54,10 @@ CGidel::CGidel(const char file[_MAX_PATH], unsigned int fpga_num):Proc(0xc00000)
f_led_force_3.Create(r_Leds, this, 0x80, 7);
f_led_blink.Create(r_Leds, this, 0x100, 8);
- r_Reset.Create(FPGA_EXTENT(num_fpga) + 0x0101C, this);
- f_rst_ahb.Create(r_Reset, this, 0x01, 0);
- f_rst_proc.Create(r_Reset, this, 0x02, 1);
-
- r_Foo.Create(FPGA_EXTENT(num_fpga) + 0x20000, this);
- f_dsu_en.Create(r_Foo, this, 0x01, 0);
- f_dsu_brk.Create(r_Foo, this, 0x02, 1);
- f_dsu_ack.Create(r_Foo, this, 0x04, 2);
-// f_pciit_to_leon.Create(r_Foo, this, 0x10, 4);
- f_wd.Create(r_Foo, this, 0x1000, 16);
-
- r_AHBLatencyTrig.Create(FPGA_EXTENT(num_fpga) + 0x01020, this);
- r_AHBLatencyMax.Create(FPGA_EXTENT(num_fpga) + 0x01024, this);
- r_AHBLatencyLast.Create(FPGA_EXTENT(num_fpga) + 0x01028, this);
-
- r_AHBCache.Create(FPGA_EXTENT(num_fpga) + 0x0102C, this);
- f_AHBcache_trig.Create(r_AHBCache, this, 0x01, 0);
- f_AHBcache_enable.Create(r_AHBCache, this, 0x02, 1);
+ r_Pciit.Create(FPGA_EXTENT(num_fpga) + 0x01004, this);
+ f_pciit_to_leon.Create(r_Pciit, this, 0x02, 1);
+ f_pciit_from_leon.Create(r_Pciit, this, 0x04, 2);
+ f_pciit_force.Create(r_Pciit, this, 0x08, 3);
}
CGidel::~CGidel()
diff --git a/cleopatre/hal/gidel/Gidel.h b/cleopatre/hal/gidel/Gidel.h
index e7b2453d0c..86870db8fa 100644
--- a/cleopatre/hal/gidel/Gidel.h
+++ b/cleopatre/hal/gidel/Gidel.h
@@ -53,6 +53,16 @@ public:
ReadWriteRegField f_rst_ahb;
ReadWriteRegField f_rst_proc;
+ //Debug latency registers
+ ReadWriteRegister r_AHBLatencyTrig;
+ ReadWriteRegister r_AHBLatencyMax;
+ ReadWriteRegister r_AHBLatencyLast;
+
+ //Variables for AHB cache register
+ ReadWriteRegister r_AHBCache;
+ ReadWriteRegField f_AHBcache_enable;
+ ReadWriteRegField f_AHBcache_trig;
+
//Variables for LEDs
WriteRegister r_Leds;
WriteRegField f_led_0;
@@ -72,24 +82,6 @@ public:
ReadWriteRegField f_pciit_force; //force = 1 => IT from Leon = f_pciit_from_leon
//force = 0 => IT from Leon = gpio 4
- //Variables for foo register
- ReadWriteRegister r_Foo;
- ReadWriteRegField f_dsu_en;
- ReadWriteRegField f_dsu_brk;
- ReadRegField f_dsu_ack;
-// ReadWriteRegField f_pciit_to_leon;
- ReadWriteRegField f_wd;
-
- //Debug latency registers
- ReadWriteRegister r_AHBLatencyTrig;
- ReadRegister r_AHBLatencyMax;
- ReadRegister r_AHBLatencyLast;
-
- //Variables for AHB cache register
- ReadWriteRegister r_AHBCache;
- ReadWriteRegField f_AHBcache_trig;
- ReadWriteRegField f_AHBcache_enable;
-
//structure for RBF informations
struct SRBF_Info
{
@@ -128,28 +120,14 @@ public:
DWORD : 1; // [1]
DWORD f_pciit_from_leon : 1; // [2]
DWORD f_pciit_force : 1; // [3]
- DWORD : 28; // reserved
- };
-
- //structures for Foo register
- struct SFoo
- {
- DWORD f_dsu_en : 1; // [1]
- DWORD f_dsu_brk : 1; // [2]
- DWORD f_dsu_ack : 1; // [3]
- DWORD : 1; // reserved
-// DWORD f_pciit_to_leon : 1; // [5]
- DWORD f_pciit_to_leon : 1; // [5]
- DWORD : 11; // reserved
- DWORD f_wd : 1; // [17]
- DWORD : 15; // reserved
+ DWORD : 27; // reserved
};
//structures for AHBCache register
struct SAHBCache
{
- DWORD f_AHBCache_trig : 1; // [1]
- DWORD f_AHBCache_enable : 1; // [2]
+ DWORD f_AHBCache_enable : 1; // [1]
+ DWORD f_AHBCache_trig : 1; // [2]
DWORD : 30; // reserved
};
diff --git a/cleopatre/hal/gidel/test/src/start2.cpp b/cleopatre/hal/gidel/test/src/start2.cpp
index 84c644a3c7..b5c7a6102e 100644
--- a/cleopatre/hal/gidel/test/src/start2.cpp
+++ b/cleopatre/hal/gidel/test/src/start2.cpp
@@ -90,105 +90,28 @@ int main(int argc, char* argv[])
for(unsigned int i=0;;i++)
{
L2A_head = i;
- for(int j=0;j<1;j++)
- {
- result = L2A_head;
- if(L2A_head != i)
- {
- printf("i=0x%08x ; result=0x%08x\n",i,result);
- error++;
- }
- }
- if(!(i%100000))
+ result = L2A_head;
+ if(result != i)
+ {
+ printf("i=0x%08x ; result=0x%08x\n",i,result);
+ printf("latency Last=%d ; latency Max=%d\n", (unsigned int)m_gidel->r_AHBLatencyLast, (unsigned int)m_gidel->r_AHBLatencyMax);
+ error++;
+ }
+ if((!(i%100000)) && (i!=0))
{
if(error)
{
- printf("%d on %d Errors\n",error, i);
+ printf("%d on %d Errors\n", error, i);
i = 0;
error = 0;
}
else
- printf("No Errors\n");
- }
- }
-
-/*
- unsigned int one;
- unsigned int two;
- unsigned int three;
- unsigned int four;
-
- for(unsigned int i=0;;i++)
- {
- L2A_head = i;
- one = L2A_head;
- two = L2A_head;
- three = L2A_head;
- // four = L2A_head;
-
- if((one != i) || (two != i) || (three != i) || (four != i))
- {
- printf("one=0x%08x ; two=0x%08x ; three=0x%08x ; four=0x%08x\n",one,two,three,four);
- error++;
- }
-
- if(!(i%100000))
- {
- if(error)
{
- printf("%d on %d Errors\n",error, i);
i = 0;
- error = 0;
- }
- else
printf("No Errors\n");
- }
- }
-*/
-/*
- unsigned int one;
- unsigned int two;
- unsigned int three;
-
- for(unsigned int i=0;;i++)
- {
- L2A_head = i;
- one = L2A_head;
- two = L2A_head;
- three = L2A_head;
- unsigned int result;
-
- if((one == two) || (one == three))
- {
- result = one;
- }
- else if(two == three)
- {
- result = two;
- }
- else
- result = three;
-
- if(result != i)
- {
- printf("i=0x%08x ; one=0x%08x ; two=0x%08x ; three=0x%08x ; result=0x%08x\n",i,one,two,three,result);
- error++;
- }
-
- if(!(i%100000))
- {
- if(error)
- {
- printf("%d on %d Errors\n",error, i);
- i = 0;
- error = 0;
}
- else
- printf("No Errors\n");
}
}
-*/
-
return 0;
}