LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-03-2015, 07:58 AM   #1
Abdul Basit
LQ Newbie
 
Registered: Apr 2015
Posts: 10

Rep: Reputation: Disabled
__raw_writel is not working in procfs write?


I am writing a kernel module in which Procfs is created. In write function of procfs I write to a reg using __raw_writel() and then I read back using __raw_readl() but I am getting 0. My device base address is 0xaca10000.

Code:
void* virtaddr;
struct proc_dir_entry *proc_file_entry;

ssize_t write_proc( struct file *filp, const char __user *buff,

                        unsigned long len, void *data )

{

while(__raw_readl(virtaddr) ! = 8601)
{
 __raw_writel(8601,virtaddr)
 printf("%d\n",__raw_readl(virtaddr));
}

}


static const struct file_operations proc_file_fops = {
 .owner = THIS_MODULE,
 .write = write_callback,
 .read  = read_callback,
};

int __init init_module(void){

  virtptr = ioremap_nocache(0xaca10000,4096);
  if(!virtptr)
  return -ENOMEM;
    proc_file_entry = proc_create("proc_file_name", 0, NULL,     &proc_file_fops);
  if(proc_file_entry == NULL)
   return -ENOMEM;
  
  return 0;
}
 
  


Reply

Tags
kernel module, linux


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
could someone help me with the procfs ?? hemanth1989 Linux - Kernel 5 04-21-2014 04:17 PM
Linux Driver - how to read/write a block or character device in kernel space (procfs) stybi Linux - Kernel 1 01-27-2011 06:26 AM
procfs read and write doubts... Devika99 Programming 2 11-30-2009 07:08 AM
procfs nullpt *BSD 1 10-25-2003 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:52 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration