Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
e6dc49d8
Commit
e6dc49d8
authored
May 07, 2015
by
YuriNenakhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache flush on specific adress
parent
753488df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
.cproject
.cproject
+1
-1
elphel393-mem.c
src/drivers/elphel/elphel393-mem.c
+24
-10
No files found.
.cproject
View file @
e6dc49d8
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/drivers/elphel/elphel393-mem.c
View file @
e6dc49d8
...
...
@@ -14,7 +14,6 @@
#define SYSFS_READONLY 0444
#define SYSFS_WRITEONLY 0222
static
ssize_t
get_paddr
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
struct
elphel_buf_t
...
...
@@ -35,12 +34,10 @@ static int __init elphelmem_init(void)
struct
device_node
*
node
;
const
__be32
*
bufsize_be
;
printk
(
"======== Allocating memory buffer ========
\n
"
);
node
=
of_find_node_by_name
(
NULL
,
"elphel393-mem"
);
if
(
!
node
)
{
printk
(
"
ERROR: No
node found
\n
"
);
printk
(
"
DMA buffer allocation ERROR: No device tree
node found
\n
"
);
return
-
ENODEV
;
}
...
...
@@ -51,7 +48,7 @@ static int __init elphelmem_init(void)
if
(
elphel_buf
.
paddr
)
{
printk
(
"Allocated %u pages
at address
%x
\n
"
,
(
u32
)
elphel_buf
.
size
,
(
u32
)
elphel_buf
.
paddr
);
printk
(
"Allocated %u pages
for DMA at address 0x
%x
\n
"
,
(
u32
)
elphel_buf
.
size
,
(
u32
)
elphel_buf
.
paddr
);
}
else
printk
(
"ERROR allocating memory buffer"
);
...
...
@@ -60,7 +57,7 @@ static int __init elphelmem_init(void)
static
void
__exit
elphelmem_exit
(
void
)
{
printk
(
"
Goodbye Cruel World!
\n
"
);
printk
(
"
DMA buffer disabled
\n
"
);
}
...
...
@@ -78,13 +75,30 @@ static ssize_t get_size(struct device *dev, struct device_attribute *attr, char
}
static
ssize_t
get_cache
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
return
sprintf
(
buf
,
"
Write in this file to flush L1 and L2 caches
.
\n
"
);
return
sprintf
(
buf
,
"
Flush L1/L2 caches to memory: write
\"
MEM_OFFSET NUMBER_OF_PAGES
\"
of memory region to be flushed into this file or
\"
1
\"
to flush all buffer memory
.
\n
"
);
}
static
ssize_t
flush_cache
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
__cpuc_flush_dcache_area
(
elphel_buf
.
vaddr
,
elphel_buf
.
size
);
outer_clean_range
(
elphel_buf
.
vaddr
,
elphel_buf
.
size
);
outer_cache
.
inv_range
(
elphel_buf
.
vaddr
,
elphel_buf
.
size
);
void
*
startaddr
,
*
endaddr
,
*
bufstart
,
*
bufend
;
unsigned
long
long
offset
,
size
;
offset
=
0
;
size
=
0
;
sscanf
(
buf
,
"%lli %lli"
,
&
offset
,
&
size
);
bufstart
=
elphel_buf
.
paddr
;
bufend
=
bufstart
+
PAGE_SIZE
*
elphel_buf
.
size
;
if
(
size
==
0
||
offset
>
elphel_buf
.
size
*
PAGE_SIZE
||
offset
+
PAGE_SIZE
*
size
>
elphel_buf
.
size
*
PAGE_SIZE
)
{
startaddr
=
elphel_buf
.
vaddr
;
endaddr
=
PAGE_SIZE
*
elphel_buf
.
size
;
}
else
{
startaddr
=
elphel_buf
.
vaddr
+
offset
;
endaddr
=
startaddr
+
PAGE_SIZE
*
size
;
}
__cpuc_flush_dcache_area
(
startaddr
,
endaddr
);
outer_clean_range
(
startaddr
,
endaddr
);
outer_cache
.
inv_range
(
startaddr
,
endaddr
);
return
count
;
}
static
DEVICE_ATTR
(
buffer_address
,
SYSFS_PERMISSIONS
&
SYSFS_READONLY
,
get_paddr
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment