Merge da SC: Rimosso timer dentro il task, che è uno spreco di memoria per troppi...
[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.3  2004/07/14 14:18:09  rasky
19  * Merge da SC: Rimosso timer dentro il task, che è uno spreco di memoria per troppi task
20  *
21  * Revision 1.2  2004/06/03 11:27:09  bernie
22  * Add dual-license information.
23  *
24  * Revision 1.1  2004/05/23 17:27:00  bernie
25  * Import kern/ subdirectory.
26  *
27  * Revision 1.3  2004/05/14 12:52:13  rasky
28  * Importato supporto kernel per AVR da Stefano
29  *
30  * Revision 1.2  2004/04/28 16:13:49  rasky
31  * proc_schedule() is now semi-private (used only within the kernel)
32  *
33  * Revision 1.1  2004/04/26 18:02:40  rasky
34  * Importato microkernel
35  *
36  * Revision 1.1  2004/04/04 17:40:26  aleph
37  * Add multithreading kernel
38  *
39  */
40
41 #ifndef KERN_PROC_P_H
42 #define KERN_PROC_P_H
43
44 #include "compiler.h"
45 #include "config.h"
46 #include "config_kern.h"
47 #include <mware/list.h>
48
49
50 typedef struct Process
51 {
52         Node         link;        /*!< Link Process into scheduler lists */
53         cpustack_t  *stack;       /*!< Per-process SP */
54
55 #if CONFIG_KERN_SIGNALS
56         sigset_t     sig_wait;    /*!< Signals the process is waiting for */
57         sigset_t     sig_recv;    /*!< Received signals */
58 #endif
59
60 #if CONFIG_KERN_HEAP
61         uint16_t     flags;       /*!< Flags */
62         cpustack_t  *stack_base;  /*!< Base of process stack */
63         size_t       stack_size;  /*!< Size of process stack */
64 #endif
65 } Process;
66
67
68 /*!
69  * \name Flags for Process.flags
70  * \{
71  */
72 #define PF_FREESTACK  BV(0)  /*!< Free the stack when process dies */
73 /*\}*/
74
75
76 /*! Track running processes */
77 extern REGISTER Process *CurrentProcess;
78
79 /*! Track ready processes */
80 extern REGISTER List     ProcReadyList;
81
82
83 /*!
84  * Enqueue a task in the ready list
85  */
86 #define SCHED_ENQUEUE(proc)  ADDTAIL(&ProcReadyList, &(proc)->link)
87
88 /*! Schedule to another process *without* adding the current to the ready list */
89 void proc_schedule(void);
90
91 #endif /* KERN_PROC_P_H */
92