Kill warnings when !CONFIG_PROC_MONITOR.
[bertos.git] / kern / proc.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2001,2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
6  * This file is part of DevLib - See devlib/README for information.
7  * -->
8  *
9  * \brief Process scheduler (public interface).
10  *
11  * \version $Id$
12  *
13  * \author Bernardo Innocenti <bernie@develer.com>
14  */
15
16 /*#*
17  *#* $Log$
18  *#* Revision 1.7  2004/10/19 08:54:55  bernie
19  *#* Define forbid_cnt.
20  *#*
21  *#* Revision 1.6  2004/10/03 20:44:18  bernie
22  *#* Remove stale declarations (moved to monitor.h).
23  *#*
24  *#* Revision 1.2  2004/06/03 11:27:09  bernie
25  *#* Add dual-license information.
26  *#*
27  *#* Revision 1.1  2004/05/23 17:27:00  bernie
28  *#* Import kern/ subdirectory.
29  *#*
30  *#*/
31
32 #ifndef KERN_PROC_H
33 #define KERN_PROC_H
34
35 #include "compiler.h"
36 #include "cpu.h"
37 #include "config_kern.h"
38
39 /* Fwd decl */
40 struct Process;
41
42 /* Task scheduling services */
43 void proc_init(void);
44 struct Process *proc_new_with_name(const char* name, void (*entry)(void), IPTR data, size_t stacksize, cpustack_t *stack);
45
46 #if !CONFIG_KERN_MONITOR
47         #define proc_new(entry,data,size,stack) proc_new_with_name(NULL,(entry),(data),(size),(stack))
48 #else
49         #define proc_new(entry,data,size,stack) proc_new_with_name(#entry,(entry),(data),(size),(stack))
50 #endif
51
52 void proc_exit(void);
53 void proc_switch(void);
54 void proc_test(void);
55 struct Process* proc_current(void);
56 IPTR proc_current_user_data(void);
57 void proc_rename(struct Process* proc, const char* name);
58
59 #if CONFIG_KERN_PREEMPTIVE
60         void proc_forbid(void);
61         void proc_permit(void);
62 #else
63         INLINE void proc_forbid(void) { /* nop */ }
64         INLINE void proc_permit(void) { /* nop */ }
65 #endif
66
67 /*!
68  * Execute a block of \a CODE atomically with respect to task scheduling.
69  */
70 #define PROC_ATOMIC(CODE) \
71         do { \
72                 proc_forbid(); \
73                 CODE; \
74                 proc_permit(); \
75         } while(0)
76
77 #endif /* KERN_PROC_H */
78