blob: aab3507dd31afa81bfe046eaa5b7b63dfeac4b82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* @file
* @brief Chrome OS-specific API for Serial Host Interface (SHI)
*/
#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_
#define ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_
/**
* @brief CROS Serial Host Interface Driver APIs
* @defgroup cros_shi_interface CROS Serial Host Interface Driver APIs
* @ingroup io_interfaces
* @{
*/
#include <kernel.h>
#include <device.h>
/**
* @cond INTERNAL_HIDDEN
*
* cros Serial Host Interface driver API definition and system call entry points
*
* (Internal use only.)
*/
typedef int (*cros_shi_api_enable)(const struct device *dev);
typedef int (*cros_shi_api_disable)(const struct device *dev);
/** @brief Driver API structure. */
__subsystem struct cros_shi_driver_api {
cros_shi_api_enable enable;
cros_shi_api_disable disable;
};
/**
* @brief Enable SHI module.
*
* @param dev Pointer to the device structure for the driver instance.
*
* @retval non-negative if successful.
* @retval Negative errno code if failure.
*/
__syscall int cros_shi_enable(const struct device *dev);
static inline int z_impl_cros_shi_enable(const struct device *dev)
{
const struct cros_shi_driver_api *api =
(const struct cros_shi_driver_api *)dev->api;
if (!api->enable) {
return -ENOTSUP;
}
return api->enable(dev);
}
/**
* @brief Disable SHI module.
*
* @param dev Pointer to the device structure for the driver instance.
*
* @retval no return if successful.
* @retval Negative errno code if failure.
*/
__syscall int cros_shi_disable(const struct device *dev);
static inline int z_impl_cros_shi_disable(const struct device *dev)
{
const struct cros_shi_driver_api *api =
(const struct cros_shi_driver_api *)dev->api;
if (!api->disable) {
return -ENOTSUP;
}
return api->disable(dev);
}
/**
* @}
*/
#include <syscalls/cros_shi.h>
#endif /* ZEPHYR_INCLUDE_DRIVERS_CROS_SHI_H_ */
|