From Peter_Pregler@email.com Mon, 3 Sep 2001 21:18:34 +0200 Date: Mon, 3 Sep 2001 21:18:34 +0200 From: Peter Pregler Peter_Pregler@email.com Subject: [cpia] Parallel Port Creative Labs Webcam 2 problems On Tue, Aug 28, 2001 at 03:04:39PM -0500, Walter Johnson wrote: > > I have compiled Linux 2.4.2 /w V4L and parallel port support and have > the webcam working with vic. The only problem seems to be my frame rate > stuck at 5fps without movement and 1-2 fps with movement. I belive the > problem lies with dma transfers. I there a way to get this to work the > 2.4.2 kernel. It worked under the 2.2.x kernel? Your guess is correct. The last time I looked at the 2.4-stuff the dma-read was not implemented and I never found the time and interest to do so. The parport-API changed substantially between 2.2 and 2.4. Basically you have to move the dma-code I have written from the cpia-driver to the generic ieee1284-parport routines. Also AFAIR the 2.4-parport driver does not utilize FIFO-read but reads character-wise. > Any suggestions would be useful. Since I do not have any parport-camera available anymore the answer is simple: implement it. ;) Feel free to contact me if you need more details about what to do. Also just implementing FIFO-read will be sufficient if you have enough cpu-cycles to burn and should be much easier than dma. -Peter -- Feeling amorous, she looked under the sheets and cried, "Oh, no, it's Microsoft!" ------------------------------- Email: Peter_Pregler@email.com From s369494@student.uq.edu.au Thu, 6 Sep 2001 20:41:25 +1000 (GMT+1000) Date: Thu, 6 Sep 2001 20:41:25 +1000 (GMT+1000) From: Selma Kwong s369494@student.uq.edu.au Subject: [cpia] CPiA version used in Creative labs WebCam II? I am trying to interface the creative lab's webcam 2 (parport vers) to a mini web server (PicoWeb server) which has a parallel port. I need to write the driver for the ECP port which it uses, as the webserver I am using cannot has its own picoweb code and does not use Linux or Windows. However, I am uncertain to whether the webcam 2 uses the original CPiA chipset or the newer CPiA 1.5 - the data sheets for both versions are available on the website (http://webcam.sourceforge.net/) but I don't know which one it is. Are there any ways of finding out which version it is so I can go with the correct datasheet? or is there a easier way to solve my problem? If anyone knows a little about this, please send me an email! Thank you! Selma (student doing a thesis) From Peter_Pregler@email.com Thu, 6 Sep 2001 13:25:09 +0200 Date: Thu, 6 Sep 2001 13:25:09 +0200 From: Peter Pregler Peter_Pregler@email.com Subject: [cpia] CPiA version used in Creative labs WebCam II? Hi, I have no idea about the differences between the versions you cite. At the time of writing the driver there was only one major version of the CPiA chip available. The creative webcam II I used to write the driver was such an older one. The driver works for instance for the following chip: CPIA Version: 1.33 (2.10) CPIA PnP-ID: 0553:0002:0106 VP-Version: 1.0 0141 To find out what you have connect the camera to a Linux/Windows machine and check out the ieee-1284 parport info. It should contain a sufficient subset of the information listed above to identify the chip. Greetings and good luck, Peter On Thu, Sep 06, 2001 at 08:41:25PM +1000, Selma Kwong wrote: > I am trying to interface the creative lab's webcam 2 (parport vers) to a > mini web server (PicoWeb server) which has a parallel port. I need to > write the driver for the ECP port which it uses, as the webserver I am > using cannot has its own picoweb code and does not use Linux or Windows. > However, I am uncertain to whether the webcam 2 uses the original CPiA > chipset or the newer CPiA 1.5 - the data > sheets for both versions are available on > the website (http://webcam.sourceforge.net/) but I don't know which one it > is. Are there any ways of finding out which version it is so I can go with > the correct datasheet? or is there a easier way to solve my problem? If > anyone knows a little about this, please send me an email! Thank you! > > Selma (student doing a thesis) > > > > _______________________________________________ > cpia mailing list - cpia@risc.uni-linz.ac.at > http://mailman.risc.uni-linz.ac.at/mailman/cgi-bin/listinfo/cpia > -- Feeling amorous, she looked under the sheets and cried, "Oh, no, it's Microsoft!" ------------------------------- Email: Peter_Pregler@email.com From haveblue@us.ibm.com Tue, 18 Sep 2001 09:09:36 -0700 Date: Tue, 18 Sep 2001 09:09:36 -0700 From: David C. Hansen haveblue@us.ibm.com Subject: [cpia] [PATCH] Updated locking for CPiA driver I added a few things to the CPiA driver. First, I modified the cam_data struct to use list_heads instead of its own list members. This allowed the removal of the #defined list routines. I also replaced the use of the BKL in the driver. I gave it 1 lock for USB and one for PP. There was a small potential race condition in the pp_detach function. The list removal itself was protected by the BKL, but the iteration through the list in the for loop was not. -- David C. Hansen haveblue@us.ibm.com IBM LTC Base/OS Group (503)578-4080 --- ../clean/linux/drivers/media/video/cpia.h Fri Mar 2 11:12:10 2001 +++ linux/drivers/media/video/cpia.h Fri Sep 14 11:08:03 2001 @@ -226,8 +226,7 @@ #define FRAME_NUM 2 /* double buffering for now */ struct cam_data { - struct cam_data **previous; - struct cam_data *next; + struct list_head cam_list; struct semaphore busy_lock; /* guard against SMP multithreading */ struct cpia_camera_ops *ops; /* lowlevel driver operations */ @@ -392,29 +391,6 @@ DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); - -#define ADD_TO_LIST(l, drv) \ - {\ - lock_kernel();\ - (drv)->next = l;\ - (drv)->previous = &(l);\ - (l) = drv;\ - unlock_kernel();\ - } while(0) - -#define REMOVE_FROM_LIST(drv) \ - {\ - if ((drv)->previous != NULL) {\ - lock_kernel();\ - if ((drv)->next != NULL)\ - (drv)->next->previous = (drv)->previous;\ - *((drv)->previous) = (drv)->next;\ - (drv)->previous = NULL;\ - (drv)->next = NULL;\ - unlock_kernel();\ - }\ - } while (0) - #endif /* __KERNEL__ */ --- ../clean/linux/drivers/media/video/cpia_pp.c Fri Mar 2 11:12:10 2001 +++ linux/drivers/media/video/cpia_pp.c Fri Sep 14 11:43:05 2001 @@ -157,7 +157,8 @@ 1 }; -static struct cam_data *cam_list; +LIST_HEAD(cam_list_head); +static spinlock_t cam_list_lock_pp = SPIN_LOCK_UNLOCKED; #ifdef _CPIA_DEBUG_ #define DEB_PORT(port) { \ @@ -582,20 +583,24 @@ kfree(cam); return -ENXIO; } - ADD_TO_LIST(cam_list, cpia); + spin_lock( &cam_list_lock_pp ); + list_add(&cpia->cam_list, &cam_list_head); + spin_unlock( &cam_list_lock_pp ); return 0; } static void cpia_pp_detach (struct parport *port) { - struct cam_data *cpia; + struct list_head* pos; - for(cpia = cam_list; cpia != NULL; cpia = cpia->next) { + spin_lock( &cam_list_lock_pp ); + list_for_each(pos, &cam_list_head) { + struct cam_data *cpia = list_entry( pos, struct cam_data, cam_list ); struct pp_cam_entry *cam = cpia->lowlevel_data; if (cam && cam->port->number == port->number) { - REMOVE_FROM_LIST(cpia); - + list_del(pos); + spin_unlock( &cam_list_lock_pp ); cpia_unregister_camera(cpia); if(cam->open_count > 0) { @@ -606,9 +611,10 @@ kfree(cam); cpia->lowlevel_data = NULL; - break; + return; } } + spin_unlock( &cam_list_lock_pp ); } static void cpia_pp_attach (struct parport *port) @@ -660,7 +666,7 @@ LOG ("unable to register with parport\n"); return -EIO; } - + return 0; } --- ../clean/linux/drivers/media/video/cpia_usb.c Mon Feb 19 10:18:18 2001 +++ linux/drivers/media/video/cpia_usb.c Fri Sep 14 11:44:36 2001 @@ -103,7 +103,8 @@ 0 }; -static struct cam_data *cam_list; +LIST_HEAD(cam_list_head); +static spinlock_t cam_list_lock_usb = SPIN_LOCK_UNLOCKED; static void cpia_usb_complete(struct urb *urb) { @@ -536,7 +537,9 @@ goto fail_all; } - ADD_TO_LIST(cam_list, cam); + spin_lock( &cam_list_lock_usb ); + list_add(&cam->cam_list,&cam_list_head); + spin_unlock( &cam_list_lock_usb ); return cam; @@ -579,8 +582,10 @@ struct cam_data *cam = (struct cam_data *) ptr; struct usb_cpia *ucpia = (struct usb_cpia *) cam->lowlevel_data; - REMOVE_FROM_LIST(cam); - + spin_lock( &cam_list_lock_usb ); + list_del(&cam->cam_list); + spin_unlock( &cam_list_lock_usb ); + /* Don't even try to reset the altsetting if we're disconnected */ cpia_usb_free_resources(ucpia, 0); @@ -619,8 +624,6 @@ static int __init usb_cpia_init(void) { - cam_list = NULL; - return usb_register(&cpia_driver); } From Peter_Pregler@email.com Tue, 18 Sep 2001 20:14:02 +0200 Date: Tue, 18 Sep 2001 20:14:02 +0200 From: Peter Pregler Peter_Pregler@email.com Subject: [cpia] Re: how to maintain framerate? On Tue, Sep 18, 2001 at 07:58:52AM +0100, lau tau tin wrote: > > i try to modify the setting of sensor FPS to 30fps : > > cam->params.sensorFps.divisor=0; > cam->params.sensorFps.baserate=1; Use the /proc interface to do so. There is a gui-tool named cpia-control to modify all camera parameters at run-time. > but the framerate only get 25frames/second (nothing moving) and drop > immediately to 9-10 frames/second with a lot motion. > > anyone know how to maintance the framerate and which part of driver > cpia must to be modify?? help! The camera, i.e. the USB-bus, cannot sustain 30fps at CIF with much motion. For instance right now I have with a very dark scene about 900kB/sec and about 5fps, and not CPU load. The 900kB/sec is IHMO pretty good. The achivable frame-rate depends on the compression settings and related to this also on the exposure (much noise due to too dark scene -> frame rate goes down). Play around a bit with the cpia-control tool to see how the change of the paramters affects the frame-rate. Geetings, Peter -- Feeling amorous, she looked under the sheets and cried, "Oh, no, it's Microsoft!" ------------------------------- Email: Peter_Pregler@email.com From s369494@student.uq.edu.au Sun, 30 Sep 2001 00:33:51 +1000 Date: Sun, 30 Sep 2001 00:33:51 +1000 From: Selma Kwong s369494@student.uq.edu.au Subject: [cpia] Help with parallel port driver in ECP mode Hi, I am trying to write a driver for Creative Webcam II (parallel port) running under a Atmel AVR 90S8515 microcontroller. I am using the linux code I found on the website webcam.sourceforge.net as a start to program in assembly. I was wondering whether anyone can tell me the difference in the programs provided by the website: * Vision PPC2 sample source - pp_test1.zip * Parallel port driver source code by STM - ppc2.zip * In download: cpia-1.2.tgz, cpia-control-0.3.3.tgz, cpia-control_0.3.3-1_i386.deb Which one should I use to start off with? I am planning to save program space by only implementing the ECP mode without buffering (no FIFO - asynchronous?). I also won't be using most of the fancy functions provided by the CPIA chipset. Just basic transfers and getting it to work first... I don't know much about linux, so any help is greatly appreciated. Thanks! Selma From Peter_Pregler@email.com Sat, 29 Sep 2001 17:10:53 +0200 Date: Sat, 29 Sep 2001 17:10:53 +0200 From: Peter Pregler Peter_Pregler@email.com Subject: [cpia] Help with parallel port driver in ECP mode On Sun, Sep 30, 2001 at 12:33:51AM +1000, Selma Kwong wrote: > * Vision PPC2 sample source - pp_test1.zip This is sample driver-code for dos/windows. > * Parallel port driver source code by STM - ppc2.zip IIRC this is the Windows driver source. > * In download: cpia-1.2.tgz, This is the latest release of the linux driver. > cpia-control-0.3.3.tgz, cpia-control_0.3.3-1_i386.deb This is a python-gtk application to write strings to the /proc-filesystem to control the camera. > Which one should I use to start off with? I am planning to save > program space by only implementing the ECP mode without buffering (no > FIFO - asynchronous?). Best start with the pp_test.zip and get the chip-description to implement a minimal driver. Especially the windows- and the linux-driver do much more and have additional levels of abstractions that you might not need for your microcontroller. -Peter -- Feeling amorous, she looked under the sheets and cried, "Oh, no, it's Microsoft!" ------------------------------- Email: Peter_Pregler@email.com