From sbd16@columbia.edu  Wed May  1 21:34:51 2002
From: sbd16@columbia.edu (Steve Diamond, Dobelle Institute)
Date: Wed, 1 May 2002 16:34:51 -0400 (EDT)
Subject: [pxc] Help installing the pxc driver
In-Reply-To: <20020429232151.A18671@morgana.systemy.it>
Message-ID: <Pine.GSO.4.44.0205011631010.12460-100000@ciao.cc.columbia.edu>

juan,

i got prety much the same errors the first few times i
tried.  Alessandro is right about the memory allocation.
You need to allocate memory for DMA.  For example, if you
had 128MB RAM, you could allocate memory for DMA at the lilo
prompt by typing"

linux mem=125MB

This would allocate 3mb for DMA, which is more than enough
(i think).  Replace "linux" with whatever you labelled your
linux installation, "linux" is default.  what the command
does is tell the kernal to only use 125mb of ram, and leave
the rest unnallocated.  Later on, when DMA is needed, the
extra RAM is allocated for DMA.

steve


From marius@tbs.co.za  Thu May  2 11:39:52 2002
From: marius@tbs.co.za (Marius van Wyk)
Date: Thu, 02 May 2002 12:39:52 +0200
Subject: [pxc] Help installing the pxc driver
In-Reply-To: <Pine.GSO.4.44.0205011631010.12460-100000@ciao.cc.columbia.
 edu>
References: <20020429232151.A18671@morgana.systemy.it>
Message-ID: <5.1.1.2.2.20020502123737.027193f8@pop3.tbs.co.za>

It all depends on the amount of buffers you want to allocate to do the DMA.

Work it out: x*y*c * buffer count

A buffer count of 3 is optimum for me.
Thus, yes 3Meg reserved memory is fine...

Regards,
Marius.

At 22:34 2002.05.01, you wrote:
>juan,
>
>i got prety much the same errors the first few times i
>tried.  Alessandro is right about the memory allocation.
>You need to allocate memory for DMA.  For example, if you
>had 128MB RAM, you could allocate memory for DMA at the lilo
>prompt by typing"
>
>linux mem=125MB
>
>This would allocate 3mb for DMA, which is more than enough
>(i think).  Replace "linux" with whatever you labelled your
>linux installation, "linux" is default.  what the command
>does is tell the kernal to only use 125mb of ram, and leave
>the rest unnallocated.  Later on, when DMA is needed, the
>extra RAM is allocated for DMA.
>
>steve
>
>_______________________________________________
>pxc mailing list
>pxc@lists.linux.it
>http://lists.linux.it/listinfo/pxc



From irem.stratmann@ais.fhg.de  Mon May 13 14:00:32 2002
From: irem.stratmann@ais.fhg.de (Irem Stratmann)
Date: Mon, 13 May 2002 15:00:32 +0200
Subject: [pxc] Problems with pxc 0.81, pxc_xgrab, pxc_grab
Message-ID: <3CDFB8F0.2EBE4F18@ais.fhg.de>

Hi,

I have some problems running pxc_xgrab and pxc_grab. 
I have installed the 0.81 Version, pxc_load and pxc_live etc. run well.
But I can't grab any image. 
Actually I want to grab sequences of low-resolution sequences. Pxc_grab
returns the system message
'pxc_grab: /dev/pxc0pgm: getsequence: device is busy '

What should i do to get it running? I know that the same card (PXC200)
was running under pxc0.28 under Kernel 2.2.18 but now I changed to 2.4.0
so I need help!
 (the installation and memory allocation for DMA were completed
successfully)


Thanks,

Irem

From marius@tbs.co.za  Tue May 14 09:31:13 2002
From: marius@tbs.co.za (Marius van Wyk)
Date: Tue, 14 May 2002 10:31:13 +0200
Subject: [pxc] Problems with pxc 0.81, pxc_xgrab, pxc_grab
In-Reply-To: <3CDFB8F0.2EBE4F18@ais.fhg.de>
Message-ID: <5.1.1.2.2.20020514102810.02770420@pop3.tbs.co.za>

Hi Irem,

This could be due to the fact that your Linux installation is loading some 
drivers automatically.
You either need to have installed the machine without the capture card 
installed, ot you need to unload the modules. (I am not sure which, but 
there are a few you may need to unload...) There is perhaps some way you 
can edit conf.modules to stop them from loading, but I'm not sure.

I have had this problem in the past as well, and I solved it by simply 
unloading the native Linux kernel modules before loading the pxc.o module.

I hope this helps!

Regards,
Marius.

At 15:00 2002.05.13, Irem Stratmann wrote:
>Hi,
>
>I have some problems running pxc_xgrab and pxc_grab.
>I have installed the 0.81 Version, pxc_load and pxc_live etc. run well.
>But I can't grab any image.
>Actually I want to grab sequences of low-resolution sequences. Pxc_grab
>returns the system message
>'pxc_grab: /dev/pxc0pgm: getsequence: device is busy '
>
>What should i do to get it running? I know that the same card (PXC200)
>was running under pxc0.28 under Kernel 2.2.18 but now I changed to 2.4.0
>so I need help!
>  (the installation and memory allocation for DMA were completed
>successfully)
>
>
>Thanks,
>
>Irem
>_______________________________________________
>pxc mailing list
>pxc@lists.linux.it
>http://lists.linux.it/listinfo/pxc



From marius@tbs.co.za  Tue May 14 10:05:56 2002
From: marius@tbs.co.za (Marius van Wyk)
Date: Tue, 14 May 2002 11:05:56 +0200
Subject: [pxc] Problems with pxc 0.81, pxc_xgrab, pxc_grab
In-Reply-To: <3CDFB8F0.2EBE4F18@ais.fhg.de>
Message-ID: <5.1.1.2.2.20020514105843.0277bdc8@pop3.tbs.co.za>

My reply failed to "Irem Stratmann" due to SPAM protection.

Irem, could you please use either a better SPAM protection or remove it, as 
I am totally unable to email you.

Your spam reply/bounce message specified a web address, but after using it 
and submitting:

Error:
You can only send to gmd.de addresses, not to "irem.stratmann@ais.fhg.de".

Sort it out please,

Regards,
Marius.

PS: Have a Look at ASK (Anti-Spam Killer) for a better option...

At 15:00 2002.05.13, Irem Stratmann wrote:
>Hi,
>
>I have some problems running pxc_xgrab and pxc_grab.
>I have installed the 0.81 Version, pxc_load and pxc_live etc. run well.
>But I can't grab any image.
>Actually I want to grab sequences of low-resolution sequences. Pxc_grab
>returns the system message
>'pxc_grab: /dev/pxc0pgm: getsequence: device is busy '
>
>What should i do to get it running? I know that the same card (PXC200)
>was running under pxc0.28 under Kernel 2.2.18 but now I changed to 2.4.0
>so I need help!
>  (the installation and memory allocation for DMA were completed
>successfully)
>
>
>Thanks,
>
>Irem
>_______________________________________________
>pxc mailing list
>pxc@lists.linux.it
>http://lists.linux.it/listinfo/pxc




From marius@tbs.co.za  Tue May 14 13:27:27 2002
From: marius@tbs.co.za (Marius van Wyk)
Date: Tue, 14 May 2002 14:27:27 +0200
Subject: [pxc] Problems with pxc 0.81, pxc_xgrab, pxc_grab
In-Reply-To: <3CDFB8F0.2EBE4F18@ais.fhg.de>
Message-ID: <5.1.1.2.2.20020514142623.026f17c0@pop3.tbs.co.za>

Here is exactly what I did to remove the currently loaded drivers...

# 0.80: remove native Linux capture card drivers...
  rmmod tuner
  rmmod bttv
  rmmod i2c-algo-bit
  rmmod i2c-core
  rmmod videodev
  (cd /usr/local/bin; ./pxc_load) > /tmp/out/pxc.out 2>&1

Regards,
Marius.

At 15:00 2002.05.13, Irem Stratmann wrote:
>Hi,
>
>I have some problems running pxc_xgrab and pxc_grab.
>I have installed the 0.81 Version, pxc_load and pxc_live etc. run well.
>But I can't grab any image.
>Actually I want to grab sequences of low-resolution sequences. Pxc_grab
>returns the system message
>'pxc_grab: /dev/pxc0pgm: getsequence: device is busy '
>
>What should i do to get it running? I know that the same card (PXC200)
>was running under pxc0.28 under Kernel 2.2.18 but now I changed to 2.4.0
>so I need help!
>  (the installation and memory allocation for DMA were completed
>successfully)
>
>
>Thanks,
>
>Irem
>_______________________________________________
>pxc mailing list
>pxc@lists.linux.it
>http://lists.linux.it/listinfo/pxc



From luislloret@visarcontrol.es  Fri May 31 10:46:30 2002
From: luislloret@visarcontrol.es (Luis Lloret)
Date: Fri, 31 May 2002 11:46:30 +0200
Subject: [pxc] how to maintain a capture queue
References: <3CDFB8F0.2EBE4F18@ais.fhg.de>
Message-ID: <000901c20888$142022a0$2217000a@VISAR>

Hi,
    I've read the documentation, but I'm not sure how to maintain a capture
queue of, say, 50 frames. The idea is to start capturing at any given
moment, then capture for about 50 images (with no loss), then stop capture
(no overwrite of previous buffers) and get a signal or something to let the
process know the secuence is over.


    We are using a pxc200L, with pxc0.81 drivers over Linux 2.4.16.

    Thanks in advance.



From rubini@gnu.org  Fri May 31 11:02:03 2002
From: rubini@gnu.org (Alessandro Rubini)
Date: Fri, 31 May 2002 12:02:03 +0200
Subject: [pxc] how to maintain a capture queue
In-Reply-To: <000901c20888$142022a0$2217000a@VISAR>
References: <000901c20888$142022a0$2217000a@VISAR>
Message-ID: <20020531120203.A8542@morgana.systemy.it>

>     I've read the documentation, but I'm not sure how to maintain a capture
> queue of, say, 50 frames. The idea is to start capturing at any given
> moment, then capture for about 50 images (with no loss), then stop capture
> (no overwrite of previous buffers) and get a signal or something to let the
> process know the secuence is over.

This is what pxc_grab does. However, the backend is currently not
working.  Fortunately (for you), I must do it for a client in a
relatively short time.  Meanwhile, I've installed 0.26 on a 2.2
kernel. 0.26 uses the old way to grab sequences, that was a quick hack
not really worth showing around.

/alessandro

From marius@tbs.co.za  Fri May 31 11:03:37 2002
From: marius@tbs.co.za (Marius van Wyk)
Date: Fri, 31 May 2002 12:03:37 +0200
Subject: [pxc] AGC on generic Bt and/or PXC200*
In-Reply-To: <20020429232151.A18671@morgana.systemy.it>
References: <3CCD7886.E2A34FEB@iri.upc.es>
 <3CCD7886.E2A34FEB@iri.upc.es>
Message-ID: <5.1.1.2.2.20020531115636.026ffa50@pop3.tbs.co.za>

How do I disable the Auto Gain Control (AGC) on my card?
(At the moment a generic Bt 878)

I've figured out that it is bit 6 on the SCLOOP register pair, and am 
assuming that I only have to switch it off.

Is there any way which I can control this from my program via ioctl calls?

Else I may need to rey and modify the driver, but am not sure where to code 
it in... (for instance when the card get's reset, I may need to clear it 
again etc.)

Any help wrt. this?

My application is such that I switch between different cameras faster  than 
the AGC can adapt, and I control the video 
level/saturation/brightness/contrast manually and explicitly. The AGC is 
only screwing things up.

Is there perhaps A WAY?
:)

Regards,
Marius.


From rubini@gnu.org  Fri May 31 11:18:43 2002
From: rubini@gnu.org (Alessandro Rubini)
Date: Fri, 31 May 2002 12:18:43 +0200
Subject: [pxc] AGC on generic Bt and/or PXC200*
In-Reply-To: <5.1.1.2.2.20020531115636.026ffa50@pop3.tbs.co.za>
References: <5.1.1.2.2.20020531115636.026ffa50@pop3.tbs.co.za>
Message-ID: <20020531121843.A8800@morgana.systemy.it>

> How do I disable the Auto Gain Control (AGC) on my card?
> (At the moment a generic Bt 878)

Same problem here with a generic 878.
 
> I've figured out that it is bit 6 on the SCLOOP register pair, and am 
> assuming that I only have to switch it off.

Interesting. Can you please send me more detailed infromation (possibly
offlist)? I'm very busy and I know I wouldn't set up to look for it.
 
> Is there any way which I can control this from my program via ioctl calls?

Currently not, but it's easily done. If I have the information already
cleaned up I can send a patch during next week.

> My application is such that I switch between different cameras
> faster than the AGC can adapt, and I control the video
> level/saturation/brightness/contrast manually and explicitly.

One idea I had (in reply to Daniel Senie's needs) was to have a set of
configurations per-grabber and per-camera (when using the mux), so
things are properly initialized at boot and switching the mux will
also fix that stuff.

I wanted to use a smart "humanreadable-to-bitdescription" engine like
the one I've dont for evacquo (ftp://ar.linux.it/pub/evacquo) but
never got the time and sufficient motivation to do it.

Would that still be interesting? Someone willing to sponsor it?

/alessandro

From rubini@gnu.org  Fri May 31 14:26:18 2002
From: rubini@gnu.org (Alessandro Rubini)
Date: Fri, 31 May 2002 15:26:18 +0200
Subject: [pxc] AGC on generic Bt and/or PXC200*
In-Reply-To: <5.1.1.2.2.20020531115636.026ffa50@pop3.tbs.co.za>
References: <5.1.1.2.2.20020531115636.026ffa50@pop3.tbs.co.za>
Message-ID: <20020531152618.A11404@morgana.systemy.it>

All-To: marius@tbs.co.za,pxc@lists.linux.it Re: [pxc] AGC on generic Bt and/or PXC200*
> From: Marius van Wyk <marius@tbs.co.za>
> To: Alessandro Rubini <rubini@gnu.org>
> Cc: pxc@lists.linux.it
> Subject: [pxc] AGC on generic Bt and/or PXC200*
> Date: Fri, 31 May 2002 12:03:37 +0200

> How do I disable the Auto Gain Control (AGC) on my card?
> (At the moment a generic Bt 878)
> 
> I've figured out that it is bit 6 on the SCLOOP register pair, and am 
> assuming that I only have to switch it off.

This is what pdftotext gives me:

 [6]        RW        0               CAGC
           This bit controls the Chroma AGC function. When enabled, 
    	   Chroma AGC will compensate for non-standard chroma levels. The 
    	   compensation is achieved by multiplying the incoming chroma sig-
    	   nal by a value in the range of 0.5 to 2.0.
    	      0        = Chroma AGC Disabled
    	      1        = Chroma AGC Enabled

Thus, I think this is chroma-related, not luma-related. It doesn't
seem the right parameter to me.

Actually, I've always thought the autogain I see in my 878 device is
the effect of external circuitry.  I'll try to change the adelay
parameter.

BTW: looks like I have a sponsor for per-camera configuration :)

> am not sure where to code it in...

If you want to make experiments, you might try my "phob" driver.  It
exports access to PCI devices so you can set or read hw registers even
if another driver is using it.

Or you can simply use mmap to access high memory, but be careful about
unsigned offsets (i.e., I found that "mapper.c", part of LDD2 sample
code, doesn't work with addresses in the 2G-4G range.  My copy is
fixed, and I think it's high time to release a new version of
ldd2-samples).

/alessandro

From rubini@gnu.org  Fri May 31 15:24:32 2002
From: rubini@gnu.org (Alessandro Rubini)
Date: Fri, 31 May 2002 16:24:32 +0200
Subject: [pxc] AGC on generic Bt and/or PXC200*
In-Reply-To: <20020531152618.A11404@morgana.systemy.it>
References: <20020531152618.A11404@morgana.systemy.it>
Message-ID: <20020531162432.A11887@morgana.systemy.it>

Since the sponsor asked for agc disabling too, and since my arm system
now happily boots, I found motivation and time to investigate the issue.

Now, CAGC has no effect on luma. Bit 4 of ADC interface register on
the other hand disables the AGC, but if it's disabled a reference
voltage is needed. To my understanding, the 878 auto-generates its
input reference voltage for the ADC, so when the camera is first
connected it's 0 and the image is saturated. This the description:

 [4]         RW       0               AGC_EN
        This bit controls the AGC function. If disabled REFOUT is not 
        driven, and an external reference voltage must be provided. If 
        enabled, REFOUT is driven to control the A/D reference voltage.
           0     = AGC enabled
           1     = AGC disabled

Disabling it I've a full-white image no matter what.
If you are curious, I'm using phob:

   rudo% ./phob_io /dev/phob/0 0:68
   read  4 bytes from '0':0x00000068 -- 0x00000082
   rudo% ./phob_io /dev/phob/0 0:68=92
   wrote 1 bytes to '0':0x00000068
   rudo% ./phob_io /dev/phob/0 0:68=82
   wrote 1 bytes to '0':0x00000068

[setting to 92 made the image white]

Changing bit 0 (that should make it adaptive or not) makes no
difference.  Seeting bit 2 make the image black.

So the answer is no: there is no way to turn off autogain in a plain-878
device. The external voltage reference (programmable, but external) is one
of the features that make the PXC200 better for real-world use as opposed
to the toy-878 devices.

Note that contrast and brightness control is independent of this
auto-gain.  Actually, my solution to this problem is adding
brightness/contrast controls to pxc_xgrab. It's a workaround rather
than a solution, but it's enough for my client in this case.

/alessandro

