]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/ti-openamp-test.git/blob - rpmsg.h
test: Add rpmsg proto socket test code
[processor-sdk/ti-openamp-test.git] / rpmsg.h
1 /*
2  * Remote processor messaging sockets
3  *
4  * Copyright (c) 2011-2017, 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 __RPMSG_H
37 #define __RPMSG_H
39 #include <linux/types.h>
40 #include <sys/socket.h>
42 /* user space needs this */
43 #ifndef AF_RPMSG
44 #include <linux/version.h>
45 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
46 #define AF_RPMSG        40
47 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
48 #define AF_RPMSG        41
49 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
50 #define AF_RPMSG        42
51 #else
52 #define AF_RPMSG        43
53 #endif /* LINUX_VERSION_CODE */
54 #endif /* AF_RPMSG */
56 /* Connection and socket states */
57 enum {
58         RPMSG_CONNECTED = 1, /* wait_for_packet() wants this... */
59         RPMSG_OPEN,
60         RPMSG_LISTENING,
61         RPMSG_CLOSED,
62 };
64 struct sockaddr_rpmsg {
65         sa_family_t family;
66         __u32 vproc_id;
67         __u32 addr;
68 };
70 #define RPMSG_LOCALHOST ((__u32) ~0UL)
72 #endif /* __RPMSG_H */