Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ipm.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2015 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef ZEPHYR_INCLUDE_DRIVERS_IPM_H_
14#define ZEPHYR_INCLUDE_DRIVERS_IPM_H_
15
25#include <zephyr/kernel.h>
26#include <zephyr/device.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
47typedef void (*ipm_callback_t)(const struct device *ipmdev, void *user_data,
48 uint32_t id, volatile void *data);
49
56typedef int (*ipm_send_t)(const struct device *ipmdev, int wait, uint32_t id,
57 const void *data, int size);
64typedef int (*ipm_max_data_size_get_t)(const struct device *ipmdev);
65
72typedef uint32_t (*ipm_max_id_val_get_t)(const struct device *ipmdev);
73
80typedef void (*ipm_register_callback_t)(const struct device *port,
82 void *user_data);
83
90typedef int (*ipm_set_enabled_t)(const struct device *ipmdev, int enable);
91
98typedef void (*ipm_complete_t)(const struct device *ipmdev);
99
100__subsystem struct ipm_driver_api {
106#ifdef CONFIG_IPM_CALLBACK_ASYNC
107 ipm_complete_t complete;
108#endif
109};
110
146__syscall int ipm_send(const struct device *ipmdev, int wait, uint32_t id,
147 const void *data, int size);
148
149static inline int z_impl_ipm_send(const struct device *ipmdev, int wait,
150 uint32_t id,
151 const void *data, int size)
152{
153 const struct ipm_driver_api *api =
154 (const struct ipm_driver_api *)ipmdev->api;
155
156 return api->send(ipmdev, wait, id, data, size);
157}
158
167static inline void ipm_register_callback(const struct device *ipmdev,
168 ipm_callback_t cb, void *user_data)
169{
170 const struct ipm_driver_api *api =
171 (const struct ipm_driver_api *)ipmdev->api;
172
173 api->register_callback(ipmdev, cb, user_data);
174}
175
186__syscall int ipm_max_data_size_get(const struct device *ipmdev);
187
188static inline int z_impl_ipm_max_data_size_get(const struct device *ipmdev)
189{
190 const struct ipm_driver_api *api =
191 (const struct ipm_driver_api *)ipmdev->api;
192
193 return api->max_data_size_get(ipmdev);
194}
195
196
207__syscall uint32_t ipm_max_id_val_get(const struct device *ipmdev);
208
209static inline uint32_t z_impl_ipm_max_id_val_get(const struct device *ipmdev)
210{
211 const struct ipm_driver_api *api =
212 (const struct ipm_driver_api *)ipmdev->api;
213
214 return api->max_id_val_get(ipmdev);
215}
216
226__syscall int ipm_set_enabled(const struct device *ipmdev, int enable);
227
228static inline int z_impl_ipm_set_enabled(const struct device *ipmdev,
229 int enable)
230{
231 const struct ipm_driver_api *api =
232 (const struct ipm_driver_api *)ipmdev->api;
233
234 return api->set_enabled(ipmdev, enable);
235}
236
251__syscall void ipm_complete(const struct device *ipmdev);
252
253static inline void z_impl_ipm_complete(const struct device *ipmdev)
254{
255#ifdef CONFIG_IPM_CALLBACK_ASYNC
256 const struct ipm_driver_api *api =
257 (const struct ipm_driver_api *)ipmdev->api;
258
259 if (api->complete != NULL) {
260 api->complete(ipmdev);
261 }
262#endif
263}
264
265#ifdef __cplusplus
266}
267#endif
268
273#include <zephyr/syscalls/ipm.h>
274
275#endif /* ZEPHYR_INCLUDE_DRIVERS_IPM_H_ */
int ipm_max_data_size_get(const struct device *ipmdev)
Return the maximum number of bytes possible in an outbound message.
uint32_t ipm_max_id_val_get(const struct device *ipmdev)
Return the maximum id value possible in an outbound message.
void(* ipm_register_callback_t)(const struct device *port, ipm_callback_t cb, void *user_data)
Callback API upon registration.
Definition: ipm.h:80
int(* ipm_set_enabled_t)(const struct device *ipmdev, int enable)
Callback API upon enablement of interrupts.
Definition: ipm.h:90
void ipm_complete(const struct device *ipmdev)
Signal asynchronous command completion.
static void ipm_register_callback(const struct device *ipmdev, ipm_callback_t cb, void *user_data)
Register a callback function for incoming messages.
Definition: ipm.h:167
int ipm_set_enabled(const struct device *ipmdev, int enable)
Enable interrupts and callbacks for inbound channels.
int(* ipm_max_data_size_get_t)(const struct device *ipmdev)
Callback API to get maximum data size.
Definition: ipm.h:64
int(* ipm_send_t)(const struct device *ipmdev, int wait, uint32_t id, const void *data, int size)
Callback API to send IPM messages.
Definition: ipm.h:56
void(* ipm_complete_t)(const struct device *ipmdev)
Callback API upon command completion.
Definition: ipm.h:98
int ipm_send(const struct device *ipmdev, int wait, uint32_t id, const void *data, int size)
Try to send a message over the IPM device.
uint32_t(* ipm_max_id_val_get_t)(const struct device *ipmdev)
Callback API to get the ID's maximum value.
Definition: ipm.h:72
void(* ipm_callback_t)(const struct device *ipmdev, void *user_data, uint32_t id, volatile void *data)
Callback API for incoming IPM messages.
Definition: ipm.h:47
Public kernel APIs.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
void * data
Address of the device instance private data.
Definition: device.h:413
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409
Definition: ipm.h:100
ipm_register_callback_t register_callback
Definition: ipm.h:102
ipm_max_data_size_get_t max_data_size_get
Definition: ipm.h:103
ipm_max_id_val_get_t max_id_val_get
Definition: ipm.h:104
ipm_set_enabled_t set_enabled
Definition: ipm.h:105
ipm_send_t send
Definition: ipm.h:101