Aggiornato il comment block dei log RCS
[bertos.git] / kern / proc_p.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 Internal scheduler structures and definitions for processes.
10  *
11  * \version $Id$
12  *
13  * \author Bernardo Innocenti <bernie@develer.com>
14  */
15
16 /*#*
17  *#* $Log$
18  *#* Revision 1.7  2004/08/25 14:12:09  rasky
19  *#* Aggiornato il comment block dei log RCS
20  *#*
21  *#* Revision 1.6  2004/08/24 16:05:15  bernie
22  *#* Add missing headers; Reformat.
23  *#*
24  *#* Revision 1.5  2004/08/14 19:37:57  rasky
25  *#* Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc.
26  *#*
27  *#* Revision 1.4  2004/07/30 14:24:16  rasky
28  *#* Task switching con salvataggio perfetto stato di interrupt (SR)
29  *#* Kernel monitor per dump informazioni su stack dei processi
30  *#*
31  *#* Revision 1.3  2004/07/14 14:18:09  rasky
32  *#* Merge da SC: Rimosso timer dentro il task, che รจ uno spreco di memoria per troppi task
33  *#*
34  *#* Revision 1.2  2004/06/03 11:27:09  bernie
35  *#* Add dual-license information.
36  *#*
37  *#* Revision 1.1  2004/05/23 17:27:00  bernie
38  *#* Import kern/ subdirectory.
39  *#*
40  *#* Revision 1.3  2004/05/14 12:52:13  rasky
41  *#* Importato supporto kernel per AVR da Stefano
42  *#*
43  *#* Revision 1.2  2004/04/28 16:13:49  rasky
44  *#* proc_schedule() is now semi-private (used only within the kernel)
45  *#*
46  *#* Revision 1.1  2004/04/26 18:02:40  rasky
47  *#* Importato microkernel
48  *#*
49  *#* Revision 1.1  2004/04/04 17:40:26  aleph
50  *#* Add multithreading kernel
51  *#*
52  *#*/
53 #ifndef KERN_PROC_P_H
54 #define KERN_PROC_P_H
55
56 #include "compiler.h"
57 #include "cpu.h"        /* for cpu_stack_t */
58 #include "config.h"
59 #include "config_kern.h"
60 #include <mware/list.h>
61
62 typedef struct Process
63 {
64         Node         link;        /*!< Link Process into scheduler lists */
65         cpustack_t  *stack;       /*!< Per-process SP */
66         IPTR         user_data;   /*!< Custom data passed to the process */
67
68 #if CONFIG_KERN_SIGNALS
69         sigset_t     sig_wait;    /*!< Signals the process is waiting for */
70         sigset_t     sig_recv;    /*!< Received signals */
71 #endif
72
73 #if CONFIG_KERN_HEAP
74         uint16_t     flags;       /*!< Flags */
75         cpustack_t  *stack_base;  /*!< Base of process stack */
76         size_t       stack_size;  /*!< Size of process stack */
77 #endif
78
79 #if CONFIG_KERN_MONITOR
80         struct ProcMonitor
81         {
82                 Node        link;
83                 const char *name;
84                 cpustack_t *stack_base;
85                 size_t      stack_size;
86         } monitor;
87 #endif
88
89 } Process;
90
91
92 /*!
93  * \name Flags for Process.flags
94  * \{
95  */
96 #define PF_FREESTACK  BV(0)  /*!< Free the stack when process dies */
97 /*\}*/
98
99
100 /*! Track running processes */
101 extern REGISTER Process *CurrentProcess;
102
103 /*! Track ready processes */
104 extern REGISTER List     ProcReadyList;
105
106
107 /*!
108  * Enqueue a task in the ready list
109  */
110 #define SCHED_ENQUEUE(proc)  ADDTAIL(&ProcReadyList, &(proc)->link)
111
112 /*! Schedule to another process *without* adding the current to the ready list */
113 void proc_schedule(void);
114
115 #endif /* KERN_PROC_P_H */
116