LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-26-2012, 12:22 AM   #1
nid83
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Rep: Reputation: Disabled
Smile How to create shared mmap for a bitmap file in c Linux?


Hi there forgive me, im a newbie in Linux.Currently Im trying to build an embedded linux system using qemu.
Im am doing some image processing programming with a special library (.so file). This library has a function to read Image from a memory.This library function is to decode an image given from the main program.c .

below are the program flow i created:

1- main program.c get an image file and put into memory with malloc function.
2- The decoder library reads the data from the malloc and compute the result.result is pass back from the library to the main program.c .


What i hope to achieved:


1-I would like to created 3 mmap with the size for and 1.3 megapixel image.
2-By having this 3 mmap, i could store 3 different image for the library to decode later.
3- I would like to know also the specific address like DMA so that i could shared this 3 mmap with a another program.c.

The problem I'm facing :

1- i never used mmap before.How to make 3 mmap?
2-How to put the image into the mmap?
3-Mmap can have a specific address? can i use this address in another program.c ?

Thank you for reading my post, I hope that post wasn't confusing
 
Old 04-26-2012, 02:12 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,001

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
here is a good example on mmap: http://www.kohala.com/start/unpv22e/unpv22e.chap12.pdf
 
1 members found this post helpful.
Old 04-26-2012, 02:58 AM   #3
nid83
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you for the quick reply . Do u know any simple example source code in C, For example a program that takes a 3 image data from a specific directory.And then create 3 mmap for each image and put it into the mmap? it wouldnt do anything else, but just give a pointer of this 3 mmap to my library for decoding I am slow, hope that u could help ,Thank you
 
Old 04-26-2012, 03:14 AM   #4
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,001

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
you need to start with the example I gave you or look for another one if you do not like this one. It is not really hard.
Be familiar with mmap and you will be able to put images into that.
 
1 members found this post helpful.
Old 04-26-2012, 03:28 AM   #5
nid83
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you pan64, I hope know that i really appreciate your help My bad, because i got all confuse reading the code from the document. Looking at mutex, semaphera or fork really scared me, hehehe. I was planing to that in the next step after im done with mmap. Thank you very much i really really appreciate your help .
 
Old 04-26-2012, 03:37 AM   #6
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,001

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
There are so many examples out there:

http://www.jimscode.ca/index.php/com...e-mmap-example
http://beej.us/guide/bgipc/output/ht...page/mmap.html
http://blog.satisheerpini.net/2010/1...sing-mmap.html

Noone will make your program, but we will help you in case you won't find the next step....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't create shared object file Mooseoo7 Linux - Newbie 5 12-22-2011 05:45 PM
How to create a shared memory and some shared objects in linux? jeremy28 Programming 6 06-11-2010 05:21 AM
[SOLVED] How to create bitmap from raw data in GTK? 10110111 Programming 3 04-03-2010 12:29 PM
tune2fs: can't read an inode bitmap while trying to create journal file fhd Linux - Desktop 2 01-18-2007 04:35 AM


All times are GMT -5. The time now is 03:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration