Repair compilability of code

This commit is contained in:
Ilja Kartašov 2020-01-17 10:13:01 +01:00
parent a0c215e954
commit a93f257f2e
14 changed files with 73 additions and 33 deletions

View File

@ -29,7 +29,6 @@ SOURCE_FILES = \
leos/leos.c \
leos/log.c \
leos/memory.c \
leos/scheduler.c \
leos/task.c \
\
drivers/timer/timer.c \

View File

@ -1,4 +1,4 @@
#include "AArch64_irq.h"
#include "aarch64_irq.h"
.globl AArch64_init
AArch64_init:
@ -15,19 +15,19 @@ AArch64_getEL:
ret
.globl AArch64_getReg32
AArch64_get32r:
AArch64_getReg32:
ldr w0, [x0]
ret
.globl AArch64_setReg32
AArch64_set32r:
AArch64_setReg32:
str w1, [x0]
ret
.globl AArch64_idle
AArch64_idle:
subs x0, x0, 1
bne AArch64_delay
bne AArch64_idle
ret
/*

View File

@ -35,7 +35,7 @@ set_stack:
mov sp, x30
bl skip
skip:
bl k_main
bl Leos_run
hang: b hang

View File

@ -14,28 +14,40 @@
*/
#include <aarch64/aarch64.h>
#include <aarch64/bcm2837.h>
#include <drivers/soc/bcm2837/bcm2837.h>
#include <leos/log.h>
#include "timer.h"
#include "log.h"
const unsigned int m_interval = 200000;
unsigned int m_current = 0;
#ifndef CONFIG_ARM_TIMER
#define CONFIG_ARM_TIMER 1
#endif
void
k_timer_init(void)
Timer_init(void)
{
#if CONFIG_ARM_TIMER == 1
#else
m_current = aarch64_get32r(TIMER_CLO);
m_current += m_interval;
aarch64_set32r(TIMER_C1, m_current);
#endif
}
void
k_timer_irq_handler(void)
Timer_incFromISR(void)
{
#if CONFIG_ARM_TIMER == 1
#else
m_current += m_interval;
aarch64_set32r(TIMER_C1, m_current);
aarch64_set32r(TIMER_CS, TIMER_CS_M1);
k_logs("Timer: ");
k_logu(m_current, 10);
k_logs("\r\n");
#endif
Log_putS("Timer: ");
Log_putI(m_current, 10);
Log_putS("\r\n");
}

View File

@ -17,9 +17,9 @@
#define TIMER_H_8D327261_47D6_4832_8DC5_31BF1614A21F
void
k_timer_init(void);
Timer_init(void);
void
k_timer_irq_handler(void);
Timer_incFromISR(void);
#endif /* !TIMER_H */

View File

@ -14,9 +14,9 @@
*/
#include <aarch64/aarch64.h>
#include <aarch64/bcm2837.h>
#include <drivers/soc/bcm2837/bcm2837.h>
#include "UARTMini.h"
#include "uart_mini.h"
int
@ -49,9 +49,9 @@ UARTMini_init(void)
AArch64_setReg32(GPFSEL1, sel);
AArch64_setReg32(GPPUD, 0);
AArch64_delay(150);
AArch64_idle(150);
AArch64_setReg32(GPPUDCLK0, (1 << 14) | (1 << 15));
AArch64_delay(150);
AArch64_idle(150);
AArch64_setReg32(GPPUDCLK0, 0);
/* Enable TX and RX */

View File

@ -18,6 +18,6 @@
#include <aarch64/aarch64.h>
#define k_arch_init(...) aarch64_init(__VA_ARGS__)
#define Arch_init(...) AArch64_init(__VA_ARGS__)
#endif /* !ARCH_H */

View File

@ -13,8 +13,8 @@
* @see https://lowenware.com/
*/
#include <aarch64/bcm2837.h>
#include "timer.h"
#include <drivers/soc/bcm2837/bcm2837.h>
#include <drivers/timer/timer.h>
#include "log.h"
#include "task.h"
#include "irq.h"

View File

@ -16,8 +16,8 @@
#include <leos/log.h>
#include <leos/arch.h>
#include <leos/irq.h>
#include <leos/timer.h>
#include <leos/leos.h>
#include <drivers/timer/timer.h>
void
@ -29,7 +29,7 @@ Leos_run(void)
Log_putI(AArch64_getEL(), 10);
Log_putS(")\r\n");
Arch_init();
AArch64_init();
Timer_init();
IRQ_init();

View File

@ -13,7 +13,7 @@
* @see https://lowenware.com/
*/
#include <device/uart/uart.h>
#include <drivers/uart/uart.h>
#include "log.h"
void
@ -28,7 +28,7 @@ Log_putS(const char *string)
char c;
const char *p = string;
while((c = *p) != 0) {
if (UART_send(c))
if (UART_put(c))
return -1;
p++;
}
@ -41,14 +41,14 @@ Log_putI(int64_t value, uint8_t base)
int result;
if (value < 0) {
if (UART_send('-'))
if (UART_put('-'))
return -1;
value = -value;
result = 1;
} else {
result = 0;
}
result += k_logu(value, base);
result += Log_putU(value, base);
return (result) ? result : -1;
}
@ -59,7 +59,7 @@ Log_putU(uint64_t value, uint8_t base)
char buffer[64];
if (!value) {
return (UART_send('0')) ? -1 : 1;
return (UART_put('0')) ? -1 : 1;
}
do {
@ -75,7 +75,7 @@ Log_putU(uint64_t value, uint8_t base)
result = i;
while (i--) {
if (UART_send(buffer[i]))
if (UART_put(buffer[i]))
return -1;
}
return result;

View File

@ -16,7 +16,7 @@
#ifndef LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
#define LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
#include <core/types.h>
#include <leos/types.h>
void
Log_init(void);

View File

@ -15,7 +15,7 @@
*/
#include <stdlib.h>
#include <aarch64/bcm2837.h>
#include <drivers/soc/bcm2837/bcm2837.h>
#include "memory.h"
static unsigned long m_map[MEMORY_PAGE_COUNT / sizeof(unsigned long) / 8] = {0,};

23
kernel/leos/task.c Normal file
View File

@ -0,0 +1,23 @@
/******************************************************************************
*
* Copyright (c) 2017-2020 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
* @file task.c
* @author Ilja Kartašov <ik@lowenware.com>
* @brief
*
* @see https://lowenware.com/
*/
#include "task.h"
unsigned long
Task_scheduleFromISR(void)
{
return 0;
}

View File

@ -16,7 +16,11 @@
#ifndef TASK_H_AE13C166_79B5_4256_ABF3_74DF04E1CD18
#define TASK_H_AE13C166_79B5_4256_ABF3_74DF04E1CD18
#include <core/types.h>
#include <leos/types.h>
#ifndef CONFIG_TASK_MAX_NAME_LEN
#define CONFIG_TASK_MAX_NAME_LEN 16
#endif
typedef void (*TaskCallback)(void *p_ctx);
@ -32,5 +36,7 @@ PID
Task_create(struct Task *pTask, TaskCallback callback, uint64_t *stack
, uint32_t stack_size);
unsigned long
Task_scheduleFromISR(void);
#endif /* !TASK_H */