* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <cyg/hal/hal_io.h> // low level i/o
-#include <cyg/hal/hal_intr.h> // low level i/o
-
-//#define VERBOSE(a) a
-#define VERBOSE(a)
-
/* used to test manual mode */
#define TEST_MANUAL() 0
+#define VERBOSE(a)
+
+#if BUILD_ECOSBOARD
+
+#include <cyg/hal/hal_io.h> // low level i/o
+#include <cyg/hal/hal_intr.h> // low level i/o
#if 0
int diag_printf(const char *fmt, ...);
#define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b)
#endif
+#else
+
+/* redirect this to TCP/IP */
+#define ZY1000_PEEK(a, b) b = 1;
+#define ZY1000_POKE(a, b)
+
+#endif
+
+
+
// FIFO empty?
static __inline__ void waitIdle(void)
{
- cyg_uint32 empty;
+ uint32_t empty;
do
{
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty);
static __inline__ void sampleShiftRegister(void)
{
#if 0
- cyg_uint32 dummy;
+ uint32_t dummy;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, dummy);
#endif
static __inline__ void setCurrentState(enum tap_state state)
{
- cyg_uint32 a;
+ uint32_t a;
a = state;
int repeat = 0;
if (state == TAP_RESET)
* Enter state and cause repeat transitions *out* of that state. So if the endState != state, then
* the transition from state to endState counts as a transition out of state.
*/
-static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value)
+static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, uint32_t value)
{
- cyg_uint32 a,b;
+ uint32_t a,b;
a = state;
b = endState;
waitQueue();
#include <target/embeddedice.h>
#include <jtag/minidriver.h>
#include <jtag/interface.h>
+#include <time.h>
+
+
+#if BUILD_ECOSBOARD
#include "zy1000_version.h"
#include <cyg/hal/hal_io.h> // low level i/o
#include <cyg/hal/hal_diag.h>
-#include <time.h>
-
#ifdef CYGPKG_HAL_NIOS2
#include <cyg/hal/io.h>
#include <cyg/firmwareutil/firmwareutil.h>
#define ZYLIN_OPENOCD GIT_OPENOCD_VERSION
#define ZYLIN_OPENOCD_VERSION "ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE
+#endif
static int zy1000_khz(int khz, int *jtag_speed)
{
static bool readPowerDropout(void)
{
- cyg_uint32 state;
+ uint32_t state;
// sample and clear power dropout
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x80);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, state);
static bool readSRST(void)
{
- cyg_uint32 state;
+ uint32_t state;
// sample and clear SRST sensing
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x00000040);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, state);
}
+#if BUILD_ECOSBOARD
/* Give TELNET a way to find out what version this is */
static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
* and actual FPGA
*/
static char *fpga_id = "0x12345678 0x12345678 0x12345678 0x12345678";
- cyg_uint32 id, timestamp;
+ uint32_t id, timestamp;
HAL_READ_UINT32(SYSID_BASE, id);
HAL_READ_UINT32(SYSID_BASE+4, timestamp);
sprintf(fpga_id, "0x%08x 0x%08x 0x%08x 0x%08x", id, timestamp, SYSID_ID, SYSID_TIMESTAMP);
return JIM_OK;
}
-
+#endif
#ifdef CYGPKG_HAL_NIOS2
struct cyg_upgrade_info firmware_info =
{
- (cyg_uint8 *)0x84000000,
+ (uint8_t *)0x84000000,
"/ram/firmware.phi",
"Firmware",
0x0300000,
return JIM_ERR;
}
- cyg_uint32 status;
+ uint32_t status;
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, status);
Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80) != 0));
int zy1000_init(void)
{
+#if BUILD_ECOSBOARD
LOG_USER("%s", ZYLIN_OPENOCD_VERSION);
+#endif
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x30); // Turn on LED1 & LED2
int interface_jtag_execute_queue(void)
{
- cyg_uint32 empty;
+ uint32_t empty;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty);
-static cyg_uint32 getShiftValue(void)
+static uint32_t getShiftValue(void)
{
- cyg_uint32 value;
+ uint32_t value;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, value);
VERBOSE(LOG_INFO("getShiftValue %08x", value));
return value;
}
#if 0
-static cyg_uint32 getShiftValueFlip(void)
+static uint32_t getShiftValueFlip(void)
{
- cyg_uint32 value;
+ uint32_t value;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x18, value);
VERBOSE(LOG_INFO("getShiftValue %08x (flipped)", value));
#endif
#if 0
-static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endState, int repeat, cyg_uint32 value)
+static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endState, int repeat, uint32_t value)
{
VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_name(state), tap_state_name(endState), repeat, value));
- cyg_uint32 a,b;
+ uint32_t a,b;
a = state;
b = endState;
ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value);
// we have (num_bits + 7)/8 bytes of bits to toggle out.
// bits are pushed out LSB to MSB
- cyg_uint32 value;
+ uint32_t value;
value = 0;
if (out_value != NULL)
{
"With no arguments, prints status.",
.usage = "('on'|'off)",
},
+#if BUILD_ECOSBOARD
{
.name = "zy1000_version",
.mode = COMMAND_ANY,
.help = "Print version info for zy1000.",
.usage = "['openocd'|'zy1000'|'date'|'time'|'pcb'|'fpga']",
},
+#endif
{
.name = "powerstatus",
.mode = COMMAND_ANY,