projekty/Source/example1/src/jtag.c

Go to the documentation of this file.
00001 /*
00002  * $Id: jtag.c,v 1 2005/07/09 16:13:00 BorisK Exp $
00003  *
00004  * Copyright (C) 2004 ONTRACK s.r.o.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    
00019  * 02111-1307, USA.
00020  *
00021  * [1] ARM-based Microcontroller LPC2119/2129/2194/2292/9994, "Preliminary User Manual", February 03, 2004
00022  *
00023  * Written by Boris Kralik <kralikbo@yahoo.com>, 2005
00024  *
00025  */
00026 #include "jtag.h"
00027 
00028 #if GPIO
00029         void SetTDO_Value(short sValue)
00030         {
00031                 if (sValue){ 
00032                                 GPIO1_IOSET     |=      (1 << 27);      //TDO
00033                                 GPIO1_IOSET     |=      (1 << 18);      // ON Test LED
00034                                 #if 0
00035                                         UARTWriteStr("\n\rvoid SetTDO_Value(1)");
00036                                 #endif
00037                         }
00038                         else {
00039                                 #if 0
00040                                         UARTWriteStr("\n\rvoid SetTDO_Value(0)");
00041                                 #endif                          
00042                                 GPIO1_IOCLR     |=      (1 << 27);      //TDO
00043                                 GPIO1_IOCLR     |=      (1 << 18);      // OFF Test LED
00044                         }
00045         }
00046         SetRTCK_Value(short sValue)
00047         {
00048                 if (sValue){ 
00049                                 GPIO1_IOSET     |=      (1 << 26);      //RTCK
00050                                 GPIO1_IOSET     |=      (1 << 18);      // ON Test LED
00051                                 #if 0
00052                                         UARTWriteStr("\n\rvoid SetTDO_Value(1)");
00053                                 #endif
00054                         }
00055                         else {
00056                                 #if 0
00057                                         UARTWriteStr("\n\rvoid SetTDO_Value(0)");
00058                                 #endif                          
00059                                 GPIO1_IOCLR     |=      (1 << 26);      //RTCK
00060                                 GPIO1_IOCLR     |=      (1 << 18);      // OFF Test LED
00061                         }
00062         }
00063 #endif
00064 void jtagOff()
00065 {
00066         PCB_PINSEL2     &=      0xB;
00067         UARTWriteStr("\n\rJtagOff");
00068 }
00069 void JtagInitialize(){
00070         #if JTAG //initialize PINS P1.26, P1.27, P1.28, P1.29, P1.30, P1.31 as JTAG
00071                 PCB_PINSEL2     |=      (1 << 2);       // Jtag port
00072                 PCB_PINSEL2     |=      (1 << 3);       // Trace port
00073                 //PCB_PINSEL2   &=      0x0C;
00074                 UARTWriteStr("\n\rJtagInitialize:Jtag pins as JTAG");
00075         #else
00076                 #if DBG
00077                         UARTWriteStr("\n\rJtagInitialize: Jtag pins as GPIO\n\rON Test LED");
00078                 #endif
00079                 PCB_PINSEL1     =       0;
00080                 PCB_PINSEL2     =       0;              // Pins as GPIO Pins
00081                 GPIO1_IODIR     |=      (1 << 18);      // Test LED     
00082                 GPIO1_IOSET     |=      (1 << 18);      // ON Test LED
00083                 //Set JTAG pins
00084                 GPIO1_IODIR     |=      (1 << 27);      // TDO as OUTPUT
00085                 GPIO1_IODIR     &=      0xEFFFFFFF;     // TDI as INPUT
00086                 GPIO1_IODIR     &=      0x7FFFFFFF;     // TRST as INPUT
00087                 
00088                 //pause(ONE_MS); systime nefunguje Why ??
00089                 GPIO1_IOSET     |=      (1 << 27);      // ON TDO
00090                 GPIO1_IOSET     |=      (1 << 26);      // ON RTCK
00091                 printf("\n\rGPIO1_IOPIN:0x%X",GPIO1_IOPIN);
00092         #endif
00093 }
00094 #if GPIO
00095 void SetGPIOPins_In_OUT(void){
00096 }
00097 #endif

Generated on Fri Sep 21 13:41:54 2007 for example1 by  doxygen 1.4.7