Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019-2020 Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| 7 | * not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 19 | /****************************************************************************** |
| 20 | * Includes |
| 21 | ******************************************************************************/ |
| 22 | |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 23 | #include "ethosu_driver.h" |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 24 | #include "ethosu_common.h" |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 25 | #include "ethosu_config.h" |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 26 | #include "ethosu_device.h" |
Per Åstrand | 25d78c0 | 2020-04-21 14:19:44 +0200 | [diff] [blame] | 27 | |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 28 | #include <assert.h> |
Per Åstrand | 25d78c0 | 2020-04-21 14:19:44 +0200 | [diff] [blame] | 29 | #include <cmsis_compiler.h> |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 30 | #include <inttypes.h> |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 31 | #include <stdbool.h> |
Bhavik Patel | bf7ae63 | 2020-06-11 21:00:16 +0200 | [diff] [blame] | 32 | #include <stddef.h> |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 33 | #include <stdio.h> |
| 34 | #include <stdlib.h> |
| 35 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 36 | /****************************************************************************** |
| 37 | * Defines |
| 38 | ******************************************************************************/ |
| 39 | |
| 40 | #define MACS_PER_CYCLE_LOG2_MASK 0x000F |
| 41 | #define SHRAM_SIZE_MASK 0xFF00 |
| 42 | #define SHRAM_SIZE_RIGHT_SHIFT 8 |
| 43 | #define BYTES_IN_32_BITS 4 |
| 44 | #define CUSTOM_OPTION_LENGTH_32_BIT_WORD 1 |
| 45 | #define DRIVER_ACTION_LENGTH_32_BIT_WORD 1 |
| 46 | #define OPTIMIZER_CONFIG_LENGTH_32_BIT_WORD 2 |
| 47 | #define ETHOSU_FOURCC ('1' << 24 | 'P' << 16 | 'O' << 8 | 'C') // "Custom Operator Payload 1" |
| 48 | #define APB_START_ADDR_MASK 0x0FFF |
| 49 | #define APB_NUM_REG_BIT_SHIFT 12 |
| 50 | #define BYTES_1KB 1024 |
| 51 | #define PRODUCT_MAJOR_ETHOSU55 (4) |
| 52 | #define MASK_16_BYTE_ALIGN (0xF) |
| 53 | #define FAST_MEMORY_BASE_ADDR_INDEX 2 |
| 54 | |
| 55 | /****************************************************************************** |
| 56 | * Types |
| 57 | ******************************************************************************/ |
| 58 | |
| 59 | // Driver actions |
| 60 | enum DRIVER_ACTION_e |
| 61 | { |
| 62 | RESERVED = 0, |
| 63 | OPTIMIZER_CONFIG = 1, |
| 64 | COMMAND_STREAM = 2, |
| 65 | READ_APB_REG = 3, |
| 66 | DUMP_SHRAM = 4, |
| 67 | NOP = 5, |
| 68 | }; |
| 69 | |
| 70 | // Custom data struct |
| 71 | struct custom_data_s |
| 72 | { |
| 73 | union |
| 74 | { |
| 75 | // Driver action data |
| 76 | struct |
| 77 | { |
| 78 | // Driver action command (valid values in DRIVER_ACTION_e) |
| 79 | uint8_t driver_action_command; |
| 80 | |
| 81 | // reserved |
| 82 | uint8_t reserved; |
| 83 | |
| 84 | // Driver action data |
| 85 | union |
| 86 | { |
| 87 | // DA_CMD_OPT_CFG |
| 88 | struct |
| 89 | { |
| 90 | uint16_t rel_nbr : 4; |
| 91 | uint16_t patch_nbr : 4; |
| 92 | uint16_t opt_cfg_reserved : 8; |
| 93 | }; |
| 94 | |
| 95 | // DA_CMD_CMSTRM |
| 96 | struct |
| 97 | { |
| 98 | uint16_t length; |
| 99 | }; |
| 100 | |
| 101 | // DA_CMD_READAPB |
| 102 | struct |
| 103 | { |
| 104 | uint16_t start_address : 12; |
| 105 | uint16_t nbr_reg_minus1 : 4; |
| 106 | }; |
| 107 | |
| 108 | uint16_t driver_action_data; |
| 109 | }; |
| 110 | }; |
| 111 | |
| 112 | uint32_t word; |
| 113 | }; |
| 114 | }; |
| 115 | |
| 116 | // optimizer config struct |
| 117 | struct opt_cfg_s |
| 118 | { |
| 119 | struct custom_data_s da_data; |
| 120 | union |
| 121 | { |
| 122 | struct |
| 123 | { |
| 124 | uint32_t macs_per_cc : 4; |
| 125 | uint32_t cmd_stream_version : 4; |
| 126 | uint32_t shram_size : 8; |
| 127 | uint32_t reserved1 : 16; |
| 128 | }; |
| 129 | uint32_t npu_cfg; |
| 130 | }; |
| 131 | union |
| 132 | { |
| 133 | struct |
| 134 | { |
| 135 | uint32_t version_status : 4; |
| 136 | uint32_t version_minor : 4; |
| 137 | uint32_t version_major : 4; |
| 138 | uint32_t product_major : 4; |
| 139 | uint32_t arch_patch_rev : 4; |
| 140 | uint32_t arch_minor_rev : 8; |
| 141 | uint32_t arch_major_rev : 4; |
| 142 | }; |
| 143 | uint32_t ethosu_id; |
| 144 | }; |
| 145 | }; |
| 146 | |
| 147 | /****************************************************************************** |
| 148 | * Functions |
| 149 | ******************************************************************************/ |
| 150 | |
Kristofer Jonsson | ef387ea | 2020-08-25 16:32:21 +0200 | [diff] [blame] | 151 | struct ethosu_driver ethosu_drv = { |
Per Åstrand | c801901 | 2020-09-28 08:44:42 +0200 | [diff] [blame] | 152 | .dev = {.base_address = 0, .pmccntr = 0, .pmu_evcntr = {0, 0, 0, 0}, .pmu_evtypr = {0, 0, 0, 0}}, |
Kristofer Jonsson | ef387ea | 2020-08-25 16:32:21 +0200 | [diff] [blame] | 153 | .abort_inference = false}; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 154 | |
| 155 | // IRQ |
| 156 | static volatile bool irq_triggered = false; |
| 157 | #if defined(CPU_CORTEX_M3) || defined(CPU_CORTEX_M4) || defined(CPU_CORTEX_M7) || defined(CPU_CORTEX_M33) || \ |
| 158 | defined(CPU_CORTEX_M55) |
Per Åstrand | 25d78c0 | 2020-04-21 14:19:44 +0200 | [diff] [blame] | 159 | void ethosu_irq_handler(void) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 160 | { |
| 161 | uint8_t irq_raised = 0; |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 162 | |
| 163 | LOG_DEBUG("Interrupt. status=0x%08x, qread=%d\n", |
| 164 | ethosu_read_reg(ðosu_drv.dev, NPU_REG_STATUS), |
| 165 | ethosu_read_reg(ðosu_drv.dev, NPU_REG_QREAD)); |
| 166 | |
| 167 | // Verify that interrupt has been raised |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 168 | (void)ethosu_is_irq_raised(ðosu_drv.dev, &irq_raised); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 169 | ASSERT(irq_raised == 1); |
| 170 | irq_triggered = true; |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 171 | |
| 172 | // Clear interrupt |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 173 | (void)ethosu_clear_irq_status(ðosu_drv.dev); |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 174 | |
| 175 | // Verify that interrupt has been successfully cleard |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 176 | (void)ethosu_is_irq_raised(ðosu_drv.dev, &irq_raised); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 177 | ASSERT(irq_raised == 0); |
| 178 | } |
| 179 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 180 | static inline void wait_for_irq(struct ethosu_driver *drv) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 181 | { |
| 182 | while (1) |
| 183 | { |
| 184 | __disable_irq(); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 185 | if (irq_triggered || drv->abort_inference) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 186 | { |
| 187 | __enable_irq(); |
| 188 | break; |
| 189 | } |
| 190 | |
Per Åstrand | 25d78c0 | 2020-04-21 14:19:44 +0200 | [diff] [blame] | 191 | __WFI(); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 192 | |
| 193 | __enable_irq(); |
| 194 | } |
| 195 | } |
| 196 | #else |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 197 | // Just polling the status register |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 198 | static inline void wait_for_irq(struct ethosu_driver *drv) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 199 | { |
| 200 | uint8_t irq_raised = 0; |
| 201 | |
| 202 | for (int i = 0; i < 5000; ++i) |
| 203 | { |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 204 | (void)ethosu_is_irq_raised(&drv->dev, &irq_raised); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 205 | if (1 == irq_raised) |
| 206 | { |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | ASSERT(1 == irq_raised); |
| 211 | |
| 212 | irq_triggered = true; |
| 213 | } |
| 214 | #endif |
| 215 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 216 | static int handle_optimizer_config(struct ethosu_driver *drv, struct opt_cfg_s *opt_cfg_p); |
| 217 | static int handle_command_stream(struct ethosu_driver *drv, |
| 218 | const uint8_t *cmd_stream, |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 219 | const int cms_length, |
| 220 | const uint64_t *base_addr, |
| 221 | const int num_base_addr); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 222 | static int read_apb_reg(struct ethosu_driver *drv, uint16_t); |
| 223 | static int dump_shram(struct ethosu_driver *drv); |
| 224 | static void dump_npu_register(struct ethosu_driver *drv, int npu_reg, int npu_reg_end); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 225 | static void dump_command_stream(const uint32_t *cmd_stream, const int cms_length, int qread); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 226 | static void npu_axi_init(struct ethosu_driver *drv); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 227 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 228 | int ethosu_init_v2(const void *base_address, const void *fast_memory, const size_t fast_memory_size) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 229 | { |
| 230 | int return_code = 0; |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 231 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 232 | LOG_INFO("%s. base_address=%p, fast_memory=%p, fast_memory_size=%zu\n", |
| 233 | __FUNCTION__, |
| 234 | base_address, |
| 235 | fast_memory, |
| 236 | fast_memory_size); |
| 237 | |
Per Åstrand | c6c1db1 | 2020-09-28 08:41:45 +0200 | [diff] [blame] | 238 | ethosu_drv.fast_memory = (uint32_t)fast_memory; |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 239 | ethosu_drv.fast_memory_size = fast_memory_size; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 240 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 241 | if (ETHOSU_SUCCESS != ethosu_dev_init(ðosu_drv.dev, base_address)) |
| 242 | { |
| 243 | LOG_ERR("Failed in ethosu_dev_init"); |
| 244 | return -1; |
| 245 | } |
| 246 | |
| 247 | if (ETHOSU_SUCCESS != ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_DISABLE, ETHOSU_POWER_Q_DISABLE)) |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 248 | { |
| 249 | LOG_ERR("Failed to disable clock-q & power-q for Ethos-U\n"); |
| 250 | return -1; |
| 251 | } |
| 252 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 253 | ethosu_soft_reset(ðosu_drv.dev); |
Kristofer Jonsson | daa0d20 | 2020-05-12 12:23:16 +0200 | [diff] [blame] | 254 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 255 | if (ETHOSU_SUCCESS != ethosu_wait_for_reset(ðosu_drv.dev)) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 256 | { |
| 257 | LOG_ERR("Failed reset of Ethos-U\n"); |
| 258 | return -1; |
| 259 | } |
| 260 | |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 261 | return return_code; |
| 262 | } |
| 263 | |
| 264 | int ethosu_get_version(struct ethosu_version *version) |
| 265 | { |
| 266 | int return_code = 0; |
| 267 | |
| 268 | if (NULL != version) |
| 269 | { |
| 270 | struct ethosu_id id; |
| 271 | struct ethosu_config cfg; |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 272 | (void)ethosu_get_id(ðosu_drv.dev, &id); |
| 273 | (void)ethosu_get_config(ðosu_drv.dev, &cfg); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 274 | |
| 275 | version->id.version_status = id.version_status; |
| 276 | version->id.version_minor = id.version_minor; |
| 277 | version->id.version_major = id.version_major; |
| 278 | version->id.product_major = id.product_major; |
| 279 | version->id.arch_patch_rev = id.arch_patch_rev; |
| 280 | version->id.arch_minor_rev = id.arch_minor_rev; |
| 281 | version->id.arch_major_rev = id.arch_major_rev; |
| 282 | version->id.driver_patch_rev = ETHOSU_DRIVER_VERSION_PATCH; |
| 283 | version->id.driver_minor_rev = ETHOSU_DRIVER_VERSION_MINOR; |
| 284 | version->id.driver_major_rev = ETHOSU_DRIVER_VERSION_MAJOR; |
| 285 | version->cfg.macs_per_cc = cfg.macs_per_cc; |
| 286 | version->cfg.cmd_stream_version = cfg.cmd_stream_version; |
| 287 | version->cfg.shram_size = cfg.shram_size; |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | return_code = -1; |
| 292 | } |
| 293 | |
| 294 | return return_code; |
| 295 | } |
| 296 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 297 | int ethosu_invoke_v2(const void *custom_data_ptr, |
| 298 | const int custom_data_size, |
| 299 | const uint64_t *base_addr, |
| 300 | const size_t *base_addr_size, |
| 301 | const int num_base_addr) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 302 | { |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 303 | const struct custom_data_s *data_ptr = custom_data_ptr; |
| 304 | const struct custom_data_s *data_end = custom_data_ptr + custom_data_size; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 305 | int return_code = 0; |
| 306 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 307 | LOG_INFO("%s\n", __FUNCTION__); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 308 | |
| 309 | // First word in custom_data_ptr should contain "Custom Operator Payload 1" |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 310 | if (data_ptr->word != ETHOSU_FOURCC) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 311 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 312 | LOG_ERR("Custom Operator Payload: %" PRIu32 " is not correct, expected %x\n", data_ptr->word, ETHOSU_FOURCC); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 313 | return -1; |
| 314 | } |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 315 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 316 | // Custom data length must be a multiple of 32 bits |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 317 | if ((custom_data_size % BYTES_IN_32_BITS) != 0) |
| 318 | { |
| 319 | LOG_ERR("ethosu_invoke ERROR custom_data_size=0x%x not a multiple of 4\n", custom_data_size); |
| 320 | return -1; |
| 321 | } |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 322 | |
| 323 | ++data_ptr; |
| 324 | |
| 325 | // Adjust base address to fast memory area |
Per Åstrand | c801901 | 2020-09-28 08:44:42 +0200 | [diff] [blame] | 326 | if (ethosu_drv.fast_memory != 0 && num_base_addr >= FAST_MEMORY_BASE_ADDR_INDEX) |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 327 | { |
| 328 | uint64_t *fast_memory = (uint64_t *)&base_addr[FAST_MEMORY_BASE_ADDR_INDEX]; |
| 329 | |
| 330 | if (base_addr_size != NULL && base_addr_size[FAST_MEMORY_BASE_ADDR_INDEX] > ethosu_drv.fast_memory_size) |
| 331 | { |
| 332 | LOG_WARN("Fast memory area too small. fast_memory_size=%u, base_addr_size=%u\n", |
| 333 | ethosu_drv.fast_memory_size, |
| 334 | base_addr_size[FAST_MEMORY_BASE_ADDR_INDEX]); |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | *fast_memory = ethosu_drv.fast_memory; |
| 339 | } |
| 340 | } |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 341 | |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 342 | ethosu_soft_reset(ðosu_drv.dev); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 343 | ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_ENABLE, ETHOSU_POWER_Q_DISABLE); |
Bhavik Patel | 5da4092 | 2020-07-15 10:06:43 +0200 | [diff] [blame] | 344 | ethosu_restore_pmu_config(ðosu_drv.dev); |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 345 | |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 346 | while (data_ptr < data_end) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 347 | { |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 348 | int ret = 0; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 349 | switch (data_ptr->driver_action_command) |
| 350 | { |
| 351 | case OPTIMIZER_CONFIG: |
| 352 | LOG_INFO("ethosu_invoke OPTIMIZER_CONFIG\n"); |
| 353 | struct opt_cfg_s *opt_cfg_p = (struct opt_cfg_s *)data_ptr; |
| 354 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 355 | ret = handle_optimizer_config(ðosu_drv, opt_cfg_p); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 356 | data_ptr += DRIVER_ACTION_LENGTH_32_BIT_WORD + OPTIMIZER_CONFIG_LENGTH_32_BIT_WORD; |
| 357 | break; |
| 358 | case COMMAND_STREAM: |
| 359 | LOG_INFO("ethosu_invoke COMMAND_STREAM\n"); |
| 360 | void *command_stream = (uint8_t *)(data_ptr) + sizeof(struct custom_data_s); |
| 361 | int cms_length = (data_ptr->reserved << 16) | data_ptr->length; |
| 362 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 363 | ethosu_drv.abort_inference = false; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 364 | // It is safe to clear this flag without atomic, because npu is not running. |
| 365 | irq_triggered = false; |
| 366 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 367 | ret = handle_command_stream(ðosu_drv, command_stream, cms_length, base_addr, num_base_addr); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 368 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 369 | if (return_code == -1 && ethosu_drv.abort_inference) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 370 | { |
| 371 | uint32_t qread = 0; |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 372 | ethosu_get_qread(ðosu_drv.dev, &qread); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 373 | LOG_ERR("NPU timeout\n"); |
| 374 | dump_command_stream(command_stream, cms_length, qread); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 375 | dump_npu_register(ðosu_drv, 0x200, 0x2BF); |
| 376 | dump_npu_register(ðosu_drv, 0x800, 0xB3F); |
| 377 | dump_shram(ðosu_drv); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | data_ptr += DRIVER_ACTION_LENGTH_32_BIT_WORD + cms_length; |
| 381 | break; |
| 382 | case READ_APB_REG: |
| 383 | LOG_INFO("ethosu_invoke READ_APB_REG\n"); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 384 | ret = read_apb_reg(ðosu_drv, data_ptr->driver_action_data); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 385 | data_ptr += DRIVER_ACTION_LENGTH_32_BIT_WORD; |
| 386 | break; |
| 387 | case DUMP_SHRAM: |
| 388 | LOG_INFO("ethosu_invoke DUMP_SHRAM\n"); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 389 | ret = dump_shram(ðosu_drv); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 390 | data_ptr += DRIVER_ACTION_LENGTH_32_BIT_WORD; |
| 391 | break; |
| 392 | case NOP: |
| 393 | LOG_INFO("ethosu_invoke NOP\n"); |
| 394 | data_ptr += DRIVER_ACTION_LENGTH_32_BIT_WORD; |
| 395 | break; |
| 396 | default: |
| 397 | LOG_ERR("ethosu_invoke UNSUPPORTED driver_action_command %d \n", data_ptr->driver_action_command); |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 398 | ret = -1; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 399 | break; |
| 400 | } |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 401 | if (ret != 0) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 402 | { |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 403 | return_code = -1; |
| 404 | break; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 405 | } |
| 406 | } |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 407 | |
Bhavik Patel | 5da4092 | 2020-07-15 10:06:43 +0200 | [diff] [blame] | 408 | ethosu_save_pmu_config(ðosu_drv.dev); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 409 | ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_ENABLE, ETHOSU_POWER_Q_ENABLE); |
Kristofer Jonsson | 2b201c3 | 2020-09-02 16:42:43 +0200 | [diff] [blame] | 410 | |
Bhavik Patel | e645fed | 2020-06-12 14:46:47 +0200 | [diff] [blame] | 411 | return return_code; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | void ethosu_abort(void) |
| 415 | { |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 416 | ethosu_drv.abort_inference = true; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 417 | } |
| 418 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 419 | static int handle_optimizer_config(struct ethosu_driver *drv, struct opt_cfg_s *opt_cfg_p) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 420 | { |
| 421 | struct ethosu_config cfg; |
| 422 | struct ethosu_id id; |
| 423 | int return_code = 0; |
| 424 | |
| 425 | LOG_INFO("handle_optimizer_config:\n"); |
| 426 | LOG_INFO("Optimizer release nbr: %d patch: %d\n", opt_cfg_p->da_data.rel_nbr, opt_cfg_p->da_data.patch_nbr); |
| 427 | LOG_INFO("Optimizer config cmd_stream_version: %d macs_per_cc: %d shram_size: %d\n", |
| 428 | opt_cfg_p->cmd_stream_version, |
| 429 | opt_cfg_p->macs_per_cc, |
| 430 | opt_cfg_p->shram_size); |
| 431 | LOG_INFO("Optimizer config Ethos-U version: %d.%d.%d\n", |
| 432 | opt_cfg_p->arch_major_rev, |
| 433 | opt_cfg_p->arch_minor_rev, |
| 434 | opt_cfg_p->arch_patch_rev); |
| 435 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 436 | (void)ethosu_get_config(&drv->dev, &cfg); |
| 437 | (void)ethosu_get_id(&drv->dev, &id); |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 438 | LOG_INFO("Ethos-U config cmd_stream_version: %" PRIu32 " macs_per_cc: %" PRIu32 " shram_size: %" PRIu32 "\n", |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 439 | cfg.cmd_stream_version, |
| 440 | cfg.macs_per_cc, |
| 441 | cfg.shram_size); |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 442 | LOG_INFO("Ethos-U version: %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", |
| 443 | id.arch_major_rev, |
| 444 | id.arch_minor_rev, |
| 445 | id.arch_patch_rev); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 446 | |
| 447 | if ((cfg.macs_per_cc != opt_cfg_p->macs_per_cc) || (cfg.shram_size != opt_cfg_p->shram_size) || |
| 448 | (cfg.cmd_stream_version != opt_cfg_p->cmd_stream_version)) |
| 449 | { |
| 450 | if (cfg.macs_per_cc != opt_cfg_p->macs_per_cc) |
| 451 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 452 | LOG_ERR("NPU config mismatch: npu.macs_per_cc=%" PRIu32 " optimizer.macs_per_cc=%d\n", |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 453 | cfg.macs_per_cc, |
| 454 | opt_cfg_p->macs_per_cc); |
| 455 | } |
| 456 | if (cfg.shram_size != opt_cfg_p->shram_size) |
| 457 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 458 | LOG_ERR("NPU config mismatch: npu.shram_size=%" PRIu32 " optimizer.shram_size=%d\n", |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 459 | cfg.shram_size, |
| 460 | opt_cfg_p->shram_size); |
| 461 | } |
| 462 | if (cfg.cmd_stream_version != opt_cfg_p->cmd_stream_version) |
| 463 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 464 | LOG_ERR("NPU config mismatch: npu.cmd_stream_version=%" PRIu32 " optimizer.cmd_stream_version=%d\n", |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 465 | cfg.cmd_stream_version, |
| 466 | opt_cfg_p->cmd_stream_version); |
| 467 | } |
| 468 | return_code = -1; |
| 469 | } |
| 470 | |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 471 | if ((id.product_major == PRODUCT_MAJOR_ETHOSU55) && |
Douglas Troha | 60d50ae | 2020-06-15 12:48:10 +0200 | [diff] [blame] | 472 | ((id.arch_major_rev != opt_cfg_p->arch_major_rev) || (id.arch_minor_rev != opt_cfg_p->arch_minor_rev))) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 473 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 474 | LOG_ERR("NPU arch mismatch: npu.arch=%" PRIu32 ".%" PRIu32 ".%" PRIu32 " optimizer.arch=%d.%d.%d\n", |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 475 | id.arch_major_rev, |
| 476 | id.arch_minor_rev, |
| 477 | id.arch_patch_rev, |
| 478 | opt_cfg_p->arch_major_rev, |
| 479 | opt_cfg_p->arch_minor_rev, |
| 480 | opt_cfg_p->arch_patch_rev); |
| 481 | return_code = -1; |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | #if !defined(LOG_ENABLED) |
| 485 | UNUSED(opt_cfg_p); |
| 486 | #endif |
| 487 | return return_code; |
| 488 | } |
| 489 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 490 | static void npu_axi_init(struct ethosu_driver *drv) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 491 | { |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 492 | ethosu_set_qconfig(&drv->dev, NPU_QCONFIG); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 493 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 494 | ethosu_set_regioncfg(&drv->dev, 0, NPU_REGIONCFG_0); |
| 495 | ethosu_set_regioncfg(&drv->dev, 1, NPU_REGIONCFG_1); |
| 496 | ethosu_set_regioncfg(&drv->dev, 2, NPU_REGIONCFG_2); |
| 497 | ethosu_set_regioncfg(&drv->dev, 3, NPU_REGIONCFG_3); |
| 498 | ethosu_set_regioncfg(&drv->dev, 4, NPU_REGIONCFG_4); |
| 499 | ethosu_set_regioncfg(&drv->dev, 5, NPU_REGIONCFG_5); |
| 500 | ethosu_set_regioncfg(&drv->dev, 6, NPU_REGIONCFG_6); |
| 501 | ethosu_set_regioncfg(&drv->dev, 7, NPU_REGIONCFG_7); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 502 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 503 | (void)ethosu_set_axi_limit0(&drv->dev, |
| 504 | AXI_LIMIT0_MAX_BEATS_BYTES, |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 505 | AXI_LIMIT0_MEM_TYPE, |
| 506 | AXI_LIMIT0_MAX_OUTSTANDING_READS, |
| 507 | AXI_LIMIT0_MAX_OUTSTANDING_WRITES); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 508 | (void)ethosu_set_axi_limit1(&drv->dev, |
| 509 | AXI_LIMIT1_MAX_BEATS_BYTES, |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 510 | AXI_LIMIT1_MEM_TYPE, |
| 511 | AXI_LIMIT1_MAX_OUTSTANDING_READS, |
| 512 | AXI_LIMIT1_MAX_OUTSTANDING_WRITES); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 513 | (void)ethosu_set_axi_limit2(&drv->dev, |
| 514 | AXI_LIMIT2_MAX_BEATS_BYTES, |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 515 | AXI_LIMIT2_MEM_TYPE, |
| 516 | AXI_LIMIT2_MAX_OUTSTANDING_READS, |
| 517 | AXI_LIMIT2_MAX_OUTSTANDING_WRITES); |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 518 | (void)ethosu_set_axi_limit3(&drv->dev, |
| 519 | AXI_LIMIT3_MAX_BEATS_BYTES, |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 520 | AXI_LIMIT3_MEM_TYPE, |
| 521 | AXI_LIMIT3_MAX_OUTSTANDING_READS, |
| 522 | AXI_LIMIT3_MAX_OUTSTANDING_WRITES); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 523 | } |
| 524 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 525 | static int handle_command_stream(struct ethosu_driver *drv, |
| 526 | const uint8_t *cmd_stream, |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 527 | const int cms_length, |
| 528 | const uint64_t *base_addr, |
| 529 | const int num_base_addr) |
| 530 | { |
| 531 | uint32_t qread = 0; |
| 532 | uint32_t cms_bytes = cms_length * BYTES_IN_32_BITS; |
Kristofer Jonsson | 125429a | 2020-08-20 16:52:23 +0200 | [diff] [blame] | 533 | LOG_INFO("handle_command_stream: cmd_stream=%p, cms_length %d\n", cmd_stream, cms_length); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 534 | |
Bhavik Patel | bf7ae63 | 2020-06-11 21:00:16 +0200 | [diff] [blame] | 535 | if (0 != ((ptrdiff_t)cmd_stream & MASK_16_BYTE_ALIGN)) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 536 | { |
Bhavik Patel | bf7ae63 | 2020-06-11 21:00:16 +0200 | [diff] [blame] | 537 | LOG_ERR("Error: Command stream addr %p not aligned to 16 bytes\n", cmd_stream); |
| 538 | return -1; |
| 539 | } |
| 540 | |
| 541 | bool base_addr_invalid = false; |
| 542 | for (int i = 0; i < num_base_addr; i++) |
| 543 | { |
| 544 | if (0 != (base_addr[i] & MASK_16_BYTE_ALIGN)) |
| 545 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 546 | LOG_ERR("Error: Base addr %d: 0x%llx not aligned to 16 bytes\n", i, base_addr[i]); |
Bhavik Patel | bf7ae63 | 2020-06-11 21:00:16 +0200 | [diff] [blame] | 547 | base_addr_invalid = true; |
| 548 | } |
| 549 | } |
| 550 | if (base_addr_invalid) |
| 551 | { |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 552 | return -1; |
| 553 | } |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 554 | npu_axi_init(drv); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 555 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 556 | if (ETHOSU_SUCCESS != ethosu_run_command_stream(&drv->dev, cmd_stream, cms_bytes, base_addr, num_base_addr)) |
Bhavik Patel | 790ef36 | 2020-06-03 10:05:28 +0200 | [diff] [blame] | 557 | { |
| 558 | return -1; |
| 559 | } |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 560 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 561 | wait_for_irq(drv); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 562 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 563 | (void)ethosu_get_qread(&drv->dev, &qread); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 564 | if (qread != cms_bytes) |
| 565 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 566 | LOG_ERR( |
| 567 | "Failure: IRQ received but qread (%" PRIu32 ") not at end of stream (%" PRIu32 ").\n", qread, cms_bytes); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 568 | return -1; |
| 569 | } |
| 570 | |
| 571 | // TODO Power off |
| 572 | return 0; |
| 573 | } |
| 574 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 575 | static int read_apb_reg(struct ethosu_driver *drv, uint16_t da_data) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 576 | { |
| 577 | uint32_t *reg_p; |
| 578 | uint32_t start_address = (uint32_t)(da_data & APB_START_ADDR_MASK); |
| 579 | uint16_t num_reg = (da_data >> APB_NUM_REG_BIT_SHIFT) + 1; |
| 580 | |
| 581 | reg_p = (uint32_t *)malloc(num_reg * sizeof(uint32_t)); |
| 582 | if (reg_p == NULL) |
| 583 | { |
| 584 | LOG_INFO("read_apb_reg, Error! memory not allocated."); |
| 585 | return -1; |
| 586 | } |
| 587 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 588 | if (ETHOSU_SUCCESS == ethosu_read_apb_reg(&drv->dev, start_address, num_reg, reg_p)) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 589 | { |
| 590 | for (int i = 0; i < num_reg; i++) |
| 591 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 592 | LOG_INFO( |
| 593 | "NPU_REG ADDR 0x%04" PRIu32 " = 0x%08" PRIu32 "\n", (start_address + (i * BYTES_IN_32_BITS)), reg_p[i]); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 594 | } |
| 595 | } |
| 596 | else |
| 597 | { |
| 598 | free(reg_p); |
| 599 | return -1; |
| 600 | } |
| 601 | |
| 602 | free(reg_p); |
| 603 | return 0; |
| 604 | } |
| 605 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 606 | static int dump_shram(struct ethosu_driver *drv) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 607 | { |
| 608 | struct ethosu_config cfg; |
| 609 | uint32_t *shram_p; |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 610 | (void)ethosu_get_config(&drv->dev, &cfg); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 611 | |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 612 | LOG_INFO("dump_shram size = %" PRIu32 " KB\n", cfg.shram_size); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 613 | |
| 614 | shram_p = (uint32_t *)malloc(BYTES_1KB); |
| 615 | if (shram_p == NULL) |
| 616 | { |
| 617 | LOG_ERR("read_shram, Error! memory not allocated."); |
| 618 | return -1; |
| 619 | } |
| 620 | |
| 621 | for (uint32_t i = 0; i < cfg.shram_size; i++) |
| 622 | { |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 623 | ethosu_get_shram_data(&drv->dev, i, (uint32_t *)shram_p); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 624 | // Output 1KB of SHRAM |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 625 | LOG_INFO("***SHRAM SECTION %" PRIu32 "***\n", i); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 626 | for (int j = 0; j < (BYTES_1KB / BYTES_IN_32_BITS); j++) |
| 627 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 628 | LOG_INFO("[0x%04" PRIx32 "] %" PRIx32 "\n", (i * 1024 + j * 4), shram_p[j]); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 629 | } |
| 630 | } |
| 631 | free(shram_p); |
| 632 | |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | typedef struct |
| 637 | { |
| 638 | int number; |
| 639 | const char *name; |
| 640 | } name_lookup_t; |
| 641 | |
| 642 | static const name_lookup_t npu_reg_name_tbl[] = { |
| 643 | {0x200, "KERNEL_X"}, |
| 644 | {0x204, "KERNEL_Y"}, |
| 645 | {0x208, "KERNEL_W_M1"}, |
| 646 | {0x20C, "KERNEL_H_M1"}, |
| 647 | {0x210, "OFM_CBLK_WIDTH_M1"}, |
| 648 | {0x214, "OFM_CBLK_HEIGHT_M1"}, |
| 649 | {0x218, "OFM_CBLK_DEPTH_M1"}, |
| 650 | {0x21c, "IFM_CBLK_DEPTH_M1"}, |
| 651 | {0x220, "OFM_X"}, |
| 652 | {0x224, "OFM_Y"}, |
| 653 | {0x228, "OFM_Z"}, |
| 654 | {0x22C, "IFM_Z"}, |
| 655 | {0x230, "PAD_TOP"}, |
| 656 | {0x234, "PAD_LEFT"}, |
| 657 | {0x238, "IFM_CBLK_WIDTH"}, |
| 658 | {0x23C, "IFM_CBLK_HEIGHT"}, |
| 659 | {0x240, "DMA_IFM_SRC"}, |
| 660 | {0x244, "DMA_IFM_SRC_HI"}, |
| 661 | {0x248, "DMA_IFM_DST"}, |
| 662 | {0x24c, "DMA_OFM_SRC"}, |
| 663 | {0x250, "DMA_OFM_DST"}, |
| 664 | {0x254, "DMA_OFM_DST_HI"}, |
| 665 | {0x258, "DMA_WEIGHT_SRC"}, |
| 666 | {0x25c, "DMA_WEIGHT_SRC_HI"}, |
| 667 | {0x260, "DMA_CMD_SRC"}, |
| 668 | {0x264, "DMA_CMD_SRC_HI"}, |
| 669 | {0x268, "DMA_CMD_SIZE"}, |
| 670 | {0x26c, "DMA_M2M_SRC"}, |
| 671 | {0x270, "DMA_M2M_SRC_HI"}, |
| 672 | {0x274, "DMA_M2M_DST"}, |
| 673 | {0x278, "DMA_M2M_DST_HI"}, |
| 674 | {0x27c, "CURRENT_QREAD"}, |
| 675 | {0x280, "DMA_SCALE_SRC"}, |
| 676 | {0x284, "DMA_SCALE_SRC_HI"}, |
| 677 | {0x2BC, "CURRENT_CMD"}, |
| 678 | {0x800, "IFM_PAD_TOP"}, |
| 679 | {0x804, "IFM_PAD_LEFT"}, |
| 680 | {0x808, "IFM_PAD_RIGHT"}, |
| 681 | {0x80C, "IFM_PAD_BOTTOM"}, |
| 682 | {0x810, "IFM_DEPTH_M1"}, |
| 683 | {0x814, "IFM_PRECISION"}, |
| 684 | {0x81C, "IFM_UPSCALE"}, |
| 685 | {0x824, "IFM_ZERO_POINT"}, |
| 686 | {0x828, "IFM_WIDTH0_M1"}, |
| 687 | {0x82C, "IFM_HEIGHT0_M1"}, |
| 688 | {0x830, "IFM_HEIGHT1_M1"}, |
| 689 | {0x834, "IFM_IB_END"}, |
| 690 | {0x83C, "IFM_REGION"}, |
| 691 | {0x844, "OFM_WIDTH_M1"}, |
| 692 | {0x848, "OFM_HEIGHT_M1"}, |
| 693 | {0x84C, "OFM_DEPTH_M1"}, |
| 694 | {0x850, "OFM_PRECISION"}, |
| 695 | {0x854, "OFM_BLK_WIDTH_M1"}, |
| 696 | {0x858, "OFM_BLK_HEIGHT_M1"}, |
| 697 | {0x85C, "OFM_BLK_DEPTH_M1"}, |
| 698 | {0x860, "OFM_ZERO_POINT"}, |
| 699 | {0x868, "OFM_WIDTH0_M1"}, |
| 700 | {0x86C, "OFM_HEIGHT0_M1"}, |
| 701 | {0x870, "OFM_HEIGHT1_M1"}, |
| 702 | {0x87C, "OFM_REGION"}, |
| 703 | {0x880, "KERNEL_WIDTH_M1"}, |
| 704 | {0x884, "KERNEL_HEIGHT_M1"}, |
| 705 | {0x888, "KERNEL_STRIDE"}, |
| 706 | {0x88C, "PARALLEL_MODE"}, |
| 707 | {0x890, "ACC_FORMAT"}, |
| 708 | {0x894, "ACTIVATION"}, |
| 709 | {0x898, "ACTIVATION_MIN"}, |
| 710 | {0x89C, "ACTIVATION_MAX"}, |
| 711 | {0x8A0, "WEIGHT_REGION"}, |
| 712 | {0x8A4, "SCALE_REGION"}, |
| 713 | {0x8B4, "AB_START"}, |
| 714 | {0x8BC, "BLOCKDEP"}, |
| 715 | {0x8C0, "DMA0_SRC_REGION"}, |
| 716 | {0x8C4, "DMA0_DST_REGION"}, |
| 717 | {0x8C8, "DMA0_SIZE0"}, |
| 718 | {0x8CC, "DMA0_SIZE1"}, |
| 719 | {0x900, "IFM2_BROADCAST"}, |
| 720 | {0x904, "IFM2_SCALAR"}, |
| 721 | {0x924, "IFM2_ZERO_POINT"}, |
| 722 | {0x928, "IFM2_WIDTH0_M1"}, |
| 723 | {0x92C, "IFM2_HEIGHT0_M1"}, |
| 724 | {0x930, "IFM2_HEIGHT1_M1"}, |
| 725 | {0x934, "IFM2_IB_START"}, |
| 726 | {0x93C, "IFM2_REGION"}, |
| 727 | {0xA00, "IFM_BASE0"}, |
| 728 | {0xA04, "IFM_BASE0_HI"}, |
| 729 | {0xA08, "IFM_BASE1"}, |
| 730 | {0xA0C, "IFM_BASE1_HI"}, |
| 731 | {0xA10, "IFM_BASE2"}, |
| 732 | {0xA14, "IFM_BASE2_HI"}, |
| 733 | {0xA18, "IFM_BASE3"}, |
| 734 | {0xA1C, "IFM_BASE3_HI"}, |
| 735 | {0xA20, "IFM_STRIDE_X"}, |
| 736 | {0xA24, "IFM_STRIDE_X_HI"}, |
| 737 | {0xA28, "IFM_STRIDE_Y"}, |
| 738 | {0xA2C, "IFM_STRIDE_Y_HI"}, |
| 739 | {0xA30, "IFM_STRIDE_C"}, |
| 740 | {0xA34, "IFM_STRIDE_C_HI"}, |
| 741 | {0xA40, "OFM_BASE0"}, |
| 742 | {0xA44, "OFM_BASE0_HI"}, |
| 743 | {0xA48, "OFM_BASE1"}, |
| 744 | {0xA4C, "OFM_BASE1_HI"}, |
| 745 | {0xA50, "OFM_BASE2"}, |
| 746 | {0xA54, "OFM_BASE2_HI"}, |
| 747 | {0xA58, "OFM_BASE3"}, |
| 748 | {0xA5C, "OFM_BASE3_HI"}, |
| 749 | {0xA60, "OFM_STRIDE_X"}, |
| 750 | {0xA64, "OFM_STRIDE_X_HI"}, |
| 751 | {0xA68, "OFM_STRIDE_Y"}, |
| 752 | {0xA6C, "OFM_STRIDE_Y_HI"}, |
| 753 | {0xA70, "OFM_STRIDE_C"}, |
| 754 | {0xA74, "OFM_STRIDE_C_HI"}, |
| 755 | {0xA80, "WEIGHT_BASE"}, |
| 756 | {0xA84, "WEIGHT_BASE_HI"}, |
| 757 | {0xA88, "WEIGHT_LENGTH"}, |
| 758 | {0xA8C, "WEIGHT_LENGTH_HI"}, |
| 759 | {0xA90, "SCALE_BASE"}, |
| 760 | {0xA94, "SCALE_BASE_HI"}, |
| 761 | {0xA98, "SCALE_LENGTH"}, |
| 762 | {0xAA0, "OFM_SCALE"}, |
| 763 | {0xAA4, "OFM_SCALE_SHIFT"}, |
| 764 | {0xAA8, "OPA_SCALE "}, |
| 765 | {0xAB0, "OPB_SCALE"}, |
| 766 | {0xAC0, "DMA0_SRC"}, |
| 767 | {0xAC4, "DMA0_SRC_HI"}, |
| 768 | {0xAC8, "DMA0_DST"}, |
| 769 | {0xACC, "DMA0_DST_HI"}, |
| 770 | {0xAD0, "DMA0_LEN"}, |
| 771 | {0xAD4, "DMA0_LEN_HI"}, |
| 772 | {0xAD8, "DMA0_SKIP0"}, |
| 773 | {0xADC, "DMA0_SKIP0_HI"}, |
| 774 | {0xAE0, "DMA0_SKIP1"}, |
| 775 | {0xAE4, "DMA0_SKIP1_HI"}, |
| 776 | {0xB00, "IFM2_BASE0"}, |
| 777 | {0xB04, "IFM2_BASE0_HI"}, |
| 778 | {0xB08, "IFM2_BASE1"}, |
| 779 | {0xB0C, "IFM2_BASE1_HI"}, |
| 780 | {0xB10, "IFM2_BASE2"}, |
| 781 | {0xB14, "IFM2_BASE2_HI"}, |
| 782 | {0xB18, "IFM2_BASE3"}, |
| 783 | {0xB1C, "IFM2_BASE3_HI"}, |
| 784 | {0xB20, "IFM2_STRIDE_X"}, |
| 785 | {0xB24, "IFM2_STRIDE_X_HI"}, |
| 786 | {0xB28, "IFM2_STRIDE_Y"}, |
| 787 | {0xB2C, "IFM2_STRIDE_Y_HI"}, |
| 788 | {0xB30, "IFM2_STRIDE_C"}, |
| 789 | {0xB34, "IFM2_STRIDE_C_HI"}, |
| 790 | {0xB40, "WEIGHT1_BASE"}, |
| 791 | {0xB44, "WEIGHT1_BASE_HI"}, |
| 792 | {0xB48, "WEIGHT1_LENGTH"}, |
| 793 | {0xB4C, "WEIGHT1_LENGTH_HI"}, |
| 794 | {0xB50, "SCALE1_BASE"}, |
| 795 | {0xB54, "SCALE1_BASE_HI"}, |
| 796 | {0xB58, "SCALE1_LENGTH"}, |
| 797 | }; |
| 798 | |
| 799 | static const char *lookup_name(const name_lookup_t *lookup_table, int lookup_table_count, int find) |
| 800 | { |
| 801 | int n; |
| 802 | for (n = 0; n < lookup_table_count; n++) |
| 803 | { |
| 804 | if (lookup_table[n].number == find) |
| 805 | { |
| 806 | return lookup_table[n].name; |
| 807 | } |
| 808 | } |
| 809 | // Not found |
| 810 | return 0; |
| 811 | } |
| 812 | |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 813 | static void dump_npu_register(struct ethosu_driver *drv, int npu_reg, int npu_reg_end) |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 814 | { |
| 815 | unsigned int reg_val; |
| 816 | const char *reg_name; |
| 817 | int npu_reg_name_tbl_count = sizeof(npu_reg_name_tbl) / sizeof(npu_reg_name_tbl[0]); |
| 818 | |
| 819 | LOG_INFO("dump_register %X - %X\n", npu_reg, npu_reg_end); |
| 820 | for (; npu_reg <= npu_reg_end; npu_reg += sizeof(int)) |
| 821 | { |
Bhavik Patel | dae5be0 | 2020-06-18 15:25:15 +0200 | [diff] [blame] | 822 | reg_val = ethosu_read_reg(&drv->dev, npu_reg); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 823 | reg_name = lookup_name(npu_reg_name_tbl, npu_reg_name_tbl_count, npu_reg); |
| 824 | LOG_INFO("[0x%.4X] 0x%.8X\t%s\n", npu_reg, reg_val, (reg_name) ? reg_name : ""); |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | static const name_lookup_t cmd0_name_tbl[] = { |
| 829 | {0x000, "NPU_OP_STOP"}, |
| 830 | {0x001, "NPU_OP_IRQ"}, |
| 831 | {0x002, "NPU_OP_CONV"}, |
| 832 | {0x003, "NPU_OP_DEPTHWISE"}, |
| 833 | {0x004, "NPU_OP_VECTOR_PROD"}, |
| 834 | {0x005, "NPU_OP_POOL"}, |
| 835 | {0x006, "NPU_OP_ELEMENTWISE"}, |
| 836 | {0x010, "NPU_OP_DMA_START"}, |
| 837 | {0x011, "NPU_OP_DMA_WAIT"}, |
| 838 | {0x012, "NPU_OP_KERNEL_WAIT"}, |
| 839 | {0x100, "NPU_SET_IFM_PAD_TOP"}, |
| 840 | {0x101, "NPU_SET_IFM_PAD_LEFT"}, |
| 841 | {0x102, "NPU_SET_IFM_PAD_RIGHT"}, |
| 842 | {0x103, "NPU_SET_IFM_PAD_BOTTOM"}, |
| 843 | {0x104, "NPU_SET_IFM_DEPTH_M1"}, |
| 844 | {0x105, "NPU_SET_IFM_PRECISION"}, |
| 845 | {0x107, "NPU_SET_IFM_UPSCALE"}, |
| 846 | {0x109, "NPU_SET_IFM_ZERO_POINT"}, |
| 847 | {0x10A, "NPU_SET_IFM_WIDTH0_M1"}, |
| 848 | {0x10B, "NPU_SET_IFM_HEIGHT0_M1"}, |
| 849 | {0x10C, "NPU_SET_IFM_HEIGHT1_M1"}, |
| 850 | {0x10D, "NPU_SET_IFM_IB_END"}, |
| 851 | {0x10F, "NPU_SET_IFM_REGION"}, |
| 852 | {0x110, "NPU_SET_OFM_BATCH_SIZE_M1"}, |
| 853 | {0x111, "NPU_SET_OFM_WIDTH_M1"}, |
| 854 | {0x112, "NPU_SET_OFM_HEIGHT_M1"}, |
| 855 | {0x113, "NPU_SET_OFM_DEPTH_M1"}, |
| 856 | {0x114, "NPU_SET_OFM_PRECISION"}, |
| 857 | {0x115, "NPU_SET_OFM_BLK_WIDTH_M1"}, |
| 858 | {0x116, "NPU_SET_OFM_BLK_HEIGHT_M1"}, |
| 859 | {0x117, "NPU_SET_OFM_BLK_DEPTH_M1"}, |
| 860 | {0x118, "NPU_SET_OFM_ZERO_POINT"}, |
| 861 | {0x11A, "NPU_SET_OFM_WIDTH0_M1"}, |
| 862 | {0x11B, "NPU_SET_OFM_HEIGHT0_M1"}, |
| 863 | {0x11C, "NPU_SET_OFM_HEIGHT1_M1"}, |
| 864 | {0x11F, "NPU_SET_OFM_REGION"}, |
| 865 | {0x120, "NPU_SET_KERNEL_WIDTH_M1"}, |
| 866 | {0x121, "NPU_SET_KERNEL_HEIGHT_M1"}, |
| 867 | {0x122, "NPU_SET_KERNEL_STRIDE"}, |
| 868 | {0x124, "NPU_SET_ACC_FORMAT"}, |
| 869 | {0x125, "NPU_SET_ACTIVATION"}, |
| 870 | {0x126, "NPU_SET_ACTIVATION_MIN"}, |
| 871 | {0x127, "NPU_SET_ACTIVATION_MAX"}, |
| 872 | {0x128, "NPU_SET_WEIGHT_REGION"}, |
| 873 | {0x129, "NPU_SET_SCALE_REGION"}, |
| 874 | {0x12D, "NPU_SET_AB_START"}, |
| 875 | {0x12F, "NPU_SET_BLOCKDEP"}, |
| 876 | {0x130, "NPU_SET_DMA0_SRC_REGION"}, |
| 877 | {0x131, "NPU_SET_DMA0_DST_REGION"}, |
| 878 | {0x180, "NPU_SET_IFM2_BROADCAST"}, |
| 879 | {0x181, "NPU_SET_IFM2_SCALAR"}, |
| 880 | {0x185, "NPU_SET_IFM2_PRECISION"}, |
| 881 | {0x189, "NPU_SET_IFM2_ZERO_POINT"}, |
| 882 | {0x18A, "NPU_SET_IFM2_WIDTH0_M1"}, |
| 883 | {0x18B, "NPU_SET_IFM2_HEIGHT0_M1"}, |
| 884 | {0x18C, "NPU_SET_IFM2_HEIGHT1_M1"}, |
| 885 | {0x18D, "NPU_SET_IFM2_IB_START"}, |
| 886 | {0x18F, "NPU_SET_IFM2_REGION"}, |
| 887 | }; |
| 888 | |
| 889 | static const name_lookup_t cmd1_name_tbl[] = { |
| 890 | {0x000, "NPU_SET_IFM_BASE0"}, {0x001, "NPU_SET_IFM_BASE1"}, {0x002, "NPU_SET_IFM_BASE2"}, |
| 891 | {0x003, "NPU_SET_IFM_BASE3"}, {0x004, "NPU_SET_IFM_STRIDE_X"}, {0x005, "NPU_SET_IFM_STRIDE_Y"}, |
| 892 | {0x006, "NPU_SET_IFM_STRIDE_C"}, {0x007, "NPU_SET_IFM_STRIDE_N"}, {0x010, "NPU_SET_OFM_BASE0"}, |
| 893 | {0x011, "NPU_SET_OFM_BASE1"}, {0x012, "NPU_SET_OFM_BASE2"}, {0x013, "NPU_SET_OFM_BASE3"}, |
| 894 | {0x014, "NPU_SET_OFM_STRIDE_X"}, {0x015, "NPU_SET_OFM_STRIDE_Y"}, {0x016, "NPU_SET_OFM_STRIDE_C"}, |
| 895 | {0x017, "NPU_SET_OFM_STRIDE_N"}, {0x020, "NPU_SET_WEIGHT_BASE"}, {0x021, "NPU_SET_WEIGHT_LENGTH"}, |
| 896 | {0x022, "NPU_SET_SCALE_BASE"}, {0x023, "NPU_SET_SCALE_LENGTH"}, {0x024, "NPU_SET_OFM_SCALE"}, |
| 897 | {0x025, "NPU_SET_OPA_SCALE"}, {0x026, "NPU_SET_OPB_SCALE"}, {0x030, "NPU_SET_DMA0_SRC"}, |
| 898 | {0x031, "NPU_SET_DMA0_DST"}, {0x032, "NPU_SET_DMA0_LEN"}, {0x080, "NPU_SET_IFM2_BASE0"}, |
| 899 | {0x081, "NPU_SET_IFM2_BASE1"}, {0x082, "NPU_SET_IFM2_BASE2"}, {0x083, "NPU_SET_IFM2_BASE3"}, |
| 900 | {0x084, "NPU_SET_IFM2_STRIDE_X"}, {0x085, "NPU_SET_IFM2_STRIDE_Y"}, {0x086, "NPU_SET_IFM2_STRIDE_C"}, |
| 901 | }; |
| 902 | |
| 903 | static void dump_command_stream(const uint32_t *cmd_stream, const int cms_length, int qread) |
| 904 | { |
| 905 | int n; |
| 906 | int offset; |
| 907 | uint32_t cmd_val; |
| 908 | const uint8_t *cmd_ptr; |
| 909 | const char *cmd_name; |
| 910 | int cmd0_name_tbl_count = sizeof(cmd0_name_tbl) / sizeof(cmd0_name_tbl[0]); |
| 911 | int cmd1_name_tbl_count = sizeof(cmd1_name_tbl) / sizeof(cmd1_name_tbl[0]); |
| 912 | |
| 913 | LOG_INFO("dump_command_stream cmd_stream = 0x%8p cms_length = %d\n", cmd_stream, cms_length); |
| 914 | for (n = 0; n < cms_length; n++) |
| 915 | { |
| 916 | // Offset |
| 917 | offset = n * sizeof(int); |
| 918 | LOG_INFO("[%.4d] ", offset); |
| 919 | // Command |
| 920 | cmd_ptr = (const uint8_t *)&cmd_stream[n]; |
| 921 | LOG_INFO("0x%.2X 0x%.2X 0x%.2X 0x%.2X ", cmd_ptr[0], cmd_ptr[1], cmd_ptr[2], cmd_ptr[3]); |
| 922 | // Command name and payload |
| 923 | if (cmd_stream[n] & 0x4000) |
| 924 | { |
| 925 | cmd_name = lookup_name(cmd1_name_tbl, cmd1_name_tbl_count, cmd_stream[n] & 0x3FF); |
| 926 | n++; |
| 927 | cmd_val = cmd_stream[n]; |
| 928 | cmd_ptr = (const uint8_t *)&cmd_stream[n]; |
| 929 | LOG_INFO("0x%.2X 0x%.2X 0x%.2X 0x%.2X ", cmd_ptr[0], cmd_ptr[1], cmd_ptr[2], cmd_ptr[3]); |
| 930 | } |
| 931 | else |
| 932 | { |
| 933 | cmd_val = cmd_stream[n] >> 16; |
| 934 | cmd_name = lookup_name(cmd0_name_tbl, cmd0_name_tbl_count, cmd_stream[n] & 0x3FF); |
| 935 | } |
| 936 | if (cmd_name) |
| 937 | { |
Per Åstrand | 14ccfee | 2020-09-25 10:40:20 +0200 | [diff] [blame] | 938 | LOG_INFO("\t%s 0x%.8" PRIX32, cmd_name, cmd_val); |
Kristofer Jonsson | 49bdee8 | 2020-04-06 13:21:21 +0200 | [diff] [blame] | 939 | } |
| 940 | if (offset == qread) |
| 941 | { |
| 942 | LOG_INFO(" <<== QREAD\n"); |
| 943 | } |
| 944 | else |
| 945 | { |
| 946 | LOG_INFO("\n"); |
| 947 | } |
| 948 | } |
| 949 | } |