Add io helper functions

This commit is contained in:
Byron Lathi
2022-03-05 22:34:34 -06:00
parent 859a954996
commit 6b24abdbd5
3 changed files with 18 additions and 2 deletions

6
sw/io.c Normal file
View File

@@ -0,0 +1,6 @@
#include <io.h>
int io_remap(int region) {
*(unsigned char*)IO_REMAP = region;
return (*(unsigned char*)IO_REMAP == region);
}

11
sw/io.h
View File

@@ -1,6 +1,15 @@
#ifndef _IO_H #ifndef _IO_H
#define IO_H #define IO_H
#define IO_REMAP *(unsigned char*)0x7f00
#define IO_REMAP 0x7f00
enum io_regions {
io_region_de10lite = 0,
};
int io_remap(int region);
#endif #endif

View File

@@ -1,5 +1,6 @@
#include <io.h> #include <io.h>
int main() { int main() {
IO_REMAP = 1; io_remap(io_region_de10lite);
return 0;
} }