I'm about to be working with a USB Uart/fifo chip from ftdichip.com, its thier FT245BM model. I'm writing my own software and they have a driver that creates a com port for the usb and allows easy access, but for what I'm doing I would MUCH rather access the device directly (which they also have a driver for)
However, I've never programmed for hardware i/o before. I'm a little curious as to how the algoritm goes (English description of what I'll need to do in the code). I'll be mostly sending a few bytes at a time (no file tranfers)... Sometimes writing to device, mostly reading from.
I see some code in thier driver regarding the read function:
These are all functions written by FTDI. They are not standard API. They do have documentation for their DLL here.
Their DLL is essentially only wrapper functions to access their driver.
I guess I'm curious as to how the whole read and write goes with buffers and whatnot.
I see the read function has:
ftHandle: pointer to the communication handle of the device to read. lpBuffer: pointer to the buffer that receives the data from the device. DwBytesToRead: Number of bytes to be read from the device. lpdwBytesReturned: Pointer to a variable of type DWORD which receives the number of bytes read from the device.
ftHandle... thats the device id (?)
lpBuffer... uh, the pointer to where data is stored
DwBytesToRead... number of data bytes I suppose
lpdwBytesReturned... dunno, isnt it the same as DwBytesToRead ?
Also say I call the read()and get the data from it... when I read again, how do i know that data is new or is the same data I just read ? When does this buffer get cleared ? I read throught the manual, but 11 pages isnt exactly in depth...
[/b]
Take a look at Silicon Labs USB controller www.silabs.com . It's a super fast 8051 + USB. They provide an API for both the host side and the Device side - No RS232 required.