libsidplayfp  2.0.2
Macros | Enumerations | Functions
exSID_ftdiwrap.c File Reference
#include "exSID_defs.h"
#include <stdio.h>
#include "exSID_ftdiwrap.h"
Include dependency graph for exSID_ftdiwrap.c:

Macros

#define XSFW_WRAPDECL
 
#define EXSID_INTERFACES   "libftd2xx, libftdi"
 
#define _xSfw_dlopen(filename)   dlopen(filename, RTLD_NOW|RTLD_LOCAL)
 
#define _xSfw_dlsym(handle, symbol)   dlsym(handle, symbol)
 
#define _xSfw_dlclose(handle)   dlclose(handle)
 
#define _xSfw_dlerror()   dlerror()
 
#define _xSfw_clear_dlerror()   dlerror()
 
#define _xSfw_free_errstr(str)   /* nothing */
 
#define XSFW_DLSYM(a, b)
 

Enumerations

enum  libtype_t { XS_LIBNONE, XS_LIBFTDI, XS_LIBFTD2XX }
 

Functions

int xSfw_dlopen ()
 
int xSfw_usb_setup (void *ftdi, int baudrate, int latency)
 
void xSfw_dlclose ()
 

Detailed Description

exSID USB FTDI access wrapper

Author
Thibaut VARENE
Date
2016
Note
Primary target is libftdi (cleaner API), adaptations are made for others. Sadly, libftdi's implementation of read() is unreliable (it doesn't seem to honour the usb timeout value and doesn't properly block long enough). This is why libftd2xx is prefered (tried first) for now. Unfortunately, using libftd2xx comes with a significant performance penalty since the code is tailored for libftdi.

Macro Definition Documentation

◆ XSFW_DLSYM

#define XSFW_DLSYM (   a,
 
)
Value:
*(void **)(&a) = _xSfw_dlsym(dlhandle, b); \
if (a == NULL) { \
dlerrorstr = _xSfw_dlerror(); \
goto dlfail; \
}

Enumeration Type Documentation

◆ libtype_t

enum libtype_t

Flag to signal which of the supported libraries is in use

Function Documentation

◆ xSfw_dlclose()

void xSfw_dlclose ( )

Release dlopen'd library.

◆ xSfw_dlopen()

int xSfw_dlopen ( )

Attempt to dlopen a known working library to access FTDI chip. Will try libftd2xx first, then libftdi.

Returns
0 on success, -1 on error.

◆ xSfw_usb_setup()

int xSfw_usb_setup ( void *  ftdi,
int  baudrate,
int  latency 
)

Setup FTDI chip to match exSID firmware. Defaults to 8N1, no flow control.

Parameters
ftdiftdi handle
baudrateTarget baudrate
latencyTarget latency
Returns
0 on success, rval on error.