fixed scheduler in vault. insert borderline reference
This commit is contained in:
@@ -2,18 +2,19 @@
|
|||||||
* \brief \ref Guard synchronizes access to epilogue level
|
* \brief \ref Guard synchronizes access to epilogue level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
//#pragma once
|
||||||
#include "../object/bbuffer.h"
|
#include "../object/bbuffer.h"
|
||||||
#include "../object/key.h"
|
#include "../object/key.h"
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "epilogues.h"
|
#include "epilogues.h"
|
||||||
#include "../device/textstream.h"
|
#include "../device/textstream.h"
|
||||||
|
#include "../thread/scheduler.h"
|
||||||
//! \brief The epilogue vault contains the protected data for the epilogue level
|
//! \brief The epilogue vault contains the protected data for the epilogue level
|
||||||
|
|
||||||
struct Vault {
|
struct Vault {
|
||||||
Vault();
|
Vault();
|
||||||
TextStream kout = TextStream(0, 80, 0, 10, true);
|
TextStream kout = TextStream(0, 80, 0, 10, true);
|
||||||
|
Scheduler sch = Scheduler();
|
||||||
// no copy
|
// no copy
|
||||||
Vault(const Vault&) = delete;
|
Vault(const Vault&) = delete;
|
||||||
Vault& operator=(const Vault&) = delete;
|
Vault& operator=(const Vault&) = delete;
|
||||||
|
|||||||
7
main.cc
7
main.cc
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
///TextStream kout = TextStream(0, 80, 0, 10, true);
|
///TextStream kout = TextStream(0, 80, 0, 10, true);
|
||||||
Ticketlock koutlock;
|
Ticketlock koutlock;
|
||||||
Scheduler sch;
|
//Scheduler sch;
|
||||||
|
|
||||||
//TextStream dout[8] = {
|
//TextStream dout[8] = {
|
||||||
// TextStream(0 ,20,12,25,false),
|
// TextStream(0 ,20,12,25,false),
|
||||||
@@ -108,6 +108,7 @@ extern "C" int main() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
Guarded g = Guard::enter();
|
Guarded g = Guard::enter();
|
||||||
|
Scheduler &sch =g.vault().sch;
|
||||||
sch.ready(&application1);
|
sch.ready(&application1);
|
||||||
sch.ready(&application2);
|
sch.ready(&application2);
|
||||||
sch.ready(&application3);
|
sch.ready(&application3);
|
||||||
@@ -140,7 +141,7 @@ extern "C" int main() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
Guarded g = Guard::enter();
|
Guarded g = Guard::enter();
|
||||||
sch.schedule();
|
g.vault().sch.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ extern "C" int main_ap() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
Guarded g = Guard::enter();
|
Guarded g = Guard::enter();
|
||||||
sch.schedule();
|
g.vault().sch.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
//assert(Core::getID() != 1);
|
//assert(Core::getID() != 1);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "../debug/output.h"
|
#include "../debug/output.h"
|
||||||
#include "../arch/context.h"
|
#include "../arch/context.h"
|
||||||
|
#include "interrupt/guard.h"
|
||||||
// Alias to simplify stuff
|
// Alias to simplify stuff
|
||||||
typedef void (*kickoff_t)(void*);
|
typedef void (*kickoff_t)(void*);
|
||||||
|
|
||||||
@@ -17,12 +17,12 @@ Thread::Thread(void* tos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "../thread/scheduler.h"
|
#include "../thread/scheduler.h"
|
||||||
extern Scheduler sch;
|
|
||||||
void Thread::resume(Thread* next) {
|
void Thread::resume(Thread* next) {
|
||||||
Context *from = &sch.active()->context;
|
Guarded g = Guard::enter();
|
||||||
|
Context *from = &g.vault().sch.active()->context;
|
||||||
Context *to = &next->context;
|
Context *to = &next->context;
|
||||||
|
|
||||||
sch.dispatcher.lifePointer[Core::getID()] = next;
|
g.vault().sch.dispatcher.lifePointer[Core::getID()] = next;
|
||||||
DBG << "from: " << hex << from << endl;
|
DBG << "from: " << hex << from << endl;
|
||||||
DBG << "to : " << hex << to << endl << flush;
|
DBG << "to : " << hex << to << endl << flush;
|
||||||
context_switch(to, from);
|
context_switch(to, from);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "../arch/context.h"
|
#include "../arch/context.h"
|
||||||
#include "../object/queue.h"
|
#include "../object/queue.h"
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../interrupt/guard.h"
|
|
||||||
/*! \brief The Thread is an object used by the scheduler.
|
/*! \brief The Thread is an object used by the scheduler.
|
||||||
* \ingroup thread
|
* \ingroup thread
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include "../../interrupt/guard.h"
|
#include "../../interrupt/guard.h"
|
||||||
#include "../../debug/output.h"
|
#include "../../debug/output.h"
|
||||||
#include "../../arch/context.h"
|
#include "../../arch/context.h"
|
||||||
#include "../../thread/scheduler.h"
|
|
||||||
|
|
||||||
extern Scheduler sch;
|
|
||||||
static uint8_t appl_cnt = 0;
|
static uint8_t appl_cnt = 0;
|
||||||
|
|
||||||
char text[] = "Ich mag\n\
|
char text[] = "Ich mag\n\
|
||||||
@@ -57,12 +55,6 @@ void Application::action() { // NOLINT
|
|||||||
//Core::pause();
|
//Core::pause();
|
||||||
//activeWaitDelay(10000000);
|
//activeWaitDelay(10000000);
|
||||||
|
|
||||||
|
|
||||||
//{
|
|
||||||
// Guarded g = Guard::enter();
|
|
||||||
// sch.resume(true);
|
|
||||||
//}
|
|
||||||
|
|
||||||
if(cnt >= sizeof(text)-1)
|
if(cnt >= sizeof(text)-1)
|
||||||
cnt=0;
|
cnt=0;
|
||||||
//context_switch(test2,test1);
|
//context_switch(test2,test1);
|
||||||
|
|||||||
Reference in New Issue
Block a user