1 / 125

Windows CE .NET Device Driver

Windows CE .NET Device Driver. 경희대학교 컴퓨터 공학과 조 진 성. 목차. Overview of device driver GPIO_LED device driver 제작 KEYPAD device driver 제작 KEYPAD, GPIO_LED 를 이용한 application 제작. Overview of Device Driver. Device driver. OS 와 application 에게 적절한 인터페이스를 제공한다 .

emmy
Télécharger la présentation

Windows CE .NET Device Driver

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows CE .NETDevice Driver 경희대학교 컴퓨터 공학과 조 진 성

  2. 목차 • Overview of device driver • GPIO_LED device driver 제작 • KEYPAD device driver 제작 • KEYPAD, GPIO_LED를 이용한 application제작

  3. Overview of Device Driver

  4. Device driver • OS와 application에게 적절한 인터페이스를 제공한다. • Application programmer는 device driver를 사용하여 하드웨어에 관한 지식 없이 하드웨어를 사용할 수 있다.

  5. WINCE device driver • Application에서 직접 H/W 제어 불가 • 제어를 하기 위해서는 device driver나 커널을 통해서 제어 • Device driver 개발 • MS “Platform Builder” • 네 가지 프로세서를 지원하는 컴파일러 • 각종 라이브러리, 소스코드 등을 포함 • 커널 포팅 및 device driver, Application 같은 모듈 개발 • MS “eMbedded Visual C++” : WinCE용 Native Application 개발 • Visual Studio.net 2003 : Managed Application 개발 • 다른 OS device driver와 달리 User Mode에서 동작한다. • dynamic 또는 static하게 OS에 링크된다. • 인터럽트를 받는 부분은 커널 소스를 수정하여야 한다. • 커널은 device driver에게 인터럽트 발생 메시지를 전송한다.

  6. WINCE device driver • 일반적인 디바이스 드라이버는 디바이스 매니저가 로드/관리의 작업수행 • 용도에 따라 FileSys, GWES에서 관리 • 디바이스 매니저가 관리 • HKEY_LOCAL_MACHINE\Drivers 레지스트리에 저장 • GWES가 관리 • HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP 위치

  7. WINCE device driver의 종류 • Built-in driver • Native device driver • 전용 디바이스 드라이버 • 다른 드라이버의 구조에 맞춰서 구현하기가 힘들고, 정해진 방식대로, 정해진 함수들을 구현해야 함 • 파이프 라인 (Pipeline) • Application이 WINCE에서 지원하는 API를 통해서 device driver에 접근 • 정적으로 GWES에 링크되거나 DLL로 동작한다. • 이 드라이버는 하드웨어에 완전히 종속적이어서 정해진 인터페이스를 제공하지 않는 경우가 많다.

  8. WINCE device driver의 종류

  9. WINCE device driver의 종류 • Installable driver • Stream device driver • Application과 device driver가 데이터를 주고 받는 경우 • H/W를 제어하는 방식이 특정 API를 통하는 방식 • Stream 관련 API : CreateFile, ReadFile, WriteFile등 • User Mode DLL파일. • 디바이스 매니저(device.exe)에 의해 로딩되어 동작한다. • 기본적으로 일관된 인터페이스를 가진다.

  10. WINCE device driver의 종류

  11. WINCE device driver의 종류 • Layered Driver • 일반적인 윈도우 CE 디바이스 드라이버 • 상위 계층 (upper Layer : MDD) • Module Dependent Driver • 각 드라이버들의 공통된 부분의 라이브러리나 소스 • 공통 모듈 • 하위 계층 (Lower Layer : PDD) • 특정 하드웨어에 맞춰진 코드 • Monolithic driver • MDD 모듈이 제공되지 않거나 비교적 간단한 드라이버에 적용

  12. WINCE device driver의 종류

  13. Stream device driver • Device에 상관없이 일관된 인터페이스를 제공한다. • 논리적으로 데이터를 주고받는 device에 적합하다. • File system API와 매치되어 진다. • CreateFile, ReadFile, WriteFile … • 디바이스 드라이버 이름은 ‘COM1’같은 형태로 만들어진다. • COM : prefix. 영어 3문자. device종류 구분 • 1 : index. 한자리 숫자. device의 index • 레지스트리에 저장되어 있는 값이어야 한다. • 사용시, ‘COM1:’형태로 사용한다. ‘:’를 항상 붙여야 한다.

  14. Stream device driver

  15. 드라이버 로드 순서 • Device manager(device.exe)가 시스템에 로드 된다. • 장치열거자(regenum.dll)을 이용하여 레지스트리 내 드라이버들을 조사한다. • [HKEY_LOCAL_MACHINE\Drivers\Builtin]을 검사한다. • 드라이버들의 목록과 초기화할 순서를 만든다. • 레지스트리를 읽어 각각의 드라이버(DLL파일)을 로드한다. • 각 드라이버의 Active키를 생성하고 레지스트리에 저장한다. • [HKEY_LOCAL_MACHINE\Drivers\Active]에 저장한다. • xxx_Init을 통해 드라이버를 초기화 시킨다. • 이후 CreateFile을 통해 드라이버를 사용한다.

  16. Device Driver 제작방법

  17. Device driver 제작 • 기본적으로 필요한 파일 • *.c – source file • *.def – definition file • makefile • sources – target name, source files등을 설정한다.

  18. GPIO_LED device driver

  19. 작업개요 • GPIO를 이용한 LED device driver의 제작 • PXA255PRO3 board에 2개의 led가 있다. • 2개의 led는 GPIO82와 83에 연결되어 있다. • LED가 10회 깜박거리는 application을 만들어 2개의 led를 test한다.

  20. [\wince40\platform\PXA255PRO3\drivers\gpio_led] • 필요한 모든 파일은 위 디렉토리에 저장한다.

  21. gpio_led.c(1)

  22. gpio_led.c(2)

  23. gpio_led.c(3)

  24. gpio_led.c(4)

  25. gpio_led.c(5)

  26. gpio_led.c(6)

  27. gpio_led.c(7)

  28. gpio_led.c(8)

  29. gpio_led.c(9)

  30. gpio_led.c(10)

  31. gpio_led.c(11)

  32. gpio_led.def

  33. makefile

  34. sources(1)

  35. sources(2)

  36. Compile device driver • Platform builder에서 • [Build]->[Open build release directory]를 선택한다.

  37. 현재 device driver를 구현한 directory로 이동한다. • [SET WINCEREL=1]을 입력한다. • 위 환경변수를 설정하면, 자동으로 release directory에 복사된다. • [build –cfs]를 입력한다.

  38. Build가 에러없이 완료되었다.

  39. GPIO LED Test Application 제작

  40. gpio_led test application • Platform builder에서 • [File]->[New Project or File…]을 선택한다.

  41. [WCE Application]을 선택한다. • Project Name에는 적절한 이름을 적은 후, [OK]를 선택한다.

  42. [A simple Windows CE application]을 선택한다. • [Finish]를 선택한다.

  43. 위와 같이 새로운 project가 생성된 것을 볼 수 있다. • [Source Files]->[gpio_led_test.cpp]의 내용을 수정해야 한다.

  44. gpio_led_test.cpp(1)

  45. gpio_led_test.cpp(2)

  46. gpio_led_test.cpp(3)

  47. gpio_led_test.cpp(4)

  48. Build gpio_led_test app • Platform builder에서 • [Build]->[Build gpio_led_test.exe]를 선택한다.

  49. 에러없이 컴파일이 완료되었다.

  50. Making OS Image

More Related