Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.system > #213
| From | new <luvraghu@gmail.com> |
|---|---|
| Newsgroups | comp.os.linux.development.system |
| Subject | Re: mmap dma buffer |
| Date | 2011-07-08 03:31 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <0c1359aa-e42f-4991-b8d0-36c13df3b68e@gv8g2000vbb.googlegroups.com> (permalink) |
| References | (2 earlier) <slrnj1b122.6ff.pavel@wolfman.devio.us> <dd10c6f9-8362-45ea-b024-81b82740926e@29g2000yqb.googlegroups.com> <slrnj1bd1l.94v.pavel@wolfman.devio.us> <ccccc47f-54c5-4b40-92ad-945e75154871@p6g2000vbj.googlegroups.com> <slrnj1daqa.6ek.pavel@wolfman.devio.us> |
On Jul 8, 12:01 pm, Pavel Borzenkov <pa...@devio.us> wrote: > On 2011-07-07, new <luvra...@gmail.com> wrote: > > > okay.. the mmap_buf is filled with data and passed to write() call,the > > write callback in driver creates the descriptor chain and initiates > > the DMA engine. > > If you are using mmap, don't use write to trigger DMA (it's very confusing). > Better style is to add new ioctl for this: > > buf = mmap(....); > memcpy(buf, <data to be written to device>, <data size>); > ioctl(fd, START_DMA_WRITE, <data size>); > > > Now to verify if the data is written properly to the device, i need to > > read the data, this is where i'm a bit struck. For reading the data, > > do I need to mmap and call read() function? where the read callback in > > driver will create the descriptor chain and initiate the DMA. > > Is this the correct way to read the data? > > You don't need to do mmap again, the buffer is already mapped to the process' > address space. You may verify the data like this: > > memset(buf, 0, <buf size>); /* required to verify that we actually read > something from the device */ > ioctl(fd, START_DMA_READ, <data size>); > > After that you can compare data like this: > memcmp(buf, <data that was written to device>, <data size>); > > You may want to add 'poll' support into your driver to notify userspace process > that DMA read/write has completed. > > -- > Pavel Oh okay... Thanks a lot Pavel. Really Appreciate. Will get back with the updated code.
Back to comp.os.linux.development.system | Previous | Next — Previous in thread | Find similar
mmap dma buffer new <luvraghu@gmail.com> - 2011-07-06 08:12 -0700
Re: mmap dma buffer Pavel Borzenkov <pavel@devio.us> - 2011-07-07 09:59 +0000
Re: mmap dma buffer Pavel Borzenkov <pavel@devio.us> - 2011-07-07 10:02 +0000
Re: mmap dma buffer new <luvraghu@gmail.com> - 2011-07-07 05:42 -0700
Re: mmap dma buffer Pavel Borzenkov <pavel@devio.us> - 2011-07-07 13:27 +0000
Re: mmap dma buffer new <luvraghu@gmail.com> - 2011-07-07 07:46 -0700
Re: mmap dma buffer Pavel Borzenkov <pavel@devio.us> - 2011-07-08 07:01 +0000
Re: mmap dma buffer new <luvraghu@gmail.com> - 2011-07-08 03:31 -0700
csiph-web