MA FTDI utilities  v1.0
 All Data Structures Files Functions Pages
ftdi_api.h
Go to the documentation of this file.
1 
22 #ifndef __FTDI_API_H__
23 #define __FTDI_API_H__
24 
25 /* Debug code */
26 #ifndef DEBUG
27 #define DEBUG 0
28 #endif
29 #define DEBUG_CODE(code) if ((gp_debug) || (DEBUG)) { code }
30 extern int gp_debug;
31 
32 
33 /* Standard C libraries */
34 #include<stdio.h>
35 #include<stdlib.h>
36 /* OS specific libraries */
37 #ifdef _WIN32
38 #include<windows.h>
39 #endif
40 
41 /* Include D2XX header*/
42 #include "ftd2xx.h"
43 
44 /* Include libMPSSE header */
45 #include "libMPSSE_spi.h"
46 
47 /******************************************************************************/
48 /* Macro and type defines */
49 /******************************************************************************/
50 /* Helper macros */
51 #define APP_CHECK_STATUS(exp) {if(exp!=FT_OK){printf("%s:%d:%s(): status(0x%x) \
52 != FT_OK\n",__FILE__, __LINE__, __FUNCTION__,exp);exit(1);}else{;}};
53 #define CHECK_NULL(exp){if(exp==NULL){printf("%s:%d:%s(): NULL expression \
54 encountered \n",__FILE__, __LINE__, __FUNCTION__);exit(1);}else{;}};
55 
56 
57 /* General parameter definitions */
58 
59 
79 int ftdi_init(uint32 clock_rate, uint8 latency, int spi_mode, int cs_pin, int ss_default);
80 
96 int ftdi_kill();
97 
115 
132 int ftdi_open_channel(int channel_id);
133 
151 int ftdi_init_channel();
152 
169 int ftdi_close_channel();
170 
190 int ftdi_read_stream(uint8 *buffer, int bytes);
191 
211 int ftdi_write_stream(uint8 *buffer, int bytes);
212 
236 int ftdi_readwrite(uint8 *inbuffer, uint8 *outbuffer, int bytes);
237 #endif
int ftdi_close_channel()
Closes FTDI channel.
Definition: ftdi_api.c:138
int ftdi_readwrite(uint8 *inbuffer, uint8 *outbuffer, int bytes)
Write and read data stream simultaneously.
Definition: ftdi_api.c:168
int ftdi_open_channel(int channel_id)
FTDI open channel.
Definition: ftdi_api.c:122
int ftdi_init_channel()
Initialise opened channel.
Definition: ftdi_api.c:130
int ftdi_kill()
FTDI destructor.
Definition: ftdi_api.c:84
int ftdi_write_stream(uint8 *buffer, int bytes)
Write data stream to FTDI.
Definition: ftdi_api.c:157
int ftdi_init(uint32 clock_rate, uint8 latency, int spi_mode, int cs_pin, int ss_default)
FTDI interface initialisation.
Definition: ftdi_api.c:33
int ftdi_print_channel_info()
Prints FTDI channel information.
Definition: ftdi_api.c:92
int ftdi_read_stream(uint8 *buffer, int bytes)
Read data stream from FTDI.
Definition: ftdi_api.c:146