Re: mmap

Hi Anne,

looks good. The function is not very well documented and that it is 
supplied as option[0] and option[1] prevents passing other parameters. 
There was a problem with the type of the option array. Maybe it's a 
good idea to pass the firmware with the help of a "real" pointer and
a size field. Just now there's only one driver in the comedi framwork 
which needs firmware (except the one I'm just writing) and therefore 
it might be the last moment to fix this. What does the community think 
about this?

/Bernd

Anne Smorthit wrote:
> Bernd,
> 
> Thanks for the reply.
> 
> What should my config command look  like?  My file to download is in 
> Tektronix format and called a.out
> 
> /usr/sbin/comedi_config   -i  /Anne/a.out        /dev/comedi0       
> Alphi_Ad8
> 
> I have looked at the man page for comedi_config, but it doesn't mention 
> anything about a -i option.
> 
> Anne
> 
> 
>> From: Bernd Porr <Bernd.Porr_at_cn.stir.ac.uk>
>> To: Anne Smorthit <annesmorthit_at_hotmail.com>,  comedi_at_comedi.org
>> Subject: Re: mmap
>> Date: Fri, 23 May 2003 09:40:36 +0100
>>
>> Hi Anne,
>>
>> options[0] is the pointer to the firmware and options[1] is the 
>> length. From the userspace: comedi_config has an option for uploading 
>> the firmware:
>>   -i, --init-data <filename>
>>       Use file for driver initialization data, typically firmware code.
>>
>> ---------------------
>>
>> driver (rough sketch):
>> static int xxx_attach(comedi_device * dev, comedi_devconfig * it)
>> {
>>                // trying to upload the firmware into the chip
>>                 if(it->options[0] && it->options[1]){
>>                         size = it->options[1];
>>                         dev->private->firmware = 
>> kmalloc(size,GFP_KERNEL);
>>                         if(copy_from_user(dev->private->firmware,
>>                                           (unsigned char 
>> *)it->options[0],
>>                                           size)){
>>                                 printk("comedi_: usbdaqdt%d: ptr to 
>> firmware invalid\n",
>>                                        index);
>>                                 ret=-EFAULT;
>>                                 return ret;
>>                         }
>> ... and then you can upload it into the chip.
>>
>> /Bernd
>>
>>
>> Anne Smorthit wrote:
>>
>>> I am writing a driver for the Alphi Technologies Ad8 cPCI card.  I 
>>> need to be able to download a file to the on board DSP.  To do this I 
>>> think I need to mmap BAR0 & BAR2 so that I can access them from my 
>>> user space application.
>>>
>>> How do I go about doing this?
>>>
>>> Thanks for your help
>>>
>>> Anne Smorthit
>>>
>>> RUAG Aerospace, Postfach 301, CH-6032 Emmen, Switzerland
>>> Tel : +41 41 268 2355
>>> Mail to: anne.smorthit_at_sfwte.ch
>>>
>>> _________________________________________________________________
>>> Protect your PC - get McAfee.com VirusScan Online 
>>> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>>>
>>>
>>> _______________________________________________
>>> comedi mailing list
>>> comedi_at_comedi.org
>>> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
>>
>>
>> -- 
>> http://www.cn.stir.ac.uk/~bp1
>> mailto:bp1_at_cn.stir.ac.uk
>>
>>
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail

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

Received on 2003-05-23Z11:35:15