Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 1 | /* |
| 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_DEVICE_H |
| 22 | #define ETHOSU_DEVICE_H |
| 23 | |
| 24 | /**************************************************************************** |
| 25 | * Includes |
| 26 | ****************************************************************************/ |
| 27 | |
| 28 | #include "ethosu_mailbox.h" |
| 29 | |
| 30 | #include <linux/device.h> |
| 31 | #include <linux/cdev.h> |
| 32 | #include <linux/io.h> |
| 33 | #include <linux/mutex.h> |
| 34 | #include <linux/workqueue.h> |
| 35 | |
| 36 | /**************************************************************************** |
| 37 | * Types |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | /** |
| 41 | * struct ethosu_device - Device structure |
| 42 | */ |
| 43 | struct ethosu_device { |
| 44 | struct device *dev; |
| 45 | struct cdev cdev; |
| 46 | struct class *class; |
| 47 | dev_t devt; |
| 48 | struct mutex mutex; |
| 49 | struct ethosu_mailbox mailbox; |
| 50 | struct list_head inference_list; |
| 51 | }; |
| 52 | |
| 53 | /**************************************************************************** |
| 54 | * Functions |
| 55 | ****************************************************************************/ |
| 56 | |
| 57 | /** |
| 58 | * ethosu_dev_init() - Initialize the device |
| 59 | * |
| 60 | * Return: 0 on success, else error code. |
| 61 | */ |
| 62 | int ethosu_dev_init(struct ethosu_device *edev, |
| 63 | struct device *dev, |
| 64 | struct class *class, |
| 65 | struct resource *in_queue, |
| 66 | struct resource *out_queue); |
| 67 | |
| 68 | /** |
| 69 | * ethosu_dev_deinit() - Initialize the device |
| 70 | */ |
| 71 | void ethosu_dev_deinit(struct ethosu_device *edev); |
| 72 | |
| 73 | #endif /* ETHOSU_DEVICE_H */ |