unsigned bfin_uart_write_buffer (struct hw *me, const unsigned char *buffer, unsigned nr_bytes) { SIM_DESC sd = hw_system (me); int status = dv_sockser_status (sd); if (status & DV_SOCKSER_DISCONNECTED) { sim_io_write_stdout (sd, (const char *) buffer, nr_bytes); sim_io_flush_stdout (sd); } else { /* Normalize errors to a value of 0. */ int ret = dv_sockser_write_buffer (sd, buffer, nr_bytes); nr_bytes = CLAMP (ret, 0, nr_bytes); } return nr_bytes; }
int dv_sockser_write (SIM_DESC sd, unsigned char c) { return dv_sockser_write_buffer (sd, &c, 1); }