nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions
Serial modem driver 구현

시리얼 접근을 위한 x86 전용 함수 인터페이스를 정의한다. More...

Enumerations

enum  serial_ctrl_cmd {
  SERIAL_CMD_BAUDRATE, SERIAL_CMD_DATA, SERIAL_CMD_STOP, SERIAL_CMD_PARITY,
  SERIAL_CMD_ENTER_SETUP, SERIAL_CMD_LEAVE_SETUP
}
 Serial control command. More...
 

Functions

int serial_init (void)
 Serial 장치를 사용할 수 있도록 초기화 하는 함수 More...
 

Detailed Description

시리얼 접근을 위한 x86 전용 함수 인터페이스를 정의한다.

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2011-7-20

Serial 과 관련된 정보는 URL: http://www.senet.com/au/~cpeacock Title: Interfacing the Serial / RS232 Port v5.0 문서를 대부분 차용하였다.

PC 를 위한 UARTS 의 종류는 다음과 같다.

8250 - First UART in this series, It contains no scratch register. The 8250A was an improved version of the 8250 which operates faster on bus side.

8250A - This UART is faster than the 8250 on the bus side, Looks exactly the same to software than 16450

8250B - Very similar to that of the 8250 UART.

16450 - Used in AT's (Improved bus speed over 8250's). Operates comfortably at 38.4KBPS. Still quite common today.

16550 - This was the first generation of buffered UART. It has a 16 byte buffer, however it doesn't work and is replaced with 16550A.

16550A - Is the most common UART use of for high speed communications eg 14.4K & 28.8K Modems. They made sure the FIFO buffers worked on this UART.

16650 - Very recent breed of UART. Contains a 32 byte FIFO, Programmable X-On / X-Off characters and supports power management.

16750 - Produced by Texas Instruments. Contains a 64 byte FIFO.

이제 Serial port 를 access 하고 초기화 하기 위해 Port In/Out 을 사용한다. Port 의 주소는 다음과 같다.

SerialPortAddress.png
표준 Serial 포트 주소

각 Port 의 Base address 를 기준으로 아래 Table 에 기록된 Offset 위치의 필요한 Register 들로 접근할 수 있다.

아래에서 Divisor Latch Low/High byte 정보를 이용해서 Serial modem 의 통신속도를 지정할 수 있다.

기본 115,200 BPS 를 원하는 Baudrate 로 나누면 Divisor Latch Low/High byte 에 설정할 값을 구할 수 있다.

즉 예를 들어 2400 BPS 의 통신 속도를 원한다면, Divisor = 115200 / 2400 이 된다.

Divisor 의 High byte 와 Low byte 를 나눠서 아래 알맞은 Register 에 써주면 된다. 물론 조건에 맞춰서 (DLAB enable)

SerialPortRegisters.png
포트의 레지스터 정보
SerialIER.png
인터럽트 활성화 레지스터(IER)
SerialIIR.png
인터럽트 정보 레지스터(IIR)
SerialFIFOCtrl.png
FIFO 제어 레지스터(FCR)
SerialLineCtrl.png
Line 제어 레지스터(LCR)
SerialModemCtrl.png
Modem 제어 레지스터(MCR)
SerialLineStatus.png
Line 상테 레지스터(LSR)
SerialModemStatus.png
Modem 상테 레지스터(MSR)

Enumeration Type Documentation

Serial control command.

Enumerator
SERIAL_CMD_BAUDRATE 

Baudrate 설정

SERIAL_CMD_DATA 

Data bit 설정

SERIAL_CMD_STOP 

Stop bit 설정

SERIAL_CMD_PARITY 

Parity bit 설정

SERIAL_CMD_ENTER_SETUP 

Enter setup

SERIAL_CMD_LEAVE_SETUP 

Leave setup

Definition at line 74 of file serial.h.

Function Documentation

int serial_init ( void  )

Serial 장치를 사용할 수 있도록 초기화 하는 함수

Definition at line 242 of file serial.c.

References DEVICE_COM1, DEVICE_COM2, DEVICE_COM3, DEVICE_COM4, EFAULT, NULL, vfs_get_ninfo(), and vfs_new_dev_ninfo().

Referenced by drivers_init().

Here is the call graph for this function:

Here is the caller graph for this function: