Lines Matching refs:port
76 port: UartPort, field
82 Self {port: UartPort::COM1, baud_rate: 115200} in default()
94 let port = uart_port.to_u16(); in uart_init() localVariable
101 io_out8(port + 1, 0x00); // Disable all interrupts in uart_init()
102 io_out8(port + 3, 0x80); // Enable DLAB (set baud rate divisor) in uart_init()
106 io_out8(port + 0, (divisor & 0xff) as u8); // Set divisor (lo byte) in uart_init()
107 io_out8(port + 1, ((divisor >> 8) & 0xff) as u8); // (hi byte) in uart_init()
108 io_out8(port + 3, 0x03); // 8 bits, no parity, one stop bit in uart_init()
109 … io_out8(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold in uart_init()
110 …io_out8(port + 4, 0x08); // IRQs enabled, RTS/DSR clear (现代计算机上一般都不需要hardware flow control,因此不需要置位… in uart_init()
111 io_out8(port + 4, 0x1E); // Set in loopback mode, test the serial chip in uart_init()
112 …io_out8(port + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte) in uart_init()
115 if io_in8(port + 0) != 0xAE { in uart_init()
121 io_out8(port + 4, 0x08); in uart_init()
157 let port = uart_port.to_u16(); in uart_send() localVariable
158 while UartDriver::is_transmit_empty(port) == false { in uart_send()
160 unsafe { io_out8(port, c); } in uart_send()
170 let port = uart_port.to_u16(); in uart_read_byte() localVariable
171 while UartDriver::serial_received(port) == false {} //TODO:pause in uart_read_byte()
172 unsafe { io_in8(port) as char } in uart_read_byte()
181 pub extern "C" fn c_uart_send(port: u16, c: u8) { in c_uart_send()
182 while UartDriver::is_transmit_empty(port) == false {} //TODO:pause in c_uart_send()
183 unsafe { io_out8(port, c); } in c_uart_send()
190 pub extern "C" fn c_uart_read(port: u16) -> u8 { in c_uart_read()
191 while UartDriver::serial_received(port) == false {} //TODO:pause in c_uart_read()
192 unsafe { io_in8(port) } in c_uart_read()
199 pub extern "C" fn c_uart_send_str(port: u16, str: *const u8) in c_uart_send_str()
204 c_uart_send(port, *offset(str, i)); in c_uart_send_str()
215 pub extern "C" fn c_uart_init(port: u16, baud_rate: u32) -> i32 { in c_uart_init()
223 io_out8(port + 1, 0x00); // Disable all interrupts in c_uart_init()
224 io_out8(port + 3, 0x80); // Enable DLAB (set baud rate divisor) in c_uart_init()
228 io_out8(port + 0, (divisor & 0xff) as u8); // Set divisor (lo byte) in c_uart_init()
229 io_out8(port + 1, ((divisor >> 8) & 0xff) as u8); // (hi byte) in c_uart_init()
230 io_out8(port + 3, 0x03); // 8 bits, no parity, one stop bit in c_uart_init()
231 io_out8(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold in c_uart_init()
232 …io_out8(port + 4, 0x08); // IRQs enabled, RTS/DSR clear (现代计算机上一般都不需要hardware flow control,因此不需要置位… in c_uart_init()
233 io_out8(port + 4, 0x1E); // Set in loopback mode, test the serial chip in c_uart_init()
234 …io_out8(port + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte) in c_uart_init()
237 if io_in8(port + 0) != 0xAE { in c_uart_init()
243 io_out8(port + 4, 0x08); in c_uart_init()
246 c_uart_send(port, *c); in c_uart_init()