디바이스 드라이버 mmap에 대한 질문입니다.
글쓴이: lovejin0309 / 작성시간: 금, 2005/12/09 - 2:25오후
블랙핀 BF533-EZKIT에서 개발중입니다.
비디오 디바이스를 열고 메모리 맵으로 주소를 얻어 오려고 하면 에러가 발생해서 이렇게 질문을 올립니다.
다음은 비디오 디바이스 파일인 bfin_ad7171fb.c의 메모리 맵 함수입니다.
bfin_mmap(struct fb_info *info, struct file *file, struct vm_area_struct * vma) { /* we really dont need any map ... not sure how the smem_start will end up in the kernel */ return((int)rgb_buffer) ; }
다음은 응용 프로그램에서 mmap를 사용한 모습입니다.
screen_ptr = mmap(0, screen_height * screen_width * (bits_per_pixel/8), PROT_READ}PROT_WRITE, 0, screen_fd, 0);
입니다.
이 상태에서 실행하면 다음과 같은 메세지가 나옵니다.
에러 메세지는 mmap()를 사용할 때 발생합니다.
<4>Jan 1 04:24:42 kernel: Illegal use of supervisor resource <4>Jan 1 04:24:42 kernel: - Attempted to use a Supervisor register or instruction from User mode. <4>Jan 1 04:24:42 kernel: Supervisor resources are registers and instructions that are reserved <4>Jan 1 04:24:42 kernel: for Supervisor use: Supervisor only registers, all MMRs, and Supervisor <4>Jan 1 04:24:42 kernel: only instructions. <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 kernel: CURRENT PROCESS: <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 kernel: COMM=video_test PID=33 <4>Jan 1 04:24:42 kernel: TEXT=01800044-01805ea4 DATA=01805ea8-018072b8 BSS=018072b8-0180a018 <4>Jan 1 04:24:42 kernel: USER-STACK=0180ff78 <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 kernel: RETX: 018005f0; contents of [RETX-16...RETX+8[: <4>Jan 1 04:24:42 kernel: 0881 1769 3202 9345 2f66 0cc0 1b0b e14a <4>Jan 1 04:24:42 kernel: 0180 e10a 9f58 9110 3048 0881 1703 3202 X <4>Jan 1 04:24:42 kernel: 9345 2f00 3215 3248 e151 0180 3004 e111 <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 kernel: RETE: 00000000 RETN: 00000000 RETX: 018005f0 RETS: 01800ba6 <4>Jan 1 04:24:42 kernel: IPEND: 0008 SYSCFG: 0036 <4>Jan 1 04:24:42 kernel: SEQSTAT: 0000002e SP: 0184ff24 <4>Jan 1 04:24:42 kernel: R0: 0000020c R1: 00000000 R2: fffffa5f R3: 00000000 <4>Jan 1 04:24:42 kernel: R4: 00000168 R5: 00000167 R6: fffffe99 R7: 00000000 <4>Jan 1 04:24:42 kernel: P0: fffffa5f P1: 00000000 P2: 01809f58 P3: 0180a004 <4>Jan 1 04:24:42 kernel: P4: 0180a008 P5: 00ff0000 FP: 0180feb4 <4>Jan 1 04:24:42 kernel: A0.w: 00000000 A0.x: 00000000 A1.w: 00000000 A1.x: 00000000 <4>Jan 1 04:24:42 kernel: LB0: 018047f5 LT0: 018047f2 LC0: 00000000 <4>Jan 1 04:24:42 kernel: LB1: 00000001 LT1: 00000000 LC1: 00000000 <4>Jan 1 04:24:42 kernel: B0: fffffd32 L0: 00000000 M0: 00000000 I0: 00000000 <4>Jan 1 04:24:42 kernel: B1: 00000000 L1: 00000000 M1: 00000000 I1: 01809f60 <4>Jan 1 04:24:42 kernel: B2: 00000000 L2: 00000000 M2: 00000000 I2: 00000000 <4>Jan 1 04:24:42 kernel: B3: 00000000 L3: 00000000 M3: 00000000 I3: 00000000 <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 kernel: USP: 0180feb4 ASTAT: 02000022 <4>Jan 1 04:24:42 kernel: <4>Jan 1 04:24:42 last message repeated 1 time(s) <0>Jan 1 04:24:42 kernel: Stack from 0184fe78:<0> <4>Jan 1 04:24:42 kernel: <0> 0180a008<0> 00004306<0> 00000001<0> 000dbf1c<0> ffffffff<0> 00000004<0> 00000000<0> 00030005<0> <4>Jan 1 04:24:42 kernel: <0> 018059e6<0> 0180feb8<0> 00000000<0> 0002910e<0> 00613740<0> 00000001<0> 00000000<0> 00613e20<0> <4>Jan 1 04:24:42 kernel: <0> 00000003<0> 0184fee8<0> 000291fa<0> 0184fee8<0> 00613740<0> fffffff7<0> 01807276<0> 00000001<0> <4>Jan 1 04:24:42 kernel: <0> 000b8380<0> 00000003<0> 00000000<0> 0184fee8<0> 00000000<0> 00000000<0> 00000000<0> 000068ea<0> <4>Jan 1 04:24:42 kernel: <0> 000291c4<0> 00000004<0> 00000100<0> ffffe000<0> 00000004<0> 0000675a<0> 00ff0000<0> 00000000<0> <4>Jan 1 04:24:42 kernel: <0> 0000000b<0> 0180622f<0> 018059e6<0> 018005f0<0> 00000008<0> 0000002e<0> 00000000<0> 00000000<0> <4>Jan 1 04:24:42 kernel: Call Trace:<0> <4>Jan 1 04:24:42 kernel: bfin_ad7171_fb Realeased
도움 부탁 드립니다.
Forums:
Re: 디바이스 드라이버 mmap에 대한 질문입니다.
rgb_buffer가 드라이버 내부의 버퍼포인터인가요?
드라이버 내부의 mmap_fileoperation이 app쪽의 mmap에 그대로 매핑되는것이 아닙니다.
드라이버쪽의 mmap구현과 메모리 매핑에 대해서 좀더 찾아보시기 바랍니다.
MMU 가 없는 시스템이기 때문에 그렇습니다. ㅎㅎ
MMU 가 없는 시스템이기 때문에 그렇습니다. ㅎㅎ
댓글 달기