-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 task management #2371
Merged
Merged
ESP32 task management #2371
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
933d3e7
Wait for UART FIFOs to empty at startup
mikee47 3f8842f
Found `cache2phys` SDK call which implements `flashmem_get_address`
mikee47 119200c
Simplify SDK config
mikee47 e36cbda
Add `Wrap` build function
mikee47 515a9f2
Use default event task for Sming
mikee47 e412da1
Add `TaskStat` class
mikee47 bd62cbb
Test `TaskStat` with Basic_IFS
mikee47 ae922c7
Get os_timer callbacks queued in event (Sming) task
mikee47 43f0bdd
Remove FRC timer dependencies, use esp_timer.
mikee47 4fa246b
Implement Timer1 using Group0, Timer0.
mikee47 c1f828e
Fix comment typo
mikee47 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/**** | ||
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development. | ||
* Created 2015 by Skurydin Alexey | ||
* http://github.com/SmingHub/Sming | ||
* All files of the Sming Core are provided under the LGPL v3 license. | ||
* | ||
* event_loop.cpp | ||
* | ||
* This code replaces the standard IDF event loop with our own, *without* associated task. | ||
* This not only reduces the system overhead but avoids the need for additional synchronisation | ||
* management because WiFi events, etc. are all called in the context of the main Sming task. | ||
*/ | ||
|
||
#include <esp_event.h> | ||
|
||
namespace | ||
{ | ||
esp_event_loop_handle_t sming_event_loop; | ||
} | ||
|
||
esp_event_loop_handle_t sming_create_event_loop() | ||
{ | ||
esp_event_loop_args_t loop_args = { | ||
.queue_size = CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE, | ||
.task_name = nullptr, | ||
}; | ||
|
||
ESP_ERROR_CHECK(esp_event_loop_create(&loop_args, &sming_event_loop)); | ||
|
||
return sming_event_loop; | ||
} | ||
|
||
namespace | ||
{ | ||
#define WRAP(name) esp_err_t __wrap_##name | ||
|
||
extern "C" { | ||
|
||
WRAP(esp_event_loop_create_default)() | ||
{ | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
WRAP(esp_event_handler_register) | ||
(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void* event_handler_arg) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_handler_register_with(sming_event_loop, event_base, event_id, event_handler, event_handler_arg); | ||
} | ||
|
||
WRAP(esp_event_handler_unregister) | ||
(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_handler_unregister_with(sming_event_loop, event_base, event_id, event_handler); | ||
} | ||
|
||
WRAP(esp_event_handler_instance_register) | ||
(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void* event_handler_arg, | ||
esp_event_handler_instance_t* instance) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_handler_instance_register_with(sming_event_loop, event_base, event_id, event_handler, | ||
event_handler_arg, instance); | ||
} | ||
|
||
WRAP(esp_event_handler_instance_unregister) | ||
(esp_event_base_t event_base, int32_t event_id, esp_event_handler_instance_t context) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_handler_instance_unregister_with(sming_event_loop, event_base, event_id, context); | ||
} | ||
|
||
WRAP(esp_event_post) | ||
(esp_event_base_t event_base, int32_t event_id, void* event_data, size_t event_data_size, TickType_t ticks_to_wait) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_post_to(sming_event_loop, event_base, event_id, event_data, event_data_size, ticks_to_wait); | ||
} | ||
|
||
#if CONFIG_ESP_EVENT_POST_FROM_ISR | ||
IRAM_ATTR WRAP(esp_event_isr_post)(esp_event_base_t event_base, int32_t event_id, void* event_data, | ||
size_t event_data_size, BaseType_t* task_unblocked) | ||
{ | ||
if(sming_event_loop == nullptr) { | ||
return ESP_ERR_INVALID_STATE; | ||
} | ||
|
||
return esp_event_isr_post_to(sming_event_loop, event_base, event_id, event_data, event_data_size, task_unblocked); | ||
} | ||
#endif | ||
|
||
} // extern "C" | ||
|
||
} // namespace |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you've meant: "uses to store configuration..."