Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
linux
rpmsg.h
Go to the documentation of this file.
1
/*
2
* Remote processor messaging
3
*
4
* Copyright (C) 2011 Texas Instruments, Inc.
5
* Copyright (C) 2011 Google, Inc.
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* * Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in
16
* the documentation and/or other materials provided with the
17
* distribution.
18
* * Neither the name Texas Instruments nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#ifndef _LINUX_RPMSG_H
36
#define _LINUX_RPMSG_H
37
38
#include <linux/types.h>
39
#include <linux/device.h>
40
#include <
linux/mod_devicetable.h
>
41
#include <
linux/kref.h
>
42
#include <
linux/mutex.h
>
43
44
/* The feature bitmap for virtio rpmsg */
45
#define VIRTIO_RPMSG_F_NS 0
/* RP supports name service notifications */
46
58
struct
rpmsg_hdr
{
59
u32
src
;
60
u32
dst
;
61
u32
reserved
;
62
u16
len
;
63
u16
flags
;
64
u8
data
[0];
65
}
__packed
;
66
79
struct
rpmsg_ns_msg
{
80
char
name
[
RPMSG_NAME_SIZE
];
81
u32
addr
;
82
u32
flags
;
83
}
__packed
;
84
91
enum
rpmsg_ns_flags
{
92
RPMSG_NS_CREATE
= 0,
93
RPMSG_NS_DESTROY
= 1,
94
};
95
96
#define RPMSG_ADDR_ANY 0xFFFFFFFF
97
98
struct
virtproc_info
;
99
110
struct
rpmsg_channel
{
111
struct
virtproc_info
*
vrp
;
112
struct
device
dev
;
113
struct
rpmsg_device_id
id
;
114
u32
src
;
115
u32
dst
;
116
struct
rpmsg_endpoint
*
ept
;
117
bool
announce
;
118
};
119
120
typedef
void
(*
rpmsg_rx_cb_t
)(
struct
rpmsg_channel
*,
void
*,
int
,
void
*,
u32
);
121
145
struct
rpmsg_endpoint
{
146
struct
rpmsg_channel
*
rpdev
;
147
struct
kref
refcount
;
148
rpmsg_rx_cb_t
cb
;
149
struct
mutex
cb_lock
;
150
u32
addr
;
151
void
*
priv
;
152
};
153
162
struct
rpmsg_driver
{
163
struct
device_driver
drv
;
164
const
struct
rpmsg_device_id
*
id_table
;
165
int
(*
probe
)(
struct
rpmsg_channel
*
dev
);
166
void
(*
remove
)(
struct
rpmsg_channel
*
dev
);
167
void
(*
callback
)(
struct
rpmsg_channel
*,
void
*,
int
,
void
*,
u32
);
168
};
169
170
int
register_rpmsg_device
(
struct
rpmsg_channel
*
dev
);
171
void
unregister_rpmsg_device
(
struct
rpmsg_channel
*
dev
);
172
int
register_rpmsg_driver
(
struct
rpmsg_driver
*drv);
173
void
unregister_rpmsg_driver
(
struct
rpmsg_driver
*drv);
174
void
rpmsg_destroy_ept
(
struct
rpmsg_endpoint
*);
175
struct
rpmsg_endpoint
*
rpmsg_create_ept
(
struct
rpmsg_channel
*,
176
rpmsg_rx_cb_t
cb
,
void
*
priv
,
u32
addr
);
177
int
178
rpmsg_send_offchannel_raw
(
struct
rpmsg_channel
*,
u32
,
u32
,
void
*,
int
,
bool
);
179
197
static
inline
int
rpmsg_send(
struct
rpmsg_channel
*
rpdev
,
void
*
data
,
int
len)
198
{
199
u32
src
= rpdev->
src
,
dst
= rpdev->
dst
;
200
201
return
rpmsg_send_offchannel_raw
(rpdev, src,
dst
, data, len,
true
);
202
}
203
222
static
inline
223
int
rpmsg_sendto(
struct
rpmsg_channel
*
rpdev
,
void
*
data
,
int
len,
u32
dst
)
224
{
225
u32
src
= rpdev->
src
;
226
227
return
rpmsg_send_offchannel_raw
(rpdev, src, dst, data, len,
true
);
228
}
229
250
static
inline
251
int
rpmsg_send_offchannel(
struct
rpmsg_channel
*
rpdev
,
u32
src
,
u32
dst
,
252
void
*
data
,
int
len)
253
{
254
return
rpmsg_send_offchannel_raw
(rpdev, src, dst, data, len,
true
);
255
}
256
273
static
inline
274
int
rpmsg_trysend(
struct
rpmsg_channel
*
rpdev
,
void
*
data
,
int
len)
275
{
276
u32
src
= rpdev->
src
,
dst
= rpdev->
dst
;
277
278
return
rpmsg_send_offchannel_raw
(rpdev, src,
dst
, data, len,
false
);
279
}
280
298
static
inline
299
int
rpmsg_trysendto(
struct
rpmsg_channel
*
rpdev
,
void
*
data
,
int
len,
u32
dst
)
300
{
301
u32
src
= rpdev->
src
;
302
303
return
rpmsg_send_offchannel_raw
(rpdev, src, dst, data, len,
false
);
304
}
305
325
static
inline
326
int
rpmsg_trysend_offchannel(
struct
rpmsg_channel
*
rpdev
,
u32
src
,
u32
dst
,
327
void
*
data
,
int
len)
328
{
329
return
rpmsg_send_offchannel_raw
(rpdev, src, dst, data, len,
false
);
330
}
331
332
#endif
/* _LINUX_RPMSG_H */
Generated on Thu Jan 10 2013 14:52:29 for Linux Kernel by
1.8.2