Skip to content
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

meminfo: Replace sys/io.h by direct register accesses. #144

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions meminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <sys/mman.h>
#include <stdint.h>
#include <errno.h>
#include <sys/io.h>
#include <stdbool.h>

#include "common.h"
Expand Down Expand Up @@ -74,24 +73,24 @@ static enum sunxi_soc_version soc_version;
unsigned int
sunxi_io_read(void *base, int offset)
{
return inl((unsigned long) (base + offset));
return *(volatile unsigned int*) (base + offset);
}

void
sunxi_io_write(void *base, int offset, unsigned int value)
{
outl(value, (unsigned long) (base + offset));
*(volatile unsigned int*) (base + offset) = value;
}

void
sunxi_io_mask(void *base, int offset, unsigned int value, unsigned int mask)
{
unsigned int tmp = inl((unsigned long) (base + offset));
unsigned int tmp = sunxi_io_read(base, offset);

tmp &= ~mask;
tmp |= value & mask;

outl(tmp, (unsigned long) (base + offset));
sunxi_io_write(base, offset, tmp);
}


Expand Down