5 bool Uart_of::startup(unsigned long)
7 char path[64], type[16];
8 for(phandle_t node = 0; prom_next_node(&node); ) {
9 prom_getprop(node, "device_type", type, sizeof(type));
11 if(strcmp(type, "serial"))
14 if(prom_call("package-to-path", 3, 1, node, path, sizeof(path))
20 if((prom_ret = prom_call("open", 1, 1, path)) == PROM_ERROR)
22 _serial = (ihandle_t)prom_ret;
26 return (!_serial)?false:true;
29 void Uart_of::shutdown()
31 prom_call("close", 1, 0, _serial);
34 int Uart_of::get_char(bool blocking) const
38 while(len != 1 && blocking)
39 len = prom_call("read", 3, 1, _serial, &c, 1);
44 int Uart_of::write(char const *s, unsigned long count) const
46 return prom_call("write", 3, 1, _serial, s, count);
49 void Uart_of::out_char(char c) const
51 prom_call("write", 3, 0, _serial, c, 1);
55 bool Uart_of::enable_rx_irq(bool){return true;}
56 bool Uart_of::enable_tx_irq(bool){return true;}
57 bool Uart_of::change_mode(Transfer_mode, Baud_rate){return true;}
58 int Uart_of::char_avail() const {return 1;}