Repair compilability of code
This commit is contained in:
parent
a0c215e954
commit
a93f257f2e
|
@ -29,7 +29,6 @@ SOURCE_FILES = \
|
||||||
leos/leos.c \
|
leos/leos.c \
|
||||||
leos/log.c \
|
leos/log.c \
|
||||||
leos/memory.c \
|
leos/memory.c \
|
||||||
leos/scheduler.c \
|
|
||||||
leos/task.c \
|
leos/task.c \
|
||||||
\
|
\
|
||||||
drivers/timer/timer.c \
|
drivers/timer/timer.c \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "AArch64_irq.h"
|
#include "aarch64_irq.h"
|
||||||
|
|
||||||
.globl AArch64_init
|
.globl AArch64_init
|
||||||
AArch64_init:
|
AArch64_init:
|
||||||
|
@ -15,19 +15,19 @@ AArch64_getEL:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.globl AArch64_getReg32
|
.globl AArch64_getReg32
|
||||||
AArch64_get32r:
|
AArch64_getReg32:
|
||||||
ldr w0, [x0]
|
ldr w0, [x0]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.globl AArch64_setReg32
|
.globl AArch64_setReg32
|
||||||
AArch64_set32r:
|
AArch64_setReg32:
|
||||||
str w1, [x0]
|
str w1, [x0]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.globl AArch64_idle
|
.globl AArch64_idle
|
||||||
AArch64_idle:
|
AArch64_idle:
|
||||||
subs x0, x0, 1
|
subs x0, x0, 1
|
||||||
bne AArch64_delay
|
bne AArch64_idle
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,7 +35,7 @@ set_stack:
|
||||||
mov sp, x30
|
mov sp, x30
|
||||||
bl skip
|
bl skip
|
||||||
skip:
|
skip:
|
||||||
bl k_main
|
bl Leos_run
|
||||||
hang: b hang
|
hang: b hang
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,40 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <aarch64/aarch64.h>
|
#include <aarch64/aarch64.h>
|
||||||
#include <aarch64/bcm2837.h>
|
#include <drivers/soc/bcm2837/bcm2837.h>
|
||||||
|
#include <leos/log.h>
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
const unsigned int m_interval = 200000;
|
const unsigned int m_interval = 200000;
|
||||||
unsigned int m_current = 0;
|
unsigned int m_current = 0;
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARM_TIMER
|
||||||
|
#define CONFIG_ARM_TIMER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
k_timer_init(void)
|
Timer_init(void)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_ARM_TIMER == 1
|
||||||
|
#else
|
||||||
m_current = aarch64_get32r(TIMER_CLO);
|
m_current = aarch64_get32r(TIMER_CLO);
|
||||||
m_current += m_interval;
|
m_current += m_interval;
|
||||||
aarch64_set32r(TIMER_C1, m_current);
|
aarch64_set32r(TIMER_C1, m_current);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
k_timer_irq_handler(void)
|
Timer_incFromISR(void)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_ARM_TIMER == 1
|
||||||
|
|
||||||
|
#else
|
||||||
m_current += m_interval;
|
m_current += m_interval;
|
||||||
aarch64_set32r(TIMER_C1, m_current);
|
aarch64_set32r(TIMER_C1, m_current);
|
||||||
aarch64_set32r(TIMER_CS, TIMER_CS_M1);
|
aarch64_set32r(TIMER_CS, TIMER_CS_M1);
|
||||||
k_logs("Timer: ");
|
#endif
|
||||||
k_logu(m_current, 10);
|
Log_putS("Timer: ");
|
||||||
k_logs("\r\n");
|
Log_putI(m_current, 10);
|
||||||
|
Log_putS("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
#define TIMER_H_8D327261_47D6_4832_8DC5_31BF1614A21F
|
#define TIMER_H_8D327261_47D6_4832_8DC5_31BF1614A21F
|
||||||
|
|
||||||
void
|
void
|
||||||
k_timer_init(void);
|
Timer_init(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
k_timer_irq_handler(void);
|
Timer_incFromISR(void);
|
||||||
|
|
||||||
#endif /* !TIMER_H */
|
#endif /* !TIMER_H */
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <aarch64/aarch64.h>
|
#include <aarch64/aarch64.h>
|
||||||
#include <aarch64/bcm2837.h>
|
#include <drivers/soc/bcm2837/bcm2837.h>
|
||||||
|
|
||||||
#include "UARTMini.h"
|
#include "uart_mini.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -49,9 +49,9 @@ UARTMini_init(void)
|
||||||
AArch64_setReg32(GPFSEL1, sel);
|
AArch64_setReg32(GPFSEL1, sel);
|
||||||
|
|
||||||
AArch64_setReg32(GPPUD, 0);
|
AArch64_setReg32(GPPUD, 0);
|
||||||
AArch64_delay(150);
|
AArch64_idle(150);
|
||||||
AArch64_setReg32(GPPUDCLK0, (1 << 14) | (1 << 15));
|
AArch64_setReg32(GPPUDCLK0, (1 << 14) | (1 << 15));
|
||||||
AArch64_delay(150);
|
AArch64_idle(150);
|
||||||
AArch64_setReg32(GPPUDCLK0, 0);
|
AArch64_setReg32(GPPUDCLK0, 0);
|
||||||
|
|
||||||
/* Enable TX and RX */
|
/* Enable TX and RX */
|
||||||
|
|
|
@ -18,6 +18,6 @@
|
||||||
|
|
||||||
#include <aarch64/aarch64.h>
|
#include <aarch64/aarch64.h>
|
||||||
|
|
||||||
#define k_arch_init(...) aarch64_init(__VA_ARGS__)
|
#define Arch_init(...) AArch64_init(__VA_ARGS__)
|
||||||
|
|
||||||
#endif /* !ARCH_H */
|
#endif /* !ARCH_H */
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* @see https://lowenware.com/
|
* @see https://lowenware.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <aarch64/bcm2837.h>
|
#include <drivers/soc/bcm2837/bcm2837.h>
|
||||||
#include "timer.h"
|
#include <drivers/timer/timer.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include <leos/log.h>
|
#include <leos/log.h>
|
||||||
#include <leos/arch.h>
|
#include <leos/arch.h>
|
||||||
#include <leos/irq.h>
|
#include <leos/irq.h>
|
||||||
#include <leos/timer.h>
|
|
||||||
#include <leos/leos.h>
|
#include <leos/leos.h>
|
||||||
|
#include <drivers/timer/timer.h>
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -29,7 +29,7 @@ Leos_run(void)
|
||||||
Log_putI(AArch64_getEL(), 10);
|
Log_putI(AArch64_getEL(), 10);
|
||||||
Log_putS(")\r\n");
|
Log_putS(")\r\n");
|
||||||
|
|
||||||
Arch_init();
|
AArch64_init();
|
||||||
|
|
||||||
Timer_init();
|
Timer_init();
|
||||||
IRQ_init();
|
IRQ_init();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* @see https://lowenware.com/
|
* @see https://lowenware.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <device/uart/uart.h>
|
#include <drivers/uart/uart.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -28,7 +28,7 @@ Log_putS(const char *string)
|
||||||
char c;
|
char c;
|
||||||
const char *p = string;
|
const char *p = string;
|
||||||
while((c = *p) != 0) {
|
while((c = *p) != 0) {
|
||||||
if (UART_send(c))
|
if (UART_put(c))
|
||||||
return -1;
|
return -1;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,14 @@ Log_putI(int64_t value, uint8_t base)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
if (UART_send('-'))
|
if (UART_put('-'))
|
||||||
return -1;
|
return -1;
|
||||||
value = -value;
|
value = -value;
|
||||||
result = 1;
|
result = 1;
|
||||||
} else {
|
} else {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
result += k_logu(value, base);
|
result += Log_putU(value, base);
|
||||||
return (result) ? result : -1;
|
return (result) ? result : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ Log_putU(uint64_t value, uint8_t base)
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return (UART_send('0')) ? -1 : 1;
|
return (UART_put('0')) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -75,7 +75,7 @@ Log_putU(uint64_t value, uint8_t base)
|
||||||
result = i;
|
result = i;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (UART_send(buffer[i]))
|
if (UART_put(buffer[i]))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
|
#ifndef LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
|
||||||
#define LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
|
#define LOG_H_AE38CD54_2822_47A5_AFB1_E785739FA01D
|
||||||
|
|
||||||
#include <core/types.h>
|
#include <leos/types.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
Log_init(void);
|
Log_init(void);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <aarch64/bcm2837.h>
|
#include <drivers/soc/bcm2837/bcm2837.h>
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
static unsigned long m_map[MEMORY_PAGE_COUNT / sizeof(unsigned long) / 8] = {0,};
|
static unsigned long m_map[MEMORY_PAGE_COUNT / sizeof(unsigned long) / 8] = {0,};
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -16,7 +16,11 @@
|
||||||
#ifndef TASK_H_AE13C166_79B5_4256_ABF3_74DF04E1CD18
|
#ifndef TASK_H_AE13C166_79B5_4256_ABF3_74DF04E1CD18
|
||||||
#define 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);
|
typedef void (*TaskCallback)(void *p_ctx);
|
||||||
|
|
||||||
|
@ -32,5 +36,7 @@ PID
|
||||||
Task_create(struct Task *pTask, TaskCallback callback, uint64_t *stack
|
Task_create(struct Task *pTask, TaskCallback callback, uint64_t *stack
|
||||||
, uint32_t stack_size);
|
, uint32_t stack_size);
|
||||||
|
|
||||||
|
unsigned long
|
||||||
|
Task_scheduleFromISR(void);
|
||||||
|
|
||||||
#endif /* !TASK_H */
|
#endif /* !TASK_H */
|
||||||
|
|
Loading…
Reference in New Issue