Root/Software/xc3sprog/sakcXCProgrammer.h

1/* at91 XC Programer
2
3Copyright (C) 2006 Carlos Camargo, Andres Calderon
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
19
20
21#ifndef SAKC_XCP_H
22#define SAKC_XCP_H
23
24#include "iobase.h"
25#include <unistd.h>
26
27
28extern "C"
29{
30  #include "jz47xx_gpio.h"
31}
32
33class sakcXCProgrammer: public IOBase
34{
35 public:
36  sakcXCProgrammer();
37  virtual ~sakcXCProgrammer();
38  virtual bool txrx(bool tms, bool tdi);
39  virtual void tx(bool tms, bool tdi);
40  
41  bool checkError(){return error;}
42  
43  bool done(){return true; /*!error && (cpld_base[0]&DONE==DONE);*/}
44
45 protected:
46  bool error;
47  unsigned char data;
48};
49
50#define TDI 14 /*C*/
51#define TMS 23 /*D*/
52#define TDO 24 /*D*/
53#define TCK 28 /*D*/
54
55 inline
56bool
57sakcXCProgrammer::txrx(bool tms, bool tdi)
58{
59 tx(tms,tdi);
60 return jz_gpio_get_pin (JZ_GPIO_PORT_D, TDO);
61}
62
63inline
64void
65sakcXCProgrammer::tx(bool tms, bool tdi)
66{
67  jz_gpio_out (JZ_GPIO_PORT_D, TCK, 0);
68  jz_gpio_out (JZ_GPIO_PORT_C, TDI, tdi);
69  jz_gpio_out (JZ_GPIO_PORT_D, TMS, tms);
70  jz_gpio_out (JZ_GPIO_PORT_D, TCK, 1);
71}
72
73
74#endif // JTAGBUS_H
75
76

Archive Download this file

Branches:
master



interactive