fpu.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2007
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * Author: Sergei Poselenov <sposelenov@emcraft.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <common.h>
  26. /*
  27. * FPU test
  28. *
  29. * This test checks the arithmetic logic unit (ALU) of CPU.
  30. * It tests independently various groups of instructions using
  31. * run-time modification of the code to reduce the memory footprint.
  32. * For more details refer to post/cpu/ *.c files.
  33. */
  34. #include <post.h>
  35. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  36. #include <watchdog.h>
  37. GNU_FPOST_ATTR
  38. extern int fpu_status (void);
  39. extern void fpu_enable (void);
  40. extern void fpu_disable (void);
  41. extern int fpu_post_test_math1 (void);
  42. extern int fpu_post_test_math2 (void);
  43. extern int fpu_post_test_math3 (void);
  44. extern int fpu_post_test_math4 (void);
  45. extern int fpu_post_test_math5 (void);
  46. extern int fpu_post_test_math6 (void);
  47. extern int fpu_post_test_math7 (void);
  48. int fpu_post_test (int flags)
  49. {
  50. int fpu = fpu_status ();
  51. int ret = 0;
  52. WATCHDOG_RESET ();
  53. if (!fpu)
  54. fpu_enable ();
  55. if (ret == 0)
  56. ret = fpu_post_test_math1 ();
  57. if (ret == 0)
  58. ret = fpu_post_test_math2 ();
  59. if (ret == 0)
  60. ret = fpu_post_test_math3 ();
  61. if (ret == 0)
  62. ret = fpu_post_test_math4 ();
  63. if (ret == 0)
  64. ret = fpu_post_test_math5 ();
  65. if (ret == 0)
  66. ret = fpu_post_test_math6 ();
  67. if (ret == 0)
  68. ret = fpu_post_test_math7 ();
  69. if (!fpu)
  70. fpu_disable ();
  71. WATCHDOG_RESET ();
  72. return ret;
  73. }
  74. #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */