Re: mmap

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

Received on 2003-05-23Z07:40:36