bktr and GPIO

Mark Tinguely tinguely at casselton.net
Fri Oct 26 08:55:51 PDT 2007


<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
}

--Mark Tinguely


More information about the freebsd-multimedia mailing list