Commit 77d3add6 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

+ char devices for raw channels

parent f5b566f9
...@@ -52,14 +52,22 @@ static DEFINE_SPINLOCK(lock); // for read-modify-write channel enable ...@@ -52,14 +52,22 @@ static DEFINE_SPINLOCK(lock); // for read-modify-write channel enable
// 2. craete char device for r/w memory access // 2. craete char device for r/w memory access
static const char * const videomem_devs[]={ static const char * const videomem_devs[]={
DEV393_DEVNAME(DEV393_VIDEOMEM_RAW), DEV393_DEVNAME(DEV393_VIDEOMEM_RAW),
DEV393_DEVNAME(DEV393_IMAGE_RAW) DEV393_DEVNAME(DEV393_IMAGE_RAW),
DEV393_DEVNAME(DEV393_IMAGE_RAW0),
DEV393_DEVNAME(DEV393_IMAGE_RAW1),
DEV393_DEVNAME(DEV393_IMAGE_RAW2),
DEV393_DEVNAME(DEV393_IMAGE_RAW3)
}; };
static const int videomem_major = DEV393_MAJOR(DEV393_VIDEOMEM_RAW); static const int videomem_major = DEV393_MAJOR(DEV393_VIDEOMEM_RAW);
static const int videomem_minor[]={ static const int videomem_minor[]={
DEV393_MINOR(DEV393_VIDEOMEM_RAW), DEV393_MINOR(DEV393_VIDEOMEM_RAW),
DEV393_MINOR(DEV393_IMAGE_RAW) DEV393_MINOR(DEV393_IMAGE_RAW),
DEV393_MINOR(DEV393_IMAGE_RAW0),
DEV393_MINOR(DEV393_IMAGE_RAW1),
DEV393_MINOR(DEV393_IMAGE_RAW2),
DEV393_MINOR(DEV393_IMAGE_RAW3)
}; };
/** @brief Global device class for sysfs */ /** @brief Global device class for sysfs */
...@@ -739,7 +747,7 @@ static int videomem_open(struct inode *inode, struct file *filp) ...@@ -739,7 +747,7 @@ static int videomem_open(struct inode *inode, struct file *filp)
// /dev/raw1 -> /dev/image_raw // /dev/raw1 -> /dev/image_raw
// there should be a way (there is no way) to read link name then extract channel number from it // there should be a way (there is no way) to read link name then extract channel number from it
pr_debug("DEV OPENED: %s\n",filp->f_path.dentry->d_iname); //pr_debug("DEV OPENED: %s\n",filp->f_path.dentry->d_iname);
privData = (struct raw_priv_t*)kmalloc(sizeof(struct raw_priv_t), GFP_KERNEL); privData = (struct raw_priv_t*)kmalloc(sizeof(struct raw_priv_t), GFP_KERNEL);
if (!privData) { if (!privData) {
...@@ -753,9 +761,12 @@ static int videomem_open(struct inode *inode, struct file *filp) ...@@ -753,9 +761,12 @@ static int videomem_open(struct inode *inode, struct file *filp)
privData->buf_size = pElphel_buf->raw_chn0_size*PAGE_SIZE; privData->buf_size = pElphel_buf->raw_chn0_size*PAGE_SIZE;
privData->buf_size32 = (privData->buf_size)>>2; privData->buf_size32 = (privData->buf_size)>>2;
// TODO: remove this
test_channel = 2; test_channel = 2;
membridge_sensor_port = test_channel; membridge_sensor_port = test_channel;
// no need
frame_number = GLOBALPARS(membridge_sensor_port,G_THIS_FRAME) & PARS_FRAMES_MASK; frame_number = GLOBALPARS(membridge_sensor_port,G_THIS_FRAME) & PARS_FRAMES_MASK;
//calculate things //calculate things
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/ *******************************************************************************/
/* Each device node should be specified in the following format: /* Each device node should be specified in the following format:
#define <DEVICE_RFEFERENCE> ("<dev path>", "<driver_name>", major, minor,"<permissions>","<b/c>") [optional comment] #define <DEVICE_RFEFERENCE> ("<dev path>", "<driver_name>", major, minor,"<permissions>","<b/c>") [optional comment]
* Access to individual fields is provide with the macros defined below, for example: * Access to individual fields is provide with the macros defined below, for example:
...@@ -106,6 +106,11 @@ ...@@ -106,6 +106,11 @@
// Video memory access uses a single (shared) membridge module, so device driver should have exclusive access // 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_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_IMAGE_RAW ("image_raw", "video_mem", 142, 2, "0666", "c") ///< Access to raw (uncompressed) data in video memory, frame-organized
// 80-83 - minor to use minor_to_chn function
#define DEV393_IMAGE_RAW0 ("image_raw0", "video_mem", 142, 80, "0666", "c") ///< Channel 0. Access to raw (uncompressed) data in video memory, frame-organized
#define DEV393_IMAGE_RAW1 ("image_raw1", "video_mem", 142, 81, "0666", "c") ///< Channel 1. Access to raw (uncompressed) data in video memory, frame-organized
#define DEV393_IMAGE_RAW2 ("image_raw2", "video_mem", 142, 82, "0666", "c") ///< Channel 2. Access to raw (uncompressed) data in video memory, frame-organized
#define DEV393_IMAGE_RAW3 ("image_raw3", "video_mem", 142, 83, "0666", "c") ///< Channel 3. 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_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_I2C_SENSORS ("", "elphel393-sensor-i2c",-1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
......
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