Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Linux-2.6.x/drivers/input/touchscreen  드라이버를 변경하여 Mouse mode 에서 그림을 그리도록 하자.

Similar presentations


Presentation on theme: " Linux-2.6.x/drivers/input/touchscreen  드라이버를 변경하여 Mouse mode 에서 그림을 그리도록 하자."— Presentation transcript:

1

2  Linux-2.6.x/drivers/input/touchscreen  드라이버를 변경하여 Mouse mode 에서 그림을 그리도록 하자.

3  Sub LCD display control ◦ 주소 : 0x04001000 ◦ Reminder (from LCD slides)  Bit control ◦ 0-2: BG Mode ◦ 3: (Engine A) BG0 2D/3D Selection (instead CGB Mode) (0=2D, 1=3D) ◦ 8: Screen Display BG0 (0=Off, 1=On) ◦ 9: Screen Display BG1 (0=Off, 1=On) ◦ 10: Screen Display BG2 (0=Off, 1=On) ◦ 11: Screen Display BG3 (0=Off, 1=On) ◦ 16-17: Display Mode (Engine A: 0..6, Engine B: 0..5) ◦ 18-19: (Engine A) VRAM block (0..3=VRAM A..D) (For Capture & above Display Mode=2) ◦ 24-26: (Engine A) Character Base (in 64K steps) (merged with 16K step in BGxCNT) ◦ 27-29: (Engine A) Screen Base (in 64K steps) (merged with 2K step in BGxCNT) ◦ 30: BG Extended Palettes (0=Disable, 1=Enable)

4 Sub 2D Engine ModeBG0BG1BG2BG3 Mode 0Text Mode 1Text Rotation Mode 2Text Rotation Mode 3Text Extended Mode 4Text RotationExtended Mode 5Text Extended 우리가 원하는 mode 우리가 원하는 frame buffer BG mode = 5, Display mode = 1 (2D) BG3 를 사용 -> 11 번 bit 1 0000 0000 0000 0001 0000 1000 0000 0101 0x 0 0 0 1 0 8 0 5

5  VRAM control register ◦ 0x04000240 부터 1 바이트 ◦ VRAM A  0x04000240 ◦ VRAM B  0x04000241 ◦ VRAM C  0x04000242 ◦ … ◦ VRAM I  0x04000249 VRAM C 쓰자 VRAM A/B 는 Main LCD 에서 쓰고 있음

6  VRAM 설정 ◦ Bit control  0-2 VRAM MST ;Bit2 not used by VRAM-A,B,H,I  3-4 VRAM Offset (0-3) ;Offset not used by VRAM-E,H,I  5-6 Not used  7 VRAM Enable (0=Disable, 1=Enable)  VRAM C 사용, Sub LCD ◦ Sub LCD 주소는 0x0620000 ◦ http://nocash.emubase.de/gbatek.htm#dsmemorycontr olvram 의 사용 가능 모드 참조 http://nocash.emubase.de/gbatek.htm#dsmemorycontr olvram  우리가 사용할 모드 VRAM SIZE MST OFS ARM9, 2D Graphics Engine B, BG-VRAM (max 128K) C 128K 4 - 6200000h

7  BG3 control register ◦ 0x0400100E  0-1 BG Priority (0-3, 0=Highest)  2: 8-bit (0), 16-bit (1)  3-5 Not used (must be zero)  6 Mosaic (0=Disable, 1=Enable)  7 Colors/Palettes (0=16/16, 1=256/1)  8-12 Screen Base Block (0-31, in units of 2 KBytes) (=BG Map Data)  13 Display Area Overflow (0=Transparent, 1=Wraparound; BG2CNT/BG3CNT only)  14-15 Screen Size (0-3) ◦ Screen size Value Text Mode Rotation/Scaling Mode 0 256x256 (2K) 128x128 (256 bytes) 1 512x256 (4K) 256x256 (1K) 2 256x512 (4K) 512x512 (4K) 3 512x512 (8K) 1024x1024 (16K) 14 번 bit 1

8  SUB_BG3_XDX (*(volatile u16*)0x04001030) ◦ X 크기 : 256  SUB_BG3_XDY (*(volatile u16*)0x04001032) ◦ rotation  SUB_BG3_YDX (*(volatile u16*)0x04001034) ◦ rotation  SUB_BG3_YDY (*(volatile u16*)0x04001036) ◦ Y 크기 : 256  SUB_BG3_CX (*(volatile u32*)0x04001038) ◦ X offset  SUB_BG3_CY (*(volatile u32*)0x0400103C) ◦ Y offset

9  Define 문장 추가 #define MODE_5_2D0x10005 #define DISPLAY_BG3_ACTIVE (1 << 11) #define SUB_BG3_CR (*(volatile u16*)0x0400100E) #define BG_BMP16_256x256 ((1<<14)|(1<<7)|(1<<2)) #define SUB_BG3_XDX (*(volatile u16*)0x04001030) #define SUB_BG3_XDY (*(volatile u16*)0x04001032) #define SUB_BG3_YDX (*(volatile u16*)0x04001034) #define SUB_BG3_YDY (*(volatile u16*)0x04001036) #define SUB_BG3_CX (*(volatile u32*)0x04001038) #define SUB_BG3_CY (*(volatile u32*)0x0400103C) #define SUB_LCD_BASE 0x06200000

10  rgb 함수 추가 static unsigned short rgb(unsigned char r, unsigned char g, unsigned char b) { return ( (r&0x1f) | ((g&0x1f)<<5) | ((b&0x1f)<<10) | (1<<15) ); }  switch_to_mouse_mode(void) 끝에 추가 SUB_DISPLAY_CR = MODE_5_2D | DISPLAY_BG3_ACTIVE; VRAM_C_CR = VRAM_ENABLE | VRAM_C_SUB_BG_0x6200000 ; SUB_BG3_CR = BG_BMP16_256x256; SUB_BG3_XDX = 1 << 8; SUB_BG3_XDY = 0; SUB_BG3_YDX = 0; SUB_BG3_YDY = 1 << 8; SUB_BG3_CX = 0; SUB_BG3_CY = 0; // Clear the screen for(i=0;i<256*192;i++) *((volatile u16*)SUB_LCD_BASE + i)=rgb(0,0,0);

11  Switch_to_keyboard_mode(void) 첫 문장 추가 draw_keyboard(0); // to change graphics mode  ndstouch_input_event(..) 에 추가 ◦ MOUSE_MODE 에서 input_sync(dev); // 원래 있던 코드 *((volatile u16*)SUB_LCD_BASE+x+y*256)=rgb(255,0,0); // 추가 – 터치되는 곳을 붉은 색으로 !

12  DSLinux 를 다시 빌드  Image (nds 파일 ) 를 NDSL 에 복사, 수행  SUB LCD 의 우측 상단 M 을 눌러 mouse mode 로 전환 후, 화면 실행을 확인

13 1. 두 개의 점을 찍으면 사각형을 그려보자. 2. 두 개의 점을 찍으면 선을 그려보자. 3. Rubber band 를 구현해 보자.


Download ppt " Linux-2.6.x/drivers/input/touchscreen  드라이버를 변경하여 Mouse mode 에서 그림을 그리도록 하자."

Similar presentations


Ads by Google