fpu.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2007
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * Author: Sergei Poselenov <sposelenov@emcraft.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. /*
  11. * FPU test
  12. *
  13. * This test checks the arithmetic logic unit (ALU) of CPU.
  14. * It tests independently various groups of instructions using
  15. * run-time modification of the code to reduce the memory footprint.
  16. * For more details refer to post/cpu/ *.c files.
  17. */
  18. #include <post.h>
  19. GNU_FPOST_ATTR
  20. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  21. #include <watchdog.h>
  22. extern int fpu_status (void);
  23. extern void fpu_enable (void);
  24. extern void fpu_disable (void);
  25. extern int fpu_post_test_math1 (void);
  26. extern int fpu_post_test_math2 (void);
  27. extern int fpu_post_test_math3 (void);
  28. extern int fpu_post_test_math4 (void);
  29. extern int fpu_post_test_math5 (void);
  30. extern int fpu_post_test_math6 (void);
  31. extern int fpu_post_test_math7 (void);
  32. int fpu_post_test (int flags)
  33. {
  34. int fpu = fpu_status ();
  35. int ret = 0;
  36. WATCHDOG_RESET ();
  37. if (!fpu)
  38. fpu_enable ();
  39. if (ret == 0)
  40. ret = fpu_post_test_math1 ();
  41. if (ret == 0)
  42. ret = fpu_post_test_math2 ();
  43. if (ret == 0)
  44. ret = fpu_post_test_math3 ();
  45. if (ret == 0)
  46. ret = fpu_post_test_math4 ();
  47. if (ret == 0)
  48. ret = fpu_post_test_math5 ();
  49. if (ret == 0)
  50. ret = fpu_post_test_math6 ();
  51. if (ret == 0)
  52. ret = fpu_post_test_math7 ();
  53. if (!fpu)
  54. fpu_disable ();
  55. WATCHDOG_RESET ();
  56. return ret;
  57. }
  58. #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */