int serial_write(char *buf, unsigned short com) { serial_configure_baud_rate(com, 2); serial_configure_line(com); while(*buf != 0) { if((serial_is_transmit_fifo_empty(com) & 0x20) == 0x00) continue; outb(SERIAL_DATA_PORT(com), *buf); buf++; } return currPos; }
void sprint(uint8_t* buf, uint16_t len){ if(is_configured == 1){ serial_configure_bit_rate(SERIAL_COM1_BASE, 1); serial_configure_line(SERIAL_COM1_BASE); serial_configure_fifo(SERIAL_COM1_BASE); serial_configure_modem(SERIAL_COM1_BASE); is_configured = 1; } for(unsigned int i = 0; i < len; i++){ while(serial_is_transmit_fifo_empty(SERIAL_COM1_BASE) == 0); outb(SERIAL_DATA_PORT(SERIAL_COM1_BASE), buf[i]); } }
void serial_write(char * buf, int len) { int burst_length = (len < 14) ? len : 14; int i = 0; while (burst_length) { while (!serial_is_transmit_fifo_empty(SERIAL_COM1_BASE)) {}; for (i = 0; i < burst_length; ++i) { outb(SERIAL_DATA_PORT(SERIAL_COM1_BASE), *(buf + i)); } buf += burst_length; len -= burst_length; burst_length = (len < 14) ? len : 14; } }
/* serial_write: * writes a character to the serial port * When serial_is_transmit_fifo_empty is true */ void serial_write(unsigned int com, char c){ while(serial_is_transmit_fifo_empty(com) == 0); outb(com, c); }