Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Nov 1997 06:11:06 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        multimedia@freebsd.org
Subject:   A small addition to the bt848 driver...
Message-ID:  <199711030511.GAA17013@labinfo.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
Hi,

yesterday I added a small piece of code to my version of the bt848
driver. It is an ioctl() which allows you to read/write peripherals
hanging off the I2C bus of the Bt84 -- such as the tuner, the
EEPROM, and the Teletext decoder.

While I wrote this because am working on a teletext decode, i think
this ioctl () will be useful to debug boards with new tuners etc. so I
suggest it to be added in the standard driver.

I have put the code within function tuner_ioctl()

    static int
    tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct
    proc* pr )
    {

	...
        case BT848_I2CWR: /* XXX */
            { u_long par = *(u_long *)arg;
              u_char write = (par >> 24) & 0xff ;
              int i2c_addr = (par >> 16) & 0xff ;
              int i2c_port = (par >> 8) & 0xff ;
              u_long data = (par) & 0xff ;
  
              if (write) { 
                  i2cWrite( bktr, i2c_addr, i2c_port, data);
              } else {
                  data = i2cRead( bktr, i2c_addr);
              }
              *(u_long *)arg = (par & 0xffffff00) | ( data & 0xff );
            }   
            break;


and the definition of BT848_I2CWR is in /sys/i386/include/ioctl_bt848.h

    /* 
     * b7-b0:    data (read/write)
     * b15-b8:   internal peripheral register (write)   
     * b23-b16:  i2c addr (write)
     * b31-b24:  1 = write, 0 = read 
     */
    #define BT848_I2CWR     _IOWR('x', 57, u_long)    /* i2c read-write */

	Cheers
	Luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________




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