20 #include "pedigree/kernel/debugger/SerialIO.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/machine/Serial.h" 23 #include "pedigree/kernel/utilities/StaticString.h" 26 : m_UpperCliLimit(0), m_LowerCliLimit(0), m_nWidth(80), m_nHeight(25),
27 m_nCursorX(0), m_nCursorY(0), m_nOldCursorX(0), m_nOldCursorY(0),
29 m_pSerial(pSerial), m_bCli(false)
39 void SerialIO::initialise()
44 #ifndef SERIAL_IS_FILE 48 m_nOldCursorY = m_nCursorY;
49 NOTICE(
Hex <<
"oldx: " << m_nOldCursorX <<
", y: " << m_nOldCursorY);
63 void SerialIO::destroy()
90 if (nlines < m_nHeight)
94 void SerialIO::setCliLowerLimit(
size_t nlines)
97 if (nlines < m_nHeight)
124 void SerialIO::disableCli()
146 ERROR(
"VT100 code!!");
155 char c,
size_t row,
size_t colStart,
size_t colEnd,
161 if (colStart > colEnd)
163 size_t tmp = colStart;
170 if (static_cast<int32_t>(colStart) < 0)
172 if (row >= m_nHeight)
174 if (static_cast<int32_t>(row) < 0)
177 startColour(foreColour, backColour);
182 if (colEnd ==
m_nWidth - 1 && c ==
' ')
188 cmd += (colStart + 1);
195 else if (colStart == 0 && c ==
' ')
214 cmd += (colStart + 1);
219 for (
size_t i = colStart; i <= colEnd; i++)
230 void SerialIO::drawVerticalLine(
231 char c,
size_t col,
size_t rowStart,
size_t rowEnd,
235 if (rowStart > rowEnd)
237 size_t tmp = rowStart;
242 if (rowEnd >= m_nHeight)
243 rowEnd = m_nHeight - 1;
244 if (static_cast<int32_t>(rowStart) < 0)
248 if (static_cast<int32_t>(col) < 0)
268 startColour(foreColour, backColour);
280 void SerialIO::disableRefreshes()
302 startColour(foreColour, backColour);
340 void SerialIO::forceRefresh()
344 void SerialIO::startColour(
347 if (foreColour == m_ForeColour && backColour == m_BackColour)
350 m_ForeColour = foreColour;
351 m_BackColour = backColour;
356 case DebuggerIO::Black:
359 case DebuggerIO::Red:
362 case DebuggerIO::Green:
365 case DebuggerIO::Yellow:
368 case DebuggerIO::Blue:
371 case DebuggerIO::Magenta:
374 case DebuggerIO::Cyan:
377 case DebuggerIO::White:
380 case DebuggerIO::DarkGrey:
383 case DebuggerIO::LightRed:
386 case DebuggerIO::LightGreen:
389 case DebuggerIO::LightBlue:
392 case DebuggerIO::LightMagenta:
395 case DebuggerIO::LightCyan:
404 case DebuggerIO::Black:
407 case DebuggerIO::Red:
410 case DebuggerIO::Green:
413 case DebuggerIO::DarkGrey:
416 case DebuggerIO::Blue:
419 case DebuggerIO::Magenta:
422 case DebuggerIO::Cyan:
425 case DebuggerIO::White:
434 char SerialIO::getCharNonBlock()
439 void SerialIO::endColour()
444 void SerialIO::readCursor()
453 ERROR(
"SerialIO - device responded incorrectly to size query.");
458 ERROR(
"SerialIO - device responded incorrectly to size query.");
464 while (c >=
'0' && c <=
'9')
470 m_nCursorY = str.intValue();
474 ERROR(
"SerialIO - device responded incorrectly to size query.");
480 while (c >=
'0' && c <=
'9')
489 ERROR(
"SerialIO - device responded incorrectly to size query.");
494 void SerialIO::setCursor()
504 void SerialIO::saveCursor()
510 void SerialIO::unsaveCursor()
516 void SerialIO::readDimensions()
520 #ifdef SERIAL_IS_FILE 522 m_nOldCursorY = m_nCursorY;
531 m_nHeight = m_nCursorY;
char m_pCommand[COMMAND_MAX]
void setCliUpperLimit(size_t nlines)
void drawString(const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
void putChar(char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
SerialIO(Serial *pSerial)