base/include/rtai_wd.h

Go to the documentation of this file.
00001 /* 00002 * Development of this (watchdog) module was sponsored by Alcatel, Strasbourg 00003 * as part of general debugging enhancements to RTAI. 00004 * 00005 * Copyright (©) 2001 Ian Soanes <ians@lineo.com>, All rights reserved 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef _RTAI_WD_H 00023 #define _RTAI_WD_H 00024 00025 #include <rtai_types.h> 00026 00027 // Useful bits and pieces 00028 #define NSECS_PER_SEC 1000000000 00029 00030 // For logging stuff 00031 #define WDLOG(fmt, args...) rt_printk("RTAI[watchdog]: " fmt, ##args) 00032 00033 // What should happen to misbehaving tasks 00034 typedef enum watchdog_policy { 00035 WD_NOTHING, // Not recommended 00036 WD_RESYNC, // Good for occasional overruns 00037 WD_DEBUG, // Good for debugging oneshot tasks 00038 WD_STRETCH, // Good for overrunning tasks 00039 WD_SLIP, // Good for infinite loops 00040 WD_SUSPEND, // Good for most things 00041 WD_KILL // Death sentence 00042 } wd_policy; 00043 00044 // Information about a misbehaving task 00045 typedef struct bad_rt_task { 00046 RT_TASK *task; // Pointer to the bad task 00047 int in_use; // Allocated (static memory management) 00048 int slipping; // In the process of being slipped 00049 int countdown; // Watchdog ticks to stay suspended 00050 int count; // How many times it's offended 00051 int valid; // Still an existing RT task 00052 int forced; // Forcibly suspended 00053 RTIME orig_period; // Original period before adjustments 00054 wd_policy policy; // Policy at time of last offence 00055 struct bad_rt_task *next; // Next in list 00056 } BAD_RT_TASK; 00057 00058 #ifdef __cplusplus 00059 extern "C" { 00060 #endif /* __cplusplus */ 00061 00062 int __rtai_wd_init(void); 00063 00064 void __rtai_wd_exit(void); 00065 00066 // API for setting parameters 00067 int rt_wdset_grace(int new_value); 00068 00069 int rt_wdset_gracediv(int new_value); 00070 00071 wd_policy rt_wdset_policy(wd_policy new_value); 00072 00073 int rt_wdset_slip(int new_value); 00074 00075 int rt_wdset_stretch(int new_value); 00076 00077 int rt_wdset_limit(int new_value); 00078 00079 int rt_wdset_safety(int new_value); 00080 00081 #ifdef __cplusplus 00082 } 00083 #endif /* __cplusplus */ 00084 00085 #endif /* !_RTAI_WD_H */

Generated on Thu Nov 20 11:49:50 2008 for RTAI API by doxygen 1.3.8