Xenomai 3.3.2
Loading...
Searching...
No Matches
rtnet_rtpc.h
1/***
2 *
3 * include/rtnet_rtpc.h
4 *
5 * RTnet - real-time networking subsystem
6 *
7 * Copyright (C) 2003, 2004 Jan Kiszka <jan.kiszka@web.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#ifndef __RTNET_RTPC_H_
26#define __RTNET_RTPC_H_
27
28#include <linux/init.h>
29
30#include <rtnet_internal.h>
31
32struct rt_proc_call;
33
34typedef int (*rtpc_proc)(struct rt_proc_call *call);
35typedef void (*rtpc_copy_back_proc)(struct rt_proc_call *call, void *priv_data);
36typedef void (*rtpc_cleanup_proc)(void *priv_data);
37
38struct rt_proc_call {
39 struct list_head list_entry;
40 int processed;
41 rtpc_proc proc;
42 int result;
43 atomic_t ref_count;
44 wait_queue_head_t call_wq;
45 rtpc_cleanup_proc cleanup_handler;
46 char priv_data[0] __attribute__((aligned(8)));
47};
48
49#define CALL_PENDING 1000 /* result value for blocked calls */
50
51int rtnet_rtpc_dispatch_call(rtpc_proc rt_proc, unsigned int timeout,
52 void *priv_data, size_t priv_data_size,
53 rtpc_copy_back_proc copy_back_handler,
54 rtpc_cleanup_proc cleanup_handler);
55
56void rtnet_rtpc_complete_call(struct rt_proc_call *call, int result);
57void rtnet_rtpc_complete_call_nrt(struct rt_proc_call *call, int result);
58
59#define rtpc_dispatch_call rtnet_rtpc_dispatch_call
60#define rtpc_complete_call rtnet_rtpc_complete_call
61#define rtpc_complete_call_nrt rtnet_rtpc_complete_call_nrt
62
63#define rtpc_get_priv(call, type) (type *)(call->priv_data)
64#define rtpc_get_result(call) call->result
65#define rtpc_set_result(call, new_result) call->result = new_result
66#define rtpc_set_cleanup_handler(call, handler) call->cleanup_handler = handler;
67
68int __init rtpc_init(void);
69void rtpc_cleanup(void);
70
71#endif /* __RTNET_RTPC_H_ */
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition atomic.h:24