- Author:
- Bridgeport Instruments, LLC
- Date:
- 2005 - 2011
Overview
Hierarchy
The API consists of a hierarchical set of four layers.
- libusb and libftdi (libusb.lib, ftdi.obj)
- The code uses the libftdi driver built on libusb. These open-source codes provide the most accurate control over the communication with the FT245RL usb-controller. For libusb-win32 see http://www.libusb.org/wiki/libusb-win32. For libftdi visit intra2net at http://www.intra2net.com/en/developer/libftdi/.
- OS and driver-dependent I/O
- The second layer consists of functions to communicate with the hardware and a wrapper, called Morpho_IO through which all communications attempts from higher level functions are routed (BPI_Morpho_Low.c). All functions that use Morpho_IO are written in an operating system independent manner. We do, however, stick to the convention that the least significant byte or word is written and read first.
- Direct access to hardware/firmware registers
- An intermediate layer provides easy to use read and write functions for direct access to the various back-end modules inside the FPGA (BPI_Morpho_Mid.c). The file BPI_Morpho_registers.c contains functions that provide access to the bit-fields in the 16 control registers of the eMorpho. Using these functions isolates the application from a future change of the contents of the control registers.
- Compex functions
- The top layer of the API comprises functions to operate the Morpho detector and convert all the information stored in the data acquisition board into physical quantities (BPI_Morpho_High.c).
- Unified command interface
- A unified command interface provides a convenient, but optional, common entry point for all Morpho commands (BPI_Morpho_Functions.c). Its single function, MorphoCommand() also loads and manages the USB driver DLL.
- Examples
- In a typical application, programmers use only the high-level functions and some of the data read functions from the mid-level. A few stand-alone examples, coded in C, have been included in BPI_Morpho_Examples.c.
Data types
The API has been written to use 32-bit integers as the default integer size and double's as the default floating point format, because C performs all floating-point computations in double precision. The types long and unsigned long have been redefined as int32 and uint32 to show more clearly the intended size.