reset.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * Carsten Langgaard, carstenl@mips.com
  3.  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
  4.  *
  5.  * ########################################################################
  6.  *
  7.  *  This program is free software; you can distribute it and/or modify it
  8.  *  under the terms of the GNU General Public License (Version 2) as
  9.  *  published by the Free Software Foundation.
  10.  *
  11.  *  This program is distributed in the hope it will be useful, but WITHOUT
  12.  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13.  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14.  *  for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License along
  17.  *  with this program; if not, write to the Free Software Foundation, Inc.,
  18.  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  19.  *
  20.  * ########################################################################
  21.  *
  22.  * Reset the MIPS boards.
  23.  *
  24.  */
  25. #include <linux/config.h>
  26. #include <asm/mips-boards/generic.h>
  27. #if defined(CONFIG_MIPS_ATLAS)
  28. #include <asm/mips-boards/atlas.h>
  29. #endif
  30. void machine_restart(char *command) __attribute__((noreturn));
  31. void machine_halt(void) __attribute__((noreturn));
  32. #if defined(CONFIG_MIPS_ATLAS)
  33. void machine_power_off(void) __attribute__((noreturn));
  34. #endif
  35. void machine_restart(char *command)
  36. {
  37.         volatile unsigned int *softres_reg = (void *)SOFTRES_REG;
  38. *softres_reg = GORESET;
  39. }
  40. void machine_halt(void)
  41. {
  42.         volatile unsigned int *softres_reg = (void *)SOFTRES_REG;
  43. *softres_reg = GORESET;
  44. }
  45. void machine_power_off(void)
  46. {
  47. #if defined(CONFIG_MIPS_ATLAS)
  48.         volatile unsigned int *psustby_reg = (void *)ATLAS_PSUSTBY_REG;
  49. *psustby_reg = ATLAS_GOSTBY;
  50. #else
  51. machine_halt();
  52. #endif
  53. }