The Pedigree Project  0.1
IoBase.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "pedigree/kernel/processor/IoBase.h"
21 
22 IoBase::IoBase() = default;
23 IoBase::~IoBase() = default;
24 
25 uint64_t IoBase::read64LowFirst(size_t offset)
26 {
27  uint64_t low = read32(offset);
28  uint64_t high = read32(offset + 4);
29  return low | (high << 32);
30 }
31 
32 uint64_t IoBase::read64HighFirst(size_t offset)
33 {
34  uint64_t high = read32(offset + 4);
35  uint64_t low = read32(offset);
36  return low | (high << 32);
37 }
38 
39 void IoBase::write64LowFirst(uint64_t value, size_t offset)
40 {
41  write32(value & 0xFFFFFFFF, offset);
42  write32(value >> 32, offset + 4);
43 }
44 
45 void IoBase::write64HighFirst(uint64_t value, size_t offset)
46 {
47  write32(value >> 32, offset + 4);
48  write32(value & 0xFFFFFFFF, offset);
49 }
virtual ~IoBase()
uint64_t read64HighFirst(size_t offset=0)
Definition: IoBase.cc:32
uint64_t read64LowFirst(size_t offset=0)
Definition: IoBase.cc:25
virtual uint32_t read32(size_t offset=0)=0
void write64HighFirst(uint64_t value, size_t offset=0)
Definition: IoBase.cc:45
void write64LowFirst(uint64_t value, size_t offset=0)
Definition: IoBase.cc:39
virtual void write32(uint32_t value, size_t offset=0)=0