Hardware Design: SIE
Sign in or create your account | Project List | Help
Hardware Design: SIE Git Source Tree
Root/
| 1 | /* at91 XC Programer |
| 2 | |
| 3 | Copyright (C) 2006 Carlos Camargo, Andres Calderon |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, 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 | |
| 28 | extern "C" |
| 29 | { |
| 30 | #include "jz47xx_gpio.h" |
| 31 | } |
| 32 | |
| 33 | class 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 |
| 56 | bool |
| 57 | sakcXCProgrammer::txrx(bool tms, bool tdi) |
| 58 | { |
| 59 | tx(tms,tdi); |
| 60 | return jz_gpio_get_pin (JZ_GPIO_PORT_D, TDO); |
| 61 | } |
| 62 | |
| 63 | inline |
| 64 | void |
| 65 | sakcXCProgrammer::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 |
Branches:
master
