/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/BIN/10-MLAB-XVC-FTDI.rules |
---|
0,0 → 1,23 |
# Rule for unbinding XVC_FT220X device from ftdi_sio driver and setting permissions for everyone |
# Put this file to /etc/udev/rules.d |
# MLAB Module XVC_FT220X for JTAG programming of Xilinx uses standard VendorID and DeviceID |
# of used FTDI chips. Unfortunately on latest Linux there is udev automaticaly loading |
# device driver ftdi_sio which creates ttyUSBxx device for any attached FTDI chip. |
# This driver prevents XVC program to comunicate with FTDI chip via FT2XX library. |
# It is necessary to disconnect (unbind) our FTDI device (identifyed by its name) from |
# ftdi_sio driver. |
# (c)miho 2013 http://www.mlab.cz |
# Hints: |
# lsusb -v |
# udevadm info -a -p /devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.0 |
# udevadm control --reload-rules |
# Ubind "MLAB XVC with FTxxxx" form ftdi_sio driver to release it for mlab_xvc program |
SUBSYSTEM=="usb", ATTRS{interface}=="MLAB XVC with FT*", RUN="/bin/sh -c 'echo %k > /sys/bus/usb/drivers/ftdi_sio/unbind'" |
# Set permissions to the device to enable run mlab_xvc program without root permissions |
# If you do not want everyone remove MODE and add GROUP |
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{product}=="MLAB XVC with FT*", MODE:="0666", RUN+="/bin/sh -c 'echo k: %k p: %p >> /tmp/XVC'" |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/BIN/mlab_xvcd.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/BIN/mlab_xvcd_i386 |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/linuxBuild.sh |
---|
0,0 → 1,8 |
# For fresh Ubuntu 64bit needs to install tools: |
# sudo apt-get install build-essential |
# On 64bit system you need 32bit library support to build 32bit application: |
# sudo apt-get install g++-multilib |
# Just compile and link the target executable: |
gcc mlab_xvcd*.cpp lib_linux_i386/libftd2xx.a -m32 -ldl -lpthread -lrt -Os -o mlab_xvcd_i386 |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/mlab_xvcd.cpp |
---|
13,8 → 13,10 |
// 1.02 2012_12 Error handling and debugged |
// 1.03 2012_12 Release version ready to publish |
// 1.04 2013_04 Socket Bind Error with explanation (multiple instance of XVC Server) |
// 1.05 2013-04 Test FTDI cable during wait for Accept (to stop the server immediately when cable is disconnected) |
// 1.06 2013-04 Added support for Linux (thanks to Martin Poviser) |
// 1.05 2013_04 Test FTDI cable during wait for Accept (to stop the server immediately when cable is disconnected) |
// 1.06 2013_04 Added support for Linux (thanks to Martin Poviser) |
// 1.07 2013_04 Rewritten Host Address function for Linux (function gethostbyname returns 127.0.1.1 on Debian systems) |
// Solved compatibility problems on Linux (FT_SetLatncyTimer requires delay, udev problem with ftdi_sio driver) |
// |
// |
// Purpose: |
83,7 → 85,6 |
// |
// Possible improvements: |
// |
// Linux version (not fully functional yet). |
// External definition of JTAG pins. |
// Enable Socket Number (to be able to run multiple XVC Servers), now it is constant XVC_TCP_PORT (should be only a default) |
118,6 → 119,9 |
#include <errno.h> |
#include <unistd.h> |
#include <netdb.h> |
#include <net/if.h> |
#include <sys/ioctl.h> |
#include <arpa/inet.h> |
#endif |
465,10 → 469,13 |
} |
#endif |
// Display HostName and Address |
// Display HostName |
char sMyName[255]; |
gethostname(sMyName, sizeof(sMyName)); |
printf(" Host Name %s\n", sMyName); |
// Display Address |
#ifdef WIN32 |
hostent * pHostInfo; |
pHostInfo = gethostbyname(sMyName); |
printf(" Network Name %s\n", pHostInfo->h_name); |
481,7 → 488,34 |
} |
printf("%d\n", (unsigned char)pHostInfo->h_addr_list[0][pHostInfo->h_length-1]); |
} |
#else |
int TempSocket; |
struct ifreq ifreqs[20]; |
struct ifconf ic; |
ic.ifc_len = sizeof ifreqs; |
ic.ifc_req = ifreqs; |
TempSocket = socket(AF_INET, SOCK_DGRAM, 0); |
if (TempSocket < 0) { |
perror("socket"); |
return -2; |
} |
if (ioctl(TempSocket, SIOCGIFCONF, &ic) < 0) { |
perror("SIOCGIFCONF"); |
return -2; |
} |
for (int i = 0; i < ic.ifc_len/sizeof(struct ifreq); ++i) |
{ |
if (ifreqs[i].ifr_name[0]!='l')// remove lo |
printf(" Host Address %s: %s\n", |
ifreqs[i].ifr_name, |
inet_ntoa(((struct sockaddr_in*)&ifreqs[i].ifr_addr)->sin_addr)); |
} |
#endif |
// Create Protocol Structure |
struct addrinfo hints; |
memset(&hints, 0, sizeof(hints)); |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/mlab_xvcd.h |
---|
1,7 → 1,7 |
// Program Version |
// --------------- |
#define VERSION "1.06" // Program version |
#define VERSION "1.07" // Program version |
#define YEAR "2013" // Year of the program |
// JTAG Port Definitions |
/Modules/CPLD_FPGA/XILINX_XVC/XVC_SOFTWARE/XVC_1x/mlab_xvcd_port_FTDI.cpp |
---|
1,7 → 1,16 |
// Include FTDI library |
#include "mlab_xvcd_port_FTDI.h" |
#ifdef WIN32 |
#include <windows.h> // Windows Console Application (Sleep) |
#else |
#include <unistd.h> // sleep |
#endif |
// JTAG Output Pin Mask |
#define IO_OUTPUT_MASK (PORT_TCK|PORT_TDI|PORT_TMS|PORT_LED) // Mask for all Output Pins |
285,6 → 294,14 |
fprintf(stderr, "FTDI: Set USB Latency Timer Failed %d\n", ftStatus); |
} |
// Fix (without this delay the next FT_Read hang for ever) |
// My Linux i5 notebook requires at least 2500us |
#ifdef WIN32 |
Sleep(10); //ms |
#else |
usleep(10000); //us |
#endif |
printf("\n"); |
return 0; |
} |
293,9 → 310,8 |
// Enable or Disable Activity LED |
void jtagSetLED(bool LedEnable) |
{ |
// DBUS Connected LED (BitBang Mode) |
LedMask = LedEnable ? (PORT_LED & 0xFF) : 0; // Set mask for jtagScan function |
LedMask = LedEnable ? (0xFF & PORT_LED) : 0; // Set mask for jtagScan function |
if (PORT_LED & 0xFF) |
{ |
// Set / Reset LED Pin |
305,7 → 321,6 |
unsigned char Dummy; |
FT_Write(ftHandle, &DataOut, 1, &BytesWritten ); // Send 1 byte |
FT_Read (ftHandle, &Dummy, 1, &BytesReceived); // Read 1 byte |
//printf("[PinStatus %x DataOut %x]", PinStatus, DataOut); |
} |
// CBUS Connected LED (BitBang Mode) 1 and 0 state of the port |