From 2dc576d25f02d1f65df639b0a858a03df437cfca Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 13 Jan 2014 16:04:14 -0600 Subject: Hard reset user device on connection and disconnection of FPGA viewer --- servers/fpga_server_lin/src/fpga_conn.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'servers/fpga_server_lin/src') diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp index e17f134..0e1aa17 100644 --- a/servers/fpga_server_lin/src/fpga_conn.cpp +++ b/servers/fpga_server_lin/src/fpga_conn.cpp @@ -111,6 +111,13 @@ void FPGASocket::connectionClosedHandler() { printf("[DEBUG] Connection from %s closed\n\r", m_remoteHost.ascii()); fflush(stdout); } + if (m_interfaceType == "gpmc") { + // Reset user device + write_gpmc(0x0c, read_gpmc(0x0c) | 0x03); + usleep(100); + write_gpmc(0x0c, read_gpmc(0x0c) & ~0x03); + } + if (m_criticalSection > 0) { throw exit_exception(-1); } @@ -254,6 +261,11 @@ int FPGASocket::setupGPMC() { } printf("[DEBUG] Detected a compatible uLab hardware debug interface (model number 0x%02x, firmware version 0x%02x)\n", model, version); + // Reset user device + write_gpmc(0x0c, read_gpmc(0x0c) | 0x03); + usleep(100); + write_gpmc(0x0c, read_gpmc(0x0c) & ~0x03); + // Clear out DSP and LCD RAM unsigned char dsp_ram_bits = read_gpmc(0x0b); unsigned int dsp_ram_offset = (1 << dsp_ram_bits); -- cgit v1.2.3