lib: update libmetal to SHA 695d29ba60a5

lib: update libmetal to release v2021.10.0

Origin:
        https://github.com/OpenAMP/libmetal

commit:
	695d29ba60a5c4946bb16d2378955fa8bad8bead

Status:
        merge libmetal new version after removing useless dirs to bring
	in important fixes and the new Xtensa and RISC-V support.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2022-02-25 15:31:21 +01:00 committed by Carlo Caione
parent f237c9d420
commit c6efe091df
37 changed files with 154 additions and 45 deletions

2
README
View File

@ -27,7 +27,7 @@ URL:
https://github.com/OpenAMP/libmetal
commit:
4ead69b8f4194ea60d4d78bc1d8b57b45b467699
695d29ba60a5c4946bb16d2378955fa8bad8bead
Maintained-by:
External

View File

@ -15,7 +15,7 @@ own project.
* **WITH_DOC** (default ON): Build with documentation. Add -DWITH_DOC=OFF in
cmake command line to disable.
* **WITH_EXAMPLES** (default ON): Build with application exemples. Add
* **WITH_EXAMPLES** (default ON): Build with application examples. Add
-DWITH_DOC=OFF in cmake command line to disable the option.
* **WITH_TESTS** (default ON): Build with application tests. Add -DWITH_DOC=OFF
in cmake command line to disable the option.
@ -231,7 +231,7 @@ handler registered by the user application.
libmetal provides APIs to flush and invalidate caches.
The cache APIs for Linux userspace are empty functions for now as cache
operations system calls are not avaiable for all architectures.
operations system calls are not available for all architectures.
### DMA

View File

@ -1,4 +1,4 @@
# Modify to match your needs. These setttings can also be overridden at the
# Modify to match your needs. These settings can also be overridden at the
# command line. (eg. cmake -DCMAKE_C_FLAGS="-O3")
set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")

View File

@ -1,4 +1,4 @@
# Modify to match your needs. These setttings can also be overridden at the
# Modify to match your needs. These settings can also be overridden at the
# command line. (eg. cmake -DCMAKE_C_FLAGS="-O3")
set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")

View File

@ -2,7 +2,7 @@ set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")
set (MACHINE "zynqmp_r5" CACHE STRING "")
set (CROSS_PREFIX "armr5-none-eabi-" CACHE STRING "")
# Xilinx SDK version earlier than 2017.2 use mfloat-abi=soft by default to generat libxil
# Xilinx SDK version earlier than 2017.2 use mfloat-abi=soft by default to generate libxil
set (CMAKE_C_FLAGS "-mfloat-abi=hard -mfpu=vfpv3-d16 -mcpu=cortex-r5" CACHE STRING "")
include (cross-generic-gcc)

View File

@ -10,5 +10,11 @@ if (WITH_ZEPHYR)
if (CONFIG_ARM)
set (MACHINE "arm" CACHE STRING "")
endif(CONFIG_ARM)
if (CONFIG_RISCV)
set (MACHINE "riscv" CACHE STRING "")
endif (CONFIG_RISCV)
if (CONFIG_XTENSA)
set (MACHINE "xtensa" CACHE STRING "")
endif (CONFIG_XTENSA)
endif (WITH_ZEPHYR)

View File

@ -36,12 +36,12 @@ static inline void *metal_allocate_memory(unsigned int size);
*/
static inline void metal_free_memory(void *ptr);
#include <metal/system/@PROJECT_SYSTEM@/alloc.h>
/** @} */
#ifdef __cplusplus
}
#endif
#include <metal/system/@PROJECT_SYSTEM@/alloc.h>
#endif /* __METAL_ALLOC__H__ */

View File

@ -17,7 +17,7 @@
#elif defined(__ICCARM__)
# include <metal/compiler/iar/compiler.h>
#elif defined(__CC_ARM)
# error "MDK-ARM ARMCC compiler requires the GNU extentions to work correctly"
# error "MDK-ARM ARMCC compiler requires the GNU extensions to work correctly"
#else
# error "Missing compiler support"
#endif

View File

@ -63,12 +63,12 @@ static inline int metal_condition_broadcast(struct metal_condition *cv);
*/
int metal_condition_wait(struct metal_condition *cv, metal_mutex_t *m);
#include <metal/system/@PROJECT_SYSTEM@/condition.h>
/** @} */
#ifdef __cplusplus
}
#endif
#include <metal/system/@PROJECT_SYSTEM@/condition.h>
#endif /* __METAL_CONDITION__H__ */

View File

@ -12,6 +12,9 @@
#ifndef __METAL_DMA__H__
#define __METAL_DMA__H__
#include <stdint.h>
#include <metal/sys.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -20,9 +23,6 @@ extern "C" {
* @{
*/
#include <stdint.h>
#include <metal/sys.h>
#define METAL_DMA_DEV_R 1 /**< DMA direction, device read */
#define METAL_DMA_DEV_W 2 /**< DMA direction, device write */
#define METAL_DMA_DEV_WR 3 /**< DMA direction, device read/write */

View File

@ -363,12 +363,12 @@ int metal_io_block_write(struct metal_io_region *io, unsigned long offset,
int metal_io_block_set(struct metal_io_region *io, unsigned long offset,
unsigned char value, int len);
#include <metal/system/@PROJECT_SYSTEM@/io.h>
/** @} */
#ifdef __cplusplus
}
#endif
#include <metal/system/@PROJECT_SYSTEM@/io.h>
#endif /* __METAL_IO__H__ */

View File

@ -12,6 +12,9 @@
#ifndef __METAL_IRQ__H__
#define __METAL_IRQ__H__
#include <metal/list.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -20,9 +23,6 @@ extern "C" {
* @{
*/
#include <metal/list.h>
#include <stdlib.h>
/** IRQ handled status */
#define METAL_IRQ_NOT_HANDLED 0
#define METAL_IRQ_HANDLED 1

View File

@ -69,7 +69,7 @@ struct metal_irq_controller {
*/
int irq_num; /**< Number of IRQs managed by the IRQ controller */
void *arg; /**< Argument to pass to interrupt controller function */
metal_irq_set_enable irq_set_enable; /**< function to set IRQ eanble */
metal_irq_set_enable irq_set_enable; /**< function to set IRQ enable */
metal_cntr_irq_register irq_register; /**< function to register IRQ
* handler
*/

View File

@ -27,7 +27,7 @@ struct metal_list {
};
/*
* METAL_INIT_LIST - used for initializing an list elmenet in a static struct
* METAL_INIT_LIST - used for initializing an list element in a static struct
* or global
*/
#define METAL_INIT_LIST(name) { .next = &name, .prev = &name }

View File

@ -63,7 +63,7 @@ extern enum metal_log_level metal_get_log_level(void);
/**
* @brief Default libmetal log handler. This handler prints libmetal log
* mesages to stderr.
* messages to stderr.
* @param[in] level log message level.
* @param[in] format log message format string.
* @return 0 on success, or -errno on failure.

View File

@ -12,6 +12,8 @@
#ifndef __METAL_MUTEX__H__
#define __METAL_MUTEX__H__
#include <metal/system/@PROJECT_SYSTEM@/mutex.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -20,8 +22,6 @@ extern "C" {
* @{
*/
#include <metal/system/@PROJECT_SYSTEM@/mutex.h>
/**
* @brief Initialize a libmetal mutex.
* @param[in] mutex Mutex to initialize.

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives
* @brief CPU specific primitives
*/
#ifndef __METAL_AARCH64_CPU__H__

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives
* @brief CPU specific primitives
*/
#ifndef __METAL_ARM_CPU__H__

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives on microblaze platform.
* @brief CPU specific primitives on microblaze platform.
*/
#ifndef __METAL_MICROBLAZE__H__

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives
* @brief CPU specific primitives
*/
#ifndef __METAL_X86_CPU__H__

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives
* @brief CPU specific primitives
*/
#ifndef __METAL_X86_64_CPU__H__

View File

@ -6,7 +6,7 @@
/*
* @file cpu.h
* @brief CPU specific primatives
* @brief CPU specific primitives
*/
#ifndef __METAL_XTENSA_CPU__H__

View File

@ -12,6 +12,8 @@
#ifndef __METAL_SOFTIRQ__H__
#define __METAL_SOFTIRQ__H__
#include <metal/irq.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -20,8 +22,6 @@ extern "C" {
* @{
*/
#include <metal/irq.h>
/**
* @brief metal_softirq_init
*

View File

@ -15,10 +15,10 @@ void metal_sys_io_mem_map(struct metal_io_region *io)
{
unsigned long p;
size_t psize;
void *va;
size_t *va;
va = io->virt;
psize = io->size;
psize = (size_t)io->size;
if (psize) {
if (psize >> io->page_shift)
psize = (size_t)1 << io->page_shift;

View File

@ -75,7 +75,7 @@ void *metal_machine_io_mem_map(void *va, metal_phys_addr_t pa,
if (!flags)
return va;
/* Ensure alignement on a section boundary */
/* Ensure alignment on a section boundary */
pa &= ~(ttb_size-1UL);
/*

View File

@ -75,7 +75,7 @@ void *metal_machine_io_mem_map(void *va, metal_phys_addr_t pa,
if (!flags)
return va;
/* Ensure alignement on a section boundary */
/* Ensure alignment on a section boundary */
pa &= ~(ttb_size-1UL);
/*

View File

@ -31,7 +31,7 @@ typedef struct {
} metal_mutex_t;
/*
* METAL_MUTEX_INIT - used for initializing an mutex elmenet in a static struct
* METAL_MUTEX_INIT - used for initializing an mutex element in a static struct
* or global
*/
#define METAL_MUTEX_INIT(m) { ATOMIC_VAR_INIT(0) }

View File

@ -25,7 +25,7 @@ extern "C" {
typedef mutex_t metal_mutex_t;
/*
* METAL_MUTEX_INIT - used for initializing an mutex elmenet in a static struct
* METAL_MUTEX_INIT - used for initializing an mutex element in a static struct
* or global
*/
#define METAL_MUTEX_INIT(m) MUTEX_INITIALIZER

View File

@ -26,7 +26,7 @@ extern "C" {
typedef struct k_sem metal_mutex_t;
/*
* METAL_MUTEX_INIT - used for initializing an mutex elmenet in a static struct
* METAL_MUTEX_INIT - used for initializing an mutex element in a static struct
* or global
*/
#define METAL_MUTEX_INIT(m) _K_SEM_INITIALIZER(m, 1, 1)

View File

@ -0,0 +1,2 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/riscv/sys.c
* @brief machine specific system primitives implementation.
*/
#include <metal/io.h>
#include <metal/sys.h>
#include <stdint.h>
/**
* @brief poll function until some event happens
*/
void metal_weak metal_generic_default_poll(void)
{
metal_asm __volatile__("wfi");
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/riscv/sys.h
* @brief Zephyr riscv system primitives for libmetal.
*/
#ifndef __METAL_ZEPHYR_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_ZEPHYR_RISCV_SYS__H__
#define __METAL_ZEPHYR_RISCV_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_ZEPHYR_RISCV_SYS__H__ */

View File

@ -16,7 +16,7 @@
#ifndef __METAL_ZEPHYR_SLEEP__H__
#define __METAL_ZEPHYR_SLEEP__H__
#include <metal/utilities.h>
#include <kernel.h>
#ifdef __cplusplus
extern "C" {
@ -24,8 +24,7 @@ extern "C" {
static inline int __metal_sleep_usec(unsigned int usec)
{
metal_unused(usec);
/* Fix me */
k_sleep(K_USEC(usec));
return 0;
}

View File

@ -0,0 +1,2 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@ -0,0 +1,23 @@
/*
* Copyright 2022 NXP
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/xtensa/sys.c
* @brief machine specific system primitives implementation.
*/
#include <metal/io.h>
#include <metal/sys.h>
#include <stdint.h>
/**
* @brief poll function until some event happens
*/
void metal_weak metal_generic_default_poll(void)
{
metal_asm __volatile__("waiti 0");
}

View File

@ -0,0 +1,28 @@
/*
* Copyright 2022 NXP
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/xtensa/sys.h
* @brief Zephyr xtensa system primitives for libmetal.
*/
#ifndef __METAL_ZEPHYR_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_ZEPHYR_XTENSA_SYS__H__
#define __METAL_ZEPHYR_XTENSA_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_ZEPHYR_XTENSA_SYS__H__ */

View File

@ -12,6 +12,9 @@
#ifndef __METAL_TIME__H__
#define __METAL_TIME__H__
#include <stdint.h>
#include <metal/sys.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -20,9 +23,6 @@ extern "C" {
* @{
*/
#include <stdint.h>
#include <metal/sys.h>
/**
* @brief get timestamp
* This function returns the timestampe as unsigned long long