lib: update libmetal to release v2021.04.0 + VERSION path fix
Origin: https://github.com/OpenAMP/libmetal commit: 04cf5d9e0ef562d676cd3f58530fed4e1901f428 Status: merge libmetal new version after removing useless dirs. In addition of the official release v2021.04.0 , the following commit has been merged: 04cf5d9e0ef5 ("cmake: fix VERSION file path", 2021-05-03) Release Description: https://github.com/OpenAMP/libmetal/releases/tag/v2021.04.0 + 04cf5d9e0ef5 ("cmake: fix VERSION file path", 2021-05-03) Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
This commit is contained in:
parent
9d4ee2c3cf
commit
39d049d4ae
2
README
2
README
|
@ -27,7 +27,7 @@ URL:
|
|||
https://github.com/OpenAMP/libmetal
|
||||
|
||||
commit:
|
||||
db77c464376e603bc46122b38a7956c87597895b
|
||||
04cf5d9e0ef562d676cd3f58530fed4e1901f428
|
||||
|
||||
Maintained-by:
|
||||
External
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
language: minimal # setting language to C will override cross-compiler and fail
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
env:
|
||||
global:
|
||||
- ZEPHYR_TOOLCHAIN_VARIANT=zephyr
|
||||
- ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
|
||||
- ZEPHYR_BASE=$TRAVIS_BUILD_DIR/deps/zephyr
|
||||
- ZEPHYR_SDK_VERSION=0.9.5
|
||||
- ZEPHYR_SDK_DOWNLOAD_FOLDER=https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/$ZEPHYR_SDK_VERSION
|
||||
- ZEPHYR_SDK_SETUP_BINARY=zephyr-sdk-$ZEPHYR_SDK_VERSION-setup.run
|
||||
- ZEPHYR_SDK_DOWNLOAD_URL=$ZEPHYR_SDK_DOWNLOAD_FOLDER/$ZEPHYR_SDK_SETUP_BINARY
|
||||
- FREERTOS_ZIP_URL=https://cfhcable.dl.sourceforge.net/project/freertos/FreeRTOS/V10.0.1/FreeRTOSv10.0.1.zip
|
||||
- GCC_ARM_COMPILER_PACKAGE=gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb
|
||||
- CC=gcc-4.9
|
||||
- CXX=g++-4.9
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: linux
|
||||
env: TARGET="zephyr"
|
||||
- os: linux
|
||||
env: TARGET="linux"
|
||||
- os: linux
|
||||
env: TARGET="generic"
|
||||
- os: linux
|
||||
env: TARGET="freertos"
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $ZEPHYR_SDK_INSTALL_DIR
|
||||
- /usr/local/bin
|
||||
- $HOME/bin/cmake
|
||||
|
||||
before_install:
|
||||
- if [ ! -f $HOME/bin/cmake/cmake-3.13.1-Linux-x86_64/bin/cmake ]; then
|
||||
mkdir -p $HOME/bin/cmake && cd $HOME/bin/cmake &&
|
||||
wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-Linux-x86_64.sh &&
|
||||
yes | sh cmake-3.13.1-Linux-x86_64.sh | cat &&
|
||||
cd -;
|
||||
fi &&
|
||||
export PATH=$HOME/bin/cmake/cmake-3.13.1-Linux-x86_64/bin:$PATH
|
||||
- if [[ "$TARGET" == "zephyr" ]]; then
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
|
||||
sudo apt-get update -qq &&
|
||||
sudo apt-get install libc6-dev-i386 make gperf gcc g++ python3-ply python3-yaml python3-pip device-tree-compiler ncurses-dev uglifyjs -qq &&
|
||||
sudo pip3 install pyelftools;
|
||||
fi
|
||||
- if [[ "$TARGET" == "linux" ]]; then
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
|
||||
sudo apt-get update -qq &&
|
||||
sudo apt-get install libsysfs-dev libhugetlbfs-dev make gcc-4.9;
|
||||
fi
|
||||
# This is to kick start CI on generic platform. Will need to have a proper way to get the required packages
|
||||
- if [[ "$TARGET" == "generic" || "$TARGET" == "freertos" ]]; then
|
||||
wget http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu/pool/main/g/gcc-arm-none-eabi/${GCC_ARM_COMPILER_PACKAGE} &&
|
||||
sudo dpkg -i ${GCC_ARM_COMPILER_PACKAGE};
|
||||
fi
|
||||
- if [[ "$TARGET" == "freertos" ]]; then
|
||||
wget $FREERTOS_ZIP_URL &&
|
||||
pwd && ls &&
|
||||
unzip FreeRTOSv10.0.1.zip > /dev/null;
|
||||
fi
|
||||
|
||||
install: >
|
||||
if [[ "$TARGET" == "zephyr" && "$(cat $ZEPHYR_SDK_INSTALL_DIR/sdk_version)" != "$ZEPHYR_SDK_VERSION" ]]; then
|
||||
wget $ZEPHYR_SDK_DOWNLOAD_URL &&
|
||||
chmod +x $ZEPHYR_SDK_SETUP_BINARY &&
|
||||
rm -rf $ZEPHYR_SDK_INSTALL_DIR &&
|
||||
./$ZEPHYR_SDK_SETUP_BINARY --quiet -- -y -d $ZEPHYR_SDK_INSTALL_DIR > /dev/null;
|
||||
fi
|
||||
|
||||
before_script: >
|
||||
if [[ "$TARGET" == "zephyr" ]]; then
|
||||
cd .. &&
|
||||
git clone --depth=1 https://github.com/zephyrproject-rtos/zephyr.git &&
|
||||
cd zephyr &&
|
||||
source zephyr-env.sh;
|
||||
fi
|
||||
|
||||
script:
|
||||
- if [[ "$TARGET" == "zephyr" ]]; then
|
||||
mkdir -p ../libmetal/build-zephyr &&
|
||||
cd ../libmetal/build-zephyr &&
|
||||
cmake .. -DWITH_ZEPHYR=on -DBOARD=qemu_cortex_m3 &&
|
||||
make VERBOSE=1;
|
||||
fi
|
||||
- if [[ "$TARGET" == "linux" ]]; then
|
||||
mkdir -p build-linux &&
|
||||
cd build-linux &&
|
||||
cmake .. -DWITH_TESTS_EXEC=on &&
|
||||
make VERBOSE=1 all test;
|
||||
fi
|
||||
- if [[ "$TARGET" == "generic" ]]; then
|
||||
mkdir -p build-generic &&
|
||||
cd build-generic &&
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=template-generic &&
|
||||
make VERBOSE=1;
|
||||
fi
|
||||
- if [[ "$TARGET" == "freertos" ]]; then
|
||||
mkdir -p build-freertos &&
|
||||
cd build-freertos &&
|
||||
export &&
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=template-freertos -DCMAKE_C_FLAGS="-I$PWD/../FreeRTOSv10.0.1/FreeRTOS/Source/include/ -I$PWD/../FreeRTOSv10.0.1/FreeRTOS/Demo/CORTEX_STM32F107_GCC_Rowley -I$PWD/../FreeRTOSv10.0.1/FreeRTOS/Source/portable/GCC/ARM_CM3" &&
|
||||
make VERBOSE=1;
|
||||
fi
|
|
@ -7,6 +7,8 @@ if (POLICY CMP0077)
|
|||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
|
||||
set (LIBMETAL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
list (APPEND CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||
|
|
|
@ -135,7 +135,8 @@ The following utilities are provided in lib/utilities.h:
|
|||
|
||||
#### Version
|
||||
|
||||
The libmetal version interface allows user to get the version of the library.
|
||||
The libmetal version interface allows user to get the version of the library. The version increment
|
||||
follows the set of rule proposed in [Semantic Versioning specification](https://semver.org/).
|
||||
|
||||
### Top Level Interfaces
|
||||
|
||||
|
@ -154,6 +155,11 @@ implementation for metal_sys_init and metal_sys_finish.
|
|||
For Linux userspace, metal_sys_init sets up a table for available shared pages,
|
||||
checks whether UIO/VFIO drivers are avail, and starts interrupt handling
|
||||
thread.
|
||||
Please note that on Linux, to access device's memory that is not page
|
||||
aligned, an offset has to be added to the pointer returned by
|
||||
mmap(). This `offset`, although it can be read from the device tree
|
||||
property exposed by the uio driver, is not handled yet by the
|
||||
library.
|
||||
|
||||
For bare-metal, metal_sys_init and metal_sys_finish just returns.
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 0
|
||||
VERSION_PATCH = 0
|
|
@ -1,7 +1,17 @@
|
|||
set (PROJECT_VER_MAJOR 0)
|
||||
set (PROJECT_VER_MINOR 1)
|
||||
set (PROJECT_VER_PATCH 0)
|
||||
set (PROJECT_VER 0.1.0)
|
||||
file(READ ${LIBMETAL_ROOT_DIR}/VERSION ver)
|
||||
|
||||
string(REGEX MATCH "VERSION_MAJOR = ([0-9]*)" _ ${ver})
|
||||
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
|
||||
string(REGEX MATCH "VERSION_MINOR = ([0-9]*)" _ ${ver})
|
||||
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
|
||||
string(REGEX MATCH "VERSION_PATCH = ([0-9]*)" _ ${ver})
|
||||
set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_1})
|
||||
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
|
||||
message(STATUS "libmetal version: ${PROJECT_VERSION} (${CMAKE_SOURCE_DIR})")
|
||||
|
||||
if (NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
|
|
|
@ -13,6 +13,7 @@ collect (PROJECT_LIB_HEADERS condition.h)
|
|||
collect (PROJECT_LIB_HEADERS config.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
collect (PROJECT_LIB_HEADERS device.h)
|
||||
collect (PROJECT_LIB_HEADERS errno.h)
|
||||
collect (PROJECT_LIB_HEADERS dma.h)
|
||||
collect (PROJECT_LIB_HEADERS io.h)
|
||||
collect (PROJECT_LIB_HEADERS irq.h)
|
||||
|
@ -82,8 +83,8 @@ else (WITH_ZEPHYR)
|
|||
endif (PROJECT_EC_FLAGS)
|
||||
set_target_properties (${_lib} PROPERTIES
|
||||
OUTPUT_NAME "${PROJECT_NAME}"
|
||||
VERSION "${PROJECT_VER}"
|
||||
SOVERSION "${PROJECT_VER_MAJOR}"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||
)
|
||||
endif (WITH_SHARED_LIB)
|
||||
|
||||
|
|
|
@ -94,7 +94,8 @@ using std::atomic_fetch_and_explicit;
|
|||
using std::atomic_thread_fence;
|
||||
using std::atomic_signal_fence;
|
||||
|
||||
#elif defined(HAVE_STDATOMIC_H) && !defined(__STDC_NO_ATOMICS__)
|
||||
#elif defined(HAVE_STDATOMIC_H) && !defined(__CC_ARM) && \
|
||||
!defined(__STDC_NO_ATOMICS__)
|
||||
# include <stdint.h>
|
||||
# include <stdatomic.h>
|
||||
#elif defined(__GNUC__)
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
# include <metal/compiler/gcc/compiler.h>
|
||||
#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"
|
||||
#else
|
||||
# error "Missing compiler support"
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
add_subdirectory (armcc)
|
||||
add_subdirectory (gcc)
|
||||
add_subdirectory (iar)
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
collect (PROJECT_LIB_HEADERS errno.h)
|
||||
|
||||
# vim: expandtab:ts=2:sw=2:smartindent
|
|
@ -0,0 +1,58 @@
|
|||
/*-
|
||||
* Copyright (c) 2020 STMicroelectronics. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef __METAL_ARMCC_ERRNO__H__
|
||||
#define __METAL_ARMCC_ERRNO__H__
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBMETAL_ERR_BASE 100
|
||||
|
||||
#define EPERM (LIBMETAL_ERR_BASE + 1) /* Operation not permitted */
|
||||
#define ENOENT (LIBMETAL_ERR_BASE + 2) /* No such file or directory */
|
||||
#define ESRCH (LIBMETAL_ERR_BASE + 3) /* No such process */
|
||||
#define EINTR (LIBMETAL_ERR_BASE + 4) /* Interrupted system call */
|
||||
#define EIO (LIBMETAL_ERR_BASE + 5) /* Input/output error */
|
||||
#define ENXIO (LIBMETAL_ERR_BASE + 6) /* Device not configured */
|
||||
#define E2BIG (LIBMETAL_ERR_BASE + 7) /* Argument list too long */
|
||||
#define ENOEXEC (LIBMETAL_ERR_BASE + 8) /* Exec format error */
|
||||
#define EBADF (LIBMETAL_ERR_BASE + 9) /* Bad file descriptor */
|
||||
#define ECHILD (LIBMETAL_ERR_BASE + 10) /* No child processes */
|
||||
#define EDEADLK (LIBMETAL_ERR_BASE + 11) /* Resource deadlock avoided */
|
||||
#define EACCES (LIBMETAL_ERR_BASE + 13) /* Permission denied */
|
||||
#define EFAULT (LIBMETAL_ERR_BASE + 14) /* Bad address */
|
||||
#define ENOTBLK (LIBMETAL_ERR_BASE + 15) /* Block device required */
|
||||
#define EBUSY (LIBMETAL_ERR_BASE + 16) /* Device busy */
|
||||
#define EEXIST (LIBMETAL_ERR_BASE + 17) /* File exists */
|
||||
#define EXDEV (LIBMETAL_ERR_BASE + 18) /* Cross-device link */
|
||||
#define ENODEV (LIBMETAL_ERR_BASE + 19) /* Operation not supported by device */
|
||||
#define ENOTDIR (LIBMETAL_ERR_BASE + 20) /* Not a directory */
|
||||
#define EISDIR (LIBMETAL_ERR_BASE + 21) /* Is a directory */
|
||||
#define ENFILE (LIBMETAL_ERR_BASE + 23) /* Too many open files in system */
|
||||
#define EMFILE (LIBMETAL_ERR_BASE + 24) /* Too many open files */
|
||||
#define ENOTTY (LIBMETAL_ERR_BASE + 25) /* Inappropriate ioctl for device */
|
||||
#define ETXTBSY (LIBMETAL_ERR_BASE + 26) /* Text file busy */
|
||||
#define EFBIG (LIBMETAL_ERR_BASE + 27) /* File too large */
|
||||
#define ENOSPC (LIBMETAL_ERR_BASE + 28) /* No space left on device */
|
||||
#define ESPIPE (LIBMETAL_ERR_BASE + 29) /* Illegal seek */
|
||||
#define EROFS (LIBMETAL_ERR_BASE + 30) /* Read-only filesystem */
|
||||
#define EMLINK (LIBMETAL_ERR_BASE + 31) /* Too many links */
|
||||
#define EPIPE (LIBMETAL_ERR_BASE + 32) /* Broken pipe */
|
||||
#define EAGAIN (LIBMETAL_ERR_BASE + 35) /* Resource temporarily unavailable */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __METAL_ARMCC_ERRNO__H__ */
|
|
@ -1,3 +1,4 @@
|
|||
collect (PROJECT_LIB_HEADERS compiler.h)
|
||||
collect (PROJECT_LIB_HEADERS errno.h)
|
||||
|
||||
# vim: expandtab:ts=2:sw=2:smartindent
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*-
|
||||
* Copyright (c) 2020 STMicroelectronics. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef __METAL_IAR_ERRNO__H__
|
||||
#define __METAL_IAR_ERRNO__H__
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBMETAL_ERR_BASE 100
|
||||
|
||||
#define EPERM (LIBMETAL_ERR_BASE + 1) /* Operation not permitted */
|
||||
#define ENOENT (LIBMETAL_ERR_BASE + 2) /* No such file or directory */
|
||||
#define ESRCH (LIBMETAL_ERR_BASE + 3) /* No such process */
|
||||
#define EINTR (LIBMETAL_ERR_BASE + 4) /* Interrupted system call */
|
||||
#define EIO (LIBMETAL_ERR_BASE + 5) /* Input/output error */
|
||||
#define ENXIO (LIBMETAL_ERR_BASE + 6) /* Device not configured */
|
||||
#define E2BIG (LIBMETAL_ERR_BASE + 7) /* Argument list too long */
|
||||
#define ENOEXEC (LIBMETAL_ERR_BASE + 8) /* Exec format error */
|
||||
#define EBADF (LIBMETAL_ERR_BASE + 9) /* Bad file descriptor */
|
||||
#define ECHILD (LIBMETAL_ERR_BASE + 10) /* No child processes */
|
||||
#define EDEADLK (LIBMETAL_ERR_BASE + 11) /* Resource deadlock avoided */
|
||||
#define ENOMEM (LIBMETAL_ERR_BASE + 12) /* Cannot allocate memory */
|
||||
#define EACCES (LIBMETAL_ERR_BASE + 13) /* Permission denied */
|
||||
#define EFAULT (LIBMETAL_ERR_BASE + 14) /* Bad address */
|
||||
#define ENOTBLK (LIBMETAL_ERR_BASE + 15) /* Block device required */
|
||||
#define EBUSY (LIBMETAL_ERR_BASE + 16) /* Device busy */
|
||||
#define EEXIST (LIBMETAL_ERR_BASE + 17) /* File exists */
|
||||
#define EXDEV (LIBMETAL_ERR_BASE + 18) /* Cross-device link */
|
||||
#define ENODEV (LIBMETAL_ERR_BASE + 19) /* Operation not supported by device */
|
||||
#define ENOTDIR (LIBMETAL_ERR_BASE + 20) /* Not a directory */
|
||||
#define EISDIR (LIBMETAL_ERR_BASE + 21) /* Is a directory */
|
||||
#define EINVAL (LIBMETAL_ERR_BASE + 22) /* Invalid argument */
|
||||
#define ENFILE (LIBMETAL_ERR_BASE + 23) /* Too many open files in system */
|
||||
#define EMFILE (LIBMETAL_ERR_BASE + 24) /* Too many open files */
|
||||
#define ENOTTY (LIBMETAL_ERR_BASE + 25) /* Inappropriate ioctl for device */
|
||||
#define ETXTBSY (LIBMETAL_ERR_BASE + 26) /* Text file busy */
|
||||
#define EFBIG (LIBMETAL_ERR_BASE + 27) /* File too large */
|
||||
#define ENOSPC (LIBMETAL_ERR_BASE + 28) /* No space left on device */
|
||||
#define ESPIPE (LIBMETAL_ERR_BASE + 29) /* Illegal seek */
|
||||
#define EROFS (LIBMETAL_ERR_BASE + 30) /* Read-only filesystem */
|
||||
#define EMLINK (LIBMETAL_ERR_BASE + 31) /* Too many links */
|
||||
#define EPIPE (LIBMETAL_ERR_BASE + 32) /* Broken pipe */
|
||||
#define EAGAIN (LIBMETAL_ERR_BASE + 35) /* Resource temporarily unavailable */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __METAL_IAR_ERRNO__H__ */
|
|
@ -17,16 +17,16 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/** Library major version number. */
|
||||
#define METAL_VER_MAJOR @PROJECT_VER_MAJOR@
|
||||
#define METAL_VER_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
|
||||
/** Library minor version number. */
|
||||
#define METAL_VER_MINOR @PROJECT_VER_MINOR@
|
||||
#define METAL_VER_MINOR @PROJECT_VERSION_MINOR@
|
||||
|
||||
/** Library patch level. */
|
||||
#define METAL_VER_PATCH @PROJECT_VER_PATCH@
|
||||
#define METAL_VER_PATCH @PROJECT_VERSION_PATCH@
|
||||
|
||||
/** Library version string. */
|
||||
#define METAL_VER "@PROJECT_VER@"
|
||||
#define METAL_VER "@PROJECT_VERSION@"
|
||||
|
||||
/** System type (linux, generic, ...). */
|
||||
#define METAL_SYSTEM "@PROJECT_SYSTEM@"
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <metal/assert.h>
|
||||
#include <metal/device.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/list.h>
|
||||
#include <metal/log.h>
|
||||
#include <metal/sys.h>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <string.h>
|
||||
#include <metal/device.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2020 STMicroelectronnics. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file metal/errno.h
|
||||
* @brief error specific primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_ERRNO__H__
|
||||
#define __METAL_ERRNO__H__
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
# include <metal/compiler/iar/errno.h>
|
||||
#elif defined(__CC_ARM)
|
||||
# include <metal/compiler/armcc/errno.h>
|
||||
#else
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#endif /* __METAL_ERRNO__H__ */
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/io.h>
|
||||
#include <metal/sys.h>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq.h>
|
||||
#include <metal/irq_controller.h>
|
||||
#include <metal/list.h>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* @file gcc/atomic.h
|
||||
* @brief GCC specific atomic primitives for libmetal.
|
||||
* @file arm/atomic.h
|
||||
* @brief Arm specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_ARM_ATOMIC__H__
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
* @brief Generic libmetal shared memory handling.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/assert.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/shmem.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/utilities.h>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/atomic.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq.h>
|
||||
#include <metal/irq_controller.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief FreeRTOS libmetal irq definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
|
||||
static inline int __metal_sleep_usec(unsigned int usec)
|
||||
{
|
||||
const TickType_t xDelay = ((usec/1000) / portTICK_PERIOD_MS);
|
||||
const TickType_t xDelay = pdMS_TO_TICKS(usec/1000);
|
||||
|
||||
vTaskDelay(xDelay ? xDelay : 1);
|
||||
return 0;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief generic libmetal Xilinx irq controller definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq_controller.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
#ifndef __METAL_GENERIC_CONDITION__H__
|
||||
#define __METAL_GENERIC_CONDITION__H__
|
||||
|
||||
#include <unistd.h>
|
||||
#include <metal/atomic.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief generic libmetal irq definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -16,10 +16,8 @@
|
|||
#ifndef __METAL_GENERIC_SYS__H__
|
||||
#define __METAL_GENERIC_SYS__H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <metal/errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief generic libmetal Xilinx irq controller definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq_controller.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/log.h>
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
#include <sys/syscall.h>
|
||||
#include <linux/futex.h>
|
||||
#include <metal/atomic.h>
|
||||
#include <metal/errno.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -87,10 +87,14 @@ static int metal_uio_read_map_attr(struct linux_device *ldev,
|
|||
if (result >= (int)sizeof(path))
|
||||
return -EOVERFLOW;
|
||||
attr = sysfs_open_attribute(path);
|
||||
if (!attr || sysfs_read_attribute(attr) != 0)
|
||||
if (!attr || sysfs_read_attribute(attr) != 0) {
|
||||
sysfs_close_attribute(attr);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
*value = strtoul(attr->value, NULL, 0);
|
||||
|
||||
sysfs_close_attribute(attr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -234,7 +238,7 @@ static int metal_uio_dev_open(struct linux_bus *lbus, struct linux_device *ldev)
|
|||
result = (result ? result :
|
||||
metal_uio_read_map_attr(ldev, i, "size", &size));
|
||||
result = (result ? result :
|
||||
metal_map(ldev->fd, offset, size, 0, 0, &virt));
|
||||
metal_map(ldev->fd, i * getpagesize(), size, 0, 0, &virt));
|
||||
if (!result) {
|
||||
io = &ldev->device.regions[ldev->device.num_regions];
|
||||
metal_io_init(io, virt, phys, size, -1, 0, NULL);
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
#ifndef __METAL_LINUX_SYS__H__
|
||||
#define __METAL_LINUX_SYS__H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <metal/errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief NuttX libmetal irq definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq_controller.h>
|
||||
#include <metal/alloc.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#ifndef __METAL_ZEPHYR_CONDITION__H__
|
||||
#define __METAL_ZEPHYR_CONDITION__H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/atomic.h>
|
||||
#include <metal/errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @brief Zephyr libmetal irq definitions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <metal/errno.h>
|
||||
#include <metal/irq.h>
|
||||
#include <metal/sys.h>
|
||||
#include <metal/log.h>
|
||||
|
|
Loading…
Reference in New Issue