os-core/kernel/leos/leos.c

78 lines
1.2 KiB
C
Raw Permalink 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/irq.h>
#include <leos/leos.h>
2020-01-29 12:01:32 +01:00
#include <leos/log.h>
#include <leos/memory.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
2020-01-29 12:01:32 +01:00
Leos_demoTask1(void *arg);
void
Leos_demoTask2(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-29 12:01:32 +01:00
Memory_init();
2020-01-15 10:56:04 +01:00
Task_initSheduler();
2020-01-29 12:01:32 +01:00
IRQ_enable();
if (Task_create(Leos_demoTask1, "T1") == -1)
Log_putS("Task 1 was not created\r\n");
2020-01-29 12:01:32 +01:00
if (Task_create(Leos_demoTask2, "T2") == -1)
Log_putS("Task 2 was not created\r\n");
2020-01-15 10:56:04 +01:00
for (;;) {
2020-01-29 12:01:32 +01:00
Log_putS("I");
Task_yield();
2020-01-15 10:56:04 +01:00
}
}
void
2020-01-29 12:01:32 +01:00
Leos_demoTask2(void *arg)
{
for (;;) {
Log_putS("B");
Task_yield();
}
}
void
Leos_demoTask1(void *arg)
{
for (;;) {
2020-01-29 12:01:32 +01:00
Log_putS("A");
Task_yield();
}
}