From 3c4391763b45c693e54b17b47e9bd65f0b3427c6 Mon Sep 17 00:00:00 2001 From: Kristofer Jonsson Date: Wed, 5 Aug 2020 09:38:40 +0200 Subject: Header cleanup Change-Id: I84754f316ce940917516cb7f5c59189f523d4095 --- include/ethosu_device.h | 15 ++++++++++++++- include/ethosu_driver.h | 9 ++++----- src/ethosu_common.h | 14 +++++++++++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/include/ethosu_device.h b/include/ethosu_device.h index 81f24a9..9c78bfc 100644 --- a/include/ethosu_device.h +++ b/include/ethosu_device.h @@ -16,7 +16,8 @@ * limitations under the License. */ -#pragma once +#ifndef ETHOSU_DEVICE_H +#define ETHOSU_DEVICE_H /****************************************************************************** * Includes @@ -358,8 +359,18 @@ enum ethosu_error_codes ethosu_set_clock_and_power(struct ethosu_device *dev, enum ethosu_clock_q_request clock_q, enum ethosu_power_q_request power_q); +/** + * Read register. + * \param[in] address Address to read. + * \return Register value. + */ uint32_t ethosu_read_reg(struct ethosu_device *dev, uint32_t address); +/** + * Write register. + * \param[in] address Address to read. + * \param[in] value Value to be written. + */ void ethosu_write_reg(struct ethosu_device *dev, uint32_t address, uint32_t value); /** @@ -381,3 +392,5 @@ enum ethosu_error_codes ethosu_restore_pmu_config(struct ethosu_device *dev); #ifdef __cplusplus } #endif + +#endif // ETHOSU_DEVICE_H diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h index f192357..64ccb89 100644 --- a/include/ethosu_driver.h +++ b/include/ethosu_driver.h @@ -16,7 +16,8 @@ * limitations under the License. */ -#pragma once +#ifndef ETHOSU_DRIVER_H +#define ETHOSU_DRIVER_H /****************************************************************************** * Includes @@ -31,10 +32,6 @@ extern "C" { #endif -/****************************************************************************** - * Defines - ******************************************************************************/ - /****************************************************************************** * Types ******************************************************************************/ @@ -109,3 +106,5 @@ void ethosu_irq_handler(void); #ifdef __cplusplus } #endif + +#endif // ETHOSU_DRIVER_H diff --git a/src/ethosu_common.h b/src/ethosu_common.h index a5ea197..b22bffd 100644 --- a/src/ethosu_common.h +++ b/src/ethosu_common.h @@ -16,14 +16,22 @@ * limitations under the License. */ -#if !defined ETHOSU_COMMON_H +#ifndef ETHOSU_COMMON_H #define ETHOSU_COMMON_H +/****************************************************************************** + * Includes + ******************************************************************************/ + #include "ethosu55_interface.h" #include "ethosu_device.h" #include +/****************************************************************************** + * Defines + ******************************************************************************/ + #if defined(DRIVER_LOG_SEVERITY) && (DRIVER_LOG_SEVERITY >= LOG_SEVERITY_EMERG) #define LOG_EMERG(format, ...) \ fprintf(stderr, format, ##__VA_ARGS__); \ @@ -97,6 +105,10 @@ #define MASK_0_31_BITS (0xFFFFFFFF) #define MASK_32_47_BITS (0xFFFF00000000) +/****************************************************************************** + * Inline functions + ******************************************************************************/ + static const __attribute__((section("npu_driver_version"))) char driver_version_str[] = VER_STR( ETHOSU_DRIVER_VERSION_MAJOR) "." VER_STR(ETHOSU_DRIVER_VERSION_MINOR) "." VER_STR(ETHOSU_DRIVER_VERSION_PATCH); -- cgit v1.2.1