Reading and Writing register i.MX6UL

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Reading and Writing register i.MX6UL

跳至解决方案
8,631 次查看
pratyushtomar
Contributor IV

I want to read and write LPTAR register for my board using i.MX6UL processor to wake up board from shutdown state. Is their any sample code how to read and write register from userspace in yocto?

标签 (3)
1 解答
5,793 次查看
Carlos_Musich
NXP Employee
NXP Employee

For direct memory access Linux provides special node /dev/mem. You can try to write to registers directly using memtool included in imx-test package.


Basically You may look at memtool sources. Please note that accesses to non-supported address regions (hardcoded in /dev/mem driver) may cause system issues.

Supported registers may be shown using the next command

$ /unit_tests/memtool .

or

$ /unit_tests/memtool *

 For help

$ /unit_tests/memtool

You can find and exampl of usage in page 30 of next document.
http://www.freescale.com/files/32bit/doc/app_note/AN4576.pdf

To include this tool in your build you need to add IMAGE_iNSTALL_append = "imx-test" in the local.conf

After built succeed, unit_test can be found in build-6ul-x11/tmp/deploy/images/imx6ulevk/core-image-base-imx6ulevk.tar.bz2

If you want to access through you own c code you may check the sourcecode of memtool. Or here you can see an example.

Accessing CCSR from linux user space 


Best regards,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
5,794 次查看
Carlos_Musich
NXP Employee
NXP Employee

For direct memory access Linux provides special node /dev/mem. You can try to write to registers directly using memtool included in imx-test package.


Basically You may look at memtool sources. Please note that accesses to non-supported address regions (hardcoded in /dev/mem driver) may cause system issues.

Supported registers may be shown using the next command

$ /unit_tests/memtool .

or

$ /unit_tests/memtool *

 For help

$ /unit_tests/memtool

You can find and exampl of usage in page 30 of next document.
http://www.freescale.com/files/32bit/doc/app_note/AN4576.pdf

To include this tool in your build you need to add IMAGE_iNSTALL_append = "imx-test" in the local.conf

After built succeed, unit_test can be found in build-6ul-x11/tmp/deploy/images/imx6ulevk/core-image-base-imx6ulevk.tar.bz2

If you want to access through you own c code you may check the sourcecode of memtool. Or here you can see an example.

Accessing CCSR from linux user space 


Best regards,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------