Talk:Circbuf

From ElphelWiki
Revision as of 08:43, 12 November 2007 by Ekratzer (talk | contribs)
Jump to: navigation, search

I have a question regarding the 353 compressor initialization. The imgsrvd program does not work after bootup because the driver has not initialized the FPGA, and not started the compressor running. The only way I can get it to work is to run ccam (via http) first. Is there a way to automatically (upon bootup) initialize both the FPGA and start the compressor running?

I have tried a few things:

I have found that just opening "/dev/ccam_img" causes the init_FPGA() to be called, so one problem solved.

However, after I open "/dev/sensorpars" and call JPEG_CMD_START and nothing happens? How do we start/stop the compressor now ?

I am using 7.1.5 from sourceforge.

--Ekratzer 14:57, 9 November 2007 (CST)

You can just put : wget http://127.0.0.1/admin-bin/ccam.cgi?parameter1=value1&parameter2=value2&... into some init.d script.

We are now designing a some PHP API and Luxigo work on a C/C++ library / API. (now it's only acquisition no programming CMOS)

Or just look in the ccam.cgi source code. (I never did)

--Polto 23:35, 9 November 2007 (GMT)

Yep, you are right - nothing is done for that yet. So while testing I did the same - opened first image with ccam.cgi (even complete camvc.html), then started compressor with "http://camera_ip:81/compressor.php?cmd=run" and only then used imgsrv to access circbuf.

Using ccam.cgi from localhost is a solution, we used it in ftp script in our webcams, but eventually there will be a better solution. You may also try to specify the ccam.cgi parameters from PHP script - similar to Adjusting_sensor_clock_phase--Andrey.filippov 14:06, 10 November 2007 (CST)


I have searched through ccam.c and found necessary code to start compressor after bootup. Some of it may not be necessary, but it works for now. If I change sensor parameters (WOI, exposure, quality, etc.) I must stop the compressor first, and then call this code again, or user-space will lock-up.

<verbatim>

   // initialize driver
   fd = open("/dev/ccam_dma.raw", O_RDWR);
   if (fd != -1)
       close(fd);
   fd = open("/dev/ccam_img", O_RDWR);
   if (fd != -1) {

// do we need to start the compressor going ? tmp = ioctl(fd, _IO(CMOSCAM_IOCTYPE, IO_CCAM_MONITOR_SEQ ), 0); if (tmp != CAMSEQ_RUN) {

// force update ioctl(fd, _CCCMD(CCAM_WPARS , P_DONTCARE), 0); ioctl(fd, _CCCMD(CCAM_WPARS , P_DONTCARE), 1);

// set parameters, not sure if all (or any) of these are required for minumum ioctl(fd, _CCCMD(CCAM_WPARS , P_BAYER), 4); ioctl(fd, _CCCMD(CCAM_WPARS, P_FPSLM), -1); tmp = ioctl(fd, _CCCMD( CCAM_RPARS , P_TRIG), 0) & ~1; ioctl(fd, _CCCMD(CCAM_WPARS , P_TRIG ), tmp); ioctl(fd, _CCCMD(CCAM_WPARS , P_UPDATE ), 1);

// reset pointers and DMA for new clip ioctl (fd,_IO(CMOSCAM_IOCTYPE, IO_CCAM_JPEG ), JPEG_CMD_RESET); close(fd);

// start compression now fd = open("/dev/ccam_dma.raw", O_RDWR); if (fd != -1) { ioctl (fd, _IO(CMOSCAM_IOCTYPE, IO_CCAM_JPEG ), JPEG_CMD_CATCHUP); ioctl (fd, _IO(CMOSCAM_IOCTYPE, IO_CCAM_JPEG ), JPEG_CMD_FORGET); ioctl (fd, _IO(CMOSCAM_IOCTYPE, IO_CCAM_JPEG ), JPEG_CMD_GET); while (lseek(fd,0,2)==0); close(fd); }

// start compressor fd = open("/dev/sensorpars", O_RDWR); if (fd != -1) { lseek(fd, CSERV_SPARS_START, SEEK_END); close(fd); } }

   }

</verbatim>

--Ekratzer 09:41, 12 November 2007 (CST)