디바이스 드라이버 메모리 접근

studentoflinux의 이미지

BBB를 이용해서 GPMC장치를 제어하는 디바이스 드라이버를 코딩중입니다.

BBB(am335x) 에서 GPMC장치의 메모리는 0x0000 0000 부터 시작으로 봤는데요.

이 부분을 디바이스 드라이버 모듈의 init 부분에서 적재 시 ioremap을 이용해 매핑하도록 구현하였습니다.

NULL포인터를 리턴하지 않는 것을 보아 매핑은 정상적으로 되는거 같은데

iowrite16/ioread16 또는 writeb/readb 모두 사용해도 에러가 발생하네요.

write 시에는 unhandled fault: imprecise external abort (0xc06)
read 시에는 Unhandled fault: external abort on non-linefetch (0x008)
에러가 발생합니다.

read의 경우에는 찾아보니 맵핑되지 않은 메모리 접근을 시도했을 경우라고 하는데 위에서 설명했듯, NULL포인터를 리턴하지 않습니다. 따라서 정상이라고 판단됩니다.

ioremap_nocache의 경우에도 마찬가지의 에러가 발생하네요.

혹시 read/write 함수를 잘못쓰고 있는건지 의견 부탁드립니다.

shint의 이미지


- 파워
- GPIO 설정 export

등등 여러가지 오류에 대한 내용이 있는거 같습니다.

잘 되는 예제소스와 책에 대한 주소도 첨부해봅니다. 참고해보세요.

임베디드 리눅스 시스템
http://book.naver.com/bookdb/book_detail.nhn?bid=9555185
http://book.naver.com/search/search.nhn?sm=sta_hty.book&sug=&where=nexearch&query=%EC%9E%84%EB%B2%A0%EB%94%94%EB%93%9C+%EB%A6%AC%EB%88%85%EC%8A%A4+%EC%8B%9C%EC%8A%A4%ED%85%9C

ioremap
http://search.naver.com/search.naver?ie=utf8&sm=stp_hty&where=se&query=ioremap

Simple I/O device driver for RaspberryPi
http://www.codeproject.com/Articles/1032794/Simple-I-O-device-driver-for-RaspberryPi

ioremap
http://www.google.co.kr/search?hl=ko&source=hp&biw=&bih=&q=ioremap&gbv=2&oq=ioremap&gs_l=heirloom-hp.12..0l10.335.335.0.1493.1.1.0.0.0.0.134.134.0j1.1.0....0...1ac.1.34.heirloom-hp..0.1.134.IQYKJhalFkw

unhandled fault: imprecise external abort (0xc06)
http://www.google.co.kr/search?q=unhandled+fault%3A+imprecise+external+abort+%280xc06%29&hl=ko&biw=&bih=&gbv=2&oq=unhandled+fault%3A+imprecise+external+abort+%280xc06%29&gs_l=heirloom-serp.12..0i30.34868.34868.0.35725.1.1.0.0.0.0.137.137.0j1.1.0....0...1ac..34.heirloom-serp..0.1.137.wSVE8ELInNQ

unhandled fault: imprecise external abort (0xc06)
http://search.naver.com/search.naver?ie=utf8&sm=stp_hty&where=se&query=unhandled+fault%3A+imprecise+external+abort+%280xc06%29

Unhandled fault: external abort on non-linefetch (0x008)
http://search.naver.com/search.naver?sm=stb_hty&where=se&ie=utf8&query=Unhandled+fault%3A+external+abort+on+non-linefetch+%280x008%29

Unhandled fault: external abort on non-linefetch (0x008)
http://www.google.co.kr/search?q=Unhandled+fault%3A+external+abort+on+non-linefetch+%280x008%29&hl=ko&biw=&bih=&gbv=2&oq=Unhandled+fault%3A+external+abort+on+non-linefetch+%280x008%29&gs_l=heirloom-serp.12..0i30.0.0.0.-267398.1.1.0.0.0.0.131.131.0j1.1.0....0...1ac..34.heirloom-serp..0.1.130.FAw9BpNyVe4

ioremap_nocache
http://www.google.co.kr/search?q=ioremap_nocache&hl=ko&biw=&bih=&gbv=2&oq=ioremap_nocache&gs_l=heirloom-serp.12..0l3j0i30l7.78271.78271.0.78686.1.1.0.0.0.0.371.371.3-1.1.0....0...1ac..34.heirloom-serp..0.1.371.armd-znGC7Y

http://search.naver.com/search.naver?sm=stb_hty&where=se&ie=utf8&query=ioremap_nocache

iowrite16/ioread16
http://search.naver.com/search.naver?sm=stb_hty&where=se&ie=utf8&query=iowrite16%2Fioread16

http://www.google.co.kr/search?q=iowrite16%2Fioread16&hl=ko&biw=&bih=&gbv=2&oq=iowrite16%2Fioread16&gs_l=heirloom-serp.12...41421.41421.0.45673.1.1.0.0.0.0.134.134.0j1.1.0....0...1ac..34.heirloom-serp..1.0.0.CN-Wx9ssdDU

writeb/readb
http://www.google.co.kr/search?q=writeb%2Freadb&hl=ko&biw=&bih=&gbv=2&oq=writeb%2Freadb&gs_l=heirloom-serp.12...104003.104003.0.104500.1.1.0.0.0.0.0.0..0.0....0...1ac.1.34.heirloom-serp..1.0.0.05orYUgS6d4

http://search.naver.com/search.naver?sm=stb_hty&where=se&ie=utf8&query=writeb%2Freadb

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com