main, scheduler: Improve latency by coroutine scheduling
Schedules tasks in the main loop using coroutines so that long running tasks, particularly relating to the UI, can yield execution in order to call the poll functions at a tighter interval.
This commit is contained in:
23
main.cpp
23
main.cpp
@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "user_io.h"
|
||||
#include "input.h"
|
||||
#include "fpga_io.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
const char *version = "$VER:HPS" VDATE;
|
||||
|
||||
@@ -75,26 +76,8 @@ int main(int argc, char *argv[])
|
||||
FindStorage();
|
||||
user_io_init((argc > 1) ? argv[1] : "");
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(!is_fpga_ready(1))
|
||||
{
|
||||
printf("FPGA is not ready. JTAG uploading?\n");
|
||||
printf("Waiting for FPGA to be ready...\n");
|
||||
scheduler_init();
|
||||
scheduler_run();
|
||||
|
||||
//enable reset in advance
|
||||
fpga_core_reset(1);
|
||||
|
||||
while (!is_fpga_ready(0))
|
||||
{
|
||||
sleep(1);
|
||||
}
|
||||
reboot(0);
|
||||
}
|
||||
|
||||
user_io_poll();
|
||||
input_poll(0);
|
||||
HandleUI();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user