From dab1fa7ea5375575776f8ba4552b7bc21df7eb1b Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 13 Feb 2013 21:01:37 +0100 Subject: digital/zigbit/common: add common reset function --- digital/zigbit/common/reset.c | 31 +++++++++++++++++++++++++++++++ digital/zigbit/common/reset.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 digital/zigbit/common/reset.c create mode 100644 digital/zigbit/common/reset.h (limited to 'digital/zigbit/common') diff --git a/digital/zigbit/common/reset.c b/digital/zigbit/common/reset.c new file mode 100644 index 00000000..fcdce5a3 --- /dev/null +++ b/digital/zigbit/common/reset.c @@ -0,0 +1,31 @@ +/* reset.c */ +/* reset related functions. {{{ + * + * Copyright (C) 2012 Florent Duchon + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * This program 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. + * + * 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. + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ + +/* This function resets the avr using the embedded watchdog */ +void reset_avr(void) +{ + wdt_enable (WDTO_15MS); + while (1); +} diff --git a/digital/zigbit/common/reset.h b/digital/zigbit/common/reset.h new file mode 100644 index 00000000..79a526cc --- /dev/null +++ b/digital/zigbit/common/reset.h @@ -0,0 +1,32 @@ +/* reset.h */ +/* reset related functions. {{{ + * + * Copyright (C) 2012 Florent Duchon + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * This program 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. + * + * 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. + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ + +#ifndef _RESET_H +#define _RESET_H + +/* This function resets the avr using the embedded watchdog */ +void reset_avr(void); + +#endif -- cgit v1.2.3