/* fpga_prog.c, Copyright 1997 (c) by M. Eisenring, Swiss Federal Institute of Technology, Computer Engineering and Networks Laboratory. TOPSY -- A Teachable Operating System. Implementation of a tiny and simple micro kernel for teaching purposes. For further information, please visit http://www.tik.ee.ethz.ch/~topsy This software is provided under the terms of the GNU General Public Licence. A full copy of the GNU GPL is provided in the file COPYING found in the development root of Topsy. */ /***************************************************************************** Programmingroutine for the XILINX XC4005 FPGA on add-on FPGA-BOARD on R3052-Evaluation BOARD 7RS385 Author : M. Eisenring File : fpga_prog.c Last modification : 13.5.97, Bernard Stauffer ******************************************************************************/ #include "IOConsole.h" #include "IODevice.h" #include "fpga_prog.h" /****************************************************************************/ /* wait for some time */ /****************************************************************************/ void wait(unsigned int TIME) { unsigned long i; for (i=0;i1000) { err = 1; /* Set Error 1 */ eSetLED(EPLD_LED3); /* FPGA never READY */ } } while (FPGA_STATUS==0); } j = 0; /* check if no error occured */ FPGA_STATUS = *Ereg2; FPGA_STATUS = FPGA_STATUS & mask_Init; if (FPGA_STATUS==0) { err = 2; /* Set Error 2 */ break; } } } eClearLED(EPLD_LED2); /* check error 1 */ if (err != 0) eSetLED(EPLD_LED0); /* signal error 1 */ else { for (i=0;i FPGA goes in configuration mode */ /******************************************************************************/ void ClearFPGA() { int i; unsigned long mask; mask = 0; *Ereg2 = mask; /* force RESET and PROGRAM down */ for (i=0;i