20 #include "pedigree/kernel/core/BootIO.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/machine/Machine.h" 23 #include "pedigree/kernel/machine/Serial.h" 24 #include "pedigree/kernel/machine/Vga.h" 25 #include "pedigree/kernel/processor/types.h" 26 #include "pedigree/kernel/utilities/StaticString.h" 38 Vga *pVga = Machine::instance().
getVga(0);
42 uint16_t *pFramebuffer = *pVga;
43 if (pFramebuffer != 0)
49 str +=
"BootIO is initialized!\n";
50 write(str, Black, Black);
56 for (
size_t i = 0; i < str.length(); i++)
57 putCharVga(str[i], foreColour, backColour);
60 #ifndef SERIAL_IS_FILE 61 startColour(Machine::instance().getSerial(0), foreColour, backColour);
63 for (
size_t j = 0; j < str.length(); j++)
64 Machine::instance().
getSerial(0)->write(str[j]);
65 #ifndef SERIAL_IS_FILE 66 endColour(Machine::instance().getSerial(0));
72 Vga *pVga = Machine::instance().
getVga(0);
73 uint16_t *pFramebuffer = *pVga;
74 pVga->
pokeBuffer(reinterpret_cast<uint8_t *>(pFramebuffer), 0);
78 void BootIO::putCharVga(
const char c,
Colour foreColour,
Colour backColour)
80 Vga *pVga = Machine::instance().
getVga(0);
83 uint16_t *pFramebuffer = *pVga;
84 if (pFramebuffer == 0)
100 uint8_t attributeByte = (backColour << 4) | (foreColour & 0x0F);
102 ' ' | (attributeByte << 8);
124 uint8_t attributeByte = (backColour << 4) | (foreColour & 0x0F);
126 c | (attributeByte << 8);
140 uint8_t attributeByte = (Black << 4) | (White & 0x0F);
141 uint16_t blank =
' ' | (attributeByte << 8);
146 pFramebuffer[i] = pFramebuffer[i + pVga->
getNumCols()];
150 pFramebuffer[i] = blank;
159 pSerial->write(
"\033[");
163 pSerial->write(
"30");
166 pSerial->write(
"31");
169 pSerial->write(
"32");
172 pSerial->write(
"1;33");
175 pSerial->write(
"34");
178 pSerial->write(
"35");
181 pSerial->write(
"36");
184 pSerial->write(
"0;37");
187 pSerial->write(
"1;30");
190 pSerial->write(
"1;31");
193 pSerial->write(
"1;32");
196 pSerial->write(
"1;34");
199 pSerial->write(
"1;35");
202 pSerial->write(
"1;36");
205 pSerial->write(
"1;37");
214 pSerial->write(
"40");
217 pSerial->write(
"41");
220 pSerial->write(
"42");
223 pSerial->write(
"43");
226 pSerial->write(
"44");
229 pSerial->write(
"45");
232 pSerial->write(
"46");
235 pSerial->write(
"47");
243 void BootIO::endColour(
Serial *pSerial)
virtual Serial * getSerial(size_t n)=0
EXPORTED_PUBLIC void write(T &str, Colour foreColour, Colour backColour)
virtual void pokeBuffer(uint8_t *pBuffer, size_t nBufLen)=0
virtual Vga * getVga(size_t n)=0
static EXPORTED_PUBLIC Log & instance()
virtual bool setLargestTextMode()=0
virtual size_t getNumRows()=0
virtual size_t getNumCols()=0