21#include "pedigree/kernel/utilities/Cord.h"
22#include "pedigree/kernel/utilities/StaticString.h"
28HostedSerial::HostedSerial() : m_File(-1), m_nFileNumber(0) {}
30HostedSerial::~HostedSerial() {
38 m_nFileNumber = nBaseAddr;
45 s.append(m_nFileNumber);
47 m_File = open(
static_cast<const char*
>(s), O_TRUNC | O_CREAT | O_WRONLY, 0644);
50char HostedSerial::read() {
55bool HostedSerial::hasData() {
59char HostedSerial::readNonBlock() {
63void HostedSerial::write(
char c) {
65 ::write(m_File, buf, 1);
71void HostedSerial::write_str(
const char* c) {
72 ::write(m_File, c, StringLength(c));
74 ::write(2, c, StringLength(c));
78void HostedSerial::write_str(
const char* c,
size_t len) {
79 ::write(m_File, c, len);
85void HostedSerial::write_str(
const Cord& cord) {
86 for (
auto it = cord.segbegin(); it != cord.segend(); ++it) {
87 ::write(m_File, it.ptr(), it.length());
88 ::write(2, it.ptr(), it.length());
95bool HostedSerial::isConnected() {
virtual void setBase(uintptr_t nBaseAddr)