1

add vorgabe05

This commit is contained in:
churl
2022-05-20 16:16:24 +02:00
parent 2b41893743
commit bdfe784340
11 changed files with 461 additions and 3 deletions

34
c_os/user/CoroutineDemo.cc Executable file
View File

@ -0,0 +1,34 @@
/*****************************************************************************
* *
* C O R O U T I N E D E M O *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Einstieg in eine Anwendung. *
* *
* Autor: Michael Schoettner, HHU, 15.8.2016 *
*****************************************************************************/
#include "kernel/Globals.h"
#include "user/CoroutineDemo.h"
#include "user/CoroutineLoop.h"
// Stacks (koennen alternative auch per 'new' alloziert werden)
static unsigned int stack[3][1024];
/*****************************************************************************
* Methode: CoroutineDemo::main *
*---------------------------------------------------------------------------*
* Beschreibung: main-Methode der Anwendung. *
*****************************************************************************/
void CoroutineDemo::main () {
/*
* Hier muss Code eingefuegt werden
*
* Die 3 Koroutinen einrichten, verketten und die 1. starten
*
*/
}

25
c_os/user/CoroutineDemo.h Executable file
View File

@ -0,0 +1,25 @@
/*****************************************************************************
* *
* C O R O U T I N E D E M O *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Einstieg in eine Anwendung. *
* *
* Autor: Michael Schoettner, HHU, 15.8.2016 *
*****************************************************************************/
#ifndef __coroutinedemo_include__
#define __coroutinedemo_include__
class CoroutineDemo {
private:
CoroutineDemo(const CoroutineDemo& copy); // Verhindere Kopieren
public:
CoroutineDemo() {}
// Koroutine-Startmethode
void main();
};
#endif

27
c_os/user/CoroutineLoop.cc Executable file
View File

@ -0,0 +1,27 @@
/*****************************************************************************
* *
* C O R O U T I N E L O O P *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Loop ist eine Koroutine, die nichts weiter tut als einen *
* Zaehler hochzuzaehlen und diesen auf dem Bildschirm *
* anzuzeigen und dann auf die naechste Korotuine umzu- *
* schalten. *
* *
* Autor: Olaf Spinczyk, TU Dortmund *
*****************************************************************************/
#include "user/CoroutineLoop.h"
#include "kernel/Globals.h"
/*****************************************************************************
* Methode: CoroutineLoop::run *
*---------------------------------------------------------------------------*
* Beschreibung: Einstiegsfunktion der Koroutine. *
*****************************************************************************/
void CoroutineLoop::run () {
/* Hier muss Code eingefuegt werden */
}

34
c_os/user/CoroutineLoop.h Executable file
View File

@ -0,0 +1,34 @@
/*****************************************************************************
* *
* C O R O U T I N E L O O P *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Loop ist eine Koroutine, die nichts weiter tut als einen *
* Zaehler hochzuzaehlen und diesen auf dem Bildschirm *
* anzuzeigen und dann auf die naechste Korotuine umzu- *
* schalten. *
* *
* Autor: Olaf Spinczyk, TU Dortmund *
*****************************************************************************/
#ifndef __coroutineloop_include__
#define __coroutineloop_include__
#include "kernel/corouts/Coroutine.h"
class CoroutineLoop : public Coroutine {
private:
int id;
CoroutineLoop(const CoroutineLoop& copy); // Verhindere Kopieren
public:
// Gibt der Loop einen Stack und eine Id.
CoroutineLoop(unsigned int* stack, int i) : Coroutine(stack) { id = i; }
// Zaehlt einen Zaehler hoch und gibt ihn auf dem Bildschirm aus.
void run();
};
#endif