-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTL8168 Implementation #1652
Open
valentinbreiz
wants to merge
9
commits into
master
Choose a base branch
from
rtl8168
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
RTL8168 Implementation #1652
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
65c39b8
Add driver + card initialization
valentinbreiz 312db3b
Merge branch 'master' into rtl8168
valentinbreiz 0e26427
Merge branch 'master' into rtl8168
valentinbreiz 8d5651f
Merge branch 'master' into rtl8168
MishaTy 4679538
Merge branch 'master' into rtl8168
MishaTy f01229f
Merge branch 'master' into rtl8168
MishaTy 59028ec
Merge branch 'master' into rtl8168
MishaTy 7ae17cf
Merge branch 'master' into rtl8168
MishaTy 9908de8
Merge branch 'master' into rtl8168
MishaTy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Cosmos.Core | ||
{ | ||
public static class Ports | ||
{ | ||
/// <summary> | ||
/// Reads a byte | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <returns></returns> | ||
public static byte InB(ushort port) | ||
{ | ||
var io = new IOPort(port); | ||
return io.Byte; | ||
} | ||
|
||
/// <summary> | ||
/// Reads a 32 bit word | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <returns></returns> | ||
public static uint InD(ushort port) | ||
{ | ||
var io = new IOPort(port); | ||
return io.DWord; | ||
} | ||
|
||
/// <summary> | ||
/// Reads a 16 bit word | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <returns></returns> | ||
public static ushort InW(ushort port) | ||
{ | ||
var io = new IOPort(port); | ||
return io.Word; | ||
} | ||
|
||
/// <summary> | ||
/// Writes a byte | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <param name="data"></param> | ||
public static void OutB(ushort port, byte data) | ||
{ | ||
var io = new IOPort(port); | ||
io.Byte = data; | ||
} | ||
|
||
/// <summary> | ||
/// Writes a 32 bit word | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <param name="data"></param> | ||
public static void OutD(ushort port, byte data) | ||
{ | ||
var io = new IOPort(port); | ||
io.DWord = data; | ||
} | ||
|
||
/// <summary> | ||
/// Writes a 32 bit word | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <param name="data"></param> | ||
public static void OutD(ushort port, uint data) | ||
{ | ||
var io = new IOPort(port); | ||
io.DWord = data; | ||
} | ||
|
||
/// <summary> | ||
/// Writes a 16 bit word | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <param name="data"></param> | ||
public static void OutW(ushort port, ushort data) | ||
{ | ||
var io = new IOPort(port); | ||
io.Word = data; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer we go with the same approach we have for other drivers as well, which is that we define all the the IOPorts we need and then access the one we actually need. For example see
Cosmos/source/Cosmos.Core/IOGroup/ATA.cs
Line 13 in a3d0a07
That approach should be quicker since we arnt constantly creating new objects and less error prone than calculating the port address every time.