1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2 /*
3 * Remote Processor Procedure Call Driver
4 *
5 * Copyright (C) 2012-2019 Texas Instruments Incorporated - http://www.ti.com/
6 */
8 #ifndef _LINUX_RPMSG_RPC_H_
9 #define _LINUX_RPMSG_RPC_H_
11 #include <uapi/linux/rpmsg_rpc.h>
13 #define RPPC_MAX_NUM_FUNCS (1024)
14 #define RPPC_MAX_CHANNEL_NAMELEN (64)
15 #define RPPC_MAX_FUNC_NAMELEN (64)
16 #define RPPC_MAX_NUM_PARAMS (10)
18 /**
19 * enum rppc_param_direction - direction of the function parameter
20 * @RPPC_PARAMDIR_IN: input argument
21 * @RPPC_PARAMDIR_OUT: output argument
22 * @RPPC_PARAMDIR_BI: an in and out argument
23 * @RPPC_PARAMDIR_MAX: limit value for the direction type
24 *
25 * The parameter direction is described as relative to the function.
26 */
27 enum rppc_param_direction {
28 RPPC_PARAMDIR_IN = 0,
29 RPPC_PARAMDIR_OUT,
30 RPPC_PARAMDIR_BI,
31 RPPC_PARAMDIR_MAX
32 };
34 /**
35 * enum rppc_param_datatype - parameter data type and descriptor flags
36 * @RPPC_PARAM_VOID: parameter is of type 'void'
37 * @RPPC_PARAM_S08: parameter is of type 's8'
38 * @RPPC_PARAM_U08: parameter is of type 'u8'
39 * @RPPC_PARAM_S16: parameter is of type 's16'
40 * @RPPC_PARAM_U16: parameter is of type 'u16'
41 * @RPPC_PARAM_S32: parameter is of type 's32'
42 * @RPPC_PARAM_U32: parameter is of type 'u32'
43 * @RPPC_PARAM_S64: parameter is of type 's64'
44 * @RPPC_PARAM_U64: parameter is of type 'u64'
45 * @RPPC_PARAM_ATOMIC_MAX: limit value for scalar data types
46 * @RPPC_PARAM_MASK: mask field for retrieving the scalar data type
47 * @RPPC_PARAM_PTR: flag to indicate the data type is a pointer
48 * @RPPC_PARAM_MAX: max limit value used as a marker
49 *
50 * This enum is used to describe the data type for the parameters.
51 * A pointer of a data type is reflected by using an additional bit
52 * mask field.
53 */
54 enum rppc_param_datatype {
55 RPPC_PARAM_VOID = 0,
56 RPPC_PARAM_S08,
57 RPPC_PARAM_U08,
58 RPPC_PARAM_S16,
59 RPPC_PARAM_U16,
60 RPPC_PARAM_S32,
61 RPPC_PARAM_U32,
62 RPPC_PARAM_S64,
63 RPPC_PARAM_U64,
64 RPPC_PARAM_ATOMIC_MAX,
66 RPPC_PARAM_MASK = 0x7F,
67 RPPC_PARAM_PTR = 0x80,
69 RPPC_PARAM_MAX
70 };
72 /*
73 * helper macros to deal with parameter types
74 */
75 #define RPPC_PTR_TYPE(type) ((type) | RPPC_PARAM_PTR)
76 #define RPPC_IS_PTR(type) ((type) & RPPC_PARAM_PTR)
77 #define RPPC_IS_ATOMIC(type) (((type) > RPPC_PARAM_VOID) && \
78 ((type) < RPPC_PARAM_ATOMIC_MAX))
80 #endif /* _LINUX_RPMSG_RPC_H_ */