diff options
| -rw-r--r-- | SimpleMotionV2.pri | 4 | ||||
| -rw-r--r-- | drivers/ftdi_d2xx/d2xx/Readme and license.txt | 168 | ||||
| -rw-r--r-- | drivers/ftdi_d2xx/sm_d2xx.c | 2 | ||||
| -rw-r--r-- | drivers/ftdi_d2xx/third_party/Readme and license.txt | 20 | ||||
| -rwxr-xr-x | drivers/ftdi_d2xx/third_party/WinTypes.h | 154 | ||||
| -rw-r--r-- | drivers/ftdi_d2xx/third_party/ftd2xx.h (renamed from drivers/ftdi_d2xx/ftd2xx.h) | 0 | ||||
| -rw-r--r-- | drivers/ftdi_d2xx/third_party/osx/libftd2xx.a | bin | 0 -> 350680 bytes | |||
| -rw-r--r-- | drivers/ftdi_d2xx/third_party/win_32bit/ftd2xx.lib (renamed from drivers/ftdi_d2xx/ftd2xx.lib) | bin | 22190 -> 22190 bytes | |||
| -rw-r--r-- | drivers/serial/pcserialport.c | 3 | ||||
| -rw-r--r-- | simplemotion.c | 2 | ||||
| -rw-r--r-- | simplemotion.h | 5 |
11 files changed, 352 insertions, 6 deletions
diff --git a/SimpleMotionV2.pri b/SimpleMotionV2.pri index c63c339..5f1b8e4 100644 --- a/SimpleMotionV2.pri +++ b/SimpleMotionV2.pri @@ -19,8 +19,8 @@ HEADERS += $$PWD/simplemotion_private.h\ greaterThan(SUPPORT_FTDI_D2XX_DRIVER, 0+) {
SOURCES += $$PWD/drivers/ftdi_d2xx/sm_d2xx.c
HEADERS += $$PWD/drivers/ftdi_d2xx/sm_d2xx.c
- macx:LIBS += #tbd. mac will also needs some helper tool to make it work..
- win32:LIBS += $$PWD/drivers/ftdi_d2xx/ftd2xx.lib
+ macx:LIBS += $$PWD/drivers/ftdi_d2xx/third_party/osx/libftd2xx.a #mac will needs insetalling some FTDI helper tool & reboot to make port open to work. see d2xx downloads page from ftdi.
+ win32:LIBS += $$PWD/drivers/ftdi_d2xx/third_party/win_32bit/ftd2xx.lib
linux:LIBS += #tbd
DEFINES += FTDI_D2XX_SUPPORT
}
diff --git a/drivers/ftdi_d2xx/d2xx/Readme and license.txt b/drivers/ftdi_d2xx/d2xx/Readme and license.txt new file mode 100644 index 0000000..e4082f2 --- /dev/null +++ b/drivers/ftdi_d2xx/d2xx/Readme and license.txt @@ -0,0 +1,168 @@ +Files in this folder are downloaded from FTDI: +http://www.ftdichip.com/Drivers/D2XX.htm + + +Driver license +-------------- + +IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE INSTALLING THE RELEVANT SOFTWARE: This licence agreement ("Licence") is a legal agreement between you ("Licencee" or "you") and Future Technology Devices International Limited of 2 Seaward Place, Centurion Business Park, Glasgow, Scotland, G41 1HH (UK Company Number SC136640) ("Licensor" or "we) for use of driver software provided by the Licensor ("Software"). + +BY INSTALLING OR USING THIS SOFTWARE YOU AGREE TO THE TERMS OF THIS LICENCE WHICH WILL BIND YOU. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, WE ARE UNWILLING TO LICENSE THE SOFTWARE TO YOU AND YOU MUST DISCONTINUE INSTALLATION OF THE SOFTWARE NOW. + +1. Grant and scope of licence + +1.1 In consideration of you agreeing to abide by the terms of this Licence, the Licensor hereby grants to you a non-exclusive, non-transferable, royalty free licence to use the Software on the terms of this Licence. + +1.2 In this Licence a "Genuine FTDI Component" means an item of hardware that was manufactured for, and sold by, the Licensor or a member of the Licensor's group of companies. It does not include any counterfeit or fake products. + +1.3 If you are a manufacturer of a device that includes a Genuine FTDI Component (each a "Device") then you may install the Software onto that device. If you are a seller or distributor of a Device then You may distribute the Software with the Device. If you are a user of a Device then you may install the Software on the Device, or onto a computer system in order to use the Device. + +1.4 In each of those cases you may: + +1.4.1 install and use the Software for your purposes only; and + +1.4.2 only use the Software in conjunction with products based on and/or incorporating a Genuine FTDI Component. + +1.5 The Software will not function properly on or with a component that is not a Genuine FTDI Component. Use of the Software as a driver for, or installation of the Software onto, a component that is not a Genuine FTDI Component, including without limitation counterfeit components, MAY IRRETRIEVABLY DAMAGE THAT COMPONENT. It is the Licensee's responsibility to make sure that all chips it installs the Software on, or uses the Software as a driver for, are Genuine FTDI Components. If in doubt then contact the Licensor. + +2. If a custom vendor ID and/or product ID or description string are used, it is the responsibility of the product manufacturer to maintain any changes and subsequent WHQL re-certification as a result of making these changes. + +3. Licensee's undertakings + +3.1 Except as expressly set out in this Licence or as permitted by any local law, you undertake: + +3.1.1 not to copy the Software, except where such copying is incidental to normal use of the Software or where it is necessary for the purpose of back-up or operational security; + +3.1.2 not to rent, lease, sub-license, loan, translate, merge, adapt, vary or modify the Software or any part of it; + +3.1.3 not to make alterations to, or modifications of, the whole or any part of the Software nor permit the Software or any part of it to be combined with, or become incorporated in, any other programs; + +3.1.4 not to disassemble, de-compile, reverse engineer or create derivative works based on the whole or any part of the Software; + +3.1.5 to keep all copies of the Software secure; + +3.1.6 to include the copyright notice of the Licensor on all entire and partial copies of the Software in any form; and + +3.1.7 not to provide, or otherwise make available, the Software in any form, in whole or in part (including, but not limited to, program listings, object and source program listings, object code and source code) to any person. + +4. Intellectual property rights + +4.1 You acknowledge that all intellectual property rights in the Software throughout the world belong to the Licensor, that rights in the Software are licensed (not sold) to you, and that you have no rights in, or to, the Software other than the right to use them in accordance with the terms of this Licence. + +5. Warranty + +5.1 To the maximum extent permitted by applicable law, the software is provided "as is". + +5.2 All implied warranties, implied conditions and/or implied licences are excluded from this Licence, including but not limited to implied warranties of quality and/or fitness for purpose (in all cases) to the fullest extent permitted by law. + + + +5.3 You acknowledge that the Software has not been developed to meet your individual requirements and that the Software may not be uninterrupted or free of bugs or errors. + +6. Licensor's liability + +6.1 To the maximum extent permitted by applicable law, in no event shall the Licensor be liable for any: + +6.1.1 special loss or damage; + +6.1.2 incidental loss or damage; + +6.1.3 indirect or consequential loss or damage: + +6.1.4 loss of income; + +6.1.5 loss of business; + +6.1.6 loss of profits; + +6.1.7 loss of revenue; + +6.1.8 loss of contracts; + +6.1.9 business interruption; + +6.1.10 loss of the use of money or anticipated savings; + +6.1.11 loss of information; + +6.1.12 loss of opportunity; + +6.1.13 loss of goodwill or reputation; and/or + +6.1.14 loss of, damage to or corruption of data; + +(in each case) of any kind howsoever arising and whether caused by delict (including negligence), breach of contract or otherwise. + +6.2 FTDI's total liability to you in relation to the Software shall not exceed 500 US Dollars. + +6.3 Nothing in this Licence limits or excludes liability for death or personal injury or for fraud. + +7. Termination + +7.1 The Licensor may terminate this Licence immediately if: + +7.1.1 you fail to comply with any of the terms and conditions of the Licence; or + +7.1.2 you commence or participate in any legal proceedings against the Licensor. + +7.2 Upon termination: + +7.2.1 all rights granted to you under this Licence shall cease; + +7.2.2 you must cease all activities authorised by this Licence; and + +7.2.3 you must immediately delete or remove the Software from all computer equipment in your possession and immediately destroy all copies of the Software then in your possession, custody or control. + +8. Transfer of rights and obligations + +8.1 You may not transfer, assign, charge or otherwise dispose of this Licence, or any of your rights or obligations arising under it. + +8.2 The Licensor may transfer, assign, charge, sub-contract or otherwise dispose of this Licence, or any of his rights or obligations arising under it, at any time during the term of the Licence. + +9. Waiver + +9.1 If the Licensor fails, at any time during the term of this Licence, to insist on strict performance of any of your obligations under this Licence, or if the Licensor fails to exercise any of the rights or remedies to which he is entitled under this Licence, this shall not constitute a waiver of such rights or remedies and shall not relieve you from compliance with such obligations. + +9.2 A waiver by the Licensor of any default shall not constitute a waiver of any subsequent default. + +9.3 No waiver by the Licensor of any of these terms and conditions shall be effective unless it is expressly stated to be a waiver and is communicated to you in writing. + +10. Severability + +If any of the terms of this Licence are determined by any competent authority to be invalid, unlawful or unenforceable to any extent, such term, condition or provision will to that extent be severed from the remaining terms, conditions and provisions which will continue to be valid to the fullest extent permitted by law. + +11. Entire agreement + +11.1 This Licence constitutes the whole agreement between us and supersedes any previous arrangement, understanding or agreement between us, relating to the licensing of the Software. + +11.2 Each party acknowledges that in entering into this Licence it does not rely on any statement, representation, warranty or understanding other than those expressly set out in this Licence. Each party agrees that it will have no remedy in respect of any statement, representation, warranty or understanding that is not expressly set out in this Licence. Each party agrees that its only remedy in respect of those representations, statements, assurances and warranties that are set out in this Licence will be for breach of contract in accordance with the terms of this Licence. + +11.3 The parties agree that nothing in this Licence will limit or exclude any liability they may have for fraud. + +12. Miscellaneous + +12.1 This Licence does not create a partnership or joint venture between the parties to it, nor authorise a party to act as agent for the other. + +12.2 This Licence does not create any legal rights enforceable by any third party. + +12.3 This Licence may only be varied by express written legal agreement between the parties. + +13. Law and jurisdiction + +This Licence, its subject matter or its formation (including non-contractual disputes or claims) shall be governed by and construed in accordance with Scots law and submitted to the non-exclusive jurisdiction of the Scottish courts. + + + +OS X library +------------ + +OS X D2XX Library Version 1.4.4 +© Future Technology Devices International Ltd. 2016 + +DISCLAIMER + +This software is supplied on an as-is basis and no warranty as to their suitability for any particular purpose is either made or implied. Future Technology Devices International Ltd. will not accept any claim for damages howsoever arising as a result of use or failure of this software. Your statutory rights are not affected. This software or any variant of it is not intended for use in any medical appliance, device or system in which the failure of the product might reasonably be expected to result in personal injury. This document provides preliminary information that may be subject to change without notice. + +Libusb + +This package uses an unmodified version of libusb (libusb.info) which is distributed under the terms of the GNU Lesser General Public License (see libusb/COPYING or www.gnu.org/licenses). Source code for libusb is included in this distribution. diff --git a/drivers/ftdi_d2xx/sm_d2xx.c b/drivers/ftdi_d2xx/sm_d2xx.c index db180de..5b6a578 100644 --- a/drivers/ftdi_d2xx/sm_d2xx.c +++ b/drivers/ftdi_d2xx/sm_d2xx.c @@ -9,7 +9,7 @@ #include "drivers/ftdi_d2xx/sm_d2xx.h" #include "simplemotion_private.h" //needed for timeout variable -#include "drivers/ftdi_d2xx/ftd2xx.h" +#include "drivers/ftdi_d2xx/third_party/ftd2xx.h" #include <string.h> #include <simplemotion.h> diff --git a/drivers/ftdi_d2xx/third_party/Readme and license.txt b/drivers/ftdi_d2xx/third_party/Readme and license.txt new file mode 100644 index 0000000..4cbd58e --- /dev/null +++ b/drivers/ftdi_d2xx/third_party/Readme and license.txt @@ -0,0 +1,20 @@ +Files in this folder are downloaded from FTDI: +http://www.ftdichip.com/Drivers/D2XX.htm + +Copyright notes +--------------- + + +OS X library +------------ + +OS X D2XX Library Version 1.4.4 +© Future Technology Devices International Ltd. 2016 + +DISCLAIMER + +This software is supplied on an as-is basis and no warranty as to their suitability for any particular purpose is either made or implied. Future Technology Devices International Ltd. will not accept any claim for damages howsoever arising as a result of use or failure of this software. Your statutory rights are not affected. This software or any variant of it is not intended for use in any medical appliance, device or system in which the failure of the product might reasonably be expected to result in personal injury. This document provides preliminary information that may be subject to change without notice. + +Libusb + +This package uses an unmodified version of libusb (libusb.info) which is distributed under the terms of the GNU Lesser General Public License (see libusb/COPYING or www.gnu.org/licenses). Source code for libusb is included in this distribution. diff --git a/drivers/ftdi_d2xx/third_party/WinTypes.h b/drivers/ftdi_d2xx/third_party/WinTypes.h new file mode 100755 index 0000000..88e500e --- /dev/null +++ b/drivers/ftdi_d2xx/third_party/WinTypes.h @@ -0,0 +1,154 @@ +#ifndef __WINDOWS_TYPES__ +#define __WINDOWS_TYPES__ + +#define WINAPI + +typedef unsigned int DWORD; +typedef unsigned int ULONG; +typedef unsigned short USHORT; +typedef unsigned short SHORT; +typedef unsigned char UCHAR; +typedef unsigned short WORD; +typedef unsigned short WCHAR; +typedef unsigned char BYTE; +typedef BYTE *LPBYTE; +typedef unsigned int BOOL; +typedef unsigned char BOOLEAN; +typedef unsigned char CHAR; +typedef BOOL *LPBOOL; +typedef UCHAR *PUCHAR; +typedef const char *LPCSTR; +typedef char *PCHAR; +typedef void *PVOID; +typedef void *HANDLE; +typedef unsigned int LONG; +typedef int INT; +typedef unsigned int UINT; +typedef char *LPSTR; +typedef char *LPTSTR; +typedef const char *LPCTSTR; +typedef DWORD *LPDWORD; +typedef WORD *LPWORD; +typedef ULONG *PULONG; +typedef LONG *LPLONG; +typedef PVOID LPVOID; +typedef void VOID; +typedef USHORT *PUSHORT; +typedef unsigned long long int ULONGLONG; + +typedef struct _OVERLAPPED { + DWORD Internal; + DWORD InternalHigh; + union { + struct{ + DWORD Offset; + DWORD OffsetHigh; + }; + PVOID Pointer; + }; + HANDLE hEvent; +} OVERLAPPED, *LPOVERLAPPED; + +typedef struct _SECURITY_ATTRIBUTES { + DWORD nLength; + LPVOID lpSecurityDescriptor; + BOOL bInheritHandle; +} SECURITY_ATTRIBUTES , *LPSECURITY_ATTRIBUTES; + +#include <pthread.h> +// Substitute for HANDLE returned by Windows CreateEvent API. +// FT_SetEventNotification expects parameter 3 to be the address +// of one of these structures. +typedef struct _EVENT_HANDLE +{ + pthread_cond_t eCondVar; + pthread_mutex_t eMutex; + int iVar; +} EVENT_HANDLE; + +typedef struct timeval SYSTEMTIME; +typedef struct timeval FILETIME; + +// WaitForSingleObject return values. +#define WAIT_ABANDONED 0x00000080L +#define WAIT_OBJECT_0 0x00000000L +#define WAIT_TIMEOUT 0x00000102L +#define WAIT_FAILED 0xFFFFFFFF +// Special value for WaitForSingleObject dwMilliseconds parameter +#define INFINITE 0xFFFFFFFF // Infinite timeout + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef CONST +#define CONST const +#endif +// +// Modem Status Flags +// +#define MS_CTS_ON ((DWORD)0x0010) +#define MS_DSR_ON ((DWORD)0x0020) +#define MS_RING_ON ((DWORD)0x0040) +#define MS_RLSD_ON ((DWORD)0x0080) + +// +// Error Flags +// +#define CE_RXOVER 0x0001 // Receive Queue overflow +#define CE_OVERRUN 0x0002 // Receive Overrun Error +#define CE_RXPARITY 0x0004 // Receive Parity Error +#define CE_FRAME 0x0008 // Receive Framing error +#define CE_BREAK 0x0010 // Break Detected +#define CE_TXFULL 0x0100 // TX Queue is full +#define CE_PTO 0x0200 // LPTx Timeout +#define CE_IOE 0x0400 // LPTx I/O Error +#define CE_DNS 0x0800 // LPTx Device not selected +#define CE_OOP 0x1000 // LPTx Out-Of-Paper +#define CE_MODE 0x8000 // Requested mode unsupported + +// +// Events +// +#define EV_RXCHAR 0x0001 // Any Character received +#define EV_RXFLAG 0x0002 // Received certain character +#define EV_TXEMPTY 0x0004 // Transmit Queue Empty +#define EV_CTS 0x0008 // CTS changed state +#define EV_DSR 0x0010 // DSR changed state +#define EV_RLSD 0x0020 // RLSD changed state +#define EV_BREAK 0x0040 // BREAK received +#define EV_ERR 0x0080 // Line status error occurred +#define EV_RING 0x0100 // Ring signal detected +#define EV_PERR 0x0200 // Printer error occured +#define EV_RX80FULL 0x0400 // Receive buffer is 80 percent full +#define EV_EVENT1 0x0800 // Provider specific event 1 +#define EV_EVENT2 0x1000 // Provider specific event 2 + +// +// Escape Functions +// +#define SETXOFF 1 // Simulate XOFF received +#define SETXON 2 // Simulate XON received +#define SETRTS 3 // Set RTS high +#define CLRRTS 4 // Set RTS low +#define SETDTR 5 // Set DTR high +#define CLRDTR 6 // Set DTR low +#define RESETDEV 7 // Reset device if possible +#define SETBREAK 8 // Set the device break line. +#define CLRBREAK 9 // Clear the device break line. + +// +// PURGE function flags. +// +#define PURGE_TXABORT 0x0001 // Kill the pending/current writes to the comm port. +#define PURGE_RXABORT 0x0002 // Kill the pending/current reads to the comm port. +#define PURGE_TXCLEAR 0x0004 // Kill the transmit queue if there. +#define PURGE_RXCLEAR 0x0008 // Kill the typeahead buffer if there. + +#ifndef INVALID_HANDLE_VALUE +#define INVALID_HANDLE_VALUE 0xFFFFFFFF +#endif + +#endif /* __WINDOWS_TYPES__ */ diff --git a/drivers/ftdi_d2xx/ftd2xx.h b/drivers/ftdi_d2xx/third_party/ftd2xx.h index 895f226..895f226 100644 --- a/drivers/ftdi_d2xx/ftd2xx.h +++ b/drivers/ftdi_d2xx/third_party/ftd2xx.h diff --git a/drivers/ftdi_d2xx/third_party/osx/libftd2xx.a b/drivers/ftdi_d2xx/third_party/osx/libftd2xx.a Binary files differnew file mode 100644 index 0000000..bcee161 --- /dev/null +++ b/drivers/ftdi_d2xx/third_party/osx/libftd2xx.a diff --git a/drivers/ftdi_d2xx/ftd2xx.lib b/drivers/ftdi_d2xx/third_party/win_32bit/ftd2xx.lib Binary files differindex afc8f19..afc8f19 100644 --- a/drivers/ftdi_d2xx/ftd2xx.lib +++ b/drivers/ftdi_d2xx/third_party/win_32bit/ftd2xx.lib diff --git a/drivers/serial/pcserialport.c b/drivers/serial/pcserialport.c index 8cbe281..2a16b82 100644 --- a/drivers/serial/pcserialport.c +++ b/drivers/serial/pcserialport.c @@ -140,7 +140,8 @@ smint32 serialPortOpen(const char * port_device_name, smint32 baudrate_bps) new_port_settings.c_lflag = 0; new_port_settings.c_cc[VMIN] = 0; /* non blocking mode */ new_port_settings.c_cc[VTIME] = readTimeoutMs/100; /* timeout 100 ms steps */ - + if(new_port_settings.c_cc[VTIME]<1)//don't allow value 0ms + new_port_settings.c_cc[VTIME]=1; #if defined(_BSD_SOURCE) cfsetspeed(&new_port_settings, baudrateEnumValue); #else diff --git a/simplemotion.c b/simplemotion.c index 45c7697..1211d63 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -151,7 +151,7 @@ smuint8 calcCRC8Buf( smuint8 *buf, int len, int crcinit ) SM_STATUS smSetTimeout( smuint16 millsecs )
{
- if(millsecs<=5000)
+ if(millsecs<=5000 && millsecs>=1)
{
readTimeoutMs=millsecs;
return SM_OK;
diff --git a/simplemotion.h b/simplemotion.h index 80db602..38d97e8 100644 --- a/simplemotion.h +++ b/simplemotion.h @@ -99,7 +99,10 @@ LIB smbus smOpenBus( const char * devicename ); LIB void smSetBaudrate( unsigned long pbs );
/** Set timeout of how long to wait reply packet from bus. Must be set before smOpenBus and cannot be changed afterwards
- * max value 5000ms. In unix this is rounded to 100ms (rounding downwards), so 99 or less gives 0ms timeout.
+ * max value 5000ms. Range may depend on underyling OS / drivers. If supplied argument is lower than minimum supported by drivers,
+ * then driver minimum is used without notice (return SM_OK).
+ *
+ * In unix PC serial port minimum is 100ms, on Windows serial port recommended minimum is 30ms and with FTDI driver 10ms. On TCP/IP: TBD.
*
*This is the only function that returns SM_STATUS which doesn't accumulate status bits to be read with getCumulativeStatus because it has no bus handle
*/
|
