void cyg_hal_plf_serial_putc(void *__ch_data, char c) { volatile cyg_uint32* pulBase = ((channel_data_t*)__ch_data)->pulBase; cyg_uint32 status; CYGARC_HAL_SAVE_GP(); do { status = pulBase[REL_Adr_uartfr / sizeof(cyg_uint32)]; } while (!TX_READY(status)); // wait until ready pulBase[REL_Adr_uartdr / sizeof(cyg_uint32)] = c; if (c == '\n') { do { status = pulBase[REL_Adr_uartfr / sizeof(cyg_uint32)]; } while (!TX_READY(status)); // wait until ready pulBase[REL_Adr_uartdr / sizeof(cyg_uint32)] = '\r'; } CYGARC_HAL_RESTORE_GP(); }
int putchar_uart0(int ch) { /* Place your implementation of fputc here */ /* e.g. write a character to a UART, or to the */ /* debugger console with SWI WriteC */ while ( TX_READY(GET_STATUS(UART0_BASE))==0); PUT_CHAR(UART0_BASE, ch); return ch; }
// txbuf_emit() static int txbuf_emit(const int wait) { int ret = 0; if ((txln > 0) && (TX_READY() || wait)) { TX_CHAR(txbuf[txrp]); if (++txrp >= TXBUFLEN) txrp = 0; txln--; } else ret = -1; //SPIN(); // just some delay return ret; }
void sendchar( char *ch ) { char Ch; unsigned int Status; Ch=*ch; do { Status = GET_STATUS(OS_COMPORT); } while (!TX_READY(Status)); // wait until ready PUT_CHAR(OS_COMPORT, Ch); if (Ch == '\n') { do { Status = GET_STATUS(OS_COMPORT); } while (!TX_READY(Status)); // wait until ready PUT_CHAR(OS_COMPORT, '\r'); } }
void cyg_hal_plf_serial_putc(void *__ch_data, char c) { channel_data_t* chan = (channel_data_t*)__ch_data; cyg_uint8* base = chan->base; cyg_uint32 status; CYGARC_HAL_SAVE_GP(); do { status = GET_STATUS(base); } while (!TX_READY(status)); // wait until ready PUT_CHAR(base, c); if (c == '\n') { do { status = GET_STATUS(base); } while (!TX_READY(status)); // wait until ready PUT_CHAR(base, '\r'); } CYGARC_HAL_RESTORE_GP(); }