20#include "pedigree/kernel/Log.h"
21#include "pedigree/kernel/debugger/SerialIO.h"
22#include "pedigree/kernel/machine/Serial.h"
23#include "pedigree/kernel/utilities/StaticString.h"
41SerialIO::~SerialIO() {
45void SerialIO::initialise() {
53 m_nOldCursorY = m_nCursorY;
54 NOTICE(
Hex <<
"oldx: " << m_nOldCursorX <<
", y: " << m_nOldCursorY);
68void SerialIO::destroy() {
93 if (nlines < m_nHeight)
97void SerialIO::setCliLowerLimit(
size_t nlines) {
99 if (nlines < m_nHeight)
125void SerialIO::disableCli() {
144 ERROR(
"VT100 code!!");
157 if (colStart > colEnd) {
158 size_t tmp = colStart;
165 if (
static_cast<int32_t
>(colStart) < 0)
167 if (row >= m_nHeight)
169 if (
static_cast<int32_t
>(row) < 0)
172 startColour(foreColour, backColour);
177 if (colEnd ==
m_nWidth - 1 && c ==
' ') {
182 cmd += (colStart + 1);
188 }
else if (colStart == 0 && c ==
' ') {
204 cmd += (colStart + 1);
209 for (
size_t i = colStart; i <= colEnd; i++) {
219void SerialIO::drawVerticalLine(
char c,
size_t col,
size_t rowStart,
size_t rowEnd,
222 if (rowStart > rowEnd) {
223 size_t tmp = rowStart;
228 if (rowEnd >= m_nHeight)
229 rowEnd = m_nHeight - 1;
230 if (
static_cast<int32_t
>(rowStart) < 0)
234 if (
static_cast<int32_t
>(col) < 0)
252 startColour(foreColour, backColour);
263void SerialIO::disableRefreshes() {
271void SerialIO::cls() {
277 startColour(foreColour, backColour);
310void SerialIO::forceRefresh() {}
313 if (foreColour == m_ForeColour && backColour == m_BackColour)
316 m_ForeColour = foreColour;
317 m_BackColour = backColour;
320 switch (foreColour) {
321 case DebuggerIO::Black:
324 case DebuggerIO::Red:
327 case DebuggerIO::Green:
330 case DebuggerIO::Yellow:
333 case DebuggerIO::Blue:
336 case DebuggerIO::Magenta:
339 case DebuggerIO::Cyan:
342 case DebuggerIO::White:
345 case DebuggerIO::DarkGrey:
348 case DebuggerIO::LightRed:
351 case DebuggerIO::LightGreen:
354 case DebuggerIO::LightBlue:
357 case DebuggerIO::LightMagenta:
360 case DebuggerIO::LightCyan:
367 switch (backColour) {
368 case DebuggerIO::Black:
371 case DebuggerIO::Red:
374 case DebuggerIO::Green:
377 case DebuggerIO::DarkGrey:
380 case DebuggerIO::Blue:
383 case DebuggerIO::Magenta:
386 case DebuggerIO::Cyan:
389 case DebuggerIO::White:
398char SerialIO::getCharNonBlock() {
402void SerialIO::endColour() {
406void SerialIO::readCursor() {
413 ERROR(
"SerialIO - device responded incorrectly to size query.");
417 ERROR(
"SerialIO - device responded incorrectly to size query.");
423 while (c >=
'0' && c <=
'9') {
428 m_nCursorY = str.intValue();
431 ERROR(
"SerialIO - device responded incorrectly to size query.");
437 while (c >=
'0' && c <=
'9') {
444 ERROR(
"SerialIO - device responded incorrectly to size query.");
449void SerialIO::setCursor() {
458void SerialIO::saveCursor() {
463void SerialIO::unsaveCursor() {
468void SerialIO::readDimensions() {
473 m_nOldCursorY = m_nCursorY;
482 m_nHeight = m_nCursorY;
char m_pCommand[COMMAND_MAX]
SerialIO(Serial *pSerial)
void putChar(char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
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 setCliUpperLimit(size_t nlines)