Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 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 | |
| 26 | #include <common.h> |
| 27 | |
| 28 | /* |
| 29 | * FPU test |
| 30 | * |
| 31 | * This test checks the arithmetic logic unit (ALU) of CPU. |
| 32 | * It tests independently various groups of instructions using |
| 33 | * run-time modification of the code to reduce the memory footprint. |
| 34 | * For more details refer to post/cpu/ *.c files. |
| 35 | */ |
| 36 | |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 37 | #include <post.h> |
| 38 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 39 | #if CONFIG_POST & CONFIG_SYS_POST_FPU |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 40 | |
| 41 | #include <watchdog.h> |
| 42 | |
Yuri Tikhonov | ce82ff0 | 2008-12-20 14:54:21 +0300 | [diff] [blame] | 43 | GNU_FPOST_ATTR |
| 44 | |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 45 | extern int fpu_status (void); |
| 46 | extern void fpu_enable (void); |
| 47 | extern void fpu_disable (void); |
| 48 | |
| 49 | extern int fpu_post_test_math1 (void); |
| 50 | extern int fpu_post_test_math2 (void); |
| 51 | extern int fpu_post_test_math3 (void); |
| 52 | extern int fpu_post_test_math4 (void); |
| 53 | extern int fpu_post_test_math5 (void); |
| 54 | extern int fpu_post_test_math6 (void); |
| 55 | extern int fpu_post_test_math7 (void); |
| 56 | |
| 57 | int fpu_post_test (int flags) |
| 58 | { |
| 59 | int fpu = fpu_status (); |
| 60 | |
| 61 | int ret = 0; |
| 62 | |
| 63 | WATCHDOG_RESET (); |
| 64 | |
| 65 | if (!fpu) |
| 66 | fpu_enable (); |
| 67 | |
| 68 | if (ret == 0) |
| 69 | ret = fpu_post_test_math1 (); |
| 70 | if (ret == 0) |
| 71 | ret = fpu_post_test_math2 (); |
| 72 | if (ret == 0) |
| 73 | ret = fpu_post_test_math3 (); |
| 74 | if (ret == 0) |
| 75 | ret = fpu_post_test_math4 (); |
| 76 | if (ret == 0) |
| 77 | ret = fpu_post_test_math5 (); |
| 78 | if (ret == 0) |
| 79 | ret = fpu_post_test_math6 (); |
| 80 | if (ret == 0) |
| 81 | ret = fpu_post_test_math7 (); |
| 82 | |
| 83 | if (!fpu) |
| 84 | fpu_disable (); |
| 85 | |
| 86 | WATCHDOG_RESET (); |
| 87 | |
| 88 | return ret; |
| 89 | } |
| 90 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 91 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |