bktr and GPIO
Achilleas Mantzios
achill at matrix.gatewaynet.com
Mon Oct 29 09:48:54 PDT 2007
Στις Παρασκευή 26 Οκτώβριος 2007 18:55, ο/η Mark Tinguely έγραψε:
> <delete>
>
> > 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
> >
> > */
>
> In your user program after compiling/booting kernel with BKTR_GPIO_ACCESS,
> all you should need to do is:
>
> #define BKTR_ZONEMINDER_ALARM1 0x040
> #define BKTR_ZONEMINDER_ALARM2 0x080
> #define BKTR_ZONEMINDER_ALARM3 0x200
> int value;
> if (ioctl(tuner, BT848_GPIO_GET_EN, &value) < 0)
> error();
> value |= BKTR_ZONEMINDER_ALARM1; /* or other alarm */
> if (ioctl(tuner, BT848_GPIO_SET_EN, &value) < 0)
> error();
>
> error()
> {
> perform some error routine and exit
> }
I was able to enable GPIO with
BT848_GPIO_SET_EN, and then write data to output and check the written value
with BT848_GPIO_SET_DATA, BT848_GPIO_GET_DATA.
Thanx.
>
> --Mark Tinguely
--
Achilleas Mantzios
More information about the freebsd-multimedia
mailing list