FreeNOS
i8250.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __SERVER_SERIAL_I8250_H
19 #define __SERVER_SERIAL_I8250_H
20 
21 #include <Macros.h>
22 #include <Types.h>
23 #include "SerialDevice.h"
24 
36 class i8250 : public SerialDevice
37 {
38  private:
39 
43  enum Constants
44  {
45  TRANSMIT = 0,
46  RECEIVE = 0,
49  RXREADY = 1,
51  IRQSTATUS = 2,
56  TXREADY = 0x20,
57  DLAB = 0x80,
58  BAUDRATE = 9600,
59  };
60 
61  public:
62 
69  i8250(const u32 irq, const u16 base);
70 
77 
85  virtual FileSystem::Result interrupt(const Size vector);
86 
97  virtual FileSystem::Result read(IOBuffer & buffer,
98  Size & size,
99  const Size offset);
100 
111  virtual FileSystem::Result write(IOBuffer & buffer,
112  Size & size,
113  const Size offset);
114 };
115 
121 #endif /* __SERVER_SERIAL_I8250_H */
i8250::IRQSTATUS
@ IRQSTATUS
Definition: i8250.h:51
i8250::read
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read bytes from the device.
Definition: i8250.cpp:78
i8250::DIVISORHIGH
@ DIVISORHIGH
Definition: i8250.h:48
Macros.h
SerialDevice.h
Types.h
i8250::Constants
Constants
Constants used to communicate with the UART.
Definition: i8250.h:43
i8250::initialize
virtual FileSystem::Result initialize()
Initializes the i8250 serial UART.
Definition: i8250.cpp:36
i8250::BAUDRATE
@ BAUDRATE
Definition: i8250.h:58
i8250::LINECONTROL
@ LINECONTROL
Definition: i8250.h:53
i8250::RXREADY
@ RXREADY
Definition: i8250.h:49
i8250::TXREADY
@ TXREADY
Definition: i8250.h:56
i8250::FIFOCONTROL
@ FIFOCONTROL
Definition: i8250.h:52
i8250::DIVISORLOW
@ DIVISORLOW
Definition: i8250.h:47
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
IOBuffer
Abstract Input/Output buffer.
Definition: IOBuffer.h:37
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
i8250::DLAB
@ DLAB
Definition: i8250.h:57
SerialDevice
Provides sequential byte stream of incoming (RX) and outgoing (TX) data.
Definition: SerialDevice.h:37
i8250::RECEIVE
@ RECEIVE
Definition: i8250.h:46
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
i8250::interrupt
virtual FileSystem::Result interrupt(const Size vector)
Called when an interrupt has been triggered for this device.
Definition: i8250.cpp:72
i8250::i8250
i8250(const u32 irq, const u16 base)
Constructor function.
Definition: i8250.cpp:29
i8250::MODEMCONTROL
@ MODEMCONTROL
Definition: i8250.h:54
i8250::TRANSMIT
@ TRANSMIT
Definition: i8250.h:45
i8250::LINESTATUS
@ LINESTATUS
Definition: i8250.h:55
i8250::write
virtual FileSystem::Result write(IOBuffer &buffer, Size &size, const Size offset)
Write bytes to the device.
Definition: i8250.cpp:104
i8250::IRQCONTROL
@ IRQCONTROL
Definition: i8250.h:50
i8250
i8250 serial UART.
Definition: i8250.h:36