USB driver

Dear David,

I'm just writing a driver for a USB board which will be produced in the 
near future. The driver works so far (channellist and ranges not 
implemented yet).

I have some questions regarding the usb-comedi interaction:

1) The USB device driver has to have an array of private data 
structures. Every entry in this array is associated with one data 
aquisition board. The structure is already there and therefore I have 
also associated to private structure of the comedi device with a entry 
in this array. I'm aware that comedi does not like global structures but 
this one has to be there. The problem arises when I call the detach 
function of comedi. This routine frees the private structure. However, 
this structure is static in memory and stays there until the module is 
removed. From my point of view there are just now two solutions: I 
_really_ allocate a private structure which is removed after detach. 
This structure might then only contain one pointer to the usb-structure. 
Or: comedi allows me to keep the private structure even after detach has 
been called. I'm open for suggestions. Just now I _give_ comedi 
something what I have allocated in order to free it. Have a look at the 
code.

2) USB has an event handler and not an interrupt. What do you think is 
the best way to cope with this? My solution you find in the code. I had 
a look how comedi treats registering an handler and did the same in my 
code. Howevre, I can not use the original code as it requests a physical 
interrupt which is not there in the usb subsystem.

3) I cannot use the macro COMEDI_INITCLEANUP. The reason is that I have 
to register the usb subsystem and the comedi driver. Can you imagine a 
macro which can call an additional init and cleanup function? It would 
be nice having that.

4) Regarding firmware: how can I upload firmware? Just now I have 
registerd an additional device /dev/ez0 which I use for the up- and 
download (which is in fact really a cypress chip which I use). Also not 
very elegant. But it works.

For all the wolfs in the community I have supplied a preliminary driver 
for this device. I like to get feedback.

Herman:
Regarding docu. I would recommed that you paste into your documentation 
the /** comments **/ of the file cmd.c which explain the evens (*src). 
Thanks to John Sims who pointed me to the right direction. Sorry Herman, 
but the section which describes the different triggers it quite opaque. 
Only the comments in the file cmd brought me further. I would suggest 
that you order the trigger according to the *.src events like:
start_src has the following options:
  a) TRIG_INT xxx,
  b) TRIG_NOW, xxx.

Many thanks.

/Bernd

-- 
http://www.cn.stir.ac.uk/~bp1/
mailto:bp1_at_cn.stir.ac.uk

Received on 2003-05-07Z12:21:15