image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
 
Loading...
Searching...
No Matches
LibFT4222.h
Go to the documentation of this file.
1
39#ifndef _FTDI_LIB_FT4222_H_
40#define _FTDI_LIB_FT4222_H_
41#ifdef _WIN32
42// Compiling on Windows
43#include <windows.h>
44
45#ifndef LIBMPSSE_SPI_H
46typedef UINT8 uint8;
47typedef UINT16 uint16;
48typedef UINT32 uint32;
49typedef UINT64 uint64;
50typedef INT8 int8;
51typedef INT16 int16;
52typedef INT32 int32;
53typedef INT64 int64;
54#endif
55
56#ifdef LIBFT4222_EXPORTS
57#define LIBFT4222_API __declspec(dllexport)
58#else
59#define LIBFT4222_API __declspec(dllimport)
60#endif
61
62#else // _WIN32
63// Compiling on non-Windows platform.
64#include <stdint.h>
65
66typedef uint8_t uint8;
70typedef int8_t int8;
71typedef int16_t int16;
72typedef int32_t int32;
73typedef int64_t int64;
74
75// No function-name decorations needed.
76#define LIBFT4222_API
77
78#endif // _WIN32
79
80#ifdef _MSC_VER
81// Prevent MS compiler warning about bad character
82#pragma warning(disable : 4819)
83#endif // _MSC_VER
84
85#include "ftd2xx.h"
86
87#define FT4222_EVENT_RXCHAR 8
88
89#define FT4222_SPI_SLAVE_SYNC_WORD 0x5A
93#define SPI_MASTER_TRANSFER 0x80
94#define SPI_SLAVE_TRANSFER 0x81
95#define SPI_SHORT_MASTER_TRANSFER 0x82
96#define SPI_SHORT_SLAVE_TRANSFER 0x83
98
100#define SPI_SHART_SLAVE_TRANSFER 0x83
101#define SPI_ACK 0x84
103
114#define I2CM_CONTROLLER_BUSY(status) (((status)&0x01) != 0)
115#define I2CM_DATA_NACK(status) (((status)&0x0A) != 0)
116#define I2CM_ADDRESS_NACK(status) (((status)&0x06) != 0)
117#define I2CM_ARB_LOST(status) (((status)&0x12) != 0)
118#define I2CM_IDLE(status) (((status)&0x20) != 0)
119#define I2CM_BUS_BUSY(status) (((status)&0x40) != 0)
121
170
179
188
197
212
218
224
232
240
246
248#define GPIO_Tigger GPIO_Trigger
256
262
263typedef enum I2C_MasterFlag
264{
265 NONE = 0x80,
266 START = 0x02,
268 STOP = 0x04,
271
278
284
285#pragma pack(push, 1)
293
294#pragma pack(pop)
295
296#ifdef __cplusplus
297extern "C" {
298#endif
299
313
318LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleRead(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeOfRead, BOOL isEndTransaction);
319LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleWrite(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred, BOOL isEndTransaction);
320LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleReadWrite(FT_HANDLE ftHandle, uint8 *readBuffer, uint8 *writeBuffer, uint16 bufferSize, uint16 *sizeTransferred, BOOL isEndTransaction);
321LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_MultiReadWrite(FT_HANDLE ftHandle, uint8 *readBuffer, uint8 *writeBuffer, uint8 singleWriteBytes, uint16 multiWriteBytes, uint16 multiReadBytes, uint32 *sizeOfRead);
322
330
335
339LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Read(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred);
340LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Write(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred);
341LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_ReadEx(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 flag, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred);
342LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_WriteEx(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 flag, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred);
345
356
367
368#ifdef __cplusplus
369}
370#endif
371
372//------------------------------------------------------------------------------
373#endif //_FTDI_LIB_FT4222_H_
unsigned short uint16_t
int int32_t
unsigned int uint32_t
long long int64_t
short int16_t
unsigned long long uint64_t
unsigned char uint8_t
signed char int8_t
static ft_uint32_t ft_uint8_t * buffer
Definition FT_Gpu_Hal.h:139
static ft_uint32_t addr
Definition FT_Gpu_Hal.h:139
LIBFT4222_API FT4222_STATUS FT4222_GPIO_GetTriggerStatus(FT_HANDLE ftHandle, GPIO_Port portNum, uint16 *queueSize)
SPI_SlaveProtocol
Definition LibFT4222.h:273
@ SPI_SLAVE_NO_ACK
Definition LibFT4222.h:276
@ SPI_SLAVE_NO_PROTOCOL
Definition LibFT4222.h:275
@ SPI_SLAVE_WITH_PROTOCOL
Definition LibFT4222.h:274
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleReadWrite(FT_HANDLE ftHandle, uint8 *readBuffer, uint8 *writeBuffer, uint16 bufferSize, uint16 *sizeTransferred, BOOL isEndTransaction)
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Read(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
FT4222_SPICPOL
Definition LibFT4222.h:214
@ CLK_IDLE_HIGH
Definition LibFT4222.h:216
@ CLK_IDLE_LOW
Definition LibFT4222.h:215
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Write(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_MultiReadWrite(FT_HANDLE ftHandle, uint8 *readBuffer, uint8 *writeBuffer, uint8 singleWriteBytes, uint16 multiWriteBytes, uint16 multiReadBytes, uint32 *sizeOfRead)
FT4222_SPIClock
Definition LibFT4222.h:199
@ CLK_DIV_512
Definition LibFT4222.h:209
@ CLK_NONE
Definition LibFT4222.h:200
@ CLK_DIV_128
Definition LibFT4222.h:207
@ CLK_DIV_32
Definition LibFT4222.h:205
@ CLK_DIV_8
Definition LibFT4222.h:203
@ CLK_DIV_4
Definition LibFT4222.h:202
@ CLK_DIV_2
Definition LibFT4222.h:201
@ CLK_DIV_16
Definition LibFT4222.h:204
@ CLK_DIV_64
Definition LibFT4222.h:206
@ CLK_DIV_256
Definition LibFT4222.h:208
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SetLines(FT_HANDLE ftHandle, FT4222_SPIMode spiMode)
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_ReadEx(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 flag, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
FT4222_STATUS
Definition LibFT4222.h:124
@ FT4222_DEVICE_NOT_FOUND
Definition LibFT4222.h:127
@ FT4222_FAILED_TO_WRITE_DEVICE
Definition LibFT4222.h:135
@ FT4222_EEPROM_ERASE_FAILED
Definition LibFT4222.h:138
@ FT4222_INVAILD_FUNCTION
Definition LibFT4222.h:154
@ FT4222_DEVICE_NOT_OPENED_FOR_ERASE
Definition LibFT4222.h:133
@ FT4222_INVALID_ARGS
Definition LibFT4222.h:141
@ FT4222_GPIO_EXCEEDED_MAX_PORTNUM
Definition LibFT4222.h:160
@ FT4222_GPIO_NOT_SUPPORTED_IN_THIS_MODE
Definition LibFT4222.h:159
@ FT4222_EXCEEDED_MAX_TRANSFER_SIZE
Definition LibFT4222.h:156
@ FT4222_INVALID_POINTER
Definition LibFT4222.h:155
@ FT4222_CLK_NOT_SUPPORTED
Definition LibFT4222.h:147
@ FT4222_IS_NOT_SPI_SINGLE_MODE
Definition LibFT4222.h:151
@ FT4222_EEPROM_NOT_PRESENT
Definition LibFT4222.h:139
@ FT4222_DEVICE_LIST_NOT_READY
Definition LibFT4222.h:144
@ FT4222_INTERRUPT_NOT_SUPPORTED
Definition LibFT4222.h:165
@ FT4222_GPIO_PULLUP_INVALID_IN_INPUTMODE
Definition LibFT4222.h:162
@ FT4222_EVENT_NOT_SUPPORTED
Definition LibFT4222.h:167
@ FT4222_INVALID_PARAMETER
Definition LibFT4222.h:131
@ FT4222_FAILED_TO_READ_DEVICE
Definition LibFT4222.h:157
@ FT4222_OTHER_ERROR
Definition LibFT4222.h:143
@ FT4222_GPIO_OPENDRAIN_INVALID_IN_OUTPUTMODE
Definition LibFT4222.h:164
@ FT4222_INVALID_BAUD_RATE
Definition LibFT4222.h:132
@ FT4222_IS_NOT_SPI_MULTI_MODE
Definition LibFT4222.h:152
@ FT4222_EEPROM_WRITE_FAILED
Definition LibFT4222.h:137
@ FT4222_GPIO_INPUT_NOT_SUPPORTED
Definition LibFT4222.h:166
@ FT4222_DEVICE_NOT_SUPPORTED
Definition LibFT4222.h:146
@ FT4222_GPIO_WRITE_NOT_SUPPORTED
Definition LibFT4222.h:161
@ FT4222_IS_NOT_SPI_MODE
Definition LibFT4222.h:149
@ FT4222_WRONG_I2C_ADDR
Definition LibFT4222.h:153
@ FT4222_IO_ERROR
Definition LibFT4222.h:129
@ FT4222_IS_NOT_I2C_MODE
Definition LibFT4222.h:150
@ FT4222_VENDER_CMD_NOT_SUPPORTED
Definition LibFT4222.h:148
@ FT4222_DEVICE_NOT_OPENED_FOR_WRITE
Definition LibFT4222.h:134
@ FT4222_DEVICE_NOT_OPENED
Definition LibFT4222.h:128
@ FT4222_INVALID_HANDLE
Definition LibFT4222.h:126
@ FT4222_NOT_SUPPORTED
Definition LibFT4222.h:142
@ FT4222_I2C_NOT_SUPPORTED_IN_THIS_MODE
Definition LibFT4222.h:158
@ FT4222_INSUFFICIENT_RESOURCES
Definition LibFT4222.h:130
@ FT4222_OK
Definition LibFT4222.h:125
@ FT4222_GPIO_PULLDOWN_INVALID_IN_INPUTMODE
Definition LibFT4222.h:163
@ FT4222_EEPROM_NOT_PROGRAMMED
Definition LibFT4222.h:140
@ FT4222_FUN_NOT_SUPPORT
Definition LibFT4222.h:168
@ FT4222_EEPROM_READ_FAILED
Definition LibFT4222.h:136
FT4222_SPIMode
Definition LibFT4222.h:190
@ SPI_IO_QUAD
Definition LibFT4222.h:194
@ SPI_IO_DUAL
Definition LibFT4222.h:193
@ SPI_IO_SINGLE
Definition LibFT4222.h:192
@ SPI_IO_NONE
Definition LibFT4222.h:191
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_Read(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeOfRead)
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_GetRxStatus(FT_HANDLE ftHandle, uint16 *pRxSize)
GPIO_Trigger
Definition LibFT4222.h:250
@ GPIO_TRIGGER_RISING
Definition LibFT4222.h:251
@ GPIO_TRIGGER_LEVEL_HIGH
Definition LibFT4222.h:253
@ GPIO_TRIGGER_FALLING
Definition LibFT4222.h:252
@ GPIO_TRIGGER_LEVEL_LOW
Definition LibFT4222.h:254
LIBFT4222_API FT4222_STATUS FT4222_UnInitialize(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_GetMaxTransferSize(FT_HANDLE ftHandle, uint16 *pMaxSize)
uint8_t uint8
Definition LibFT4222.h:66
LIBFT4222_API FT4222_STATUS FT4222_SetWakeUpInterrupt(FT_HANDLE ftHandle, BOOL enable)
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_Init(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_WriteEx(FT_HANDLE ftHandle, uint16 deviceAddress, uint8 flag, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
FT4222_FUNCTION
Definition LibFT4222.h:181
@ FT4222_SPI_MASTER
Definition LibFT4222.h:184
@ FT4222_I2C_MASTER
Definition LibFT4222.h:182
@ FT4222_SPI_SLAVE
Definition LibFT4222.h:185
@ FT4222_I2C_SLAVE
Definition LibFT4222.h:183
LIBFT4222_API FT4222_STATUS FT4222_SetSuspendOut(FT_HANDLE ftHandle, BOOL enable)
LIBFT4222_API FT4222_STATUS FT4222_ChipReset(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_GetAddress(FT_HANDLE ftHandle, uint8 *addr)
LIBFT4222_API FT4222_STATUS FT4222_GPIO_ReadTriggerQueue(FT_HANDLE ftHandle, GPIO_Port portNum, GPIO_Trigger *events, uint16 readSize, uint16 *sizeofRead)
FT4222_ClockRate
Definition LibFT4222.h:172
@ SYS_CLK_80
Definition LibFT4222.h:176
@ SYS_CLK_48
Definition LibFT4222.h:175
@ SYS_CLK_24
Definition LibFT4222.h:174
@ SYS_CLK_60
Definition LibFT4222.h:173
LIBFT4222_API FT4222_STATUS FT4222_SetEventNotification(FT_HANDLE ftHandle, DWORD mask, PVOID param)
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_RxQuickResponse(FT_HANDLE ftHandle, BOOL enable)
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_Init(FT_HANDLE ftHandle, FT4222_SPIMode ioLine, FT4222_SPIClock clock, FT4222_SPICPOL cpol, FT4222_SPICPHA cpha, uint8 ssoMap)
LIBFT4222_API FT4222_STATUS FT4222_GPIO_Read(FT_HANDLE ftHandle, GPIO_Port portNum, BOOL *value)
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_SetMode(FT_HANDLE ftHandle, FT4222_SPICPOL cpol, FT4222_SPICPHA cpha)
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_Write(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
LIBFT4222_API FT4222_STATUS FT4222_GetVersion(FT_HANDLE ftHandle, FT4222_Version *pVersion)
#define LIBFT4222_API
Definition LibFT4222.h:76
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_GetRxStatus(FT_HANDLE ftHandle, uint16 *pRxSize)
int64_t int64
Definition LibFT4222.h:73
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Reset(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_SPI_ResetTransaction(FT_HANDLE ftHandle, uint8 spiIdx)
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleRead(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeOfRead, BOOL isEndTransaction)
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_Reset(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_GPIO_SetInputTrigger(FT_HANDLE ftHandle, GPIO_Port portNum, GPIO_Trigger trigger)
SPI_DrivingStrength
Definition LibFT4222.h:226
@ DS_12MA
Definition LibFT4222.h:229
@ DS_4MA
Definition LibFT4222.h:227
@ DS_16MA
Definition LibFT4222.h:230
@ DS_8MA
Definition LibFT4222.h:228
LIBFT4222_API FT4222_STATUS FT4222_SPIMaster_SingleWrite(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred, BOOL isEndTransaction)
int16_t int16
Definition LibFT4222.h:71
FT4222_SPICPHA
Definition LibFT4222.h:220
@ CLK_LEADING
Definition LibFT4222.h:221
@ CLK_TRAILING
Definition LibFT4222.h:222
LIBFT4222_API FT4222_STATUS FT4222_GPIO_SetWaveFormMode(FT_HANDLE ftHandle, BOOL enable)
int8_t int8
Definition LibFT4222.h:70
LIBFT4222_API FT4222_STATUS FT4222_SPI_Reset(FT_HANDLE ftHandle)
LIBFT4222_API FT4222_STATUS FT4222_SetClock(FT_HANDLE ftHandle, FT4222_ClockRate clk)
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_InitEx(FT_HANDLE ftHandle, SPI_SlaveProtocol protocolOpt)
GPIO_Dir
Definition LibFT4222.h:242
@ GPIO_INPUT
Definition LibFT4222.h:244
@ GPIO_OUTPUT
Definition LibFT4222.h:243
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_SetRespWord(FT_HANDLE ftHandle, uint8 responseWord)
LIBFT4222_API FT4222_STATUS FT4222_SetInterruptTrigger(FT_HANDLE ftHandle, GPIO_Trigger trigger)
int32_t int32
Definition LibFT4222.h:72
uint64_t uint64
Definition LibFT4222.h:69
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_SetAddress(FT_HANDLE ftHandle, uint8 addr)
LIBFT4222_API FT4222_STATUS FT4222_SPI_SetDrivingStrength(FT_HANDLE ftHandle, SPI_DrivingStrength clkStrength, SPI_DrivingStrength ioStrength, SPI_DrivingStrength ssoStrength)
uint16_t uint16
Definition LibFT4222.h:67
uint32_t uint32
Definition LibFT4222.h:68
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_SetClockStretch(FT_HANDLE ftHandle, BOOL enable)
I2C_MasterFlag
Definition LibFT4222.h:264
@ START
Definition LibFT4222.h:266
@ STOP
Definition LibFT4222.h:268
@ Repeated_START
Definition LibFT4222.h:267
@ NONE
Definition LibFT4222.h:265
@ START_AND_STOP
Definition LibFT4222.h:269
LIBFT4222_API FT4222_STATUS FT4222_SPISlave_Write(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
LIBFT4222_API FT4222_STATUS FT4222_GPIO_Write(FT_HANDLE ftHandle, GPIO_Port portNum, BOOL bValue)
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_Init(FT_HANDLE ftHandle)
GPIO_Output
Definition LibFT4222.h:258
@ GPIO_OUTPUT_LOW
Definition LibFT4222.h:259
@ GPIO_OUTPUT_HIGH
Definition LibFT4222.h:260
LIBFT4222_API FT4222_STATUS FT4222_GetClock(FT_HANDLE ftHandle, FT4222_ClockRate *clk)
LIBFT4222_API FT4222_STATUS FT4222_GPIO_Init(FT_HANDLE ftHandle, GPIO_Dir gpioDir[4])
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_Init(FT_HANDLE ftHandle, uint32 kbps)
LIBFT4222_API FT4222_STATUS FT4222_I2CSlave_Read(FT_HANDLE ftHandle, uint8 *buffer, uint16 bufferSize, uint16 *sizeTransferred)
GPIO_Port
Definition LibFT4222.h:234
@ GPIO_PORT0
Definition LibFT4222.h:235
@ GPIO_PORT3
Definition LibFT4222.h:238
@ GPIO_PORT2
Definition LibFT4222.h:237
@ GPIO_PORT1
Definition LibFT4222.h:236
LIBFT4222_API FT4222_STATUS FT4222_I2CMaster_GetStatus(FT_HANDLE ftHandle, uint8 *controllerStatus)
void * PVOID
Definition WinTypes.h:53
unsigned int BOOL
Definition WinTypes.h:46
unsigned long DWORD
Definition ff.h:61
Native USB device driver for FTDI FT232x, FT245x, FT2232x and FT4232x devices FTD2XX library definiti...
PVOID FT_HANDLE
Definition ftd2xx.h:68
DWORD chipVersion
Definition LibFT4222.h:281