X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=kern%2Fproc_p.h;h=8fbb0ed0a723d8ddd5a440c09f8fb519f6c795a6;hb=2535cb94ec2183791128f8bbd109ca69a960cf78;hp=5daf0dd0d47568c7c610c308fc7152a45faa5e24;hpb=99ebec567d8485806f6ebe23b8c8a1b825d0cf4d;p=bertos.git diff --git a/kern/proc_p.h b/kern/proc_p.h old mode 100755 new mode 100644 index 5daf0dd0..8fbb0ed0 --- a/kern/proc_p.h +++ b/kern/proc_p.h @@ -1,105 +1,120 @@ -/*! +/** * \file * - * - * \brief Internal scheduler structures and definitions for processes. - * - * \version $Id$ + * This file is part of BeRTOS. * - * \author Bernardo Innocenti - */ - -/* - * $Log$ - * Revision 1.4 2004/07/30 14:24:16 rasky - * Task switching con salvataggio perfetto stato di interrupt (SR) - * Kernel monitor per dump informazioni su stack dei processi + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * Revision 1.3 2004/07/14 14:18:09 rasky - * Merge da SC: Rimosso timer dentro il task, che è uno spreco di memoria per troppi task + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Revision 1.2 2004/06/03 11:27:09 bernie - * Add dual-license information. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * Revision 1.1 2004/05/23 17:27:00 bernie - * Import kern/ subdirectory. + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. * - * Revision 1.3 2004/05/14 12:52:13 rasky - * Importato supporto kernel per AVR da Stefano + * Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999, 2000, 2001 Bernardo Innocenti * - * Revision 1.2 2004/04/28 16:13:49 rasky - * proc_schedule() is now semi-private (used only within the kernel) + * --> * - * Revision 1.1 2004/04/26 18:02:40 rasky - * Importato microkernel + * \brief Internal scheduler structures and definitions for processes. * - * Revision 1.1 2004/04/04 17:40:26 aleph - * Add multithreading kernel + * \version $Id$ * + * \author Bernardo Innocenti */ #ifndef KERN_PROC_P_H #define KERN_PROC_P_H -#include "compiler.h" -#include "config.h" -#include "config_kern.h" +#include +#include /* for cpu_stack_t */ #include +#include +#include typedef struct Process { - Node link; /*!< Link Process into scheduler lists */ - cpustack_t *stack; /*!< Per-process SP */ + Node link; /**< Link Process into scheduler lists */ + cpustack_t *stack; /**< Per-process SP */ + iptr_t user_data; /**< Custom data passed to the process */ #if CONFIG_KERN_SIGNALS - sigset_t sig_wait; /*!< Signals the process is waiting for */ - sigset_t sig_recv; /*!< Received signals */ + sigmask_t sig_wait; /**< Signals the process is waiting for */ + sigmask_t sig_recv; /**< Received signals */ +#endif + +#if CONFIG_KERN_PREEMPTIVE + int forbid_cnt; /**< Nesting count for proc_forbid()/proc_permit(). */ #endif #if CONFIG_KERN_HEAP - uint16_t flags; /*!< Flags */ - cpustack_t *stack_base; /*!< Base of process stack */ - size_t stack_size; /*!< Size of process stack */ + uint16_t flags; /**< Flags */ + cpustack_t *stack_base; /**< Base of process stack */ + size_t stack_size; /**< Size of process stack */ #endif #if CONFIG_KERN_MONITOR struct ProcMonitor { - Node link; - cpustack_t* stack_base; - size_t stack_size; + Node link; + const char *name; + cpustack_t *stack_base; + size_t stack_size; } monitor; #endif } Process; -/*! - * \name Flags for Process.flags +/** + * \name Flags for Process.flags. * \{ */ -#define PF_FREESTACK BV(0) /*!< Free the stack when process dies */ +#define PF_FREESTACK BV(0) /**< Free the stack when process dies */ /*\}*/ -/*! Track running processes */ +/** Track running processes. */ extern REGISTER Process *CurrentProcess; -/*! Track ready processes */ +/** Track ready processes. */ extern REGISTER List ProcReadyList; -/*! - * Enqueue a task in the ready list - */ +/** Enqueue a task in the ready list. */ #define SCHED_ENQUEUE(proc) ADDTAIL(&ProcReadyList, &(proc)->link) -/*! Schedule to another process *without* adding the current to the ready list */ +/** Schedule to another process *without* adding the current to the ready list. */ void proc_schedule(void); +#if CONFIG_KERN_MONITOR + /** Initialize the monitor */ + void monitor_init(void); + + /** Register a process into the monitor */ + void monitor_add(Process *proc, const char *name, cpustack_t *stack, size_t stacksize); + + /** Unregister a process from the monitor */ + void monitor_remove(Process *proc); + + /** Rename a process */ + void monitor_rename(Process *proc, const char* name); +#endif /* CONFIG_KERN_MONITOR */ + #endif /* KERN_PROC_P_H */