|
ncloader
0.1
|
시리얼 접근을 위한 x86 전용 함수 인터페이스를 정의한다. 더 자세히 ...
Serial Controller에 대한 협력 다이어그램:열거형 타입 | |
| 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. 더 자세히 ... | |
함수 | |
| int | serial_open (int id, int ctx_id) |
| Serial 장치를 초기화 한다. 더 자세히 ... | |
| int | serial_read (int handle, char *buffer, int size) |
| Serial 장치로 부터 데이터를 읽는다. 더 자세히 ... | |
| int | serial_write (int handle, const char *buffer, int size) |
| Serial 장치에 데이터를 쓴다. 더 자세히 ... | |
| int | serial_ctrl (int handle, int cmd, va_list ap) |
| Serial 장치를 제어한다. 더 자세히 ... | |
| int | serial_close (int handle) |
| Serial 장치를 종료 시킨다. 더 자세히 ... | |
| int | serial_init (void) |
| Serial 장치를 사용할 수 있도록 초기화 하는 함수 더 자세히 ... | |
시리얼 접근을 위한 x86 전용 함수 인터페이스를 정의한다.
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 의 주소는 다음과 같다.
각 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)
| enum serial_ctrl_cmd |
| int serial_close | ( | int | handle) |
Serial 장치를 종료 시킨다.
| [in] | handle | 컨텍스트 아이디 |
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:| int serial_ctrl | ( | int | handle, |
| int | cmd, | ||
| va_list | ap | ||
| ) |
Serial 장치를 제어한다.
| [in] | handle | 컨텍스트 아이디 |
| [in] | cmd | 명령 |
| [in] | ap | 가변 인자 목록 |
| int serial_init | ( | void | ) |
Serial 장치를 사용할 수 있도록 초기화 하는 함수
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:| int serial_open | ( | int | id, |
| int | ctx_id | ||
| ) |
Serial 장치를 초기화 한다.
| [in] | id | 장치 아이디 Major/Minor 번호로 구성된다. |
| [in] | ctx_id | 현재 컨텍스트 아이디 |
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:| int serial_read | ( | int | handle, |
| char * | buffer, | ||
| int | size | ||
| ) |
Serial 장치로 부터 데이터를 읽는다.
| [in] | handle | 컨텍스트 아이디 |
| [in] | buffer | 읽어올 데이터가 저장될 버퍼 |
| [in] | size | 읽어올 데어터의 크기 |
| int serial_write | ( | int | handle, |
| const char * | buffer, | ||
| int | size | ||
| ) |
Serial 장치에 데이터를 쓴다.
| [in] | handle | 컨텍스트 아이디 |
| [in] | buffer | 쓸 데이터가 저장된 버퍼 |
| [in] | size | 쓸 데이터의 크기 |