LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 10-26-2009, 01:52 PM   #1
atif_shabir
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
help regarding memory driver


Hello

I want to write to some specific physical address in the system memory space. I am writing a driver for it. I am using following functions

in module_init:
check_region() to check the availability of that specific physical address.
request_mem_region() to request the memory resource from the kernel in case of successful check_region(). The function request_mem_region() returns success which means (as far as I assume) that the resource has been allocated to my driver.

in write function
If the request_region() returns success then I must be able to write to that memory address just freely.
For example: *(char *)myphysicaladdr = some value

But when I open the driver file from /dev and write a charater to it, segmentation fault occurs. Kindly somebody help me what should I do?

outb() is used to write to an i/o port address. Kindly tell me is there any function to write to physical address?

regards,
Atif Shabir
 
Old 10-29-2009, 10:37 AM   #2
cladisch
Member
 
Registered: Oct 2008
Location: Earth
Distribution: Slackware
Posts: 227

Rep: Reputation: 54
Quote:
If the request_region() returns success then I must be able to write to that memory address just freely.
For example: *(char *)myphysicaladdr = some value
No; request_region() just gives you ownership of some address range on the (PCI) bus.
To map that range into the CPU's address space, call ioremap(), and don't forget to call iounmap() later for releasing that mapping.
To access that memory, use readb/w/l/q() and writeb/w/l/q().
 
  


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
Isolating driver memory space rajeshwar27singh Linux - Kernel 4 10-29-2007 05:39 PM
SIS driver : out of video memory Phlange Linux - Software 1 06-25-2003 07:36 AM
how do I exclude memory from driver use? basd Linux - Hardware 0 04-15-2003 02:48 PM
Secure Digital (SD) Memory Driver Problems? stevef1 Linux - General 2 12-15-2001 04:43 AM
memory allocation, application<-->driver charlies Programming 2 03-03-2001 11:26 PM


All times are GMT -5. The time now is 07:43 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
Open Source Consulting | Domain Registration