Confident that OP's I/O is buffered somewhere.
Output does not appear until a \r
and/or \n
is sent.
#if !defined( OUT_8 )
#define OUT_8(p,d) (*(volatile char *)(p) = (char)(d))
#endif
// make ptr a `const char *`
int write(int file, const char *ptr, int len) {
OUT_8(DUART1_UMCR1, 0x02); //Informs UART is ready for sending data
OUT_8(DUART1_ULCR1, 0x03);
OUT_8(DUART1_UIER1, 0x0f);
OUT_8(DUART1_UFCR1, 0x8f);
while (len-- > 0) {
OUT_8(DUART1_UTHR, *ptr++);
wait();
}
// Force an EOL at the _end_ of transmission.
OUT_8(DUART1_UTHR, '\n');
OUT_8(DUART1_UTHR, '\r');
wait();
OUT_8(DUART1_UMCR1, 0x00); // say that modem is not not ready. Connection over
OUT_8(DUART1_UFCR1, 0x87);
OUT_8(DUART1_ULCR1, 0x00); // Clear all interrupts! virtually shut UART port
errno = ENOSYS;
return -1;
}
I suspect that the buffering is occurring in the receiving side, either the UART or more likely in the terminal viewing the data. OP said "the curser goes to next line". There is no "cursor" in a UART.