/*! * \brief Send a single character to debug device. * * A newline character will be automatically prepended by a carriage * return. */ static void DebugPut(const NUTDEVICE * dev, char ch) { if (ch == '\n') { DebugPut(dev, '\r'); } while ((mem_rd32(dev->dev_base + UART_LSR_OFF) & UART_THRE) == 0); mem_wr32_mb(dev->dev_base + UART_THR_OFF, ch); }
/*! * \brief Send characters to debug device 0. * * A carriage return character will be automatically appended * to any linefeed. * * \return Number of characters sent. */ static int DebugWrite(NUTFILE * fp, CONST void *buffer, int len) { int c = len; CONST char *cp = buffer; while(c--) DebugPut(*cp++); return len; }
/*! * \brief Send a single character to debug device. * * A carriage return character will be automatically appended * to any linefeed. */ static void DebugPut(char ch) { while (!(inl(DEBUG_CHK_STAT_BASE) & 0x40)); outl(ch, DEBUG_TX_BUFF_BASE); if (ch == '\n') DebugPut('\r'); }
/*! * \brief Send characters to debug device 0. * * This function is called by the low level input routines of the * \ref xrCrtLowio "C runtime library", using the _NUTDEVICE::dev_write * entry. * * A newline character will be automatically prepended by a carriage * return. * * \param fp Pointer to a \ref _NUTFILE structure, obtained by a previous * call to LpcDevDebugOpen(). * * \return Number of characters sent. */ int LpcDevDebugWrite(NUTFILE * fp, const void *buffer, int len) { int c = len; const char *cp = buffer; while (c--) { DebugPut(fp->nf_dev, *cp++); } return len; }
/*! * \brief Send characters from progam memory to debug device 0. * * A carriage return character will be automatically appended * to any linefeed. * * \return Number of characters sent. */ static int DebugWrite_P(NUTFILE * fp, PGM_P buffer, int len) { int c = len; PGM_P cp = buffer; while(c--) { DebugPut(PRG_RDB(cp)); cp++; } return len; }