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