From owner-freebsd-multimedia Sun Nov 2 22:22:56 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA10312 for multimedia-outgoing; Sun, 2 Nov 1997 22:22:56 -0800 (PST) (envelope-from owner-freebsd-multimedia) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id WAA10307 for ; Sun, 2 Nov 1997 22:22:46 -0800 (PST) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id GAA17013; Mon, 3 Nov 1997 06:11:07 +0100 From: Luigi Rizzo Message-Id: <199711030511.GAA17013@labinfo.iet.unipi.it> Subject: A small addition to the bt848 driver... To: multimedia@freebsd.org Date: Mon, 3 Nov 1997 06:11:06 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-multimedia@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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/ _____________________________|______________________________________