FreeNOS
IO.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 __LIBARCH_IO_H
19 #define __LIBARCH_IO_H
20 
21 #include <Types.h>
22 #include "Memory.h"
23 
35 class IO
36 {
37  public:
38 
42  enum Result
43  {
47  };
48 
52  IO();
53 
59  Address getBase() const;
60 
66  void setBase(const Address base);
67 
76  Result map(Address phys,
77  Size size = 4096,
79 
85  Result unmap();
86 
87  protected:
88 
91 
94 };
95 
101 #endif /* __LIBARCH_IO_H */
Memory::Range
Memory range.
Definition: Memory.h:55
IO::unmap
Result unmap()
Unmap I/O address space.
Definition: IO.cpp:70
Types.h
IO::OutOfMemory
@ OutOfMemory
Definition: IO.h:46
Memory::Writable
@ Writable
Definition: Memory.h:42
IO::map
Result map(Address phys, Size size=4096, Memory::Access access=Memory::Readable|Memory::Writable|Memory::User)
Map I/O address space.
Definition: IO.cpp:38
IO::m_base
Address m_base
memory I/O base offset is added to each I/O address.
Definition: IO.h:90
Memory::User
@ User
Definition: Memory.h:44
Address
unsigned long Address
A memory address.
Definition: Types.h:131
Memory::Readable
@ Readable
Definition: Memory.h:41
IO::setBase
void setBase(const Address base)
Set memory I/O base offset.
Definition: IO.cpp:33
IO
Generic I/O functions.
Definition: IO.h:35
IO::IO
IO()
Constructor.
Definition: IO.cpp:23
IO::Result
Result
Result codes.
Definition: IO.h:42
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Memory::Access
Access
Memory access flags.
Definition: Memory.h:38
Memory.h
IO::Success
@ Success
Definition: IO.h:44
IO::getBase
Address getBase() const
Get memory I/O base offset.
Definition: IO.cpp:28
IO::MapFailure
@ MapFailure
Definition: IO.h:45
IO::m_range
Memory::Range m_range
Memory range for performing I/O mappings.
Definition: IO.h:93