Commit d8d417d9 authored by Andrey Filippov's avatar Andrey Filippov

exported buffer from elphel393-mem

parent 99011cdb
...@@ -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>
...@@ -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>&lt;project&gt;/.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>&lt;project&gt;/.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>&lt;project&gt;/.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.ScannerConfigBuilder</name> <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers> <triggers>full,incremental,</triggers>
<arguments> <arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/bitbake deploy [Builder].launch</value>
</dictionary>
<dictionary>
<key>incclean</key>
<value>true</value>
</dictionary>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
......
/*!***************************************************************************
*! 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)
{ {
......
/*!***************************************************************************
*! 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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment