os-core/kernel/leos/leos.c

63 lines
1.1 KiB
C
Raw Normal View History

2019-05-29 11:10:01 +02:00
/******************************************************************************
*
* Copyright (c) 2017-2019 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
2020-01-15 10:56:04 +01:00
* @file main.c
2019-05-29 11:10:01 +02:00
* @author Ilja Kartašov <ik@lowenware.com>
* @brief
*
* @see https://lowenware.com/
*/
2020-01-15 10:56:04 +01:00
#include <leos/log.h>
#include <leos/irq.h>
#include <leos/leos.h>
#include <leos/task.h>
2020-01-17 10:13:01 +01:00
#include <drivers/timer/timer.h>
2019-05-29 11:10:01 +02:00
void
Leos_demoTask(void *arg);
2019-05-29 11:10:01 +02:00
2019-05-29 11:10:01 +02:00
void
2020-01-15 10:56:04 +01:00
Leos_run(void)
{
Log_init();
2019-05-29 11:10:01 +02:00
Log_putS("Starting LEOS (EL");
2020-01-15 10:56:04 +01:00
Log_putI(AArch64_getEL(), 10);
Log_putS(")\r\n");
2020-01-17 10:13:01 +01:00
AArch64_init();
2020-01-15 10:56:04 +01:00
IRQ_init();
Timer_init();
2020-01-15 10:56:04 +01:00
IRQ_enable();
Task_initSheduler();
if (Task_create(Leos_demoTask, "Task 1") == -1)
Log_putS("Task 1 was not created\r\n");
2020-01-15 10:56:04 +01:00
for (;;) {
Log_putU(Timer_getTicks(), 10);
Log_putS(". Idle Task\r\n");
Task_yield();
2020-01-15 10:56:04 +01:00
}
}
void
Leos_demoTask(void *arg)
{
for (;;) {
Log_putU(Timer_getTicks(), 10);
Log_putS(". ");
Log_putS((const char *)arg);
Log_putS("\r\n");
Task_yield();
}
}