blob: 827ce4f545256054d18bdcd93491e15cfa71f6a6 [file] [log] [blame]
Kristofer Jonsson116a6352020-08-20 17:25:23 +02001/*
2 * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
3 *
4 * This program is free software and is provided to you under the terms of the
5 * GNU General Public License version 2 as published by the Free Software
6 * Foundation, and any use by you of this program is subject to the terms
7 * of such GNU licence.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * SPDX-License-Identifier: GPL-2.0-only
19 */
20
21#ifndef ETHOSU_CORE_INTERFACE_H
22#define ETHOSU_CORE_INTERFACE_H
23
24#ifdef __KERNEL__
25#include <linux/types.h>
26#else
27#include <stdint.h>
28#endif
29
30/**
31 * enum ethosu_core_msg_type - Message types
32 *
33 * Types for the messages sent between the host and the core subsystem.
34 */
35enum ethosu_core_msg_type {
36 ETHOSU_CORE_MSG_PING = 1,
37 ETHOSU_CORE_MSG_PONG,
38 ETHOSU_CORE_MSG_INFERENCE_REQ,
39 ETHOSU_CORE_MSG_INFERENCE_RSP,
40 ETHOSU_CORE_MSG_MAX
41};
42
43/**
44 * struct ethosu_core_msg - Message header
45 */
46struct ethosu_core_msg {
47 uint32_t type;
48 uint32_t length;
49};
50
51/**
52 * struct ethosu_core_queue_header - Message queue header
53 */
54struct ethosu_core_queue_header {
55 uint32_t size;
56 uint32_t read;
57 uint32_t write;
58};
59
60/**
61 * struct ethosu_core_queue - Message queue
62 *
63 * Dynamically sized message queue.
64 */
65struct ethosu_core_queue {
66 struct ethosu_core_queue_header header;
67 uint8_t data[];
68};
69
70enum ethosu_core_status {
71 ETHOSU_CORE_STATUS_OK,
72 ETHOSU_CORE_STATUS_ERROR
73};
74
75struct ethosu_core_buffer {
76 uint32_t ptr;
77 uint32_t size;
78};
79
80struct ethosu_core_inference_req {
81 uint64_t user_arg;
82 struct ethosu_core_buffer ifm;
83 struct ethosu_core_buffer ofm;
84 struct ethosu_core_buffer network;
85};
86
87struct ethosu_core_inference_rsp {
88 uint64_t user_arg;
89 uint32_t ofm_size;
90 uint32_t status;
91};
92
93#endif