1 /* 2 * SPDX-FileCopyrightText: Copyright 2019-2021, 2024 Arm Limited and/or its affiliates <open-source-office@arm.com> 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the License); you may 6 * not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef ETHOSU_TYPES_H 19 #define ETHOSU_TYPES_H 20 21 /****************************************************************************** 22 * Includes 23 ******************************************************************************/ 24 25 #include <stdint.h> 26 27 /****************************************************************************** 28 * Types 29 ******************************************************************************/ 30 31 struct NPU_REG; // Forward declare, to be implemented by each device 32 33 struct ethosu_device 34 { 35 volatile struct NPU_REG *reg; // Register map 36 uint32_t secure; 37 uint32_t privileged; 38 }; 39 40 enum ethosu_error_codes 41 { 42 ETHOSU_SUCCESS = 0, ///< Success 43 ETHOSU_GENERIC_FAILURE = -1, ///< Generic failure 44 ETHOSU_INVALID_PARAM = -2 ///< Invalid parameter 45 }; 46 47 enum ethosu_clock_q_request 48 { 49 ETHOSU_CLOCK_Q_DISABLE = 0, ///< Disable NPU signal ready for clock off. 50 ETHOSU_CLOCK_Q_ENABLE = 1, ///< Enable NPU signal ready for clock off when stop+idle state reached. 51 ETHOSU_CLOCK_Q_UNCHANGED = 2 ///< Keep current clock q setting 52 }; 53 54 enum ethosu_power_q_request 55 { 56 ETHOSU_POWER_Q_DISABLE = 0, ///< Disable NPU signal ready for power off. 57 ETHOSU_POWER_Q_ENABLE = 1, ///< Enable NPU signal ready for power off when stop+idle state reached. 58 ETHOSU_POWER_Q_UNCHANGED = 2 ///< Keep current power q setting 59 }; 60 61 struct ethosu_id 62 { 63 uint32_t version_status; ///< Version status 64 uint32_t version_minor; ///< Version minor 65 uint32_t version_major; ///< Version major 66 uint32_t product_major; ///< Product major 67 uint32_t arch_patch_rev; ///< Architecture version patch 68 uint32_t arch_minor_rev; ///< Architecture version minor 69 uint32_t arch_major_rev; ///< Architecture version major 70 }; 71 72 struct ethosu_config 73 { 74 uint32_t macs_per_cc; ///< MACs per clock cycle 75 uint32_t cmd_stream_version; ///< NPU command stream version 76 uint32_t custom_dma; ///< Custom DMA enabled 77 }; 78 79 struct ethosu_hw_info 80 { 81 struct ethosu_id version; 82 struct ethosu_config cfg; 83 }; 84 #endif // ETHOSU_TYPES_H 85