Move IO Port Function to a separate file
This commit is contained in:
parent
a164d9d67c
commit
91b52f1872
|
@ -0,0 +1,13 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
static inline uint8_t inb(uint16_t port) {
|
||||||
|
uint8_t result;
|
||||||
|
asm volatile("inb %1, %0" : "=a"(result) : "Nd"(port));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void outb(uint16_t port, uint8_t value) {
|
||||||
|
asm volatile("outb %0, %1" ::"a"(value), "Nd"(port));
|
||||||
|
}
|
|
@ -1,10 +1,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define COM1 0x3f8
|
#include "common/port.h"
|
||||||
|
|
||||||
void outb(uint16_t port, uint8_t value) {
|
#define COM1 0x3f8
|
||||||
asm volatile("outb %0, %1" ::"a"(value), "Nd"(port));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void zion() {
|
extern "C" void zion() {
|
||||||
outb(COM1, 'a');
|
outb(COM1, 'a');
|
||||||
|
|
Loading…
Reference in New Issue