Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2007 18:27:25 +0300
From:      Achilleas Mantzios <achill@matrix.gatewaynet.com>
To:        Mark Tinguely <tinguely@casselton.net>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: bktr and GPIO
Message-ID:  <200710261827.25933.achill@matrix.gatewaynet.com>
In-Reply-To: <200710261359.l9QDxFZh088302@casselton.net>
References:  <200710261359.l9QDxFZh088302@casselton.net>

next in thread | previous in thread | raw e-mail | index | archive | help
=CE=A3=CF=84=CE=B9=CF=82 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=
=CE=AE 26 =CE=9F=CE=BA=CF=84=CF=8E=CE=B2=CF=81=CE=B9=CE=BF=CF=82 2007 16:59=
, =CE=BF/=CE=B7 Mark Tinguely =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> (deleted information. He is interested in getting the Zoneminder bktr(8)
> based relays to work).
>
> >  I have some contact with the person who manufactures the cards and
> > writes the linux drivers, and he asked me if FreeBSD has access to bt878
> > GPIO, and said that it would be easy if so.
>
> You will need to know what values need to be writen to which register to
> enable the particular relay. In the kernel driver source program, add
> a new ioctl() so that you can enable this feature from the user program.

According to Vassili Leonov of LML,
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
In relation to bits assignments on LMLBT4M and LMLBT44 cards:

/* to allow access to GPIO bits for sensors input and
   alarms output

   GPIObit    | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
   assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1|   |   |

   IN - sensor inputs, INx - sensor inputs and TI XORed together
   O1,O2,O3 - alarm outputs (relays)

   GPIO bits should be enabled for outpus as follows:

   OUT ENABLE   1    1   0  . 1  1   0   0 . 0   0   0    0   =3D 0x6C0

*/

So the words are 11 bits long.

>
> The command inside the new ioctl() will probably look roughly like:
>
> #ifdef OPTIONAL_READ_OLD
> 	/* optionally may need to preserve some other settings */
> set =3D (IN#(bktr, BKTR_GPIO_@@@@) & ~mask) | set;
> #endif
> OUT#(bktr, BKTR_GPIO_@@@@, set);	/* turn on relay "value" */
>
>  where
>      mask   optional turn off bits
>       set   enable bits
> 	 #  is the size (B)yte, (W)ord, (L)ong
>        @@@@ is the register location (you probably will have to add a
> 	    define for this location into the header file).

Is=20

#define BKTR_GPIO_DMA_CTL               0x10C
#define BKTR_GPIO_OUT_EN                0x118
#define BKTR_GPIO_REG_INP               0x11C
#define BKTR_GPIO_DATA                  0x200

in /usr/src/sys/dev/bktr/bktr_reg.h any relevant to the above?
What to they represent?
Why i was able to call ioctl BT848_GPIO_* on /dev/tuner0 but=20
not /dev/bktr0?
A little enlightment would be great!

>
> --Mark Tinguely

=2D-=20
Achilleas Mantzios



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710261827.25933.achill>