Lines Matching refs:port
76 port: UartPort, field
83 port: UartPort::COM1, in default()
97 let port = uart_port.to_u16(); in uart_init() localVariable
104 io_out8(port + 1, 0x00); // Disable all interrupts in uart_init()
105 io_out8(port + 3, 0x80); // Enable DLAB (set baud rate divisor) in uart_init()
109 io_out8(port + 0, (divisor & 0xff) as u8); // Set divisor (lo byte) in uart_init()
110 io_out8(port + 1, ((divisor >> 8) & 0xff) as u8); // (hi byte) in uart_init()
111 io_out8(port + 3, 0x03); // 8 bits, no parity, one stop bit in uart_init()
112 io_out8(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold in uart_init()
113 …io_out8(port + 4, 0x08); // IRQs enabled, RTS/DSR clear (现代计算机上一般都不需要hardware flow control,因此不需要置位… in uart_init()
114 io_out8(port + 4, 0x1E); // Set in loopback mode, test the serial chip in uart_init()
115 …io_out8(port + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte) in uart_init()
118 if io_in8(port + 0) != 0xAE { in uart_init()
124 io_out8(port + 4, 0x08); in uart_init()
160 let port = uart_port.to_u16(); in uart_send() localVariable
161 while UartDriver::is_transmit_empty(port) == false { in uart_send()
164 io_out8(port, c); in uart_send()
175 let port = uart_port.to_u16(); in uart_read_byte() localVariable
176 while UartDriver::serial_received(port) == false {} //TODO:pause in uart_read_byte()
177 unsafe { io_in8(port) as char } in uart_read_byte()
185 pub extern "C" fn c_uart_send(port: u16, c: u8) { in c_uart_send()
186 while UartDriver::is_transmit_empty(port) == false {} //TODO:pause in c_uart_send()
188 io_out8(port, c); in c_uart_send()
196 pub extern "C" fn c_uart_read(port: u16) -> u8 { in c_uart_read()
197 while UartDriver::serial_received(port) == false {} //TODO:pause in c_uart_read()
198 unsafe { io_in8(port) } in c_uart_read()
205 pub extern "C" fn c_uart_send_str(port: u16, str: *const u8) { in c_uart_send_str()
209 c_uart_send(port, *offset(str, i)); in c_uart_send_str()
220 pub extern "C" fn c_uart_init(port: u16, baud_rate: u32) -> i32 { in c_uart_init()
228 io_out8(port + 1, 0x00); // Disable all interrupts in c_uart_init()
229 io_out8(port + 3, 0x80); // Enable DLAB (set baud rate divisor) in c_uart_init()
233 io_out8(port + 0, (divisor & 0xff) as u8); // Set divisor (lo byte) in c_uart_init()
234 io_out8(port + 1, ((divisor >> 8) & 0xff) as u8); // (hi byte) in c_uart_init()
235 io_out8(port + 3, 0x03); // 8 bits, no parity, one stop bit in c_uart_init()
236 io_out8(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold in c_uart_init()
237 …io_out8(port + 4, 0x08); // IRQs enabled, RTS/DSR clear (现代计算机上一般都不需要hardware flow control,因此不需要置位… in c_uart_init()
238 io_out8(port + 4, 0x1E); // Set in loopback mode, test the serial chip in c_uart_init()
239 …io_out8(port + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte) in c_uart_init()
242 if io_in8(port + 0) != 0xAE { in c_uart_init()
248 io_out8(port + 4, 0x08); in c_uart_init()
251 c_uart_send(port, *c); in c_uart_init()