Commit 80687177 authored by Andrey Filippov's avatar Andrey Filippov

Merge branch 'master' of https://github.com/Elphel/linux-elphel

parents 27f25ce6 90bd8799
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,7 +7,7 @@ Code must be located in `poky/` directory. Navigate to `poky/` and run: ...@@ -7,7 +7,7 @@ Code must be located in `poky/` directory. Navigate to `poky/` and run:
git clone https://github.com/Elphel/linux-elphel.git git clone https://github.com/Elphel/linux-elphel.git
``` ```
##Generating links and headers ##Generating links and headers
Links between project tree and kernel source tree are generated by Bitbake during 'unpack' task. Some required header files are automatically generated during the build process. Links between project tree and kernel source tree are generated by Bitbake during 'unpack' task when using `meta-elphel393`. Some required header files are automatically generated during the build process.
``` ```
. ./oe-init-build-env . ./oe-init-build-env
bitbake linux-xlnx -c clean -f bitbake linux-xlnx -c clean -f
...@@ -24,9 +24,20 @@ Run Eclipse from its location directory and provide additional heap memory to it ...@@ -24,9 +24,20 @@ Run Eclipse from its location directory and provide additional heap memory to it
Project now is imported into Eclipse workspace. Project now is imported into Eclipse workspace.
- Project → Properties
- C/C++ General → Preprocessor Include Paths → Entries → GNU C → CDT User Settings - C/C++ General → Preprocessor Include Paths → Entries → GNU C → CDT User Settings
- [Add...] → Select "Preprocessor macros file" → `linux/include/generated/autoconf.h`[OK] - [Add...] → Select "Preprocessor macros file" → `linux/include/generated/autoconf.h`[OK]
- [Add...] → Select "Preprocessor macros file" → `linux/include/linux/compiler.h`[OK] - [Add...] → Select "Preprocessor macros file" → `linux/include/linux/compiler.h`[OK]
- [Add...] → Select "Include file" → `linux/include/linux/kconfig.h`[OK] - [Add...] → Select "Include file" → `linux/include/linux/kconfig.h`[OK]
- C/C++ General → Indexer
- Check “Enable project specific setttings”
- Check “Enable indexer”
- Uncheck “Index source files not included in the build”
- Uncheck “Index unused headers”
- Check “Index header variants”
- Uncheck “Index source and header files opened in editor”
- Uncheck “Allow heuristic resolution of includes”
- Set size of files to be skipped >100MB (effectively disabling this feature)
- Uncheck all “Skip…” options
- [OK] to close the Advanced Settings window. - [OK] to close the Advanced Settings window.
- Project → C/C++ Index → Rebuild - Project → C/C++ Index → Rebuild
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dma-direction.h> #include <linux/dma-direction.h>
#include <asm/dma-mapping.h> #include <asm/dma-mapping.h>
#include <asm/outercache.h>
#include <asm/cacheflush.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
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);
...@@ -32,12 +34,10 @@ static int __init elphelmem_init(void) ...@@ -32,12 +34,10 @@ static int __init elphelmem_init(void)
struct device_node *node; struct device_node *node;
const __be32 *bufsize_be; const __be32 *bufsize_be;
printk("======== Allocating memory buffer ========\n");
node = of_find_node_by_name(NULL, "elphel393-mem"); node = of_find_node_by_name(NULL, "elphel393-mem");
if (!node) if (!node)
{ {
printk("ERROR: No node found\n"); printk("DMA buffer allocation ERROR: No device tree node found\n");
return -ENODEV; return -ENODEV;
} }
...@@ -48,7 +48,7 @@ static int __init elphelmem_init(void) ...@@ -48,7 +48,7 @@ static int __init elphelmem_init(void)
if(elphel_buf.paddr) 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"); else printk("ERROR allocating memory buffer");
...@@ -57,7 +57,7 @@ static int __init elphelmem_init(void) ...@@ -57,7 +57,7 @@ static int __init elphelmem_init(void)
static void __exit elphelmem_exit(void) static void __exit elphelmem_exit(void)
{ {
printk("Goodbye Cruel World!\n"); printk("DMA buffer disabled\n");
} }
...@@ -73,12 +73,24 @@ static ssize_t get_size(struct device *dev, struct device_attribute *attr, char ...@@ -73,12 +73,24 @@ static ssize_t get_size(struct device *dev, struct device_attribute *attr, char
{ {
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)
{
return sprintf(buf,"Write into this file to flush L1/L2 caches to memory.\n");
}
static ssize_t flush_cache(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
__cpuc_flush_kern_all();
outer_flush_all();
return count;
}
static DEVICE_ATTR(buffer_address, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr, NULL); static DEVICE_ATTR(buffer_address, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr, NULL);
static DEVICE_ATTR(buffer_pages, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size, NULL); static DEVICE_ATTR(buffer_pages, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size, NULL);
static DEVICE_ATTR(buffer_flush, SYSFS_PERMISSIONS, get_cache, flush_cache);
static struct attribute *root_dev_attrs[] = { static struct attribute *root_dev_attrs[] = {
&dev_attr_buffer_address.attr, &dev_attr_buffer_address.attr,
&dev_attr_buffer_pages.attr, &dev_attr_buffer_pages.attr,
&dev_attr_buffer_flush.attr,
NULL NULL
}; };
......
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