-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fiber] x86_64 support + return from fiber + tests
- Loading branch information
Showing
19 changed files
with
502 additions
and
58 deletions.
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,56 @@ | ||
/* | ||
* Copyright (c) 2020, Erik Henriksson | ||
* | ||
* This file is part of the modm project. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
// ---------------------------------------------------------------------------- | ||
|
||
#include <modm/debug/logger.hpp> | ||
#include <modm/processing.hpp> | ||
|
||
#include <chrono> | ||
#include <cmath> | ||
|
||
using namespace std::chrono_literals; | ||
|
||
#define STACK_SIZE 1024 | ||
|
||
modm_fiber | ||
void f1() { | ||
MODM_LOG_INFO << "f1" << modm::endl; | ||
modm::yield(); | ||
MODM_LOG_INFO << "f1 done" << modm::endl; | ||
modm::done(); | ||
} | ||
|
||
modm_fiber | ||
void f2() { | ||
MODM_LOG_INFO << "f2" << modm::endl; | ||
modm::yield(); | ||
MODM_LOG_INFO << "f2 done" << modm::endl; | ||
modm::done(); | ||
} | ||
|
||
modm_fiber | ||
void idle() { | ||
MODM_LOG_INFO << "idle" << modm::endl; | ||
modm::yield(); | ||
MODM_LOG_INFO << "all done" << modm::endl; | ||
modm::done(); | ||
} | ||
|
||
modm::fiber::Stack<STACK_SIZE> stack1, stack2, stack_idle; | ||
modm::Fiber fiber1(stack1, &f1), fiber2(stack2, &f2), fiber_idle(stack_idle, &idle); | ||
|
||
int main( int argc, char * argv[]) | ||
{ | ||
MODM_LOG_INFO << "Start" << modm::endl; | ||
modm::fiber::scheduler().start(); | ||
// Will never get here. | ||
MODM_LOG_INFO << "End" << modm::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,12 @@ | ||
<library> | ||
<options> | ||
<option name="modm:target">hosted-darwin</option> | ||
<option name="modm:build:build.path">../../../build/linux/fiber</option> | ||
</options> | ||
<modules> | ||
<module>modm:debug</module> | ||
<module>modm:platform:core</module> | ||
<module>modm:processing:fiber</module> | ||
<module>modm:build:scons</module> | ||
</modules> | ||
</library> |
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
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
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,15 @@ | ||
/* | ||
* Copyright (c) 2020, Erik Henriksson | ||
* | ||
* This file is part of the modm project. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
// ---------------------------------------------------------------------------- | ||
|
||
|
||
#include "context.hpp" | ||
|
||
modm_context main_context; |
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
Oops, something went wrong.