blob: 7ab420a42ed4f5e7c2b701a222c0e26209805205 [file] [log] [blame]
Kristofer Jonsson49bdee82020-04-06 13:21:21 +02001/*
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
19#pragma once
20
21/******************************************************************************
22 * Includes
23 ******************************************************************************/
24
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/******************************************************************************
32 * Defines
33 ******************************************************************************/
34
35/******************************************************************************
36 * Types
37 ******************************************************************************/
38
39struct ethosu_version_id
40{
41 // Ethos-U id
42 uint8_t version_status;
43 uint8_t version_minor;
44 uint8_t version_major;
45 uint8_t product_major;
46 uint8_t arch_patch_rev;
47 uint8_t arch_minor_rev;
48 uint8_t arch_major_rev;
49
50 // Driver Version
51 uint8_t driver_patch_rev;
52 uint8_t driver_minor_rev;
53 uint8_t driver_major_rev;
54};
55
56struct ethosu_version_config
57{
58 uint8_t macs_per_cc;
59 uint8_t cmd_stream_version;
60 uint8_t shram_size;
61};
62
63struct ethosu_version
64{
65 struct ethosu_version_id id;
66 struct ethosu_version_config cfg;
67};
68
69/******************************************************************************
70 * Prototypes
71 ******************************************************************************/
72
73/**
74 * Initialize the Ethos-U driver.
75 */
76int ethosu_init(void);
77
78/**
79 * Get Ethos-U version.
80 */
81int ethosu_get_version(struct ethosu_version *version);
82
83/**
84 * Invoke Vela command stream.
85 */
86int ethosu_invoke(const void *custom_data_ptr,
87 const int custom_data_size,
88 const uint64_t *base_addr,
89 const int num_base_addr);
90/**
91 * Abort Ethos-U inference.
92 */
93void ethosu_abort(void);
94
Per Åstrand25d78c02020-04-21 14:19:44 +020095/**
96 * Interrupt handler do be called on IRQ from Ethos-U
97 */
98void ethosu_irq_handler(void);
99
Kristofer Jonsson49bdee82020-04-06 13:21:21 +0200100#ifdef __cplusplus
101}
102#endif