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
d8d417d9
Commit
d8d417d9
authored
Feb 25, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exported buffer from elphel393-mem
parent
99011cdb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
13 deletions
+102
-13
.cproject
.cproject
+1
-0
.project
.project
+39
-3
elphel393-mem.c
src/drivers/elphel/elphel393-mem.c
+35
-10
elphel393-mem.h
src/drivers/elphel/elphel393-mem.h
+27
-0
No files found.
.cproject
View file @
d8d417d9
...
@@ -85,4 +85,5 @@
...
@@ -85,4 +85,5 @@
<autodiscovery
enabled=
"true"
problemReportingEnabled=
"true"
selectedProfileId=
""
/>
<autodiscovery
enabled=
"true"
problemReportingEnabled=
"true"
selectedProfileId=
""
/>
</scannerConfigBuildInfo>
</scannerConfigBuildInfo>
</storageModule>
</storageModule>
<storageModule
moduleId=
"refreshScope"
/>
</cproject>
</cproject>
.project
View file @
d8d417d9
...
@@ -6,15 +6,51 @@
...
@@ -6,15 +6,51 @@
</projects>
</projects>
<buildSpec>
<buildSpec>
<buildCommand>
<buildCommand>
<name>
org.eclipse.cdt.managedbuilder.core.genmakebuilder
</name>
<name>
org.eclipse.ui.externaltools.ExternalToolBuilder
</name>
<triggers>
clean,full,incremental,
</triggers>
<triggers>
full,incremental,
</triggers>
<arguments>
<dictionary>
<key>
LaunchConfigHandle
</key>
<value>
<
project
>
/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch
</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.ui.externaltools.ExternalToolBuilder
</name>
<triggers>
full,incremental,
</triggers>
<arguments>
<dictionary>
<key>
LaunchConfigHandle
</key>
<value>
<
project
>
/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder.launch
</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.ui.externaltools.ExternalToolBuilder
</name>
<triggers>
full,incremental,
</triggers>
<arguments>
<arguments>
<dictionary>
<key>
LaunchConfigHandle
</key>
<value>
<
project
>
/.externalToolBuilders/bitbake compile [Builder].launch
</value>
</dictionary>
<dictionary>
<key>
incclean
</key>
<value>
true
</value>
</dictionary>
</arguments>
</arguments>
</buildCommand>
</buildCommand>
<buildCommand>
<buildCommand>
<name>
org.eclipse.
cdt.managedbuilder.core.ScannerConfig
Builder
</name>
<name>
org.eclipse.
ui.externaltools.ExternalTool
Builder
</name>
<triggers>
full,incremental,
</triggers>
<triggers>
full,incremental,
</triggers>
<arguments>
<arguments>
<dictionary>
<key>
LaunchConfigHandle
</key>
<value>
<
project
>
/.externalToolBuilders/bitbake deploy [Builder].launch
</value>
</dictionary>
<dictionary>
<key>
incclean
</key>
<value>
true
</value>
</dictionary>
</arguments>
</arguments>
</buildCommand>
</buildCommand>
</buildSpec>
</buildSpec>
...
...
src/drivers/elphel/elphel393-mem.c
View file @
d8d417d9
/*!***************************************************************************
*! FILE NAME : elphel393-mem.c
*! DESCRIPTION: Reserve large memory range at boot time (when it is available)
*! to use as a circular video buffer
*! Copyright (C) 2015 Elphel, Inc.
*! -----------------------------------------------------------------------------**
*!
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*!****************************************************************************/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of.h>
...
@@ -9,31 +29,36 @@
...
@@ -9,31 +29,36 @@
#include <asm/dma-mapping.h>
#include <asm/dma-mapping.h>
#include <asm/outercache.h>
#include <asm/outercache.h>
#include <asm/cacheflush.h>
#include <asm/cacheflush.h>
#include "elphel393-mem.h"
#define SYSFS_PERMISSIONS 0644
/* default permissions for sysfs files */
#define SYSFS_PERMISSIONS 0644
/* default permissions for sysfs files */
#define SYSFS_READONLY 0444
#define SYSFS_READONLY 0444
#define SYSFS_WRITEONLY 0222
#define SYSFS_WRITEONLY 0222
static
ssize_t
get_paddr
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
static
ssize_t
get_paddr
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
/*
struct elphel_buf_t
struct elphel_buf_t
{
{
void *vaddr;
void *vaddr;
dma_addr_t paddr;
dma_addr_t paddr;
ssize_t size;
ssize_t size;
};
};
*/
static
struct
elphel_buf_t
elphel_buf
=
{
static
struct
elphel_buf_t
_
elphel_buf
=
{
.
vaddr
=
NULL
,
.
vaddr
=
NULL
,
.
paddr
=
0
,
.
paddr
=
0
,
.
size
=
0
.
size
=
0
};
};
struct
elphel_buf_t
elphel_buf
;
// static can not be extern
EXPORT_SYMBOL_GPL
(
elphel_buf
);
static
int
__init
elphelmem_init
(
void
)
static
int
__init
elphelmem_init
(
void
)
{
{
struct
device_node
*
node
;
struct
device_node
*
node
;
const
__be32
*
bufsize_be
;
const
__be32
*
bufsize_be
;
elphel_buf
=
_elphel_buf
;
// static can not be extern
node
=
of_find_node_by_name
(
NULL
,
"elphel393-mem"
);
node
=
of_find_node_by_name
(
NULL
,
"elphel393-mem"
);
if
(
!
node
)
if
(
!
node
)
{
{
...
@@ -42,13 +67,13 @@ static int __init elphelmem_init(void)
...
@@ -42,13 +67,13 @@ static int __init elphelmem_init(void)
}
}
bufsize_be
=
(
__be32
*
)
of_get_property
(
node
,
"memsize"
,
NULL
);
bufsize_be
=
(
__be32
*
)
of_get_property
(
node
,
"memsize"
,
NULL
);
elphel_buf
.
size
=
be32_to_cpup
(
bufsize_be
);
_
elphel_buf
.
size
=
be32_to_cpup
(
bufsize_be
);
elphel_buf
.
vaddr
=
dma_alloc_coherent
(
NULL
,(
elphel_buf
.
size
*
PAGE_SIZE
),
&
(
elphel_buf
.
paddr
),
GFP_KERNEL
);
_elphel_buf
.
vaddr
=
dma_alloc_coherent
(
NULL
,(
_elphel_buf
.
size
*
PAGE_SIZE
),
&
(
_
elphel_buf
.
paddr
),
GFP_KERNEL
);
if
(
elphel_buf
.
paddr
)
if
(
_
elphel_buf
.
paddr
)
{
{
printk
(
"Allocated %u pages for DMA at address 0x%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"
);
else
printk
(
"ERROR allocating memory buffer"
);
...
@@ -66,12 +91,12 @@ static void __exit elphelmem_exit(void)
...
@@ -66,12 +91,12 @@ static void __exit elphelmem_exit(void)
static
ssize_t
get_paddr
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
static
ssize_t
get_paddr
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
return
sprintf
(
buf
,
"0x%x
\n
"
,
(
u32
)
elphel_buf
.
paddr
);
return
sprintf
(
buf
,
"0x%x
\n
"
,
(
u32
)
_
elphel_buf
.
paddr
);
}
}
static
ssize_t
get_size
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
static
ssize_t
get_size
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
return
sprintf
(
buf
,
"%u
\n
"
,
elphel_buf
.
size
);
return
sprintf
(
buf
,
"%u
\n
"
,
_
elphel_buf
.
size
);
}
}
static
ssize_t
get_cache
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
static
ssize_t
get_cache
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
...
...
src/drivers/elphel/elphel393-mem.h
0 → 100644
View file @
d8d417d9
/*!***************************************************************************
*! FILE NAME : elphel393-mem.h
*! DESCRIPTION:
*! Copyright (C) 2015 Elphel, Inc.
*! -----------------------------------------------------------------------------**
*!
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*!****************************************************************************/
struct
elphel_buf_t
{
void
*
vaddr
;
dma_addr_t
paddr
;
ssize_t
size
;
};
extern
struct
elphel_buf_t
elphel_buf
;
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