1 / 42

Device Driver in Linux

Device Driver in Linux. 경희대학교 컴퓨터공학과 조 진 성. 주요내용. 주요내용 UART 이해 LCD 이해 Ethernet 이해 USB 이해. Asynchronous Serial Communication -- UART. Universal asynchronous receiver/transmitter Transmit bits in a single channel simplex (one way) half-duplex (one direction at a time)

whitfield
Download Presentation

Device Driver in Linux

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. Device Driver in Linux 경희대학교 컴퓨터공학과 조 진 성

  2. 주요내용 • 주요내용 • UART 이해 • LCD 이해 • Ethernet 이해 • USB 이해

  3. Asynchronous Serial Communication -- UART • Universal asynchronous receiver/transmitter • Transmit bits in a single channel • simplex (one way) • half-duplex (one direction at a time) • full-duplex (two way) • A sequence of bits – packet or character • ASCII code – 7 bits for 128 characters (alphabet, numerical, and control) • fixed length or variable length • Start, stop, and parity bits

  4. EIA RS232 • Connection and signal characteristics • Data terminal equipment and data communication equipment • Logic '1' (marking) – -3v to -25v with respect to signal ground • Logic “0” (spacing) – +3v to +25v • Not assigned –between -3v and +3v (a transition region)

  5. RS232(2) • Flow control (handshaking) signals to avoid buffer overflow or lock-up. • RTS : to prepare the DCE device for accepting transmission • CTS : to inform the DTE device that transmission may begin • DCD: data carrier detected • DSR: DCE ready • SG: system ground • DTR: DTE ready DTE FEP DB25 DCE MOD DB25 1 FG --------------- 1 FG 2 TX --------------> 2 TX 3 RX <-------------- 3 RX 4 RTS --------------> 4 RTS 5 CTS <-------------- 5 CTS 6 DSR <-------------- 6 DSR 7 SG --------------- 7 SG 8 DCD <-------------- 8 DCD 20 DTR --------------> 20 DTR

  6. Signal Format for ASCII Character • data, start, stop, and (even or odd) parity bits

  7. UART(1) PC Com Port - EIA-574 RS-232 pin out DB-9 pin used for Asynchronous Data

  8. UART(2) • Is Your Interface a DTE or a DCE? • Find out by following these steps: The point of reference for all signals is the terminal (or PC). ① Measure the DC voltages between (DB25) pins 2 & 7 and between pins 3 & 7. Be sure the black lead is connected to pin 7 (Signal Ground) and the red lead to whichever pin you are measuring. ② If the voltage on pin 2 (TD) is more negative than -3 Volts, then it is a DTE, otherwise it should be near zero volts. ③ If the voltage on pin 3 (RD) is more negative than -3 Volts, then it is a DCE. ④ If both pins 2 & 3 have a voltage of at least 3 volts, then either you are measuring incorrectly, or your device is not a standard EIA-232 device. Call technical support. ⑤ In general, a DTE provides a voltage on TD, RTS, & DTR, whereas a DCE provides voltage on RD, CTS, DSR, & CD.

  9. UART(3) • This is a standard 9 to 25 pin cable layout for async data on a PC AT serial cable

  10. UART(4) RS-232 interface RS-232(EIA Std.) applicable to the 25 pin interconnection of Data Terminal Equipment (DTE)and Data Communication Equipment (DCE) using serial binary data

  11. UART(5) • RS232D used RJ45 type connectors(similar to telephone connectors)

  12. Liquid Crystal Display(1) • LC(액정)란? • 일정 온도 범위에서 유동성을 지닌 액정 상태를 말함 • 동시에 광학적으로 복굴절성을 나타내는 결정임 • 보통 물질은 용융 온도에서 고체로부터 투명한 액체로 변화하지만, 액정물질은 용융 온도에서 우선 불투명하고 혼탁한 액체로 일단 변화하고 그 후 더욱 온도를 올리면 보통의 투명한 액체로 변화한다. • 액정이란 명칭은 고체상과 액체상의 중간 상태인 액정상을 가리키는 경우와 이러한 액정상을 갖는 물질 그 자체를 가리키는 경우의 두 가지 의미로 사용되고 있다. 액정 물질의 온도 변화에 의한 상태 변화

  13. Liquid Crystal Display(2) • LCD • 액정의 특성을 이용해 만드는 디스플레이 • LCD 특징 • 장점 • 저소비 전력(수∼수십μW/cm2)으로 장시간의 전지구동이 가능한 에너지 절약형이다. • 저전압에서 동작(수∼10V)하므로 직접 IC 구동이 가능하고 구동 전자회로의 소형화, 간략화가 가능하다.

  14. Liquid Crystal Display(3) • 소자가 얇고(수mm), 또한 대형표시(수십 cm대각) 부터 소형표시(수 mm대각)까지 가능하다. 특히 휴대형(portable) 기기에 적합하다. • 수광형 표시이므로 밝은 장소에서도 표시가 선명하다. • 표시의 컬러화가 쉽기 때문에 표시기능의 확대, 다양화가 이루어질 수 있다. • 투사확대 표시나 집적표시가 가능하여 대화면 표시 (수 m대각)가 용이하다. • 단점 • 비발광형이므로 반사형 표시인 경우 어두운 곳에서 표시의 선명함이 떨어진다. • 선명한 표시가 요구되는 경우 또는 컬러 표시의 경우 후광(back light)을 필요로 한다. • 표시 콘트라스트가 보는 방향에 의존하는 경우가 많아서 시각에 제약을 받는다. • 응답시간이 주위 온도에 의존하기 때문에 저온동작(-30∼-40℃)에 어려움이 있다.

  15. LCD 용도 및 분류 • LCD의 분류 • 형태에 따른 분류 • 투사형 LCD • 직시형 LCD • 구동방식에 따른 분류 • 전기적 구동(electrically addressed) LCD • 광학적 구동(optically addressed) LCD

  16. LCD 동작 원리 • 동작원리 • 'OFF' 상태는 전압을 가하지 않은 상태를 나타내며, 편광판을 통과한 빛이 액정의 분자 배열을 따라 꼬여지면서 교차된 다른 편광판을 통과하게 된다. (즉 전압을 가하지 않은 상태에서는 빛이 통과한다.) • 'ON' 상태는 전압을 가한 상태를 나타내며, 이때에는 전계의 방향을 따라 액정 분자가 일어서면서 편광판을 통과한 빛을 그대로 교차된 편광판에 전달시킴으로써 빛은 편광판에 의해 차단된다. (즉 전압을 가하면 빛이 차단된다.) 전압을 선택적으로 인가함으로써 상, 하판의 전극 모양에 따라 원하는 도형 또는 문자를 표시할 수 있게 된다.

  17. TFT LCD & Touch screen PXA255 Dynamic Memory Controller SDCKE[1] SDCLK[1] SDCS[0]# PXA250 Core SDRAS# MDCNFG SDCAS# MDCAS00 WE# MDREFR DQM[3:0] MMU D[31:0] A[31:0] LCD CON LCD Controller LDD[15:0] L-FCLK L-LCLK L-PCLK L-BIAS LCD Control Registers FIQ, IRQ DMA DMA Registers Inverter Power E-PORT0 7 Interrupt Controller GP23 DCLK ADS 7843 E-PORT Bridge GPIO X+ CS# E-PORT0[7:0] GP25 X- DIN GP4 GP[27:0] ICIP ICCR Y+ BUSY GPIO Registers GP26 ICMR ICFP Y- DOUT GP5 GP[27:0] ICLR PENIRQ# LCD Hardware overview

  18. 이더넷(Ethernet)(1) • Ethernet • Commonly used to refer to all carrier sense multiple access collision detection (CSMA/CD) LANS that generally conform to Ethernet specifications, including IEEE 802.3

  19. Ethernet(2) • 전자적인 특성 • 신호 방식(Signaling) • 기저대역 (Base-band)시스템 • Manchester digital Encoding • 디지털 대 디지털 부호화 • 극형 – 이상 부호화 • 광대역 (Broadband)시스템 • differential PSK • 디지털 대 아날로그 부호화 • 전송속도(data rate) • 1~100Mbps

  20. Ethernet(3) • Baseband: • 디지털 신호 (이 경우 맨체스터 부호화를 의미) • 표준 • 첫 숫자는 Mbps 단위로 데이터 전송율 • 10Base2: 얇은 동축케이블 이용, 최장 길이는 185m • 10Base5: 굵은 동축케이블 이용, 최장 길이는 500m • 10Base-F: 광케이블을 이용 • 10Base-T: Twisted Pair cable 이용 • 광대역 (Broadband): • 아날로그 신호 (이 경우에는 PSK) • 한 가지 표준: 10Broad36

  21. Ethernet(4) • IEEE 802

  22. Ethernet(5) • 프레임 형식(Frame Format) • Preamble(7바이트) - alert, timing, start synchronization • SFD(Start frame delimiter) - 프레임 시작 • DA(Destination address) - 목적지 주소 • SA(Source address) - 발신지 주소 • PDU 길이/유형 • 802.2 프레임(PDU) - 46~1500 바이트길이 • CRC - 오류 검출 정보, CRC-32

  23. Ethernet(6) • 제어(Control) 필드 • HDLC의 제어 필드와 동일 P/F Poll/final bit N(S) 프레임 송신 번호 N(R) 프레임 수신 번호 Code 비번호나 감시코드 I-Frame S-Frame U-Frame

  24. Ethernet(7) • ACCESS Method : CSMA/CD • Carrier Sense Multiple Access with Collision Detection : "Listen before talk" 방식 • 각 Node는 Common Line을 계속적으로 감시하면서 Data 송신 기회 감지 • 전송 감지 : Listen before talk • 경쟁에 의한 엑세스로 충돌 발생 가능 : Collision 발생시 재전송 • 충돌 검출 : Listen while talk • 구현이 간단하지만, 트래픽 부하가 높을 경우에 충돌로 인한 망 성능 저하 발생 • 충돌 회수가 네트워크의 성능을 좌우

  25. 프레임 송신 요구 Yes 채널트래픽여부? Carrier Sense No 송신 개시 Multi Access No Yes 충돌검출? Collision Dection No 충돌검출? jamming발생 Yes 송신완료 임의의 시간 대기 Ethernet(8) • CSMA/CD 동작 절차 • 컴퓨터가 전송을 원할 때는 전송 매체를 감지하고 있다가 채널상에 트래픽이 있으면 트래픽이 끝날 때까지 기다리고, 신호가 없으면 즉시 전송을 개시 • 전송도중에도 항상 버스를 감지해서 충돌여부를 감지하며, 충돌이 발생하면 즉시 전송을 중지, 다른 스테이션에 충돌을 알리는 jamming 신호 발생 • jamming 신호 전송이 끝나면 임의의 시간 동안 대기하였다가 다시 처음부터 시도

  26. EthernetHardware예 • Ethernet Controller • SMSC 10/100 Ethernet Single Chip LAN91C111 • Internal 32Bit Wide Data Path • 8Kbytes Internal Memory (Receive and Transmit FIFO Buffers) • External 25MHz-output pin for an external PHY and MAC • MSC0,1 - Static Chip Select 1,2 (Bank 1,2) • Base Address = 0x04000_0000 (Pri) 0x0800_0000(sec)

  27. Universal Serial Bus – USB(1) • Motivation • Connection of the PC to the telephone • Ease-of-use • Port expansion • Goals for the Universal Serial Bus • Ease-of-use for PC peripheral expansion • Low-cost solution that supports transfer rates up to 480 Mb/s • Full support for real-time data for voice, audio, and video • Protocol flexibility for mixed-mode isochronous data transfers and asynchronous messaging • Integration in commodity device technology • Comprehension of various PC configurations and form factors • Provision of a standard interface capable of quick diffusion into product • Enabling new classes of devices that augment the PC’s capability • Full backward compatibility of USB 2.0 for devices built to previous versions of the specification

  28. Universal Serial Bus – USB (2) • Feature • Easy to use for end user • Single model for cabling and connectors • Electrical details isolated from end user (e.g., bus terminations) • Self-identifying peripherals, automatic mapping of function to driver and configuration • Dynamically attachable and reconfigurable peripherals • Wide range of workloads and applications • Suitable for device bandwidths ranging from a few kb/s to several hundred Mb/s • Supports isochronous as well as asynchronous transfer types over the same set of wires • Supports concurrent operation of many devices (multiple connections) • Supports up to 127 physical devices • Supports transfer of multiple data and message streams between the host and devices • Allows compound devices (i.e., peripherals composed of many functions) • Lower protocol overhead, resulting in high bus utilization

  29. Universal Serial Bus – USB (3) • Isochronous bandwidth • Guaranteed bandwidth and low latencies appropriate for telephony, audio, video, etc. • Flexibility • Supports a wide range of packet sizes, which allows a range of device buffering options • Allows a wide range of device data rates by accommodating packet buffer size and latencies • Flow control for buffer handling is built into the protocol • Robustness • Error handling/fault recovery mechanism is built into the protocol • Dynamic insertion and removal of devices is identified in user-perceived real-time • Supports identification of faulty devices • Synergy with PC industry • Protocol is simple to implement and integrate • Consistent with the PC plug-and-play architecture • Leverages existing operating system interfaces

  30. Universal Serial Bus – USB (4) • Low-cost implementation • Low-cost subchannel at 1.5 Mb/s • Optimized for integration in peripheral and host hardware • Suitable for development of low-cost peripherals • Low-cost cables and connectors • Uses commodity technologies • Upgrade path • Architecture upgradeable to support multiple USB Host Controllers in a system

  31. Universal Serial Bus – USB (5)

  32. Universal Serial Bus – USB (6) • Taxonomy of Application Space

  33. USB H/W Architectural(1) • Physical Interface

  34. USB H/W Architectural(2)

  35. USB Host Controller • Host Controller의 분류 • OHCI(Open Host Controller Interface : Compaq ) • UHCI(Universal Host Controller Interface : Intel ) ※ 같은 capability를 제공 Linux USB Device Driver Stack

  36. USB Hub • 기능 • 포트 제어 • 연결 인식 • 포트 enable/disable • reset/resume 신호 • 데이터 신호 • 신호 재생 • robustness/recover • 전력 분배

  37. USB Data Flow • Type • Control Transfers: Used to configure a device at attach time and can be used for other device-specific purposes, including control of other pipes on the device. • Bulk Data Transfers: Generated or consumed in relatively large and bursty quantities and have wide dynamic latitude in transmission constraints. • Interrupt Data Transfers: Used for timely but reliable delivery of data, for example, characters or coordinates with human-perceptible echo or feedback response characteristics. • Isochronous Data Transfers: Occupy a prenegotiated amount of USB bandwidth with a prenegotiated delivery latency. (Also called streaming real time transfers).

  38. USB모델 • 한 개의 호스트(마스터 모드), 다수의 디바이스(client) • USB 모델의 계층

  39. 호스트 계층 • USB host controller • 매체에 대한 물리적인 연결 • low level 프로토콜 처리(SIE) • H/W + S/W • USB system S/W • 드라이버층과의 인터페이스 • standard device 처리 • Client S/W • 디바이스 드라이버 • 주변장치의 기능 처리를 위한 S/W

  40. 디바이스 계층 • USB bus interface • 매체에 대한 물리적인 연결 • low level 프로토콜 처리(SIE) • USB logical device • 호스트에 대한 소자의 common view point • high-level 프로토콜 처리 • Function • 장치에 의해 제공되는 기능

  41. 디바이스 추상화 • 엔드 포인트 • 디바이스 끝의 데이터 소스 또는 싱크 • 고유주소, unidirection, transfer 특성을 가짐 • 파이프 • 호스트 S/W owner와 디바이스 endpoint의 결합 • 호스트 메모리 버퍼에서 엔드포인트 FIFO의 연결 • 파이프 통신 모드: stream(데이터)과 message(USB 데이터 구조) • default control pipe : endpoint 0와의 파이프 • 인터페이스 • 파이프의 집합 • 각 기능에 map • 1개의 S/W client에 의해 소유됨

  42. USB의 상세 형태

More Related