-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adaptações para PMU seguindo PDF do Leo e criei novo app test_PMU par…
…a testar se PMU funciona
- Loading branch information
Showing
4 changed files
with
177 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <utility/ostream.h> | ||
#include <architecture.h> | ||
|
||
using namespace EPOS; | ||
|
||
OStream cout; | ||
|
||
int main() | ||
{ | ||
long long c = PMU::read(1); | ||
cout << "Hello world!" << endl; | ||
cout << "ABSOLUTES = " << PMU::read(1) << ", " << PMU::read(0) << ", " << PMU::read(2) << endl; | ||
cout << "DIFFERENCE = " << PMU::read(1) - c << endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#ifndef __traits_h | ||
#define __traits_h | ||
|
||
#include <system/config.h> | ||
|
||
__BEGIN_SYS | ||
|
||
// Build | ||
template<> struct Traits<Build>: public Traits_Tokens | ||
{ | ||
// Basic configuration | ||
static const unsigned int SMOD = LIBRARY; | ||
static const unsigned int ARCHITECTURE = IA32; | ||
static const unsigned int MACHINE = PC; | ||
static const unsigned int MODEL = Legacy_PC; | ||
static const unsigned int CPUS = ((MODEL == Legacy_PC) || (MODEL == Raspberry_Pi3) || (MODEL == Realview_PBX) || (MODEL == Zynq) || (MODEL == SiFive_U)) ? 2 : 1; | ||
static const unsigned int NETWORKING = STANDALONE; | ||
static const unsigned int EXPECTED_SIMULATION_TIME = 60; // s (0 => not simulated) | ||
|
||
// Default flags | ||
static const bool enabled = true; | ||
static const bool monitored = true; | ||
static const bool debugged = true; | ||
static const bool hysterically_debugged = false; | ||
}; | ||
|
||
|
||
// Utilities | ||
template<> struct Traits<Debug>: public Traits<Build> | ||
{ | ||
static const bool error = true; | ||
static const bool warning = true; | ||
static const bool info = false; | ||
static const bool trace = false; | ||
}; | ||
|
||
template<> struct Traits<Lists>: public Traits<Build> | ||
{ | ||
static const bool debugged = hysterically_debugged; | ||
}; | ||
|
||
template<> struct Traits<Spin>: public Traits<Build> | ||
{ | ||
static const bool debugged = hysterically_debugged; | ||
}; | ||
|
||
template<> struct Traits<Heaps>: public Traits<Build> | ||
{ | ||
static const bool debugged = hysterically_debugged; | ||
}; | ||
|
||
template<> struct Traits<Observers>: public Traits<Build> | ||
{ | ||
// Some observed objects are created before initializing the Display | ||
// Enabling debug may cause trouble in some Machines | ||
static const bool debugged = false; | ||
}; | ||
|
||
|
||
// System Parts (mostly to fine control debugging) | ||
template<> struct Traits<Boot>: public Traits<Build> | ||
{ | ||
}; | ||
|
||
template<> struct Traits<Setup>: public Traits<Build> | ||
{ | ||
}; | ||
|
||
template<> struct Traits<Init>: public Traits<Build> | ||
{ | ||
}; | ||
|
||
template<> struct Traits<Framework>: public Traits<Build> | ||
{ | ||
}; | ||
|
||
template<> struct Traits<Aspect>: public Traits<Build> | ||
{ | ||
static const bool debugged = hysterically_debugged; | ||
}; | ||
|
||
|
||
__END_SYS | ||
|
||
// Mediators | ||
#include __ARCHITECTURE_TRAITS_H | ||
#include __MACHINE_TRAITS_H | ||
|
||
__BEGIN_SYS | ||
|
||
|
||
// API Components | ||
template<> struct Traits<Application>: public Traits<Build> | ||
{ | ||
static const unsigned int STACK_SIZE = Traits<Machine>::STACK_SIZE; | ||
static const unsigned int HEAP_SIZE = Traits<Machine>::HEAP_SIZE; | ||
static const unsigned int MAX_THREADS = Traits<Machine>::MAX_THREADS; | ||
}; | ||
|
||
template<> struct Traits<System>: public Traits<Build> | ||
{ | ||
static const bool multithread = (Traits<Application>::MAX_THREADS > 1) || (CPUS > 1); | ||
static const bool multicore = multithread && (CPUS > 1); | ||
static const bool multiheap = Traits<Scratchpad>::enabled; | ||
|
||
static const unsigned long LIFE_SPAN = 1 * YEAR; // s | ||
static const unsigned int DUTY_CYCLE = 1000000; // ppm | ||
|
||
static const bool reboot = true; | ||
|
||
static const unsigned int STACK_SIZE = Traits<Machine>::STACK_SIZE; | ||
static const unsigned int HEAP_SIZE = (Traits<Application>::MAX_THREADS + Traits<Build>::CPUS) * Traits<Application>::STACK_SIZE; | ||
}; | ||
|
||
template<> struct Traits<Thread>: public Traits<Build> | ||
{ | ||
static const bool enabled = Traits<System>::multithread; | ||
static const bool smp = Traits<System>::multicore; | ||
static const bool trace_idle = hysterically_debugged; | ||
static const bool simulate_capacity = false; | ||
static const int priority_inversion_protocol = NONE; | ||
|
||
|
||
typedef IF<(CPUS > 1), PEAMQ, EAMQ>::Result Criterion; | ||
static const unsigned int QUANTUM = 10000; // us | ||
}; | ||
|
||
template<> struct Traits<Scheduler<Thread>>: public Traits<Build> | ||
{ | ||
static const bool debugged = Traits<Thread>::trace_idle || hysterically_debugged; | ||
}; | ||
|
||
template<> struct Traits<Synchronizer>: public Traits<Build> | ||
{ | ||
static const bool enabled = Traits<System>::multithread; | ||
}; | ||
|
||
template<> struct Traits<Alarm>: public Traits<Build> | ||
{ | ||
static const bool visible = hysterically_debugged; | ||
}; | ||
|
||
template<> struct Traits<Address_Space>: public Traits<Build> {}; | ||
|
||
template<> struct Traits<Segment>: public Traits<Build> {}; | ||
|
||
__END_SYS | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters