20#include "pedigree/kernel/processor/types.h"
21#include "pedigree/kernel/utilities/Buffer.h"
22#include "pedigree/kernel/utilities/String.h"
25#include "ConsoleDefines.h"
29extern const char defaultControl[MAX_CONTROL_CHAR];
31ConsoleSlaveFile::ConsoleSlaveFile(
size_t consoleNumber,
String consoleName,
Filesystem* pFs)
34ConsoleSlaveFile::ConsoleSlaveFile(
size_t consoleNumber,
String consoleName,
Filesystem* pFs,
36 :
ConsoleFile(consoleNumber, consoleName, pFs, pParent) {}
38uint64_t ConsoleSlaveFile::readIo(
ConsoleIoState& state, uint64_t size, uintptr_t buffer,
40 uint64_t nBytes = state.input.
read(
reinterpret_cast<char*
>(buffer), size, bCanBlock);
50 size_t endSize =
processInput(
reinterpret_cast<char*
>(buffer), nBytes);
55uint64_t ConsoleSlaveFile::writeIo(
ConsoleIoState& state, uint64_t size, uintptr_t buffer,
57 if (!size || !state.output.
canWrite(bCanBlock)) {
61 size_t amount = state.output.
writeAvailable(
reinterpret_cast<char*
>(buffer), size);
67 return readEpoch(captureOpenEpoch(), size, buffer, canBlock);
71 return writeEpoch(captureOpenEpoch(), size, buffer, canBlock);
bool canWrite(bool block)
size_t writeAvailable(const T *buffer, size_t count, bool atomic=false)
size_t read(T *buffer, size_t count, bool block=true)
ConsoleFile * m_pOther
Other side of the console.
size_t processInput(char *buf, size_t len)
Input processing.
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)