summaryrefslogtreecommitdiffstats
path: root/include/linux/tegra-capture-ivc.h
blob: f6a9bcd690276ad2e28216ede104bc8eabbc9761 (plain) (blame)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Tegra capture IVC driver.
 *
 * Copyright (c) 2017-2021, NVIDIA CORPORATION.  All rights reserved.
 *
 * NVIDIA CORPORATION and its licensors retain all intellectual property
 * and proprietary rights in and to this software, related documentation
 * and any modifications thereto.  Any use, reproduction, disclosure or
 * distribution of this software and related documentation without an express
 * license agreement from NVIDIA CORPORATION is strictly prohibited.
 */

#ifndef INCLUDE_CAPTURE_IVC_H
#define INCLUDE_CAPTURE_IVC_H

#include <linux/types.h>

/*
 * Submit the control message binary blob to capture-IVC driver,
 * which is to be transfered over control IVC channel to RTCPU.
 *
 * @param[in] control_desc: binary blob containing control message descriptor,
 * is opaque to capture-IVC driver.
 * @param[in] len: size of control_desc.
 */
int tegra_capture_ivc_control_submit(const void *control_desc, size_t len);

/*
 * Submit the capture message binary blob to capture-IVC driver,
 * which is to be transfered over capture IVC channel to RTCPU.
 *
 * @param[in] capture_desc: binary blob containing capture message descriptor,
 * is opaque to KMDs.
 * @param[in] len: size of capture_desc.
 */
int tegra_capture_ivc_capture_submit(const void *capture_desc, size_t len);

/*
 * Callback function to be registered by client to receive the rtcpu
 * notifications through control or capture IVC channel.
 *
 * @param[in] resp_desc: binary blob containing the response message received
 * from rtcpu through control or capture IVC channel, its opaque to KMDs.
 * @param[in] priv_context: Client's private context, opaque to
 * capture-IVC driver.
 */
typedef void (*tegra_capture_ivc_cb_func)(const void *resp_desc,
		const void *priv_context);

/*
 * Register callback function to receive response messages from rtcpu through
 * control IVC channel.
 *
 * @param[in] control_resp_cb: callback function to be registered for
 * control IVC channel.
 * @param[in] priv_context: client's private context, opaque to
 * capture-IVC driver.
 * @param[out] trans_id: temporary id assigned by capture-IVC driver, for the
 * clients whose unique chan_id is not yet allocated by RTCPU, to match their
 * responses with the requests.
 *
 */
int tegra_capture_ivc_register_control_cb(
		tegra_capture_ivc_cb_func control_resp_cb,
		uint32_t *trans_id, const void *priv_context);

/*
 * Notify client’s channel ID to capture-IVC driver.
 *
 * Once client gets the newly allocated channel ID from RTCPU, it has to
 * notify it to capture-IVC driver also, so that it can replace the temporary
 * ID trans_id with the new channel ID chan_id in its internal context.
 * IVC driver uses this unique channel ID for mapping upcoming responses
 * with the client requests.
 *
 * @param[in] chan_id: new channel id allocated by RTCPU for the client,
 * capture-IVC driver uses to refer the client for its future control responses.
 * @param[in] trans_id: temporary id assigned by capture-IVC driver,
 * for the client.
 */
int tegra_capture_ivc_notify_chan_id(uint32_t chan_id, uint32_t trans_id);

/*
 * Register callback function to receive status-indication messages from
 * rtcpu through capture IVC channel.
 *
 * @param[in] capture_status_ind_cb: callback function to be registered for
 * capture ivc channel.
 * @param[in] chan_id: client's channel id, capture-IVC driver uses it refer
 * the client for its capture responses.
 * @param[in] priv_context: client's private context, opaque to
 * capture-IVC driver.
 */
int tegra_capture_ivc_register_capture_cb(
		tegra_capture_ivc_cb_func capture_status_ind_cb,
		uint32_t chan_id, const void *priv_context);

/*
 * Un-register callback function to stop receiving messages over control ivc
 * channel.
 *
 * @param[in] id: client's channel id or transaction id, for which the callback
 * needs to be unregistered.
 */
int tegra_capture_ivc_unregister_control_cb(uint32_t id);

/*
 * Un-register callback function to stop receiving messages over capture ivc
 * channel.
 *
 * @param[in] chan_id: client's channel id, for which the callback needs to be
 * unregistered.
 */
int tegra_capture_ivc_unregister_capture_cb(uint32_t chan_id);

/*
 * Read number of pending capture control ivc messages
 *
 */
int tegra_capture_ivc_capture_control_can_read(void);

/*
 * Read number of pending capture status ivc messages
 *
 */

int tegra_capture_ivc_capture_status_can_read(void);

#endif /* INCLUDE_CAPTURE_IVC_H */