-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from lf-lang/single-threaded
Mentions of "unthreaded" replaced with "single-threaded"
- Loading branch information
Showing
42 changed files
with
117 additions
and
131 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
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
* @author{Anirudh Rengarajan <[email protected]>} | ||
*/ | ||
|
||
#if defined(LF_THREADED) | ||
#if !defined(LF_SINGLE_THREADED) | ||
#include "mbed.h" | ||
#include "MutexWrapper.h" | ||
|
||
|
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
* @author{Anirudh Rengarajan <[email protected]>} | ||
*/ | ||
|
||
#if defined(LF_THREADED) | ||
#if !defined(LF_SINGLE_THREADED) | ||
#include "mbed.h" | ||
#include "rtos.h" | ||
using namespace rtos; | ||
|
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
* @author{Anirudh Rengarajan <[email protected]>} | ||
*/ | ||
|
||
#if defined(LF_THREADED) | ||
#if !defined(LF_SINGLE_THREADED) | ||
#include "mbed.h" | ||
#include "rtos.h" | ||
|
||
|
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#if defined LF_UNTHREADED && !defined(PLATFORM_ARDUINO) | ||
#if defined LF_SINGLE_THREADED && !defined(PLATFORM_ARDUINO) | ||
/** | ||
* @file lf_os_single_threaded_support.c | ||
* @author Marten Lohstroh ([email protected]) | ||
|
@@ -16,7 +16,7 @@ | |
#endif | ||
|
||
/** | ||
* @brief Unthreaded support under a OS is a special case in which we assume | ||
* @brief Single-threaded support under a OS is a special case in which we assume | ||
* only a single execution context. Other threads scheduling physical actions | ||
* are not a use-case. ISRs scheduling physical actions are also not a use-case. | ||
* | ||
|
@@ -30,7 +30,7 @@ int lf_enable_interrupts_nested() { | |
return 0; | ||
} | ||
|
||
int _lf_unthreaded_notify_of_event() { | ||
int _lf_single_threaded_notify_of_event() { | ||
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 |
---|---|---|
|
@@ -31,6 +31,10 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
* @author{Abhi Gundrala <[email protected]>} | ||
*/ | ||
|
||
#if !defined(LF_SINGLE_THREADED) | ||
#error "Only the single-threaded runtime has support for RP2040" | ||
#endif | ||
|
||
#include "lf_rp2040_support.h" | ||
#include "platform.h" | ||
#include "utils/util.h" | ||
|
@@ -59,7 +63,7 @@ static uint32_t _lf_num_nested_crit_sec = 0; | |
|
||
/** | ||
* Initialize basic runtime infrastructure and | ||
* synchronization structs for an unthreaded runtime. | ||
* synchronization structs for an single-threaded runtime. | ||
*/ | ||
void _lf_initialize_clock(void) { | ||
// init stdio lib | ||
|
@@ -113,8 +117,8 @@ int lf_sleep(interval_t sleep_duration) { | |
* by the argument or return early if the binary | ||
* _lf_sem_irq_event semaphore is released before the target time. | ||
* | ||
* The semaphore is released using the _lf_unthreaded_notify_of_event | ||
* which is called by lf_schedule in the unthreaded runtime for physical actions. | ||
* The semaphore is released using the _lf_single_threaded_notify_of_event | ||
* which is called by lf_schedule in the single_threaded runtime for physical actions. | ||
* | ||
* @param env pointer to environment struct this runs in. | ||
* @param wakeup_time time in nanoseconds since boot to sleep until. | ||
|
@@ -145,7 +149,7 @@ int _lf_interruptable_sleep_until_locked(environment_t* env, instant_t wakeup_ti | |
return ret_code; | ||
} | ||
|
||
#ifdef LF_UNTHREADED | ||
#if defined(LF_SINGLE_THREADED) | ||
/** | ||
* The single thread RP2040 platform support treats second core | ||
* routines similar to external interrupt routine threads. | ||
|
@@ -205,16 +209,13 @@ int lf_enable_interrupts_nested() { | |
* | ||
* @return error code or 0 on success | ||
*/ | ||
int _lf_unthreaded_notify_of_event() { | ||
int _lf_single_threaded_notify_of_event() { | ||
// notify main sleep loop of event | ||
sem_release(&_lf_sem_irq_event); | ||
return 0; | ||
} | ||
#endif //LF_UNTHREADED | ||
#endif // LF_SINGLE_THREADED | ||
|
||
#ifdef LF_THREADED | ||
#error "Threading for baremetal RP2040 not supported" | ||
#endif //LF_THREADED | ||
|
||
#endif // PLATFORM_RP2040 | ||
|
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
Oops, something went wrong.