1 /*
2 * Remote processor messaging sockets
3 *
4 * Copyright (c) 2011-2013, Texas Instruments Incorporated
5 * All rights reserved.
6 *
7 * Ohad Ben-Cohen <ohad@wizery.com>
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * * Neither the name of Texas Instruments Incorporated nor the names of
21 * its contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
31 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
34 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 #ifndef __NET_RPMSG_H
37 #define __NET_RPMSG_H
39 #include <linux/types.h>
40 #include <sys/socket.h>
42 /* user space needs this */
43 #ifndef AF_RPMSG
44 #ifdef IPC_BUILDOS_ANDROID
45 #include <uapi/linux/version.h>
46 #else
47 #include <linux/version.h>
48 #endif
49 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
50 #define AF_RPMSG 40
51 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
52 #define AF_RPMSG 41
53 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
54 #define AF_RPMSG 42
55 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
56 #define AF_RPMSG 43
57 #else
58 #define AF_RPMSG 44
59 #endif /* LINUX_VERSION_CODE */
60 #endif /* AF_RPMSG */
62 /* Connection and socket states */
63 enum {
64 RPMSG_CONNECTED = 1, /* wait_for_packet() wants this... */
65 RPMSG_OPEN,
66 RPMSG_LISTENING,
67 RPMSG_CLOSED,
68 };
70 struct sockaddr_rpmsg {
71 sa_family_t family;
72 __u32 vproc_id;
73 __u32 addr;
74 };
76 #define RPMSG_LOCALHOST ((__u32) ~0UL)
78 #endif /* __NET_RPMSG_H */