Home > OS >  Why can't directly in LED driver configuration ioremap () function generates the virtual addres
Why can't directly in LED driver configuration ioremap () function generates the virtual addres

Time:09-26

In write the LED driver, has been through ioremap () function to obtain the corresponding LED register virtual address, why can't directly control the values in the GPJ2DAT_VA? Also buf first by the copy_from_user function from user space to kernel space, then to judge wbuf values to configure the corresponding register again? Because when driving load has entered into the kernel, not to read data on the user's space? Here is part of the program, I am beginner driver, also is not very understanding, in this respect please bosses glad

Ret=the copy_from_user (wbuf, buf, len);
If (ret!=0)
{
Printk (" failed to copy the from user \ n ");
return -1;
}

If (wbuf [0]=='0')
{
* GPJ2DAT_VA & amp;=~ 0 xf.
* GPJ2DAT_VA |=0 xe;
}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Copyright statement: this article to CSDN blogger (ZJE_ANDY) of the original articles, follow BY CC 4.0 - SA the copyright agreement, reproduced and this statement, please attach the original source link
The original link: https://blog.csdn.net/u014453898/article/details/60144021

CodePudding user response:

The user space and kernel space memory cannot be accessed directly, only through the copy_from_user and copy_to_user interact
  • Related