Commit 38b6079d authored by Andrey Filippov's avatar Andrey Filippov

moving all driver definitions into uapi/elphel/x393_devices.h

parent 39905996
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <elphel/elphel393-mem.h> #include <elphel/elphel393-mem.h>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "x393_helpers.h" #include "x393_helpers.h"
/** @brief Driver name displayed in system logs */ /** @brief Driver name displayed in system logs */
#define CIRCBUF_DRIVER_NAME "circbuf driver" //#define CIRCBUF_DRIVER_NAME "circbuf driver"
/** @brief Wait queue for the processes waiting for a new frame to appear in the circular buffer */ /** @brief Wait queue for the processes waiting for a new frame to appear in the circular buffer */
wait_queue_head_t circbuf_wait_queue; wait_queue_head_t circbuf_wait_queue;
...@@ -115,13 +115,13 @@ int circbuf_all_open(struct inode *inode, struct file *filp) ...@@ -115,13 +115,13 @@ int circbuf_all_open(struct inode *inode, struct file *filp)
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
res = circbuf_open(inode, filp); res = circbuf_open(inode, filp);
break; break;
case JPEGHEAD_MINOR: case DEV393_MINOR(DEV393_JPEGHEAD0):
res = jpeghead_open(inode, filp); res = jpeghead_open(inode, filp);
break; break;
case HUFFMAN_MINOR: case DEV393_MINOR(DEV393_HUFFMAN0):
res = huffman_open(inode, filp); res = huffman_open(inode, filp);
break; break;
default: default:
...@@ -146,13 +146,13 @@ int circbuf_all_release(struct inode *inode, struct file *filp) ...@@ -146,13 +146,13 @@ int circbuf_all_release(struct inode *inode, struct file *filp)
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
// res=circbuf_release(inode,filp); // res=circbuf_release(inode,filp);
break; break;
case JPEGHEAD_MINOR: case DEV393_MINOR(DEV393_JPEGHEAD0):
// res=jpeghead_release(inode,filp); // res=jpeghead_release(inode,filp);
break; break;
case HUFFMAN_MINOR: case DEV393_MINOR(DEV393_HUFFMAN0):
// res=huffman_release(inode,filp); // res=huffman_release(inode,filp);
break; break;
default: default:
...@@ -180,15 +180,15 @@ loff_t circbuf_all_lseek(struct file *file, loff_t offset, int orig) ...@@ -180,15 +180,15 @@ loff_t circbuf_all_lseek(struct file *file, loff_t offset, int orig)
dev_dbg(g_dev_ptr, "circbuf_all_lseek, minor = 0x%x\n", minor); dev_dbg(g_dev_ptr, "circbuf_all_lseek, minor = 0x%x\n", minor);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
return circbuf_lseek(file, offset, orig); return circbuf_lseek(file, offset, orig);
case JPEGHEAD_MINOR: case DEV393_MINOR(DEV393_JPEGHEAD0):
if (orig == SEEK_END && offset > 0) { if (orig == SEEK_END && offset > 0) {
rp = BYTE2DW(X393_BUFFSUB(offset, CHUNK_SIZE)) & (~7); // convert to index to long, align to 32-bytes rp = BYTE2DW(X393_BUFFSUB(offset, CHUNK_SIZE)) & (~7); // convert to index to long, align to 32-bytes
fp = (struct interframe_params_t *) &circbuf_priv[chn].buf_ptr[rp]; fp = (struct interframe_params_t *) &circbuf_priv[chn].buf_ptr[rp];
} }
return jpeghead_lseek(file, offset, orig, fp); return jpeghead_lseek(file, offset, orig, fp);
case HUFFMAN_MINOR: case DEV393_MINOR(DEV393_HUFFMAN0):
return huffman_lseek(file, offset, orig); return huffman_lseek(file, offset, orig);
default: default:
return -EINVAL; return -EINVAL;
...@@ -212,11 +212,11 @@ ssize_t circbuf_all_read(struct file *file, char *buf, size_t count, loff_t *off ...@@ -212,11 +212,11 @@ ssize_t circbuf_all_read(struct file *file, char *buf, size_t count, loff_t *off
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
return circbuf_read(file, buf, count, off); return circbuf_read(file, buf, count, off);
case JPEGHEAD_MINOR: case DEV393_MINOR(DEV393_JPEGHEAD0):
return jpeghead_read(file, buf, count, off); return jpeghead_read(file, buf, count, off);
case HUFFMAN_MINOR: case DEV393_MINOR(DEV393_HUFFMAN0):
return huffman_read(file, buf, count, off); return huffman_read(file, buf, count, off);
default: default:
return -EINVAL; return -EINVAL;
...@@ -240,12 +240,12 @@ ssize_t circbuf_all_write(struct file *file, const char *buf, size_t count, loff ...@@ -240,12 +240,12 @@ ssize_t circbuf_all_write(struct file *file, const char *buf, size_t count, loff
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
return circbuf_write (file, buf, count, off); return circbuf_write (file, buf, count, off);
case JPEGHEAD_MINOR: case DEV393_MINOR(DEV393_JPEGHEAD0):
// no method for this module // no method for this module
return -EINVAL; return -EINVAL;
case HUFFMAN_MINOR: case DEV393_MINOR(DEV393_HUFFMAN0):
return huffman_write (file, buf, count, off); return huffman_write (file, buf, count, off);
default: default:
return -EINVAL; return -EINVAL;
...@@ -268,7 +268,7 @@ int circbuf_all_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -268,7 +268,7 @@ int circbuf_all_mmap(struct file *file, struct vm_area_struct *vma)
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
return circbuf_mmap(file, vma); return circbuf_mmap(file, vma);
default: default:
return -EINVAL; return -EINVAL;
...@@ -292,7 +292,7 @@ unsigned int circbuf_all_poll(struct file *file, poll_table *wait) ...@@ -292,7 +292,7 @@ unsigned int circbuf_all_poll(struct file *file, poll_table *wait)
minor_to_chn(minor, &dev_type); minor_to_chn(minor, &dev_type);
switch (dev_type) { switch (dev_type) {
case CIRCBUF_MINOR: case DEV393_MINOR(DEV393_CIRCBUF0):
return circbuf_poll(file, wait); return circbuf_poll(file, wait);
default: default:
return 0; return 0;
...@@ -963,12 +963,12 @@ static int circbuf_all_init(struct platform_device *pdev) ...@@ -963,12 +963,12 @@ static int circbuf_all_init(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
dev_dbg(dev, "registering character device with name 'circbuf_operations'"); dev_dbg(dev, "registering character device with name 'circbuf_operations'");
res = register_chrdev(CIRCBUF_MAJOR, "circbuf_operations", &circbuf_fops); res = register_chrdev(DEV393_MAJOR(DEV393_CIRCBUF0), "circbuf_operations", &circbuf_fops);
if(res < 0) { if(res < 0) {
dev_err(dev, "couldn't get a major number %d.\n", CIRCBUF_MAJOR); dev_err(dev, "couldn't get a major number %d.\n", DEV393_MAJOR(DEV393_CIRCBUF0));
return res; return res;
} }
dev_info(dev, "registered MAJOR: %d\n", CIRCBUF_MAJOR); dev_info(dev, "registered MAJOR: %d\n", DEV393_MAJOR(DEV393_CIRCBUF0));
res = jpeghead_init(pdev); res = jpeghead_init(pdev);
if (res < 0) { if (res < 0) {
...@@ -1002,7 +1002,7 @@ static int circbuf_all_init(struct platform_device *pdev) ...@@ -1002,7 +1002,7 @@ static int circbuf_all_init(struct platform_device *pdev)
*/ */
static int circbuf_remove(struct platform_device *pdev) static int circbuf_remove(struct platform_device *pdev)
{ {
unregister_chrdev(CIRCBUF_MAJOR, "circbuf_operations"); unregister_chrdev(DEV393_MAJOR(DEV393_CIRCBUF0), "circbuf_operations");
return 0; return 0;
} }
...@@ -1017,7 +1017,7 @@ static struct platform_driver elphel393_circbuf = { ...@@ -1017,7 +1017,7 @@ static struct platform_driver elphel393_circbuf = {
.probe = circbuf_all_init, .probe = circbuf_all_init,
.remove = circbuf_remove, .remove = circbuf_remove,
.driver = { .driver = {
.name = CIRCBUF_DRIVER_NAME, .name = DEV393_NAME(DEV393_CIRCBUF0),
.of_match_table = elphel393_circbuf_of_match, .of_match_table = elphel393_circbuf_of_match,
}, },
}; };
...@@ -1026,4 +1026,4 @@ module_platform_driver(elphel393_circbuf); ...@@ -1026,4 +1026,4 @@ module_platform_driver(elphel393_circbuf);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
MODULE_DESCRIPTION(CIRCBUF_DRIVER_NAME); MODULE_DESCRIPTION(DEV393_NAME(DEV393_CIRCBUF0));
This diff is collapsed.
...@@ -31,15 +31,13 @@ ...@@ -31,15 +31,13 @@
#include <linux/fs.h> #include <linux/fs.h>
#include "x393.h" #include "x393.h"
//#include "x393_detect_sensors.h" #include <uapi/elphel/x393_devices.h>
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include "mt9x001.h" #include "mt9x001.h"
#include "multi10359.h" #include "multi10359.h"
#include "detect_sensors.h" #include "detect_sensors.h"
#define DETECT_SENSORS_MODULE_DESCRIPTION "Detect sensor type(s) attached to each of the ports" #define DETECT_SENSORS_MODULE_DESCRIPTION "Detect sensor type(s) attached to each of the ports"
#define DETECT_SENSORS_DRIVER_NAME "detect_sensors"
#define OF_PREFIX_NAME "elphel393-detect_sensors" #define OF_PREFIX_NAME "elphel393-detect_sensors"
struct sensor_port_config_t struct sensor_port_config_t
{ {
...@@ -359,35 +357,43 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev) ...@@ -359,35 +357,43 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
///< @return 0 on success, or negative error. ///< @return 0 on success, or negative error.
{ {
const char * config_string; const char * config_string;
// struct x393_i2c_device_list * dl;
char names[4][80]; char names[4][80];
// int rslt;
// int num_devs, nd, ni, sa7, num_addr, num_data, khz;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
// struct device_attribute *new_attr;
// struct device *dev =&pdev->dev;
int num_ports, port, num_sub, sub_chn; int num_ports, port, num_sub, sub_chn;
if (node) { if (node) {
config_string = of_get_property(node, OF_PREFIX_NAME",port-mux", NULL); // &len);
pr_info ("Mux config_string = %s (was looking for '%s')\n",config_string, OF_PREFIX_NAME",port-mux");
if (config_string) {
num_ports = sscanf(config_string,"%79s %79s %79s %79s", names[0], names[1], names[2], names[3]);
if (num_ports > SENSOR_PORTS) if (num_ports > SENSOR_PORTS)
num_ports = SENSOR_PORTS; num_ports = SENSOR_PORTS;
config_string = of_get_property(node, OF_PREFIX_NAME",ports", NULL); // &len); pr_info ("num_ports= %d\n",num_ports);
num_ports = sscanf(config_string,"%79s %79s %79s %79s", names[0], names[1], names[2], names[3]);
for (port = 0; port < num_ports; port++){ for (port = 0; port < num_ports; port++){
set_detected_mux_code(port, get_code_by_name(names[sub_chn], DETECT_MUX)); pr_info ("Setting port %d mux '%s' (0x%x)\n",port, names[port], get_code_by_name(names[port], DETECT_MUX));
set_detected_mux_code(port, get_code_by_name(names[port], DETECT_MUX));
}
} }
num_ports = of_property_count_strings(node,OF_PREFIX_NAME",sensors"); num_ports = of_property_count_strings(node,OF_PREFIX_NAME",sensors");
if (num_ports > SENSOR_PORTS)
num_ports = SENSOR_PORTS;
pr_info ("num_ports = %d (was looking for '%s')\n",num_ports, OF_PREFIX_NAME",sensors");
for (port = 0; port < num_ports; port++){ for (port = 0; port < num_ports; port++){
if (of_property_read_string_index(node, OF_PREFIX_NAME",sensors", port, &config_string)) { if (of_property_read_string_index(node, OF_PREFIX_NAME",sensors", port, &config_string)) {
pr_err("%s: No data for selected port\n", __func__); pr_err("%s: No data for selected port\n", __func__);
BUG(); BUG();
} }
pr_info ("Sensor config_string = %s\n",config_string);
if (config_string) {
num_sub = sscanf(config_string,"%79s %79s %79s %79s", names[0], names[1], names[2], names[3]); num_sub = sscanf(config_string,"%79s %79s %79s %79s", names[0], names[1], names[2], names[3]);
pr_info ("port %d : %d subchannels\n",port, num_sub);
for (sub_chn = 0; sub_chn < num_sub; sub_chn++){ for (sub_chn = 0; sub_chn < num_sub; sub_chn++){
pr_info ("Setting sensor %d:%d '%s' (0x%x)\n",port, sub_chn, names[sub_chn], get_code_by_name(names[sub_chn], DETECT_SENSOR));
set_detected_sensor_code(port, sub_chn, get_code_by_name(names[sub_chn], DETECT_SENSOR)); set_detected_sensor_code(port, sub_chn, get_code_by_name(names[sub_chn], DETECT_SENSOR));
} }
} }
} }
} }
}
...@@ -402,17 +408,18 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev) ...@@ -402,17 +408,18 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
// pSensorPortConfig = sensorPortConfig; // pSensorPortConfig = sensorPortConfig;
elphel393_detect_sensors_sysfs_register(pdev); elphel393_detect_sensors_sysfs_register(pdev);
pr_info ("Registered sysfs for detect_sensors");
match = of_match_device(elphel393_detect_sensors_of_match, dev); match = of_match_device(elphel393_detect_sensors_of_match, dev);
if (!match) if (!match) {
pr_err("Detect sensors ERROR: No device tree for '%s' node found\n",elphel393_detect_sensors_of_match[0].compatible); pr_err("Detect sensors ERROR: No device tree for '%s' node found\n",elphel393_detect_sensors_of_match[0].compatible);
return -EINVAL; return -EINVAL;
}
detect_sensors_init_of(pdev); detect_sensors_init_of(pdev);
// dev_dbg(dev, "Registering character device with name "DETECT_SENSORS_DRIVER_NAME); // dev_dbg(dev, "Registering character device with name "DEV393_NAME(DEV393_DETECT_SENSORS));
// res = register_chrdev(DETECT_SENSORS_MAJOR, DETECT_SENSORS_DRIVER_NAME, &detect_sensors_fops); // res = register_chrdev(DETECT_SENSORS_MAJOR, DEV393_NAME(DEV393_DETECT_SENSORS), &detect_sensors_fops);
// if(res < 0) { // if(res < 0) {
// dev_err(dev, "\nlogger_init: couldn't get a major number %d.\n ",DETECT_SENSORS_MAJOR); // dev_err(dev, "\nlogger_init: couldn't get a major number %d.\n ",DETECT_SENSORS_MAJOR);
// return res; // return res;
...@@ -426,7 +433,7 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev) ...@@ -426,7 +433,7 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
static int detect_sensors_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure static int detect_sensors_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure
///< @return always 0 ///< @return always 0
{ {
// unregister_chrdev(DETECT_SENSORS_MAJOR, DETECT_SENSORS_DRIVER_NAME); // unregister_chrdev(DETECT_SENSORS_MAJOR, DEV393_NAME(DEV393_DETECT_SENSORS));
return 0; return 0;
} }
...@@ -442,7 +449,7 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev) ...@@ -442,7 +449,7 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
.probe = detect_sensors_probe, .probe = detect_sensors_probe,
.remove = detect_sensors_remove, .remove = detect_sensors_remove,
.driver = { .driver = {
.name = DETECT_SENSORS_DRIVER_NAME, .name = DEV393_NAME(DEV393_DETECT_SENSORS),
.of_match_table = elphel393_detect_sensors_of_match, .of_match_table = elphel393_detect_sensors_of_match,
}, },
}; };
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h> #include <uapi/elphel/exifa.h>
#include <uapi/elphel/x393_devices.h>
//#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr //#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr
// //
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#define X3X3_EXIF_DRIVER_NAME "Elphel (R) model 353 Exif device driver" #define X3X3_EXIF_DRIVER_DESCRIPTION "Elphel (R) model 393 Exif device driver"
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
//#define MAX_EXIF_FIELDS 256 // number of Exif tags in the header //#define MAX_EXIF_FIELDS 256 // number of Exif tags in the header
...@@ -125,17 +125,17 @@ ssize_t minor_file_size(int minor) { //return current file size for different mi ...@@ -125,17 +125,17 @@ ssize_t minor_file_size(int minor) { //return current file size for different mi
switch (minor) { switch (minor) {
case X3X3_EXIF_TEMPLATE: case X3X3_EXIF_TEMPLATE:
return exif_template_size; return exif_template_size;
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
sensor_port = minor - X3X3_EXIF_EXIF_CHN_0; sensor_port = minor - DEV393_MINOR(DEV393_EXIF0);
return aexif_enabled[sensor_port]? (exif_template_size * (MAX_EXIF_FRAMES+1)):0; return aexif_enabled[sensor_port]? (exif_template_size * (MAX_EXIF_FRAMES+1)):0;
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
sensor_port = minor - X3X3_EXIF_META_CHN_0; sensor_port = minor - DEV393_MINOR(DEV393_EXIF_META0);
return aexif_meta_size[sensor_port]; return aexif_meta_size[sensor_port];
case X3X3_EXIF_METADIR: case X3X3_EXIF_METADIR:
return exif_fields * sizeof(struct exif_dir_table_t); return exif_fields * sizeof(struct exif_dir_table_t);
...@@ -148,15 +148,15 @@ ssize_t minor_max_size(int minor) { //return max file size for different minors ...@@ -148,15 +148,15 @@ ssize_t minor_max_size(int minor) { //return max file size for different minors
switch (minor) { switch (minor) {
case X3X3_EXIF_TEMPLATE: case X3X3_EXIF_TEMPLATE:
return MAX_EXIF_SIZE; return MAX_EXIF_SIZE;
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
return MAX_EXIF_SIZE * (MAX_EXIF_FRAMES+1); return MAX_EXIF_SIZE * (MAX_EXIF_FRAMES+1);
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
return MAX_EXIF_SIZE; return MAX_EXIF_SIZE;
case X3X3_EXIF_METADIR: case X3X3_EXIF_METADIR:
return MAX_EXIF_FIELDS * sizeof(struct exif_dir_table_t); return MAX_EXIF_FIELDS * sizeof(struct exif_dir_table_t);
...@@ -430,14 +430,14 @@ static int exif_open(struct inode *inode, struct file *filp) { ...@@ -430,14 +430,14 @@ static int exif_open(struct inode *inode, struct file *filp) {
int p = MINOR(inode->i_rdev); int p = MINOR(inode->i_rdev);
int * pd= (int *) &(filp->private_data); int * pd= (int *) &(filp->private_data);
switch (p) { switch (p) {
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
case X3X3_EXIF_TEMPLATE: case X3X3_EXIF_TEMPLATE:
case X3X3_EXIF_METADIR: case X3X3_EXIF_METADIR:
case X3X3_EXIF_TIME: case X3X3_EXIF_TIME:
...@@ -457,15 +457,15 @@ static int exif_release(struct inode *inode, struct file *filp){ ...@@ -457,15 +457,15 @@ static int exif_release(struct inode *inode, struct file *filp){
int p = MINOR(inode->i_rdev); int p = MINOR(inode->i_rdev);
int * pd= (int *) &(filp->private_data); int * pd= (int *) &(filp->private_data);
switch (p) { switch (p) {
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
break; break;
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
break; break;
case X3X3_EXIF_TEMPLATE: case X3X3_EXIF_TEMPLATE:
break; break;
...@@ -521,11 +521,11 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) { ...@@ -521,11 +521,11 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) {
default:return -EINVAL; default:return -EINVAL;
} }
break; break;
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
// sensor_port = p - X3X3_EXIF_EXIF_CHN_0; // sensor_port = p - DEV393_MINOR(DEV393_EXIF0);
if (offset > MAX_EXIF_FRAMES) return -EOVERFLOW; //larger than buffer if (offset > MAX_EXIF_FRAMES) return -EOVERFLOW; //larger than buffer
// file->f_pos=exif_meta_size * offset; // file->f_pos=exif_meta_size * offset;
file->f_pos=exif_template_size * offset; file->f_pos=exif_template_size * offset;
...@@ -535,10 +535,10 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) { ...@@ -535,10 +535,10 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) {
if (fp < 0) return -EOVERFLOW; // tag is not in the directory if (fp < 0) return -EOVERFLOW; // tag is not in the directory
file->f_pos=fp; file->f_pos=fp;
break; break;
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
file->f_pos=offset*sizeof(struct exif_dir_table_t); file->f_pos=offset*sizeof(struct exif_dir_table_t);
break; break;
case X3X3_EXIF_TIME: case X3X3_EXIF_TIME:
...@@ -609,11 +609,11 @@ static ssize_t exif_write (struct file * file, const char * buf, size_t coun ...@@ -609,11 +609,11 @@ static ssize_t exif_write (struct file * file, const char * buf, size_t coun
cp= (char *) &exif_time; cp= (char *) &exif_time;
if (copy_from_user(&cp[*off], buf, count)) return -EFAULT; if (copy_from_user(&cp[*off], buf, count)) return -EFAULT;
break; break;
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
sensor_port = p - X3X3_EXIF_META_CHN_0; sensor_port = p - DEV393_MINOR(DEV393_EXIF_META0);
if (copy_from_user(tmp, buf, count)) return -EFAULT; if (copy_from_user(tmp, buf, count)) return -EFAULT;
local_irq_save(flags); local_irq_save(flags);
//local_irq_disable(); //local_irq_disable();
...@@ -625,10 +625,10 @@ static ssize_t exif_write (struct file * file, const char * buf, size_t coun ...@@ -625,10 +625,10 @@ static ssize_t exif_write (struct file * file, const char * buf, size_t coun
count=0; count=0;
} }
break; break;
case X3X3_EXIF_EXIF_CHN_0: case DEV393_MINOR(DEV393_EXIF0):
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
return -EINVAL; // no writing - read only return -EINVAL; // no writing - read only
break; break;
default:return -EINVAL; default:return -EINVAL;
...@@ -673,19 +673,19 @@ static ssize_t exif_read (struct file * file, char * buf, size_t count, lof ...@@ -673,19 +673,19 @@ static ssize_t exif_read (struct file * file, char * buf, size_t count, lof
cp= (char *) &exif_time; cp= (char *) &exif_time;
if (copy_to_user(buf, &cp[*off], count)) return -EFAULT; if (copy_to_user(buf, &cp[*off], count)) return -EFAULT;
break; break;
case X3X3_EXIF_META_CHN_0: case DEV393_MINOR(DEV393_EXIF_META0):
case X3X3_EXIF_META_CHN_1: case DEV393_MINOR(DEV393_EXIF_META1):
case X3X3_EXIF_META_CHN_2: case DEV393_MINOR(DEV393_EXIF_META2):
case X3X3_EXIF_META_CHN_3: case DEV393_MINOR(DEV393_EXIF_META3):
sensor_port = p - X3X3_EXIF_META_CHN_0; sensor_port = p - DEV393_MINOR(DEV393_EXIF_META0);
if (!aexif_enabled[sensor_port]) return 0; if (!aexif_enabled[sensor_port]) return 0;
if (copy_to_user(buf, &ameta_buffer[sensor_port][*off], count)) return -EFAULT; if (copy_to_user(buf, &ameta_buffer[sensor_port][*off], count)) return -EFAULT;
break; break;
case X3X3_EXIF_EXIF_CHN_0:// generates exif data by merging exif_template with the selected meta_buffer page case DEV393_MINOR(DEV393_EXIF0):// generates exif data by merging exif_template with the selected meta_buffer page
case X3X3_EXIF_EXIF_CHN_1: case DEV393_MINOR(DEV393_EXIF1):
case X3X3_EXIF_EXIF_CHN_2: case DEV393_MINOR(DEV393_EXIF2):
case X3X3_EXIF_EXIF_CHN_3: case DEV393_MINOR(DEV393_EXIF3):
sensor_port = p - X3X3_EXIF_EXIF_CHN_0; sensor_port = p - DEV393_MINOR(DEV393_EXIF0);
//will truncate by the end of current page //will truncate by the end of current page
if (!aexif_enabled[sensor_port]) return 0; if (!aexif_enabled[sensor_port]) return 0;
i=((int) *off) / exif_template_size; i=((int) *off) / exif_template_size;
...@@ -716,16 +716,16 @@ static ssize_t exif_read (struct file * file, char * buf, size_t count, lof ...@@ -716,16 +716,16 @@ static ssize_t exif_read (struct file * file, char * buf, size_t count, lof
static int __init exif_init(void) { static int __init exif_init(void) {
int res; int res;
res = register_chrdev(X3X3_EXIF_MAJOR, "Exif", &exif_fops); res = register_chrdev(DEV393_MAJOR(DEV393_EXIF0), "Exif", &exif_fops);
if(res < 0) { if(res < 0) {
printk(KERN_ERR "\nexif_init: couldn't get a major number %d.\n",X3X3_EXIF_MAJOR); printk(KERN_ERR "\nexif_init: couldn't get a major number %d.\n",DEV393_MAJOR(DEV393_EXIF0));
return res; return res;
} }
printk(X3X3_EXIF_DRIVER_NAME" - %d\n",X3X3_EXIF_MAJOR); printk(DEV393_NAME(DEV393_EXIF0)" - %d\n",DEV393_MAJOR(DEV393_EXIF0));
return 0; return 0;
} }
module_init(exif_init); module_init(exif_init);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
MODULE_DESCRIPTION(X3X3_EXIF_DRIVER_NAME); MODULE_DESCRIPTION(X3X3_EXIF_DRIVER_DESCRIPTION);
This diff is collapsed.
...@@ -47,9 +47,10 @@ ...@@ -47,9 +47,10 @@
//#include <asm/delay.h> //#include <asm/delay.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h> #include <uapi/elphel/exifa.h>
#include <uapi/elphel/x393_devices.h>
//#include "fpgactrl.h" // defines port_csp0_adsensor_common.hdr, port_csp4_addr //#include "fpgactrl.h" // defines port_csp0_adsensor_common.hdr, port_csp4_addr
//#include "cc3x3.h" //#include "cc3x3.h"
//#include "x3x3.h" // hardware definitions //#include "x3x3.h" // hardware definitions
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
/** /**
* driver name to display * driver name to display
*/ */
#define FRAMEPARS_DRIVER_NAME "Elphel (R) Model 393 Frame Parameters device driver" #define FRAMEPARS_DRIVER_DESCRIPTION "Elphel (R) Model 393 Frame Parameters device driver"
/* 393: sFrameParsAll is an array of 4per-port structures */ /* 393: sFrameParsAll is an array of 4per-port structures */
static struct framepars_all_t sFrameParsAll[SENSOR_PORTS] __attribute__ ((aligned(PAGE_SIZE))); ///< Sensor Parameters, currently 16 pages all and 2048 pages some, static struct static struct framepars_all_t sFrameParsAll[SENSOR_PORTS] __attribute__ ((aligned(PAGE_SIZE))); ///< Sensor Parameters, currently 16 pages all and 2048 pages some, static struct
...@@ -1067,10 +1068,10 @@ int framepars_open(struct inode *inode, struct file *filp) ...@@ -1067,10 +1068,10 @@ int framepars_open(struct inode *inode, struct file *filp)
privData->minor = MINOR(inode->i_rdev); privData->minor = MINOR(inode->i_rdev);
MDF1(printk(": minor=0x%x\n", privData->minor)); MDF1(printk(": minor=0x%x\n", privData->minor));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_FRAMEPARS_CHN_0: case DEV393_MINOR(DEV393_FRAMEPARS0):
case CMOSCAM_MINOR_FRAMEPARS_CHN_1: case DEV393_MINOR(DEV393_FRAMEPARS1):
case CMOSCAM_MINOR_FRAMEPARS_CHN_2: case DEV393_MINOR(DEV393_FRAMEPARS2):
case CMOSCAM_MINOR_FRAMEPARS_CHN_3: case DEV393_MINOR(DEV393_FRAMEPARS3):
inode->i_size = 0; //or return 8 - number of frame pages? inode->i_size = 0; //or return 8 - number of frame pages?
return 0; return 0;
default: default:
...@@ -1093,10 +1094,10 @@ int framepars_release(struct inode *inode, struct file *filp) ...@@ -1093,10 +1094,10 @@ int framepars_release(struct inode *inode, struct file *filp)
MDF1(printk(": minor=0x%x\n", p)); MDF1(printk(": minor=0x%x\n", p));
switch ( p ) { switch ( p ) {
case CMOSCAM_MINOR_FRAMEPARS_CHN_0: case DEV393_MINOR(DEV393_FRAMEPARS0):
case CMOSCAM_MINOR_FRAMEPARS_CHN_1: case DEV393_MINOR(DEV393_FRAMEPARS1):
case CMOSCAM_MINOR_FRAMEPARS_CHN_2: case DEV393_MINOR(DEV393_FRAMEPARS2):
case CMOSCAM_MINOR_FRAMEPARS_CHN_3: case DEV393_MINOR(DEV393_FRAMEPARS3):
break; break;
default: default:
return -EINVAL; //! do not need to free anything - "wrong number" return -EINVAL; //! do not need to free anything - "wrong number"
...@@ -1122,7 +1123,7 @@ loff_t framepars_lseek(struct file * file, loff_t offset, int orig) ...@@ -1122,7 +1123,7 @@ loff_t framepars_lseek(struct file * file, loff_t offset, int orig)
{ {
unsigned long target_frame; unsigned long target_frame;
struct framepars_pd * privData = (struct framepars_pd*) file -> private_data; struct framepars_pd * privData = (struct framepars_pd*) file -> private_data;
int sensor_port = privData -> minor - CMOSCAM_MINOR_FRAMEPARS_CHN_0; int sensor_port = privData -> minor - DEV393_MINOR(DEV393_FRAMEPARS0);
// struct framepars_t *framepars = aframepars[sensor_port]; // struct framepars_t *framepars = aframepars[sensor_port];
MDF1(printk(" offset=0x%x, orig=0x%x, sensor_port = %d\n", (int)offset, (int)orig, sensor_port)); MDF1(printk(" offset=0x%x, orig=0x%x, sensor_port = %d\n", (int)offset, (int)orig, sensor_port));
switch (orig) { switch (orig) {
...@@ -1223,7 +1224,7 @@ ssize_t framepars_write(struct file * file, const char * buf, size_t count, loff ...@@ -1223,7 +1224,7 @@ ssize_t framepars_write(struct file * file, const char * buf, size_t count, loff
struct frameparspair_t pars_static[256]; // will be sufficient for most calls struct frameparspair_t pars_static[256]; // will be sufficient for most calls
struct frameparspair_t * pars = pars_static; struct frameparspair_t * pars = pars_static;
struct framepars_pd * privData = (struct framepars_pd*)file->private_data; struct framepars_pd * privData = (struct framepars_pd*)file->private_data;
int sensor_port = privData -> minor - CMOSCAM_MINOR_FRAMEPARS_CHN_0; int sensor_port = privData -> minor - DEV393_MINOR(DEV393_FRAMEPARS0);
// struct framepars_t *framepars = aframepars[sensor_port]; // struct framepars_t *framepars = aframepars[sensor_port];
unsigned long frame = *off; // ************* NOTE: Never use file->f_pos in write() and read() !!! unsigned long frame = *off; // ************* NOTE: Never use file->f_pos in write() and read() !!!
int latency = -1; int latency = -1;
...@@ -1234,7 +1235,10 @@ ssize_t framepars_write(struct file * file, const char * buf, size_t count, loff ...@@ -1234,7 +1235,10 @@ ssize_t framepars_write(struct file * file, const char * buf, size_t count, loff
MDF1(printk(": file->f_pos=0x%x, *off=0x%x, count=0x%x\n", (int)file->f_pos, (int)*off, (int)count)); MDF1(printk(": file->f_pos=0x%x, *off=0x%x, count=0x%x\n", (int)file->f_pos, (int)*off, (int)count));
count &= ~7; // sizeof (struct frameparspair_t)==8 count &= ~7; // sizeof (struct frameparspair_t)==8
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_FRAMEPARS: case DEV393_MINOR(DEV393_FRAMEPARS0):
case DEV393_MINOR(DEV393_FRAMEPARS1):
case DEV393_MINOR(DEV393_FRAMEPARS2):
case DEV393_MINOR(DEV393_FRAMEPARS3):
if (count > sizeof(pars_static)) // only allocate if static is not enough if (count > sizeof(pars_static)) // only allocate if static is not enough
pars = (struct frameparspair_t*)kmalloc(count, GFP_KERNEL); pars = (struct frameparspair_t*)kmalloc(count, GFP_KERNEL);
if (!pars) return -ENOMEM; if (!pars) return -ENOMEM;
...@@ -1296,11 +1300,14 @@ int framepars_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1296,11 +1300,14 @@ int framepars_mmap(struct file *file, struct vm_area_struct *vma)
{ {
int result; int result;
struct framepars_pd * privData = (struct framepars_pd*)file->private_data; struct framepars_pd * privData = (struct framepars_pd*)file->private_data;
int sensor_port = privData -> minor - CMOSCAM_MINOR_FRAMEPARS_CHN_0; int sensor_port = privData -> minor - DEV393_MINOR(DEV393_FRAMEPARS0);
MDF1(printk(": minor=0x%x\n", privData->minor)); MDF1(printk(": minor=0x%x\n", privData->minor));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_FRAMEPARS: case DEV393_MINOR(DEV393_FRAMEPARS0):
case DEV393_MINOR(DEV393_FRAMEPARS1):
case DEV393_MINOR(DEV393_FRAMEPARS2):
case DEV393_MINOR(DEV393_FRAMEPARS3):
result = remap_pfn_range(vma, result = remap_pfn_range(vma,
vma->vm_start, vma->vm_start,
((unsigned long)virt_to_phys(&aframeparsall[sensor_port])) >> PAGE_SHIFT, // Should be page-aligned ((unsigned long)virt_to_phys(&aframeparsall[sensor_port])) >> PAGE_SHIFT, // Should be page-aligned
...@@ -1331,22 +1338,22 @@ int framepars_init(struct platform_device *pdev) ...@@ -1331,22 +1338,22 @@ int framepars_init(struct platform_device *pdev)
initMultiPars(sensor_port); // just clear - needs to be called again when sensor is recognized initMultiPars(sensor_port); // just clear - needs to be called again when sensor is recognized
} }
frameParsInitialized = 0; frameParsInitialized = 0;
res = register_chrdev(FRAMEPARS_MAJOR, "framepars_operations", &framepars_fops); res = register_chrdev(DEV393_MAJOR(DEV393_FRAMEPARS0), DEV393_NAME(DEV393_FRAMEPARS0), &framepars_fops);
if (res < 0) { if (res < 0) {
printk(KERN_ERR "\nframepars_init: couldn't get a major number %d.\n", FRAMEPARS_MAJOR); printk(KERN_ERR "\nframepars_init: couldn't get a major number %d.\n", DEV393_MAJOR(DEV393_FRAMEPARS0));
return res; return res;
} }
for (sensor_port = 0; sensor_port < SENSOR_PORTS; sensor_port++) { for (sensor_port = 0; sensor_port < SENSOR_PORTS; sensor_port++) {
init_waitqueue_head(&aframepars_wait_queue[sensor_port]); init_waitqueue_head(&aframepars_wait_queue[sensor_port]);
} }
dev_info(dev, "registered MAJOR: %d\n", FRAMEPARS_MAJOR); dev_info(dev, "registered MAJOR: %d\n", DEV393_MAJOR(DEV393_FRAMEPARS0));
return 0; return 0;
} }
int framepars_remove(struct platform_device *pdev) int framepars_remove(struct platform_device *pdev)
{ {
unregister_chrdev(FRAMEPARS_MAJOR, "framepars_operations"); unregister_chrdev(DEV393_MAJOR(DEV393_FRAMEPARS0), DEV393_NAME(DEV393_FRAMEPARS0));
return 0; return 0;
} }
...@@ -1361,7 +1368,7 @@ int framepars_remove(struct platform_device *pdev) ...@@ -1361,7 +1368,7 @@ int framepars_remove(struct platform_device *pdev)
// .probe = framepars_init, // .probe = framepars_init,
// .remove = framepars_remove, // .remove = framepars_remove,
// .driver = { // .driver = {
// .name = FRAMEPARS_DRIVER_NAME, // .name = DEV393_NAME(DEV393_FRAMEPARS0),
// .of_match_table = elphel393_framepars_of_match, // .of_match_table = elphel393_framepars_of_match,
// }, // },
//}; //};
...@@ -1370,4 +1377,5 @@ int framepars_remove(struct platform_device *pdev) ...@@ -1370,4 +1377,5 @@ int framepars_remove(struct platform_device *pdev)
// //
//MODULE_LICENSE("GPL"); //MODULE_LICENSE("GPL");
//MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); //MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
//MODULE_DESCRIPTION(X3X3_FRAMEPARS_DRIVER_NAME); //MODULE_DESCRIPTION(FRAMEPARS_DRIVER_DESCRIPTION);
//
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h> #include <uapi/elphel/exifa.h>
//#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr //#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
/** Combine color, sensor port and sub-channel into a single index /** Combine color, sensor port and sub-channel into a single index
* It is still possible to use "color" parameter in the range of 0..63 with port and channel set to 0 */ * It is still possible to use "color" parameter in the range of 0..63 with port and channel set to 0 */
#define PORT_CHN_COLOR(color,port,chn) (((color) & 0x3f) | ((((port) & 3 ) << 4)) | ((((chn) & 3 ) << 2))) #define PORT_CHN_COLOR(color,port,chn) (((color) & 0x3f) | ((((port) & 3 ) << 4)) | ((((chn) & 3 ) << 2)))
#define X3X3_GAMMAS_DRIVER_NAME "Elphel (R) Model 353 Gamma Tables device driver" #define X3X3_GAMMAS_DRIVER_DESCRIPTION "Elphel (R) Model 353 Gamma Tables device driver"
/** /**
* @brief number of different non-scaled tables in cache when it starts to overwrite non-scaled tables rather than scaled * @brief number of different non-scaled tables in cache when it starts to overwrite non-scaled tables rather than scaled
* \n TODO: use P_*? * \n TODO: use P_*?
...@@ -750,7 +750,7 @@ int gammas_open(struct inode *inode, struct file *file) { ...@@ -750,7 +750,7 @@ int gammas_open(struct inode *inode, struct file *file) {
privData-> minor=MINOR(inode->i_rdev); privData-> minor=MINOR(inode->i_rdev);
MDF10(printk("gammas_open, minor=0x%x\n",privData-> minor)); MDF10(printk("gammas_open, minor=0x%x\n",privData-> minor));
switch (privData-> minor) { switch (privData-> minor) {
case CMOSCAM_MINOR_GAMMAS : case DEV393_MINOR(DEV393_GAMMA) :
inode->i_size = GAMMA_FILE_SIZE; inode->i_size = GAMMA_FILE_SIZE;
privData-> scale= 0; privData-> scale= 0;
privData-> hash16=0; privData-> hash16=0;
...@@ -775,7 +775,7 @@ int gammas_release(struct inode *inode, struct file *file) { ...@@ -775,7 +775,7 @@ int gammas_release(struct inode *inode, struct file *file) {
int p = MINOR(inode->i_rdev); int p = MINOR(inode->i_rdev);
MDF10(printk("gammas_release, minor=0x%x\n",p)); MDF10(printk("gammas_release, minor=0x%x\n",p));
switch ( p ) { switch ( p ) {
case CMOSCAM_MINOR_GAMMAS : case DEV393_MINOR(DEV393_GAMMA) :
break; break;
default: default:
return -EINVAL; //! do not need to free anything - "wrong number" return -EINVAL; //! do not need to free anything - "wrong number"
...@@ -804,7 +804,7 @@ loff_t gammas_lseek (struct file * file, loff_t offset, int orig) { ...@@ -804,7 +804,7 @@ loff_t gammas_lseek (struct file * file, loff_t offset, int orig) {
struct gammas_pd * privData = (struct gammas_pd *) file->private_data; struct gammas_pd * privData = (struct gammas_pd *) file->private_data;
MDF10(printk("offset=0x%x, orig=0x%x, file->f_pos=0x%x\n",(int) offset, (int) orig, (int) file->f_pos)); MDF10(printk("offset=0x%x, orig=0x%x, file->f_pos=0x%x\n",(int) offset, (int) orig, (int) file->f_pos));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_GAMMAS : case DEV393_MINOR(DEV393_GAMMA) :
switch(orig) { switch(orig) {
case SEEK_SET: case SEEK_SET:
file->f_pos = offset; file->f_pos = offset;
...@@ -872,7 +872,7 @@ ssize_t gammas_write(struct file * file, ///< this file structure ...@@ -872,7 +872,7 @@ ssize_t gammas_write(struct file * file, ///< this file structure
unsigned short * gamma= data.gamma; unsigned short * gamma= data.gamma;
MDF10(printk(" file->f_pos=0x%x, *off=0x%x\n", (int) file->f_pos, (int) *off)); MDF10(printk(" file->f_pos=0x%x, *off=0x%x\n", (int) file->f_pos, (int) *off));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_GAMMAS : case DEV393_MINOR(DEV393_GAMMA) :
if (count>sizeof (data)) count = sizeof (data); if (count>sizeof (data)) count = sizeof (data);
if(count) { if(count) {
if(copy_from_user((char *) &data, buf, count)) return -EFAULT; if(copy_from_user((char *) &data, buf, count)) return -EFAULT;
...@@ -903,7 +903,7 @@ int gammas_mmap (struct file *file, struct vm_area_struct *vma) { ...@@ -903,7 +903,7 @@ int gammas_mmap (struct file *file, struct vm_area_struct *vma) {
struct gammas_pd * privData = (struct gammas_pd *) file->private_data; struct gammas_pd * privData = (struct gammas_pd *) file->private_data;
MDF10(printk("gammas_all_mmap, minor=0x%x\n",privData-> minor)); MDF10(printk("gammas_all_mmap, minor=0x%x\n",privData-> minor));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_GAMMAS : case DEV393_MINOR(DEV393_GAMMA) :
result=remap_pfn_range(vma, result=remap_pfn_range(vma,
vma->vm_start, vma->vm_start,
((unsigned long) virt_to_phys(gammas_p)) >> PAGE_SHIFT, // Should be page-aligned ((unsigned long) virt_to_phys(gammas_p)) >> PAGE_SHIFT, // Should be page-aligned
...@@ -922,19 +922,19 @@ int gammas_mmap (struct file *file, struct vm_area_struct *vma) { ...@@ -922,19 +922,19 @@ int gammas_mmap (struct file *file, struct vm_area_struct *vma) {
*/ */
static int __init gammas_init(void) { static int __init gammas_init(void) {
int res; int res;
printk ("Starting "X3X3_GAMMAS_DRIVER_NAME" - %d \n",GAMMAS_MAJOR); printk ("Starting "DEV393_NAME(DEV393_GAMMA)" - %d \n",DEV393_MAJOR(DEV393_GAMMA));
init_gammas(); init_gammas();
MDF10(printk("set_gamma_table (0, GAMMA_SCLALE_1, NULL, 0, 0)\n"); udelay (ELPHEL_DEBUG_DELAY)); MDF10(printk("set_gamma_table (0, GAMMA_SCLALE_1, NULL, 0, 0)\n"); udelay (ELPHEL_DEBUG_DELAY));
set_gamma_table (0, GAMMA_SCLALE_1, NULL, 0, 0, 0, 0); // maybe not needed to put linear to cache - it can be calculated as soon FPGA will be tried to be programmed with set_gamma_table (0, GAMMA_SCLALE_1, NULL, 0, 0, 0, 0); // maybe not needed to put linear to cache - it can be calculated as soon FPGA will be tried to be programmed with
// hash16==0 // hash16==0
res = register_chrdev(GAMMAS_MAJOR, "gamma_tables_operations", &gammas_fops); res = register_chrdev(DEV393_MAJOR(DEV393_GAMMA), DEV393_NAME(DEV393_GAMMA), &gammas_fops);
if(res < 0) { if(res < 0) {
printk(KERN_ERR "\ngammas_init: couldn't get a major number %d.\n",GAMMAS_MAJOR); printk(KERN_ERR "\ngammas_init: couldn't get a major number %d.\n",DEV393_MAJOR(DEV393_GAMMA));
return res; return res;
} }
// init_waitqueue_head(&gammas_wait_queue); // init_waitqueue_head(&gammas_wait_queue);
printk(X3X3_GAMMAS_DRIVER_NAME" - %d \n",GAMMAS_MAJOR); printk(DEV393_NAME(DEV393_GAMMA)" - %d \n",DEV393_MAJOR(DEV393_GAMMA));
return 0; return 0;
} }
...@@ -942,7 +942,7 @@ static int __init gammas_init(void) { ...@@ -942,7 +942,7 @@ static int __init gammas_init(void) {
module_init(gammas_init); module_init(gammas_init);
MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPLv3.0");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
MODULE_DESCRIPTION(X3X3_GAMMAS_DRIVER_NAME); MODULE_DESCRIPTION(X3X3_GAMMAS_DRIVER_DESCRIPTION);
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
#include <linux/dma-direction.h> #include <linux/dma-direction.h>
// ##include <asm/dma-mapping.h> // ##include <asm/dma-mapping.h>
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h> #include <uapi/elphel/exifa.h>
//#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr //#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
u32 (*fpga_hist_data)[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data u32 (*fpga_hist_data)[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data
dma_addr_t fpga_hist_phys; // physical address of the start of the received histogram data dma_addr_t fpga_hist_phys; // physical address of the start of the received histogram data
#define X3X3_HISTOGRAMS_DRIVER_NAME "Elphel (R) Model 353 Histograms device driver" #define X3X3_HISTOGRAMS_DRIVER_DESCRIPTION "Elphel (R) Model 353 Histograms device driver"
/** for each port and possible sensor subchannel provides index in combine histogram data */ /** for each port and possible sensor subchannel provides index in combine histogram data */
int histograms_map[SENSOR_PORTS][MAX_SENSORS]; int histograms_map[SENSOR_PORTS][MAX_SENSORS];
...@@ -463,7 +463,7 @@ int histograms_open(struct inode *inode, ///< inode ...@@ -463,7 +463,7 @@ int histograms_open(struct inode *inode, ///< inode
privData-> minor=MINOR(inode->i_rdev); privData-> minor=MINOR(inode->i_rdev);
MDF21(printk("minor=0x%x\n",privData-> minor)); MDF21(printk("minor=0x%x\n",privData-> minor));
switch (privData-> minor) { switch (privData-> minor) {
case CMOSCAM_MINOR_HISTOGRAMS : case DEV393_MINOR(DEV393_HISTOGRAM) :
inode->i_size = HISTOGRAMS_FILE_SIZE; inode->i_size = HISTOGRAMS_FILE_SIZE;
privData->frame=0xffffffff; privData->frame=0xffffffff;
privData->frame_index=-1; privData->frame_index=-1;
...@@ -490,7 +490,7 @@ int histograms_release (struct inode *inode, ///< inode ...@@ -490,7 +490,7 @@ int histograms_release (struct inode *inode, ///< inode
int p = MINOR(inode->i_rdev); int p = MINOR(inode->i_rdev);
MDF21(printk("minor=0x%x\n",p)); MDF21(printk("minor=0x%x\n",p));
switch ( p ) { switch ( p ) {
case CMOSCAM_MINOR_HISTOGRAMS : case DEV393_MINOR(DEV393_HISTOGRAM) :
break; break;
default: default:
return -EINVAL; //! do not need to free anything - "wrong number" return -EINVAL; //! do not need to free anything - "wrong number"
...@@ -535,7 +535,7 @@ loff_t histograms_lseek (struct file * file, ...@@ -535,7 +535,7 @@ loff_t histograms_lseek (struct file * file,
MDF21(printk("offset=0x%x, orig=0x%x\n",(int) offset, (int) orig)); MDF21(printk("offset=0x%x, orig=0x%x\n",(int) offset, (int) orig));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_HISTOGRAMS : case DEV393_MINOR(DEV393_HISTOGRAM) :
switch(orig) { switch(orig) {
case SEEK_CUR: // ignore offset case SEEK_CUR: // ignore offset
offset+=(privData-> wait_mode)? offset+=(privData-> wait_mode)?
...@@ -655,7 +655,7 @@ int histograms_mmap (struct file *file, struct vm_area_struct *vma) { ...@@ -655,7 +655,7 @@ int histograms_mmap (struct file *file, struct vm_area_struct *vma) {
struct histograms_pd * privData = (struct histograms_pd *) file->private_data; struct histograms_pd * privData = (struct histograms_pd *) file->private_data;
MDF21(printk("minor=0x%x\n",privData-> minor)); MDF21(printk("minor=0x%x\n",privData-> minor));
switch (privData->minor) { switch (privData->minor) {
case CMOSCAM_MINOR_HISTOGRAMS : case DEV393_MINOR(DEV393_HISTOGRAM) :
result=remap_pfn_range(vma, result=remap_pfn_range(vma,
vma->vm_start, vma->vm_start,
((unsigned long) virt_to_phys(histograms_p)) >> PAGE_SHIFT, // Should be page-aligned ((unsigned long) virt_to_phys(histograms_p)) >> PAGE_SHIFT, // Should be page-aligned
...@@ -676,15 +676,15 @@ static int __init histograms_init(void) { ...@@ -676,15 +676,15 @@ static int __init histograms_init(void) {
int res; int res;
// init_histograms(); // Not now??? Need to have list of channels // init_histograms(); // Not now??? Need to have list of channels
// Do it later, from the user space // Do it later, from the user space
res = register_chrdev(HISTOGRAMS_MAJOR, "gamma_tables_operations", &histograms_fops); res = register_chrdev(DEV393_MAJOR(DEV393_HISTOGRAM), "gamma_tables_operations", &histograms_fops);
if(res < 0) { if(res < 0) {
printk(KERN_ERR "histograms_init: couldn't get a major number %d.\n",HISTOGRAMS_MAJOR); printk(KERN_ERR "histograms_init: couldn't get a major number %d.\n",DEV393_MAJOR(DEV393_HISTOGRAM));
return res; return res;
} }
// init_waitqueue_head(&histograms_wait_queue); // init_waitqueue_head(&histograms_wait_queue);
init_waitqueue_head(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y) init_waitqueue_head(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y)
init_waitqueue_head(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color) init_waitqueue_head(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color)
printk(X3X3_HISTOGRAMS_DRIVER_NAME"\r\n"); printk(DEV393_NAME(DEV393_HISTOGRAM)"\n");
return 0; return 0;
} }
...@@ -692,4 +692,4 @@ static int __init histograms_init(void) { ...@@ -692,4 +692,4 @@ static int __init histograms_init(void) {
module_init(histograms_init); module_init(histograms_init);
MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPLv3.0");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
MODULE_DESCRIPTION(X3X3_HISTOGRAMS_DRIVER_NAME); MODULE_DESCRIPTION(X3X3_HISTOGRAMS_DRIVER_DESCRIPTION);
...@@ -49,12 +49,13 @@ ...@@ -49,12 +49,13 @@
#include <linux/string.h> #include <linux/string.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/uaccess.h> // copy_*_user #include <asm/uaccess.h> // copy_*_user
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <elphel/elphel393-mem.h> #include <elphel/elphel393-mem.h>
#include "imu_log393.h" #include "imu_log393.h"
#include "x393.h" #include "x393.h"
#include "cci2c.h" #include "cci2c.h"
#include <uapi/elphel/x393_devices.h>
#if 0 #if 0
#define D(x) x #define D(x) x
...@@ -104,7 +105,7 @@ ...@@ -104,7 +105,7 @@
#endif #endif
#define RS232_RATE 19200 ///< RS232 bps #define RS232_RATE 19200 ///< RS232 bps
#define IMU_MODULE_DESCRIPTION "IMU logger for 10365 ext. board" #define IMU_MODULE_DESCRIPTION "IMU logger for 10365 ext. board"
#define LOGGER_DRIVER_NAME "imu_logger" //#define LOGGER_DRIVER_NAME "imu_logger"
#define IMU_MAXMINOR 10 #define IMU_MAXMINOR 10
#ifdef NC353 #ifdef NC353
...@@ -606,12 +607,12 @@ static int imu_open(struct inode *inode, struct file *filp) { ...@@ -606,12 +607,12 @@ static int imu_open(struct inode *inode, struct file *filp) {
D(printk("filp=%lx\r\n",(unsigned long)filp) ); D(printk("filp=%lx\r\n",(unsigned long)filp) );
switch ( p ) { switch ( p ) {
case LOGGER_CTL_MINOR: case DEV393_MINOR(DEV393_LOGGER_CTRL):
D1(printk(KERN_NOTICE "IMU_ctl_open\n")); D1(printk(KERN_NOTICE "IMU_ctl_open\n"));
inode->i_size=sizeof(wbuf); inode->i_size=sizeof(wbuf);
// nothing more here, after writing parameters should start imu (and dma), otherwise will use defaults on next open of /dev/imu // nothing more here, after writing parameters should start imu (and dma), otherwise will use defaults on next open of /dev/imu
break; break;
case LOGGER_MINOR : case DEV393_MINOR(DEV393_LOGGER) :
{ {
D1(printk(KERN_NOTICE "IMU_open\n")); D1(printk(KERN_NOTICE "IMU_open\n"));
inode->i_size=sizeof(wbuf); // only in write mode inode->i_size=sizeof(wbuf); // only in write mode
...@@ -668,8 +669,8 @@ static int imu_release(struct inode *inode, struct file *filp) { ...@@ -668,8 +669,8 @@ static int imu_release(struct inode *inode, struct file *filp) {
// int res=0; // int res=0;
int p = MINOR(inode->i_rdev); int p = MINOR(inode->i_rdev);
switch ( p ) { switch ( p ) {
case LOGGER_MINOR : case DEV393_MINOR(DEV393_LOGGER) :
case LOGGER_CTL_MINOR: case DEV393_MINOR(DEV393_LOGGER_CTRL):
printk(KERN_NOTICE "Closing IMU device, numBytesWritten=0x%llx, numBytesRead=0x%llx (only global pointer, does not include files opened in read mode)\n", numBytesWritten, numBytesRead); printk(KERN_NOTICE "Closing IMU device, numBytesWritten=0x%llx, numBytesRead=0x%llx (only global pointer, does not include files opened in read mode)\n", numBytesWritten, numBytesRead);
break; break;
default: return -EINVAL; default: return -EINVAL;
...@@ -687,8 +688,8 @@ static ssize_t imu_write(struct file * file, const char * buf, size_t count, lof ...@@ -687,8 +688,8 @@ static ssize_t imu_write(struct file * file, const char * buf, size_t count, lof
D(printk("imu_write: (int)file->private_data)= %x\r\n",((int)file->private_data))); D(printk("imu_write: (int)file->private_data)= %x\r\n",((int)file->private_data)));
// switch (((int *)file->private_data)[0]) { // switch (((int *)file->private_data)[0]) {
switch ((int) file->private_data) { switch ((int) file->private_data) {
case LOGGER_MINOR : case DEV393_MINOR(DEV393_LOGGER) :
case LOGGER_CTL_MINOR: case DEV393_MINOR(DEV393_LOGGER_CTRL):
if (!file->f_mode & FMODE_WRITE) { if (!file->f_mode & FMODE_WRITE) {
return -EINVAL; // readonly return -EINVAL; // readonly
} }
...@@ -722,8 +723,8 @@ static loff_t imu_lseek(struct file * file, loff_t offset, int orig) { ...@@ -722,8 +723,8 @@ static loff_t imu_lseek(struct file * file, loff_t offset, int orig) {
D(printk (" file=%x, offset=%llx (%d), orig=%x\r\n", (int) file, offset,(int) offset, (int) orig)); D(printk (" file=%x, offset=%llx (%d), orig=%x\r\n", (int) file, offset,(int) offset, (int) orig));
int p=(int)file->private_data; int p=(int)file->private_data;
switch (p) { switch (p) {
case LOGGER_MINOR: case DEV393_MINOR(DEV393_LOGGER):
case LOGGER_CTL_MINOR: case DEV393_MINOR(DEV393_LOGGER_CTRL):
switch (orig) { switch (orig) {
case SEEK_SET: case SEEK_SET:
file->f_pos = offset; file->f_pos = offset;
...@@ -783,7 +784,7 @@ static loff_t imu_lseek(struct file * file, loff_t offset, int orig) { ...@@ -783,7 +784,7 @@ static loff_t imu_lseek(struct file * file, loff_t offset, int orig) {
return (-EOVERFLOW); return (-EOVERFLOW);
} }
/** enable seeking beyond buffer - it now is absolute position in the data stream*/ /** enable seeking beyond buffer - it now is absolute position in the data stream*/
if ((p==LOGGER_CTL_MINOR) && (file->f_pos > sizeof(wbuf))) { if ((p==DEV393_MINOR(DEV393_LOGGER_CTRL)) && (file->f_pos > sizeof(wbuf))) {
printk(KERN_ERR "beyond end: minor=%d, file->f_pos=0x%llx\n", p, file->f_pos); printk(KERN_ERR "beyond end: minor=%d, file->f_pos=0x%llx\n", p, file->f_pos);
file->f_pos = sizeof(wbuf); file->f_pos = sizeof(wbuf);
return (-EOVERFLOW); return (-EOVERFLOW);
...@@ -811,7 +812,7 @@ static ssize_t imu_read(struct file * file, char * buf, size_t count, loff_t *of ...@@ -811,7 +812,7 @@ static ssize_t imu_read(struct file * file, char * buf, size_t count, loff_t *of
reg_bif_dma_r_ch1_stat ch1_stat; reg_bif_dma_r_ch1_stat ch1_stat;
#endif #endif
switch ((int)file->private_data) { switch ((int)file->private_data) {
case LOGGER_CTL_MINOR: case DEV393_MINOR(DEV393_LOGGER_CTRL):
// if (*off >= sizeof(wbuf)) return -EINVAL; // bigger than all // if (*off >= sizeof(wbuf)) return -EINVAL; // bigger than all
if (*off >= sizeof(wbuf)) return 0; // bigger than all if (*off >= sizeof(wbuf)) return 0; // bigger than all
if( (*off + count) > sizeof(wbuf)) { // truncate count if( (*off + count) > sizeof(wbuf)) { // truncate count
...@@ -826,7 +827,7 @@ static ssize_t imu_read(struct file * file, char * buf, size_t count, loff_t *of ...@@ -826,7 +827,7 @@ static ssize_t imu_read(struct file * file, char * buf, size_t count, loff_t *of
*off+=count; *off+=count;
return count; return count;
break; break;
case LOGGER_MINOR : case DEV393_MINOR(DEV393_LOGGER) :
#ifdef NC353 #ifdef NC353
updateNumBytesWritten(); updateNumBytesWritten();
#endif #endif
...@@ -944,13 +945,13 @@ static int logger_init(struct platform_device *pdev) ...@@ -944,13 +945,13 @@ static int logger_init(struct platform_device *pdev)
if (!match) if (!match)
return -EINVAL; return -EINVAL;
dev_dbg(dev, "Registering character device with name "LOGGER_DRIVER_NAME); dev_dbg(dev, "Registering character device with name "DEV393_NAME(DEV393_LOGGER));
res = register_chrdev(LOGGER_MAJOR, LOGGER_DRIVER_NAME, &imu_fops); res = register_chrdev(DEV393_MAJOR(DEV393_LOGGER), DEV393_NAME(DEV393_LOGGER), &imu_fops);
if(res < 0) { if(res < 0) {
dev_err(dev, "\nlogger_init: couldn't get a major number %d.\n ",LOGGER_MAJOR); dev_err(dev, "\nlogger_init: couldn't get a major number %d.\n ",DEV393_MAJOR(DEV393_LOGGER));
return res; return res;
} }
dev_info(dev,LOGGER_DRIVER_NAME"- %d\n",LOGGER_MAJOR); dev_info(dev,DEV393_NAME(DEV393_LOGGER)"- %d\n",DEV393_MAJOR(DEV393_LOGGER));
// Setup memory buffer from CMA // Setup memory buffer from CMA
logger_buffer = (u32 *) pElphel_buf->logger_vaddr; // must be page-aligned! logger_buffer = (u32 *) pElphel_buf->logger_vaddr; // must be page-aligned!
logger_size = pElphel_buf->logger_size << PAGE_SHIFT; logger_size = pElphel_buf->logger_size << PAGE_SHIFT;
...@@ -1236,7 +1237,7 @@ int x313_setDMA1Buffer(void) { ...@@ -1236,7 +1237,7 @@ int x313_setDMA1Buffer(void) {
static int logger_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure static int logger_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure
///< @return always 0 ///< @return always 0
{ {
unregister_chrdev(LOGGER_MAJOR, LOGGER_DRIVER_NAME); unregister_chrdev(DEV393_MAJOR(DEV393_LOGGER), DEV393_NAME(DEV393_LOGGER));
return 0; return 0;
} }
...@@ -1251,7 +1252,7 @@ static struct platform_driver elphel393_logger = { ...@@ -1251,7 +1252,7 @@ static struct platform_driver elphel393_logger = {
.probe = logger_init, .probe = logger_init,
.remove = logger_remove, .remove = logger_remove,
.driver = { .driver = {
.name = LOGGER_DRIVER_NAME, .name = DEV393_NAME(DEV393_LOGGER),
.of_match_table = elphel393_logger_of_match, .of_match_table = elphel393_logger_of_match,
}, },
}; };
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
//#include <asm/delay.h> //#include <asm/delay.h>
//#include <asm/uaccess.h> //#include <asm/uaccess.h>
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h>
#include <elphel/c313a.h> #include <elphel/c313a.h>
//#include <asm/elphel/fpgaconfa.h> //#include <asm/elphel/fpgaconfa.h>
#include <elphel/exifa.h> #include <elphel/exifa.h>
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
/** /**
* @brief driver name to display in log messages * @brief driver name to display in log messages
*/ */
#define IMAGEACQ_DRIVER_NAME "Elphel (R) Model 393 Image Acquisition device driver" #define IMAGEACQ_DRIVER_DESCRIPTION "Elphel (R) Model 393 Image Acquisition device driver"
/**@struct jpeg_ptr_t /**@struct jpeg_ptr_t
* @brief \e jpeg_ptr_t structure contains read and write pointers along with * @brief \e jpeg_ptr_t structure contains read and write pointers along with
...@@ -804,4 +804,4 @@ int image_acq_stop(struct platform_device *pdev) ...@@ -804,4 +804,4 @@ int image_acq_stop(struct platform_device *pdev)
//MODULE_LICENSE("GPL"); //MODULE_LICENSE("GPL");
//MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); //MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
//MODULE_DESCRIPTION(IMAGEACQ_DRIVER_NAME); //MODULE_DESCRIPTION(IMAGEACQ_DRIVER_DESCRIPTION);
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
#include <asm/outercache.h> #include <asm/outercache.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h> #include <uapi/elphel/exifa.h>
//#include <uapi/elphel/x393_devices.h>
#include "framepars.h" #include "framepars.h"
#include "sensor_common.h" #include "sensor_common.h"
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
#include <asm/delay.h> // just for usleep1000() #include <asm/delay.h> // just for usleep1000()
/** @brief Driver name to display in log messages.*/ /* Driver name to display in log messages.*/
#define IMAGEACQ_DRIVER_NAME "Elphel (R) Model 393 Image Acquisition device driver" //#define IMAGEACQ_DRIVER_DESCRIPTION "Elphel (R) Model 393 Image Acquisition device driver"
/** @brief The size in bytes of L2 cache invalidation area. This size must be aligned to cache line size. 16 kbytes seems to be good starting point.*/ /** @brief The size in bytes of L2 cache invalidation area. This size must be aligned to cache line size. 16 kbytes seems to be good starting point.*/
#define L2_INVAL_SIZE (32 * 1024) #define L2_INVAL_SIZE (32 * 1024)
...@@ -1031,4 +1031,4 @@ int legacy_i2c(int ports) ///< bitmask of the sensor ports to use ...@@ -1031,4 +1031,4 @@ int legacy_i2c(int ports) ///< bitmask of the sensor ports to use
//MODULE_LICENSE("GPL"); //MODULE_LICENSE("GPL");
//MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); //MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
//MODULE_DESCRIPTION(IMAGEACQ_DRIVER_NAME); //MODULE_DESCRIPTION(IMAGEACQ_DRIVER_DESCRIPTION);
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h> // just driver name
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "x393.h" #include "x393.h"
#include "sensor_i2c.h" #include "sensor_i2c.h"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#define SYSFS_READONLY 0444 #define SYSFS_READONLY 0444
#define SYSFS_WRITEONLY 0222 #define SYSFS_WRITEONLY 0222
#define DRV_NAME "elphel_sensor_i2c" //#define DRV_NAME "elphel_sensor_i2c"
struct x393_i2c_device_list { struct x393_i2c_device_list {
x393_i2c_device_t i2c_dev; x393_i2c_device_t i2c_dev;
...@@ -1400,7 +1400,7 @@ static struct platform_driver elphel393_sensor_i2c = { ...@@ -1400,7 +1400,7 @@ static struct platform_driver elphel393_sensor_i2c = {
.probe = elphel393_sensor_i2c_probe, ///< Function executed on probe operation .probe = elphel393_sensor_i2c_probe, ///< Function executed on probe operation
.remove = elphel393_sensor_i2c_remove, ///< Function executed on remove operation .remove = elphel393_sensor_i2c_remove, ///< Function executed on remove operation
.driver = { ///< Driver specifications .driver = { ///< Driver specifications
.name = "elphel393-sensor-i2c", ///< driver name .name = DEV393_NAME(DEV393_I2C_SENSORS), ///< driver name
.owner = THIS_MODULE, ///< Driver owner .owner = THIS_MODULE, ///< Driver owner
.of_match_table = elphel393_sensor_i2c_of_match, ///< Device tree match data .of_match_table = elphel393_sensor_i2c_of_match, ///< Device tree match data
.pm = NULL, ///< No power management supported in this driver .pm = NULL, ///< No power management supported in this driver
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#ifndef _X393_MACRO #ifndef _X393_MACRO
#define _X393_MACRO #define _X393_MACRO
#include <elphel/driver_numbers.h> #include <uapi/elphel/x393_devices.h>
/** @brief Resolution of current/OEF pointer in bits */ /** @brief Resolution of current/OEF pointer in bits */
#define OFFSET256_CNTR_RES 26 #define OFFSET256_CNTR_RES 26
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_type) static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_type)
{ {
if (dev_type != NULL) { if (dev_type != NULL) {
if ((minor & 0xf0) == CIRCBUF_MINOR || (minor & 0xf0) == HUFFMAN_MINOR || (minor & 0xf0) == JPEGHEAD_MINOR) if ((minor & 0xf0) == DEV393_MINOR(DEV393_CIRCBUF0) || (minor & 0xf0) == DEV393_MINOR(DEV393_HUFFMAN0) || (minor & 0xf0) == DEV393_MINOR(DEV393_JPEGHEAD0))
*dev_type = minor & 0xf0; *dev_type = minor & 0xf0;
else else
*dev_type = 0; *dev_type = 0;
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include "x393.h" #include "x393.h"
#include "x393_videomem.h" #include "x393_videomem.h"
#include <elphel/driver_numbers.h>
#include <uapi/elphel/c313a.h> #include <uapi/elphel/c313a.h>
#include <uapi/elphel/x393_devices.h>
#define VIDEOMEM_MODULE_DESCRIPTION "Video buffer driver" #define VIDEOMEM_MODULE_DESCRIPTION "Video buffer driver"
#define VIDEOMEM_DRIVER_NAME "video_mem" //#define VIDEOMEM_DRIVER_NAME "video_mem"
static const struct of_device_id elphel393_videomem_of_match[]; static const struct of_device_id elphel393_videomem_of_match[];
static struct device *g_dev_ptr; ///< Global pointer to basic device structure. This pointer is used in debugfs output functions static struct device *g_dev_ptr; ///< Global pointer to basic device structure. This pointer is used in debugfs output functions
...@@ -542,10 +542,12 @@ static int videomem_probe(struct platform_device *pdev) ...@@ -542,10 +542,12 @@ static int videomem_probe(struct platform_device *pdev)
// Add sysfs modification // Add sysfs modification
dev_dbg(dev, "Registering character device with name "VIDEOMEM_DRIVER_NAME); dev_dbg(dev, "Registering character device with name "DEV393_NAME(DEV393_VIDEOMEM_RAW));
res = register_chrdev(VIDEOMEM_MAJOR, VIDEOMEM_DRIVER_NAME, &videomem_fops); // res = register_chrdev(VIDEOMEM_MAJOR, VIDEOMEM_DRIVER_NAME, &videomem_fops);
res = register_chrdev(DEV393_MAJOR(DEV393_VIDEOMEM_RAW), DEV393_NAME(DEV393_VIDEOMEM_RAW), &videomem_fops);
if(res < 0) { if(res < 0) {
dev_err(dev, "\videomem_probe: couldn't get a major number %d.\n ",VIDEOMEM_MAJOR); dev_err(dev, "\videomem_probe: couldn't get a major number %d.\n ",DEV393_MAJOR(DEV393_VIDEOMEM_RAW));
return res; return res;
} }
// Setup interrupt // Setup interrupt
...@@ -569,7 +571,7 @@ static int videomem_probe(struct platform_device *pdev) ...@@ -569,7 +571,7 @@ static int videomem_probe(struct platform_device *pdev)
static int videomem_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure static int videomem_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure
///< @return always 0 ///< @return always 0
{ {
unregister_chrdev(VIDEOMEM_MAJOR, VIDEOMEM_DRIVER_NAME); unregister_chrdev(DEV393_MAJOR(DEV393_VIDEOMEM_RAW), DEV393_NAME(DEV393_VIDEOMEM_RAW));
return 0; return 0;
} }
...@@ -585,7 +587,7 @@ static struct platform_driver elphel393_videomem = { ...@@ -585,7 +587,7 @@ static struct platform_driver elphel393_videomem = {
.probe = videomem_probe, .probe = videomem_probe,
.remove = videomem_remove, .remove = videomem_remove,
.driver = { .driver = {
.name = VIDEOMEM_DRIVER_NAME, .name = DEV393_NAME(DEV393_VIDEOMEM_RAW),
.of_match_table = elphel393_videomem_of_match, .of_match_table = elphel393_videomem_of_match,
}, },
}; };
......
/// driver_numbers.h /// driver_numbers.h
/// see packages/devices/elphel/Makefile - major numbers should match /// see packages/devices/elphel/Makefile - major numbers should match
/*
#define LLL1 ("one", 2, 3, 4)
#define lll_first(n, ...) n
#define lll_second(x,n, ...) n
const char * ccc1 = lll_first LLL1;
const int iii2 = lll_second LLL1;
#define xxx lll_first LLL1
const char *ccc2 = xxx;
*/
//#define CMOSCAM_MAJOR 126 //#define CMOSCAM_MAJOR 126
#define X3X3_EXIF_MAJOR 125 #define X3X3_EXIF_MAJOR 125 // DONE!
#define ELPHEL_MAJOR 126 #define ELPHEL_MAJOR 126 // NOT Used
#define STREAM_MAJOR 127 #define STREAM_MAJOR 127 // Not used (was in sensor_common.c, but no operations)
#define FPGA_MAJOR 129 #define FPGA_MAJOR 129 // Not used in 393 - was for direct FP:GA access (register, tables, sdram) (/fpgaio, /fsdram, /fpga_tables)
// @$(MKNOD) -m 0666 $(DEV)/autoexp c 131 1 - was already rotten
#define FPGA_JTAG_MAJOR 132 #define FPGA_JTAG_MAJOR 132
#define FPGA_CLOCK_MAJOR 133 #define FPGA_CLOCK_MAJOR 133
#define X3X3_I2C_MAJOR 134 #define X3X3_I2C_MAJOR 134
...@@ -63,9 +72,9 @@ ...@@ -63,9 +72,9 @@
#define CMOSCAM_MINOR_IMAGEACQ 19 #define CMOSCAM_MINOR_IMAGEACQ 19
#define CMOSCAM_MINOR_HUFFMAN 20 #define CMOSCAM_MINOR_HUFFMAN 20
#define FPGACONF_MINOR_IORW 3 /* direct R/W FPGA registers */ #define FPGACONF_MINOR_IORW 3 ///< direct R/W FPGA registers
#define FPGACONF_MINOR_SDRAM 4 /* read/write SDRAM through PIO */ #define FPGACONF_MINOR_SDRAM 4 ///< read/write SDRAM through PIO
#define FPGACONF_MINOR_TABLES 6 /// Write FPGA tables directly #define FPGACONF_MINOR_TABLES 6 ///< Write FPGA tables directly
#define FPGA_CLOCK_MINOR 2 #define FPGA_CLOCK_MINOR 2
...@@ -92,7 +101,7 @@ ...@@ -92,7 +101,7 @@
#define X3X3_EXIF_TEMPLATE 2 // write Exif template #define X3X3_EXIF_TEMPLATE 2 // write Exif template
#define X3X3_EXIF_METADIR 3 // write metadata to Exif header translation (dir_table[MAX_EXIF_FIELDS]) #define X3X3_EXIF_METADIR 3 // write metadata to Exif header translation (dir_table[MAX_EXIF_FIELDS])
// those 2 files will disable exif_enable and exif_valid, truncate file size to file pointer on release. // those 2 files will disable exif_enable and exif_valid, truncate file size to file pointer on release.
#define X3X3_EXIF_TIME 4 // write today/tomorrow date (YYYY:MM:DD) and number of seconds at today/tomorrow #define X3X3_EXIF_TIME 4 // write today omorrow date (YYYY:MM:DD) and number of seconds at today omorrow
// midnight (00:00:00) in seconds from epoch (long, startting from LSB) // midnight (00:00:00) in seconds from epoch (long, startting from LSB)
#define X3X3_EXIF_EXIF_CHN_0 0x10 // read encoded Exif data (SEEK_END, #define X3X3_EXIF_EXIF_CHN_0 0x10 // read encoded Exif data (SEEK_END,
......
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
header-y += exifa.h header-y += exifa.h
header-y += c313a.h header-y += c313a.h
header-y += x393_devices.h
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
#define MCPwrseq 0x200 #define MCPwrseq 0x200
#else #else
// Temporarily porting, to use only bus = 1 (GPS, IMU) // Temporarily porting, to use only bus = 1 (GPS, IMU)
// Moved to include/uapi/elphel/x393_devices.h
#if 0
#define X3X3_I2C_CTRL 0 ///< control/reset i2c #define X3X3_I2C_CTRL 0 ///< control/reset i2c
#define X3X3_I2C_8_AINC 1 ///< 8bit registers, autoincement while read/write #define X3X3_I2C_8_AINC 1 ///< 8bit registers, autoincement while read/write
#define X3X3_I2C_16_AINC 2 ///< 16bit registers, autoincement while read/write #define X3X3_I2C_16_AINC 2 ///< 16bit registers, autoincement while read/write
...@@ -128,6 +130,7 @@ ...@@ -128,6 +130,7 @@
#define X3X3_I2C_RAW 5 ///< 8bit registers, no address byte (just slave, then read/write byte(s) #define X3X3_I2C_RAW 5 ///< 8bit registers, no address byte (just slave, then read/write byte(s)
#define X3X3_I2C1_RAW 6 ///< 8bit registers, no address byte (just slave, then read/write byte(s) #define X3X3_I2C1_RAW 6 ///< 8bit registers, no address byte (just slave, then read/write byte(s)
#define X3X3_I2C_ENABLE 7 ///< enable(/protect) different I2C devices for different types of I2C accesses #define X3X3_I2C_ENABLE 7 ///< enable(/protect) different I2C devices for different types of I2C accesses
#endif
#define X3X3_I2C_ENABLE_RD 0 ///< bit 0 - enable i2c read #define X3X3_I2C_ENABLE_RD 0 ///< bit 0 - enable i2c read
#define X3X3_I2C_ENABLE_WR 1 ///< bit 1 - enable i2c write #define X3X3_I2C_ENABLE_WR 1 ///< bit 1 - enable i2c write
#define X3X3_I2C_ENABLE_RAW 2 ///< bit 2 - enable i2c raw (no address byte) #define X3X3_I2C_ENABLE_RAW 2 ///< bit 2 - enable i2c raw (no address byte)
...@@ -1478,7 +1481,7 @@ struct p_names_t { ...@@ -1478,7 +1481,7 @@ struct p_names_t {
#define LSEEK_HIST_WAIT_C 0x29 ///< set histogram waiting for the C (actually R, G2, B) histograms to become available - implies G1 too #define LSEEK_HIST_WAIT_C 0x29 ///< set histogram waiting for the C (actually R, G2, B) histograms to become available - implies G1 too
#define LSEEK_HIST_REQ_EN 0x2a ///< enable histogram request when reading histogram (safer, but may be not desirable in HDR mode) - default after opening #define LSEEK_HIST_REQ_EN 0x2a ///< enable histogram request when reading histogram (safer, but may be not desirable in HDR mode) - default after opening
#define LSEEK_HIST_REQ_DIS 0x2b ///< disable histogram request when reading histogram - will read latest available relying it is available #define LSEEK_HIST_REQ_DIS 0x2b ///< disable histogram request when reading histogram - will read latest available relying it is available
#define LSEEK_HIST_SET_CHN 0x30 ///< ..2F Select channel to wait for (4*port+subchannel) #define LSEEK_HIST_SET_CHN 0x30 ///< ..3F Select channel to wait for (4*port+subchannel)
#define LSEEK_HIST_NEEDED 0x10000 ///< set histogram "needed" mask - 0x10000..0x1ffff #define LSEEK_HIST_NEEDED 0x10000 ///< set histogram "needed" mask - 0x10000..0x1ffff
//#define LSEEK_HIST_WAIT_AE 0x2a ///< wait for autoexposure enabled //#define LSEEK_HIST_WAIT_AE 0x2a ///< wait for autoexposure enabled
......
/***************************************************************************//**
* @file x393_devices.h
* @brief Definitions of static device files, major and minor numbers
* and userland.
* @copyright Copyright 2002-2016 (C) Elphel, Inc.
* @par <b>License</b>
* 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 2 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/>.
*******************************************************************************/
#define DEV393_EXIF_TEMPLATE ("exif_template", "exif_elphel", 125, 2, "0666", "c") ///< write Exif template
#define DEV393_EXIF_METADIR ("exif_metadir", "exif_elphel", 125, 3, "0666", "c") ///< write metadata to Exif header translation (dir_table[MAX_EXIF_FIELDS])
#define DEV393_EXIF_TIME ("exif_time", "exif_elphel", 125, 4, "0666", "c") ///< write today/tomorrow date (YYYY:MM:DD) and number of seconds at today/tomorrow
///< midnight (00:00:00) in seconds from epoch (long, startting from LSB)
#define DEV393_EXIF0 ("exif_exif0", "exif_elphel", 125, 16, "0666", "c") ///< sensor port 0: read encoded Exif data (SEEK_END)
#define DEV393_EXIF1 ("exif_exif1", "exif_elphel", 125, 17, "0666", "c") ///< sensor port 1: read encoded Exif data (SEEK_END)
#define DEV393_EXIF2 ("exif_exif2", "exif_elphel", 125, 18, "0666", "c") ///< sensor port 2: read encoded Exif data (SEEK_END)
#define DEV393_EXIF3 ("exif_exif3", "exif_elphel", 125, 19, "0666", "c") ///< sensor port 3: read encoded Exif data (SEEK_END)
#define DEV393_EXIF_META0 ("exif_meta0", "exif_elphel", 125, 32, "0666", "c") ///< sensor port 0: write metadata, concurrently opened files. All writes atomic
#define DEV393_EXIF_META1 ("exif_meta1", "exif_elphel", 125, 33, "0666", "c") ///< sensor port 1: write metadata, concurrently opened files. All writes atomic
#define DEV393_EXIF_META2 ("exif_meta2", "exif_elphel", 125, 34, "0666", "c") ///< sensor port 2: write metadata, concurrently opened files. All writes atomic
#define DEV393_EXIF_META3 ("exif_meta3", "exif_elphel", 125, 35, "0666", "c") ///< sensor port 3: write metadata, concurrently opened files. All writes atomic
#define DEV393_FRAMEPARS0 ("frameparsall0","framepars_operations",125,80, "0666", "c") ///< Access frame parameters for channel 0 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS1 ("frameparsall1","framepars_operations",125,81, "0666", "c") ///< Access frame parameters for channel 1 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS2 ("frameparsall2","framepars_operations",125,82, "0666", "c") ///< Access frame parameters for channel 2 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS3 ("frameparsall3","framepars_operations",125,83, "0666", "c") ///< Access frame parameters for channel 3 (schedule modification, read with mmap)
#define DEV393_JTAG_RESET ("fpgaresetjtag", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw)
#define DEV393_JTAG_RAW ("jtagraw", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw)
#define DEV393_JTAGS_CONF0 ("sfpgaconfjtag0", "x393_jtag", 132, 8, "0666", "c") ///< JTAG configure sensor port 0 FPGA
#define DEV393_JTAGS_CONF1 ("sfpgaconfjtag1", "x393_jtag", 132, 9, "0666", "c") ///< JTAG configure sensor port 1 FPGA
#define DEV393_JTAGS_CONF2 ("sfpgaconfjtag2", "x393_jtag", 132, 10, "0666", "c") ///< JTAG configure sensor port 2 FPGA
#define DEV393_JTAGS_CONF3 ("sfpgaconfjtag3", "x393_jtag", 132, 11, "0666", "c") ///< JTAG configure sensor port 3 FPGA
#define DEV393_JTAGS_BSCAN0 ("sfpgabscan0", "x393_jtag", 132, 12, "0666", "c") ///< JTAG boundary scan sensor port 0 FPGA
#define DEV393_JTAGS_BSCAN1 ("sfpgabscan1", "x393_jtag", 132, 13, "0666", "c") ///< JTAG boundary scan sensor port 1 FPGA
#define DEV393_JTAGS_BSCAN2 ("sfpgabscan2", "x393_jtag", 132, 14, "0666", "c") ///< JTAG boundary scan sensor port 2 FPGA
#define DEV393_JTAGS_BSCAN3 ("sfpgabscan3", "x393_jtag", 132, 15, "0666", "c") ///< JTAG boundary scan sensor port 3 FPGA
#define DEV393_I2C_CTRL ("xi2cctl", "fpga_xi2c", 134, 0, "0666", "c") ///< control/reset i2c
#define DEV393_I2C_8_AINC ("xi2c8", "fpga_xi2c", 134, 1, "0666", "c") ///< 8bit registers, autoincrement while read/write (NC393: Not used)
#define DEV393_I2C_16_AINC ("xi2c16", "fpga_xi2c", 134, 2, "0666", "c") ///< 16bit registers, autoincrement while read/write (NC393: Not used)
#define DEV393_I2C1_8_AINC ("xi2c8_aux", "fpga_xi2c", 134, 3, "0666", "c") ///< 8bit registers, autoincrement while read/write (bus 1)
#define DEV393_I2C1_16_AINC ("xi2c16_aux", "fpga_xi2c", 134, 4, "0666", "c") ///< 16bit registers, autoincrement while read/write (bus 1)
#define DEV393_I2C_RAW ("xi2craw", "fpga_xi2c", 134, 5, "0666", "c") ///< 8bit registers, no address byte (just slave, then read/write byte(s) (NC393: Not used)
#define DEV393_I2C1_RAW ("xi2craw_aux", "fpga_xi2c", 134, 6, "0666", "c") ///< 8bit registers, no address byte (just slave, then read/write byte(s) bus 1
#define DEV393_I2C_ENABLE ("xi2cenable", "fpga_xi2c", 134, 7, "0666", "c") ///< enable(/protect) different I2C devices for different types of I2C accesses
#define DEV393_CIRCBUF0 ("circbuf0", "circbuf", 135, 32, "0666", "c") ///< circbuf for channel 0
#define DEV393_CIRCBUF1 ("circbuf1", "circbuf", 135, 33, "0666", "c") ///< circbuf for channel 1
#define DEV393_CIRCBUF2 ("circbuf2", "circbuf", 135, 34, "0666", "c") ///< circbuf for channel 2
#define DEV393_CIRCBUF3 ("circbuf3", "circbuf", 135, 35, "0666", "c") ///< circbuf for channel 3
#define DEV393_JPEGHEAD0 ("jpeghead0", "circbuf", 135, 48, "0666", "c") ///< JPEG header for channel 0
#define DEV393_JPEGHEAD1 ("jpeghead1", "circbuf", 135, 49, "0666", "c") ///< JPEG header for channel 1
#define DEV393_JPEGHEAD2 ("jpeghead2", "circbuf", 135, 50, "0666", "c") ///< JPEG header for channel 2
#define DEV393_JPEGHEAD3 ("jpeghead3", "circbuf", 135, 51, "0666", "c") ///< JPEG header for channel 3
#define DEV393_HUFFMAN0 ("huffman0", "circbuf", 135, 64, "0666", "c") ///< Huffman table for channel 0
#define DEV393_HUFFMAN1 ("huffman1", "circbuf", 135, 65, "0666", "c") ///< Huffman table for channel 1
#define DEV393_HUFFMAN2 ("huffman2", "circbuf", 135, 66, "0666", "c") ///< Huffman table for channel 2
#define DEV393_HUFFMAN3 ("huffman3", "circbuf", 135, 67, "0666", "c") ///< Huffman table for channel 3
#define DEV393_GAMMA ("gamma_cache","gamma_tables_operations",137,17,"0666", "c") ///< Cache for calculated gamma tables (common for all ports/channels/colors)
#define DEV393_HISTOGRAM ("histogram_cache","histograms_operations",138,18,"0666","c") ///< Access to acquired/calculated histograms for all ports/channels/colors
#define DEV393_LOGGER ("imu", "imu_logger", 141, 1, "0666", "c") ///< IMU/GPS/images logs data access
#define DEV393_LOGGER_CTRL ("imu_ctl", "imu_logger", 141, 2, "0666", "c") ///< IMU/GPS/images logger control
// Video memory access uses a single (shared) membridge module, so device driver should have exclusive access
#define DEV393_VIDEOMEM_RAW ("videomem_raw", "video_mem", 142, 1, "0666", "c") ///< Raw access to video memory using membridge module (NC393: Not yet implemented)
#define DEV393_IMAGE_RAW ("image_raw", "video_mem", 142, 2, "0666", "c") ///< Access to raw (uncompressed) data in video memory, frame-organized
#define DEV393_DETECT_SENSORS ("detect_sensors", "detect_sensors",143, 1, "0666", "c") ///< Probably not needed, only sysfs is used
#define DEV393_I2C_SENSORS ("", "elphel393-sensor-i2c",-1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define _DEV393_PATH(n, ...) "/dev/"n
#define _DEV393_NAME(a,n, ...) n
#define _DEV393_MAJOR(a,b,n, ...) n
#define _DEV393_MINOR(a,b,c,n, ...) n
#define _DEV393_PERMISSIONS(a,b,c,d,n, ...) n
#define _DEV393_TYPE(a,b,c,d,e,n,...) n
#define DEV393_PATH(LIST) _DEV393_PATH LIST
#define DEV393_NAME(LIST) _DEV393_NAME LIST
#define DEV393_MAJOR(LIST) _DEV393_MAJOR LIST
#define DEV393_MINOR(LIST) _DEV393_MINOR LIST
#define DEV393_PERMISSIONS(LIST) _DEV393_PERMISSIONS LIST
#define DEV393_TYPE(LIST) _DEV393_TYPE LIST
char * aaa = DEV393_PATH(DEV393_HUFFMAN0);
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