1 /*
2 * Copyright (c) 2011-2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its 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 "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /*
33 * ======== rpmsg_omx.h ========
34 *
35 * These must match definitions in the Linux rpmsg_omx driver.
36 */
38 #ifndef _RPMSGOMX_H_
39 #define _RPMSGOMX_H_
41 /**
42 * enum omx_msg_types - various message types currently supported
43 *
44 * @OMX_CONN_REQ: a connection request message type. the message should carry
45 * the name of the OMX service which we try to connect to. An instance of
46 * that service will be created remotely, and its address will be sent as
47 * a reply.
48 *
49 * @OMX_CONN_RSP: a response to a connection request. the message will carry
50 * an error code (success/failure), and if connection established successfully,
51 * the addr field will carry the address of the newly created OMX instance.
52 *
53 * @OMX_PING_MSG: a ping message. should trigger a pong message as a response,
54 * with the same payload the ping had, used for testing purposes.
55 *
56 * @OMX_PONG_MSG: a response to a ping. should carry the same payload that
57 * the ping had. used for testing purposes.
58 *
59 * @OMX_DISC_REQ: a disconnect request message type. the message should carry
60 * the address of the OMX service previously received from the OMX_CONN_RSP
61 * message.
62 *
63 * @OMX_RAW_MSG: a message that should be propagated as-is to the user.
64 * this would immediately enable user space development to start.
65 * as we progress, most likely this message won't be needed anymore.
66 *
67 * @OMX_DISC_RSP: a disconnect response message type. the message should carry
68 * the status from the OMX_DISC_REQ message.
69 */
70 enum omx_msg_types {
71 OMX_CONN_REQ = 0,
72 OMX_CONN_RSP = 1,
73 OMX_PING_MSG = 2,
74 OMX_PONG_MSG = 3,
75 OMX_DISC_REQ = 4,
76 OMX_RAW_MSG = 5,
77 OMX_DISC_RSP = 6
78 };
80 /**
81 * enum omx_error_codes - various error codes that will be used
82 *
83 * @OMX_SUCCESS: success
84 *
85 * @OMX_NOTSUPP: not supported
86 *
87 * @OMX_NOMEM: remote processor is out of memory
88 *
89 * @OMX_FAIL: general failure.
90 */
91 enum omx_error_codes {
92 OMX_SUCCESS = 0,
93 OMX_NOTSUPP = 1,
94 OMX_NOMEM = 2,
95 OMX_FAIL = 3
96 };
98 /**
99 * struct omx_msg_hdr - common header for all OMX messages
100 * @type:type of message, see enum omx_msg_types
101 * @len:length of msg payload (in bytes)
102 * @data:the msg payload (depends on the message type)
103 *
104 * All OMX messages will start with this common header (which will begin
105 * right after the standard rpmsg header ends).
106 */
107 struct omx_msg_hdr {
108 UInt32 type;
109 UInt32 len;
110 Char data[1];
111 };
113 /* define this here because we cannot use data[0] in struct above */
114 #define HDRSIZE (2 * sizeof(UInt))
116 struct omx_connect_req {
117 Char name[48];
118 };
120 struct omx_connect_rsp {
121 UInt32 status;
122 UInt32 addr;
123 };
125 struct omx_disc_req {
126 UInt32 addr;
127 };
129 struct omx_disc_rsp {
130 UInt32 status;
131 };
133 #endif