-
Notifications
You must be signed in to change notification settings - Fork 271
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
Zero 2W 64bit port #261
Open
zxfishhack
wants to merge
6
commits into
juj:master
Choose a base branch
from
zxfishhack:rpi2w-64bit-port
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
Zero 2W 64bit port #261
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cabd50e
port pi2w 64bit raspbian
zxfishhack 72acdb5
remove debug info
zxfishhack 92fd05d
FIX: system timer register offset mistake
zxfishhack 61e55a1
remove GPL2 code
zxfishhack 4d6df73
remove GPL2 code
zxfishhack 0840eb3
Update spi.cpp
zxfishhack 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
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,63 @@ | ||
#ifdef USE_VCSM_CMA | ||
|
||
#include "config.h" | ||
#include "cma.h" | ||
#include "util.h" | ||
#include <sys/ioctl.h> | ||
#include <fcntl.h> | ||
#include <syslog.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
static int cma_fd = -1; | ||
#define PAGE_SIZE 4096 | ||
|
||
void OpenVCSM(void) { | ||
cma_fd = open("/dev/vcsm-cma", O_RDWR|O_SYNC); | ||
if (cma_fd < 0) FATAL_ERROR("can't open /dev/vcsm-cma"); | ||
} | ||
|
||
void CloseVCSM(void) { | ||
if (cma_fd >= 0) { | ||
close(cma_fd); | ||
} | ||
} | ||
|
||
const int NAME_LENGTH = 32; | ||
|
||
struct Allocate { | ||
/* user -> kernel */ | ||
uint32_t size; | ||
uint32_t num; | ||
uint32_t flags; | ||
uint32_t pad; | ||
char name[NAME_LENGTH]; | ||
|
||
/* kernel -> user */ | ||
int32_t fd; | ||
uint32_t vcHandle; | ||
uint64_t dmaAddr; | ||
}; | ||
|
||
int AllocateCMA(const char* reason, size_t req, CMAInfo* res) { | ||
if (res == NULL) { | ||
return -1; | ||
} | ||
Allocate ctx; | ||
memset(&ctx, 0, sizeof(ctx)); | ||
ctx.size = ALIGN_UP(req, PAGE_SIZE); | ||
ctx.flags = 0; // NO cache | ||
strncpy((char*)ctx.name, reason, NAME_LENGTH -1); | ||
ctx.num = 1; | ||
if (ioctl(cma_fd, _IOR('J', 0x5A, struct Allocate), &ctx) < 0 || ctx.fd < 0) { // allocate cmd | ||
return -1; | ||
} | ||
res->size = ctx.size; | ||
res->vcHandle = ctx.vcHandle; | ||
res->dmaAddr = ctx.dmaAddr; | ||
res->fd = ctx.fd; | ||
return 0; | ||
} | ||
|
||
#endif |
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,16 @@ | ||
#pragma once | ||
#ifdef USE_VCSM_CMA | ||
|
||
#include <memory.h> | ||
#include <inttypes.h> | ||
struct CMAInfo { | ||
size_t size; | ||
uintptr_t dmaAddr; | ||
uint32_t fd; | ||
uint32_t vcHandle; | ||
}; | ||
|
||
void OpenVCSM(void); | ||
void CloseVCSM(void); | ||
int AllocateCMA(const char* reason, size_t req, CMAInfo* res); | ||
#endif |
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
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
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
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.
Probably didn't mean to permanently change this to CS1 outside of the
#ifdef DISPLAY_USES_CS1
below?