bktr and GPIO
achill at matrix.gatewaynet.com
Fri Oct 26 08:27:43 PDT 2007
Στις Παρασκευή 26 Οκτώβριος 2007 16:59, ο/η Mark Tinguely έγραψε:
> (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,
In relation to bits assignments on LMLBT4M and LMLBT44 cards:
/* to allow access to GPIO bits for sensors input and
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 = 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 = (IN#(bktr, BKTR_GPIO_@@@@) & ~mask) | set;
> OUT#(bktr, BKTR_GPIO_@@@@, set); /* turn on relay "value" */
> 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).
#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
A little enlightment would be great!
> --Mark Tinguely
More information about the freebsd-multimedia