rpmsg_rpc.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Remote Processor Procedure Call Driver
  3. *
  4. * Copyright (C) 2012-2017 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the name Texas Instruments nor the names of its
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. #ifndef _LINUX_RPMSG_RPC_H_
  33. #define _LINUX_RPMSG_RPC_H_
  34. #include <uapi/linux/rpmsg_rpc.h>
  35. #define RPPC_MAX_NUM_FUNCS (1024)
  36. #define RPPC_MAX_CHANNEL_NAMELEN (64)
  37. #define RPPC_MAX_FUNC_NAMELEN (64)
  38. #define RPPC_MAX_NUM_PARAMS (10)
  39. /**
  40. * enum rppc_param_direction - direction of the function parameter
  41. * @RPPC_PARAMDIR_IN: input argument
  42. * @RPPC_PARAMDIR_OUT: output argument
  43. * @RPPC_PARAMDIR_BI: an in and out argument
  44. * @RPPC_PARAMDIR_MAX: limit value for the direction type
  45. *
  46. * The parameter direction is described as relative to the function.
  47. */
  48. enum rppc_param_direction {
  49. RPPC_PARAMDIR_IN = 0,
  50. RPPC_PARAMDIR_OUT,
  51. RPPC_PARAMDIR_BI,
  52. RPPC_PARAMDIR_MAX
  53. };
  54. /**
  55. * enum rppc_param_datatype - parameter data type and descriptor flags
  56. * @RPPC_PARAM_VOID: parameter is of type 'void'
  57. * @RPPC_PARAM_S08: parameter is of type 's8'
  58. * @RPPC_PARAM_U08: parameter is of type 'u8'
  59. * @RPPC_PARAM_S16: parameter is of type 's16'
  60. * @RPPC_PARAM_U16: parameter is of type 'u16'
  61. * @RPPC_PARAM_S32: parameter is of type 's32'
  62. * @RPPC_PARAM_U32: parameter is of type 'u32'
  63. * @RPPC_PARAM_S64: parameter is of type 's64'
  64. * @RPPC_PARAM_U64: parameter is of type 'u64'
  65. * @RPPC_PARAM_ATOMIC_MAX: limit value for scalar data types
  66. * @RPPC_PARAM_MASK: mask field for retrieving the scalar data type
  67. * @RPPC_PARAM_PTR: flag to indicate the data type is a pointer
  68. * @RPPC_PARAM_MAX: max limit value used as a marker
  69. *
  70. * This enum is used to describe the data type for the parameters.
  71. * A pointer of a data type is reflected by using an additional bit
  72. * mask field.
  73. */
  74. enum rppc_param_datatype {
  75. RPPC_PARAM_VOID = 0,
  76. RPPC_PARAM_S08,
  77. RPPC_PARAM_U08,
  78. RPPC_PARAM_S16,
  79. RPPC_PARAM_U16,
  80. RPPC_PARAM_S32,
  81. RPPC_PARAM_U32,
  82. RPPC_PARAM_S64,
  83. RPPC_PARAM_U64,
  84. RPPC_PARAM_ATOMIC_MAX,
  85. RPPC_PARAM_MASK = 0x7F,
  86. RPPC_PARAM_PTR = 0x80,
  87. RPPC_PARAM_MAX
  88. };
  89. /*
  90. * helper macros to deal with parameter types
  91. */
  92. #define RPPC_PTR_TYPE(type) ((type) | RPPC_PARAM_PTR)
  93. #define RPPC_IS_PTR(type) ((type) & RPPC_PARAM_PTR)
  94. #define RPPC_IS_ATOMIC(type) (((type) > RPPC_PARAM_VOID) && \
  95. ((type) < RPPC_PARAM_ATOMIC_MAX))
  96. #endif /* _LINUX_RPMSG_RPC_H_ */