Xenomai  3.0.5
apc.h
1 /*
2  * Copyright (C) 2012 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_KERNEL_APC_H
20 #define _COBALT_KERNEL_APC_H
21 
22 #include <linux/ipipe.h>
23 #include <asm/xenomai/machine.h>
24 
30 int xnapc_alloc(const char *name,
31  void (*handler)(void *cookie),
32  void *cookie);
33 
34 void xnapc_free(int apc);
35 
36 static inline void __xnapc_schedule(int apc)
37 {
38  unsigned long *p = &raw_cpu_ptr(&cobalt_machine_cpudata)->apc_pending;
39 
40  if (!__test_and_set_bit(apc, p))
41  ipipe_post_irq_root(cobalt_pipeline.apc_virq);
42 }
43 
66 static inline void xnapc_schedule(int apc)
67 {
68  unsigned long flags;
69 
70  flags = ipipe_test_and_stall_head() & 1;
71  __xnapc_schedule(apc);
72  ipipe_restore_head(flags);
73 }
74 
75 void apc_dispatch(unsigned int virq, void *arg);
76 
79 #endif /* !_COBALT_KERNEL_APC_H */
static void xnapc_schedule(int apc)
Schedule an APC invocation.
Definition: apc.h:66
int xnapc_alloc(const char *name, void(*handler)(void *cookie), void *cookie)
Allocate an APC slot.
Definition: apc.c:112
void xnapc_free(int apc)
Releases an APC slot.
Definition: apc.c:152