From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 04:41:13 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2164616A4CF for ; Sun, 24 Apr 2005 04:41:13 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F8C143D54 for ; Sun, 24 Apr 2005 04:41:12 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id C2A2D1F4630; Sat, 23 Apr 2005 21:41:11 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j3O4f9Wm016325; Sat, 23 Apr 2005 21:41:11 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <426B2363.3020909@elischer.org> Date: Sat, 23 Apr 2005 21:41:07 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050214 X-Accept-Language: en, hu MIME-Version: 1.0 To: Jacob Meuser References: <20050423232253.GA17807@puff.jakemsr.gom> In-Reply-To: <20050423232253.GA17807@puff.jakemsr.gom> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-multimedia@freebsd.org Subject: Re: patch for bktr(4): better luma notch filter ioctls X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 04:41:13 -0000 Jacob Meuser wrote: > the current luma notch interface does not jive with the datasheet, > and it really doesn't seem to work as expected. instead of changing > the bahaviour of the current ioctls and potentially breaking > programs, add new ioctls. > so we need some people with brooktree cards to confirm these patches work if they do, then we can commit them.. From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 04:42:35 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4093616A4CF for ; Sun, 24 Apr 2005 04:42:35 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17CE043D54 for ; Sun, 24 Apr 2005 04:42:35 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 0F5FC1F4605; Sat, 23 Apr 2005 21:42:35 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j3O4gY1e018075; Sat, 23 Apr 2005 21:42:34 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <426B23BA.6060206@elischer.org> Date: Sat, 23 Apr 2005 21:42:34 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050214 X-Accept-Language: en, hu MIME-Version: 1.0 To: Jacob Meuser References: <20050423225506.GA25461@puff.jakemsr.gom> In-Reply-To: <20050423225506.GA25461@puff.jakemsr.gom> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-multimedia@freebsd.org Subject: Re: patch for bktr(4): don't reset tuner on open/close X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 04:42:35 -0000 Jacob Meuser wrote: > the following is a patch that is in OpenBSD's bktr. > > the idea is to not reset the tuner device on open(2) and close(2). > > effects: > - don't need to hold /dev/tuner open to get audio. > - selected channelset won't get clobbered on open/close. IMO, the > current behaviour here is idiotic. the channelset has nothing to > do with the hardware. it is internally used by the driver. also, > this is IMO a much cleaner fix to the problems with V4L programs > not tuning properly because they never set the channelset. now > the correct channelset can be set at bootup with something like > bsdbktrtvtune or whatever, instead of rebuilding the kernel with > the default channelset hardcoded into the driver. > > BTW, I haven't tested this on FreeBSD at all. it might need some > tweaking. the diff is also set up so that BKTR_NO_OPEN_RESET must > be defined to enable it. ultimately, I think this should be the > default behaviour. > can you comment on what you mean by "V4L programs"? (since we don't have V4L on freeBSD (as such)) From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 05:29:43 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 64CF116A4CE for ; Sun, 24 Apr 2005 05:29:43 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by mx1.FreeBSD.org (Postfix) with SMTP id E024F43D2F for ; Sun, 24 Apr 2005 05:29:42 +0000 (GMT) (envelope-from jakemsr@jakemsr.com) Received: (qmail 24618 invoked from network); 24 Apr 2005 05:35:31 -0000 Received: from unknown (HELO puff.jakemsr.gom) (63.111.27.87) by mail231.csoft.net with SMTP; 24 Apr 2005 05:35:31 -0000 Received: (from jakemsr@jakemsr.com) by puff.jakemsr.gom (mini_sendmail/1.3.5 16nov2003); Sat, 23 Apr 2005 22:29:41 PDT (sender jakemsr@puff.jakemsr.gom) Date: Sat, 23 Apr 2005 22:29:41 -0700 From: Jacob Meuser To: freebsd-multimedia@freebsd.org Message-ID: <20050424052941.GA3339@puff.jakemsr.gom> Mail-Followup-To: freebsd-multimedia@freebsd.org References: <20050423225506.GA25461@puff.jakemsr.gom> <426B23BA.6060206@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <426B23BA.6060206@elischer.org> User-Agent: Mutt/1.4.2i Subject: Re: patch for bktr(4): don't reset tuner on open/close X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 05:29:43 -0000 On Sat, Apr 23, 2005 at 09:42:34PM -0700, Julian Elischer wrote: > Jacob Meuser wrote: > >the following is a patch that is in OpenBSD's bktr. > > > >the idea is to not reset the tuner device on open(2) and close(2). > > > >effects: > > - don't need to hold /dev/tuner open to get audio. > > - selected channelset won't get clobbered on open/close. IMO, the > > current behaviour here is idiotic. the channelset has nothing to > > do with the hardware. it is internally used by the driver. also, > > this is IMO a much cleaner fix to the problems with V4L programs > > not tuning properly because they never set the channelset. now > > the correct channelset can be set at bootup with something like > > bsdbktrtvtune or whatever, instead of rebuilding the kernel with > > the default channelset hardcoded into the driver. > > > >BTW, I haven't tested this on FreeBSD at all. it might need some > >tweaking. the diff is also set up so that BKTR_NO_OPEN_RESET must > >be defined to enable it. ultimately, I think this should be the > >default behaviour. > > > > > can you comment on what you mean by "V4L programs"? > (since we don't have V4L on freeBSD (as such)) mplayer, xawtv, etc. I guess what I meant was programs that were originally for V4L and then ported (with some pieces missing). the bktr interface is not very intuitive, and it's pretty easy, IMO, to understand why some projects that were ported from V4L to bktr don't do things quite right. probably the most common issue is with tuning via TVTUNER_SETFREQ. on the surface this looks like VIDIOCSFREQ or VIDIOC_S_FREQUENCY. however, bktr uses it's internal channelset to calculate carrier offset, etc. this does not happen in the linux bttv driver. as a result, programs like mplayer and xawtv never set the channelset. for mplayer, allowing a user to choose the channelset (because remember, as it is now, the channelset gets reset to the default everytime the tuner is opened) would require another option. xawtv has a menu box for selecting the channelset. however, the action of changing the channelset doesn't do anything but update the list pointer. the less intrusive fix would be to add TVTUNER_SETTYPE before each TVTUNER_SETFREQ. otherwise a new action would have to be added to xawtv (which I have patches for. but of course, they are for xawtv-3.x, which is now obsolete ...). also, there is (was) no documentation for bktr ioctls. some was recently added to the OpenBSD bktr manpage. your meteor(4) explains some of the METEOR_ ioctls, but it seems there are differences and some of the stuff it talks about was apparently never implemented in bktr(4)? -- From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 05:32:49 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED4A916A4CE for ; Sun, 24 Apr 2005 05:32:49 +0000 (GMT) Received: from t-mta3.odn.ne.jp (mfep3.odn.ne.jp [143.90.131.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1AFE43D39 for ; Sun, 24 Apr 2005 05:32:48 +0000 (GMT) (envelope-from kazuhito@ph.noda.tus.ac.jp) Received: from localhost ([211.121.96.191]) by t-mta3.odn.ne.jp with ESMTP id <20050424053247526.TXJO.496069.t-mta3.odn.ne.jp@mta3.odn.ne.jp>; Sun, 24 Apr 2005 14:32:47 +0900 Date: Sun, 24 Apr 2005 14:32:47 +0900 (JST) Message-Id: <20050424.143247.846931806.kazuhito@ph.noda.tus.ac.jp> To: tlhingan1@optonline.net From: Kazuhito HONDA In-Reply-To: <200504231701.58220.tlhingan1@optonline.net> References: <200504231701.58220.tlhingan1@optonline.net> X-Mailer: Mew version 3.3 on XEmacs 21.4.17 (Jumbo Shrimp) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: multimedia@FreeBSD.org Subject: Re: need help w/logitech 350 usb headset on 5.3-Stable X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 05:32:50 -0000 Hello, USB audio driver are suddenly improved by a few earnest developers, recently. So it becomes useful, but it still has some problem. Especially, a full duplex problem --concerned with USB headset-- just start researching. (It was described in arguments with Artem Ignatiev at this mailing-list. But they have not uploaded in FreeBSD web page yet.) You should check below: 1. You should use FreeBSD-stable or -current. You can't record with old FreeBSD. kernels for recording is FreeBSD-4-stable after Apr 23 FreeBSD-5-stable after Apr 16 FreeBSD-current after Apr 14. But there are fixes after that, you should use the latest codes. Released FreeBSDs don't have the codes for recording and the latest fixes. 2. You had better know sampling rates of your headset. USB audio can't be used with a wrong sampling rate now. it is 48000 Hz in almost cases, and 44100 Hz sometime. 3. Is your USB controller ohci or uhci? uhci has no problem. But ohci has the full duplex problem. microphone and speaker can't be use simultaneously without full duplex. Then a USB headset can't be use with ohci. But if you want to use it as headphone only, or microphone only, ohci has no problem. 3'.If you want to use microphone and speaker simultaneously with uhci, you must comment-out below lines at function uaudio_init_params() in uaudio.c if ((sc->sc_playchan.pipe != NULL) || (sc->sc_recchan.pipe != NULL)) return (-1); Sincerely, Kazuhito HONDA From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 07:19:20 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9BFA16A4CE for ; Sun, 24 Apr 2005 07:19:20 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDAE843D46 for ; Sun, 24 Apr 2005 07:19:19 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 97A1A1F1326; Sun, 24 Apr 2005 00:19:19 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j3O7JIrL036565; Sun, 24 Apr 2005 00:19:19 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <426B4876.6020307@elischer.org> Date: Sun, 24 Apr 2005 00:19:18 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050214 X-Accept-Language: en, hu MIME-Version: 1.0 To: Jacob Meuser References: <20050423225506.GA25461@puff.jakemsr.gom> <426B23BA.6060206@elischer.org> <20050424052941.GA3339@puff.jakemsr.gom> In-Reply-To: <20050424052941.GA3339@puff.jakemsr.gom> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit cc: freebsd-multimedia@freebsd.org Subject: Re: patch for bktr(4): don't reset tuner on open/close X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 07:19:20 -0000 Jacob Meuser wrote: > On Sat, Apr 23, 2005 at 09:42:34PM -0700, Julian Elischer wrote: > >>Jacob Meuser wrote: >> >>>the following is a patch that is in OpenBSD's bktr. >>> >>>the idea is to not reset the tuner device on open(2) and close(2). >>> >>>effects: >>> - don't need to hold /dev/tuner open to get audio. >>> - selected channelset won't get clobbered on open/close. IMO, the >>> current behaviour here is idiotic. the channelset has nothing to >>> do with the hardware. it is internally used by the driver. also, >>> this is IMO a much cleaner fix to the problems with V4L programs >>> not tuning properly because they never set the channelset. now >>> the correct channelset can be set at bootup with something like >>> bsdbktrtvtune or whatever, instead of rebuilding the kernel with >>> the default channelset hardcoded into the driver. >>> >>>BTW, I haven't tested this on FreeBSD at all. it might need some >>>tweaking. the diff is also set up so that BKTR_NO_OPEN_RESET must >>>be defined to enable it. ultimately, I think this should be the >>>default behaviour. >>> >> >> >>can you comment on what you mean by "V4L programs"? >>(since we don't have V4L on freeBSD (as such)) > > > mplayer, xawtv, etc. I guess what I meant was programs that were > originally for V4L and then ported (with some pieces missing). > > the bktr interface is not very intuitive, and it's pretty easy, IMO, > to understand why some projects that were ported from V4L to bktr > don't do things quite right. > > probably the most common issue is with tuning via TVTUNER_SETFREQ. > on the surface this looks like VIDIOCSFREQ or VIDIOC_S_FREQUENCY. > however, bktr uses it's internal channelset to calculate carrier > offset, etc. this does not happen in the linux bttv driver. > as a result, programs like mplayer and xawtv never set the > channelset. for mplayer, allowing a user to choose the channelset > (because remember, as it is now, the channelset gets reset to the > default everytime the tuner is opened) would require another option. > xawtv has a menu box for selecting the channelset. however, the > action of changing the channelset doesn't do anything but update > the list pointer. the less intrusive fix would be to add > TVTUNER_SETTYPE before each TVTUNER_SETFREQ. otherwise a new > action would have to be added to xawtv (which I have patches for. > but of course, they are for xawtv-3.x, which is now obsolete ...). > > also, there is (was) no documentation for bktr ioctls. some was > recently added to the OpenBSD bktr manpage. your meteor(4) explains > some of the METEOR_ ioctls, but it seems there are differences and > some of the stuff it talks about was apparently never implemented > in bktr(4)? > ok. I was just checking that there wasn't more V4L work going on that I wasn't aware of.. So far I know of the following: We have a largely working port of the V4L2 basic interface by Christian Gusenbauer and the V4L and V4L2 authors have indicated to me that we are welcome to copy the interface spec (read include files) so I think we'll end up with a V4L interface ourselves.. I've looked at the code and it looks like a good starting point. I'm in the process of ponderring whether we can take that interface and provide a real framework for video that uses that interface as one of the ways in/out of it. (see later) Luis López Solé, and Tomomi Suzuki are apparently active in this field and Stacey Son has been mentionned similarly. Hopefully we can make something that makes teh V4L interface look a bit half hearted, while maintaining compatibility with it. If we are good enough at doing that we may even be able to give it back the Linux guys as a thankyou for the headstart. My basic thoughts keep coming back to the fact that there is no starndard abstraction for a full Multimedia stream. A full stream has multiple channels, some of which may contain video and some of which may contain audio. These in turn may have subchannels and alternative format channels, while all the time maintaining time synchronisation between these various parts. For example there could be a stream with 2 video channels and 5 track audio. The video could in turn be available in mpeg4 and raw at the same time, and the audio might be available in raw and mp3. In addition there could be a synchronous data stream (e.g. a digital whiteboard session) that is also to be synchronised with this (like the old multicast 'wb' program), so that you could play back a recording of a meeting or use it to send/record a videoconference, including the whiteboard doodles, at the correct pace. In addition there needs to be a way to specify readers and writers to these streams where a writer might be writing asynchronously (e.g. reading as fast as it can from a recording file) but the reader is working synchronously (sending the video and audio out to be viewed), or it could be the other way around, where a synchronous source (a camera/microphone) is sending to a reader that is async in nature (being recorded to disk). In fact some cases the more difficult situation is the case of 2 synchronous entities working together.. And what do we do if there needs to be a format conversion between them? and what about if the source is a webcam doing 15 fps and teh sync is a TV broadcast reading at 25 or 30 fps? In my opinion the framework needs to take all this into account and I believe it is possible. Puting a V4L frontend/backend on it is just the easy part. From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 07:22:48 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B88F16A4CE for ; Sun, 24 Apr 2005 07:22:48 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C98143D5D for ; Sun, 24 Apr 2005 07:22:48 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id EFA3A1F46C7; Sun, 24 Apr 2005 00:22:47 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j3O7MkOj039924; Sun, 24 Apr 2005 00:22:46 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <426B4943.7010201@elischer.org> Date: Sun, 24 Apr 2005 00:22:43 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050214 X-Accept-Language: en, hu MIME-Version: 1.0 To: Kazuhito HONDA References: <200504231701.58220.tlhingan1@optonline.net> <20050424.143247.846931806.kazuhito@ph.noda.tus.ac.jp> In-Reply-To: <20050424.143247.846931806.kazuhito@ph.noda.tus.ac.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: tlhingan1@optonline.net cc: multimedia@freebsd.org Subject: Re: need help w/logitech 350 usb headset on 5.3-Stable X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 07:22:48 -0000 Kazuhito HONDA wrote: > > 3. Is your USB controller ohci or uhci? > uhci has no problem. But ohci has the full duplex problem. > microphone and speaker can't be use simultaneously without full duplex. > Then a USB headset can't be use with ohci. Has anyone tried ehci (with a 2.0 speed translating hub)? > > But if you want to use it as headphone only, or microphone only, > ohci has no problem. > From owner-freebsd-multimedia@FreeBSD.ORG Sun Apr 24 15:44:34 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F238516A4CE for ; Sun, 24 Apr 2005 15:44:33 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 24D9643D46 for ; Sun, 24 Apr 2005 15:44:33 +0000 (GMT) (envelope-from cronopiolopez@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so1060040wra for ; Sun, 24 Apr 2005 08:44:29 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=hi5+Skky3ZqYDtoHlcRla9Cxfnvo87Cuv0MbAa0UjyoqdJcLP674SIA6WtKnzKD1B+ZTfX6bIVFL7sQv+A4VX4Iqyyghp0RhaPSNo/sCmAMK/nRd0LwjT3iD1NU9g/q9VIUtYRz0V6trIxNAvwtLT3RPqGHNj8SXcOSrAkaKxIU= Received: by 10.54.10.67 with SMTP id 67mr1467430wrj; Sun, 24 Apr 2005 08:44:29 -0700 (PDT) Received: by 10.54.32.71 with HTTP; Sun, 24 Apr 2005 08:44:29 -0700 (PDT) Message-ID: <8f8eb53e0504240844220ea350@mail.gmail.com> Date: Sun, 24 Apr 2005 17:44:29 +0200 From: =?ISO-8859-1?Q?Lluis_L=F3pez?= To: freebsd-multimedia@freebsd.org In-Reply-To: <426B4876.6020307@elischer.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_536_15114077.1114357469568" References: <20050423225506.GA25461@puff.jakemsr.gom> <426B23BA.6060206@elischer.org> <20050424052941.GA3339@puff.jakemsr.gom> <426B4876.6020307@elischer.org> X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: Re: patch for bktr(4): don't reset tuner on open/close X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: =?ISO-8859-1?Q?Lluis_L=F3pez?= List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 15:44:34 -0000 ------=_Part_536_15114077.1114357469568 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/24/05, Julian Elischer wrote: > > Luis L=F3pez Sol=E9, and Tomomi Suzuki are apparently active in this fiel= d > and Stacey Son has been mentionned similarly. Answer for alusions. My work (see attach) is a port to Hauppauge pvr250/350 of work make by Tomomi Suzuki. His work is more card dependent and only work with YUAN and IO-DATA cards. This cards have more capabilities don't supported by Hauppauge cards (Ghost reducer chip, YC/3D audio and support for other devices like saa7173 video decoder and new two audio chips). Ported features are: - complete encoder interface, new (and more completed) video controls and v4l2 interface. The new controls and all ioctl interface (except v4l2) are tuned via /dev/cxm0.ctl device. - A GUI application for control all this (see in tools/cxm_controler/readme.txt in source), this allows live time switching channels, inputs or profile encoder types (only between profiles with the same resolution). -Some addeds for me: some new profiles in codec_profiles, this are based in stream types of ivtv.h, but values are me decision and accept suggestions for correct values. Two new sysctl's for fix tuner and audio chip, but I think don't work properly (need some help in tuner and audio loads). This driver is tested in my home machine. This have a pvr250 rev2 and pvr350 rev1 in both seems work well. In v4l2 question. In code (see cxm_ioctl and cxm.c -starts on line 5866-) seems this takes a Mike Son v4l2 interface wtih some addeds. This have a v4l2 interface mapped on /dev/cxm0.v4l2 device, you can enable this via sysctl command: # sysctl -w hw.cxm0.tuner.v4l2_crtl=3D1 I don't have time for testing this issues but # file -s /dev/cxm0.v4l2 reports: /dev/cxm0.v4l2: MPEG system stream data. The great problem is that all aplications don't enable v4l interface because don't find apropiate header files in path. If somebody wants to test this driver follow the next steps: 1. You need a cxm driver working on your machine. For security reason you want backup your old modules in /boot/kernel.old/ and (if yuo have) coment lines cxm_iic_load=3D"YES" cxm_load=3D"YES" in your loader.conf 2. More warnings. If you have a kernel with: device smbus device smb device iic device iicsmb Coment this lines and recompiles and loads a new kernel (if take this option backup of modules are automatic). If not, if some of devices isn't supported expects hangs and dirty reboots. In this case (or if simple don't work) you can send me a dmesg -a|grep cxm and pciconf -lv output of the old driver (multimedia/pvr250) and If I can, add support for you. In this moment only PHILIPS FQ1216ME and Microtune 4049 FM5 are unsupported. Finally if all works you can uncomment this lines and recompile again. 3. Compile and test: # cd /tmp #tar zxvf /path/to/ivtv4bsd-alpha.tar.gz #cd ivtv4bsd/ #make #cp modules/cxm/cxm/cxm.ko modules/cxm/cxm_iic/cxm_iic.ko /boot/kernel/ #kldunload cxm #kldunload cxm_iic #kldload cxm_iic #kldload cxm And next type dmesg|grep cxm and you see something like this: cxm0: mem 0xd8000000-0xdbffffff irq 18 at device 2.0 on pci2 cxm0: pcib2: device cxm0 requested decoded memory range 0xd8000000-0xdbffffff cxm_iic0: on cxm0 iicbb0: on cxm_iic0 cxm0: Philips FM1216 tuner cxm0: SAA7115 rev 1 video decoder cxm0: MSP4418G-A2 audio decoder cxm0: IR Remote cxm0: [GIANT-LOCKED] cxm0: encoder firmware version 0x2040024 cxm0: decoder firmware version 0x2020023 cxm1: mem 0xd4000000-0xd7ffffff irq 19 at device 3.0 on pci2 cxm1: pcib2: device cxm1 requested decoded memory range 0xd4000000-0xd7ffffff cxm_iic1: on cxm1 iicbb1: on cxm_iic1 cxm1: Philips FM1216 tuner cxm1: SAA7115 rev 1 video decoder cxm1: MSP4418G-A2 audio decoder cxm1: IR Remote cxm1: [GIANT-LOCKED] 4. Applications. cd to tools directory and type make. Only cxm_ctl, cxm_show_props and probe_saa7115 works for Hauppage. After you can cd to cxm_controler directory and see readme.txt (cxm_controler needs gtk2 libs). LAST NOTES 1. Problems with NICAM supports. I need remove NICAM audio support in cxm_audio.c, if not live switch between channels don't works properly and all tuner stations don't have sound. When removes NICAM supports all works properly, but some channels don't have sound (for exemple 37 in bg pal standard). 2. The Default profile is dvd_s1_pal. You can change this via cxm_ctl or via cxm_controler. This profile specs: 720x576 res. 4 Mb/s video bitrate and 384 kb/s Layer II mp2 audio. 3. Number of channels of tuners needs a revision. I put 1 to 125 but I'm sure this aren't correct values. And last. I'm not a programmer only a librarian formed via RTFM and this works for me but i'm not sure if works for you. I only promise my limitaded help. Test with care. Luis L=F3pez Sol=E9. ------=_Part_536_15114077.1114357469568-- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 00:36:42 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B811916A4CE for ; Mon, 25 Apr 2005 00:36:42 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C41343D1D for ; Mon, 25 Apr 2005 00:36:42 +0000 (GMT) (envelope-from lioux@uol.com.br) Received: from 200.140.3.246 (unknown [200.140.3.246]) by vette.gigo.com (Postfix) with ESMTP id C98D85477 for ; Sun, 24 Apr 2005 17:36:40 -0700 (PDT) Received: (qmail 96504 invoked by uid 1001); 25 Apr 2005 00:33:23 -0000 Message-ID: <20050425003323.96480.qmail@exxodus.fedaykin.here> Date: Sun, 24 Apr 2005 21:33:01 -0300 From: Mario Sergio Fujikawa Ferreira To: Yuriy Tsibizov References: <20050423060326.77136.qmail@exxodus.fedaykin.here> <20050423111641.C1642@free.home.local> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <20050423111641.C1642@free.home.local> User-Agent: Mutt/1.5.9i cc: FreeBSD-multimedia@FreeBSD.org Subject: Re: Help with TV capture (mplayer/brooktree/audigy) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 00:36:42 -0000 --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 23, 2005 at 05:07:52PM +0400, Yuriy Tsibizov wrote: [snip] > You should also try to set other 'mixer' levels (except master, rec & > pcm) to zero. This can produce more clean sound. [snip] > Can you try to connect your sound source into line input? Mic input can > have only mono ADC. Okay, these are the settings that are working. I connected my sound source to the line input. I set all mixers to 0 but the only I really needed to get it to work. So you can use only those and get a clear sound input. $ mixer Recording source: line1 Mixer vol is currently set to 64:64 Mixer pcm is currently set to 81:81 Mixer speaker is currently set to 0:0 Mixer line is currently set to 100:100 Mixer mic is currently set to 0:0 Mixer cd is currently set to 0:0 Mixer rec is currently set to 100:100 Mixer ogain is currently set to 0:0 Mixer line1 is currently set to 0:0 Mixer phin is currently set to 0:0 Mixer phout is currently set to 0:0 Mixer video is currently set to 0:0 Just the same with emuctrl. I am using the minimum options required. $ emuctrl list Id Description Vol RecVol FX (PCM) buses fx0 DSP FX BUS 0 83:83 (0:0) DSP Inputs in0 AC97 Codec 0:0 (100:100) in1 CD S/PDIF 0:0 (0:0) in2 Optical S/PDIF 0:0 (0:0) in3 0x06 0:0 (0:0) in4 Line-In (2) 0:0 (0:0) in5 Coaxial S/PDIF 0:0 (0:0) in6 AUX2 0:0 (0:0) in7 0x0E 0:0 (0:0) DSP Outputs out0 DIGITAL: Front 0:0 out1 DIGITAL: Center 0 out2 DIGITAL: Subwoofer 0 out3 Headphones 100:100 out4 DIGITAL: Rear 0:0 out5 Front 100:100 out6 Center 100 out7 Subwoofer 100 out8 Side 0:0 out9 Rear 100:100 out10 AC97 ?? 0:0 out11 0x12 0:0 out12 0x14 0:0 out13 A/D converter (REC) 100:100 out14 0x18 0:0 out15 0x1A 0:0 out16 0x1C 0:0 out17 0x1E 0:0 > Does it produce better sound than recoding from AC97 mic? Yes, line input produces excellent quality. It would be nice if you added those figures above to the FAQ. :) Let me know if you want me to test anything. I would really like to be of assistance. Thanks a lot for everybody's help. Just one question remains. My video input is /dev/bktr0 alas my audio input is /dev/audio0.1. How do I get mplayer to record both audio and video at the same time from different sources? mplayer(1) man page mentions a "adevice=3Dfile" option but mplayer complains it does not exist. This works without audio just fine $ mplayer -tv driver=3Dbsdbt848:noaudio:width=3D640:height=3D480:input=3D0:= norm=3Dntsc tv:// But this doesn't. $ mplayer -tv driver=3Dbsdbt848:adevice=3D/dev/audio0.1:width=3D640:height= =3D480:input=3D0:norm=3Dntsc tv:// MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team CPU: Advanced Micro Devices Athlon MP/XP/XP-M Barton (Family: 6, Stepping: = 0) Detected cache-line size is 64 bytes CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0 Compiled with runtime CPU detection - WARNING - this is not optimal! To get best performance, recompile MPlayer with --disable-runtime-cpudetect= ion. Option tv: Unknown suboption adevice In case you're wondering if audio0.1 works $ ls -l /dev/audio0.1 crw-rw-rw- 1 root wheel 30, 0x00010004 Apr 18 01:24 /dev/audio0.1 Using wavrec works just fine so I know the audio input device is sound. $ wavrec -d /dev/audio0.1 test.wav Any help is appreciated. Oh, in case you guys want to use my sample of mplayer 1.0pre7, it can be found at http://people.FreeBSD.org/~lioux/mplayer.tgz It is not a final version but it is working just fine for me. Regards, --=20 Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCbDrTrxEiaFLzGQwRArSeAJ9BL8bYQr+uM25E3jtRCDmv716DaACfZ9V8 yrvCvw00jmXuoX3rHrmD0+E= =TJbn -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/-- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 02:21:49 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F84316A4CE for ; Mon, 25 Apr 2005 02:21:49 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F01343D46 for ; Mon, 25 Apr 2005 02:21:48 +0000 (GMT) (envelope-from lioux@uol.com.br) Received: from 200.140.3.246 (unknown [200.140.3.246]) by vette.gigo.com (Postfix) with ESMTP id 67730546C for ; Sun, 24 Apr 2005 19:21:47 -0700 (PDT) Received: (qmail 48778 invoked by uid 1001); 25 Apr 2005 02:10:58 -0000 Message-ID: <20050425021058.48738.qmail@exxodus.fedaykin.here> Date: Sun, 24 Apr 2005 23:10:36 -0300 From: Mario Sergio Fujikawa Ferreira To: freebsd-multimedia@freebsd.org References: <20050421021909.28497.qmail@exxodus.fedaykin.here> <20050421102551.12ebb916.steve@sohara.org> <20050421095950.GB3188@puff.jakemsr.gom> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <20050421095950.GB3188@puff.jakemsr.gom> User-Agent: Mutt/1.5.9i Subject: Re: Help with TV capture (mplayer/brooktree/audigy) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 02:21:49 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 21, 2005 at 02:59:28AM -0700, Jacob Meuser wrote: > On Thu, Apr 21, 2005 at 10:25:51AM +0100, Steve O'Hara-Smith wrote: >=20 > > > 2) Every few seconds the video stream seems to choke; thus, > > > giving me an effect similar to the famous interlaced "blinders > > > effect" so I added a deinterlacer filter > >=20 > > Sync detection problems perhaps. >=20 > this can be tweaked a bit. >=20 > look for SYNC_LEVEL in the driver. try ADC_CRUSH instead of ADC_SYNC_T. >=20 > to me, it is a bit less interlaced looking. the linux bttv uses either > ADC_CRUSH or 0 for this, BTW. I'm building a kernel right now with this modification to /usr/src/sys/dev/bktr/bktr_core.c Any other indications on what we could do INSIDE the driver to make more reliable, some improvements at the signal handling...etc? I am not advocating adding a ring buffer there since that it is more appropriate for application level than kernel driver interface. Though it is alwaays something to propose in both FreeBSD-arch and FreeBSD-multimedia I am open for suggestions. Let me know if there are other hacks you think would be helpful. Regards. --=20 Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCbFGyrxEiaFLzGQwRAlEdAJ9DV2GtUkpFMfUK8ho6MCgZRej60wCfQxyT EZ7JQkxqHAJJO538pbwZ528= =WJnt -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 02:38:46 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D55C16A4CE for ; Mon, 25 Apr 2005 02:38:46 +0000 (GMT) Received: from parse.com (ottawa-hs-206-191-28-202.s-ip.magma.ca [206.191.28.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3C5143D45 for ; Mon, 25 Apr 2005 02:38:45 +0000 (GMT) (envelope-from root@parse.com) Received: (from root@localhost) by parse.com (8.8.8/8.8.8) id WAA25506 for freebsd-multimedia@freebsd.org; Sun, 24 Apr 2005 22:38:45 -0400 Message-Id: <200504250238.WAA25506@parse.com> To: freebsd-multimedia@freebsd.org Date: Sun, 24 Apr 2005 22:38:45 -0400 (EDT) From: "Robert Krten" X-Mailer: ELM [version 2.5 PL1] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: Is it MIDI yet? (fwd) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 02:38:46 -0000 > On Feb 11, Joel Ray Holveck wrote: > > I've been holding off on going to 5.3 because the MIDI driver > > evaporated. I'm getting a bit tired of waiting. I know that nobody > > owes me anything when it comes to FreeBSD, but you can understand that > > I'm a bit frustrated. > > > > What happened to the new framework? Why was the old framework removed? > > Should it be re-added, until the new one is finished? > > I'm the guy working on Midi and I just got back to it. My > available time fluctuates, and I've been busy, sick, etc, etc. > Anyway, previosuly, the MIDI that was removed did not with any cards > (that I know of) other than CSA. So I don't think there is any point > in being frustrated with its removal. Also, I've posted a few times > to the list a replacement that you can test if you have either a > soundblaster live or a es137x. Present problems including broken > sound recording and no-AMD64. > > I plan to have a cross-compilable version available this > weekend. Hi Mat et al., My motherboard claims to have an MPU401-compatible midi port on it, and I'm wondering if the stuff you've done will work with that? If so, I'd be happy to be a trial tester of the new stuff. If not, can you tell me if the old framework would work with that h/w, and, if so, how I'd go about enabling it? I've pulled down all the CVS files that I can think of dating back to 10 months ago, but it still doesn't work (he said, vaguely). It (midi.c, mpu.c) compiles (with tweaks for dev_t -> struct cdev* etc.); the sequencer.c doesn't compile yet (a few warnings left), but my device never shows up in /dev, nor is there any message in dmesg about it. This is on an i386. Suggestions? Do you recall what I need to put into my conf file, is just "device midi" sufficient, or are there other things? Thanks in advance! Cheers, -RK -- Robert Krten, PARSE Software Devices +1 613 599 8316. Realtime Systems Architecture, Consulting, Books and Training at www.parse.com Looking for Digital Equipment Corp. PDP-1 through PDP-15 minicomputers! From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 07:50:21 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D84A16A4CE for ; Mon, 25 Apr 2005 07:50:21 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by mx1.FreeBSD.org (Postfix) with SMTP id E355443D31 for ; Mon, 25 Apr 2005 07:50:20 +0000 (GMT) (envelope-from jakemsr@jakemsr.com) Received: (qmail 16026 invoked from network); 25 Apr 2005 07:56:12 -0000 Received: from unknown (HELO puff.jakemsr.gom) (63.111.27.87) by mail231.csoft.net with SMTP; 25 Apr 2005 07:56:12 -0000 Received: (from jakemsr@jakemsr.com) by puff.jakemsr.gom (mini_sendmail/1.3.5 16nov2003); Mon, 25 Apr 2005 00:50:19 PDT (sender jakemsr@puff.jakemsr.gom) Date: Mon, 25 Apr 2005 00:50:19 -0700 From: Jacob Meuser To: freebsd-multimedia@freebsd.org Message-ID: <20050425075019.GA1378@puff.jakemsr.gom> Mail-Followup-To: freebsd-multimedia@freebsd.org References: <20050421021909.28497.qmail@exxodus.fedaykin.here> <20050421102551.12ebb916.steve@sohara.org> <20050421095950.GB3188@puff.jakemsr.gom> <20050425021058.48738.qmail@exxodus.fedaykin.here> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050425021058.48738.qmail@exxodus.fedaykin.here> User-Agent: Mutt/1.4.2i Subject: Re: Help with TV capture (mplayer/brooktree/audigy) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 07:50:21 -0000 On Sun, Apr 24, 2005 at 11:10:36PM -0300, Mario Sergio Fujikawa Ferreira wrote: > On Thu, Apr 21, 2005 at 02:59:28AM -0700, Jacob Meuser wrote: > > On Thu, Apr 21, 2005 at 10:25:51AM +0100, Steve O'Hara-Smith wrote: > > > > > > 2) Every few seconds the video stream seems to choke; thus, > > > > giving me an effect similar to the famous interlaced "blinders > > > > effect" so I added a deinterlacer filter > > > > > > Sync detection problems perhaps. > > > > this can be tweaked a bit. > > > > look for SYNC_LEVEL in the driver. try ADC_CRUSH instead of ADC_SYNC_T. > > > > to me, it is a bit less interlaced looking. the linux bttv uses either > > ADC_CRUSH or 0 for this, BTW. > > I'm building a kernel right now with this modification to > > /usr/src/sys/dev/bktr/bktr_core.c > > Any other indications on what we could do INSIDE the driver > to make more reliable, some improvements at the signal handling...etc? compare the RISC routines to the bttv (linux) and btwincap (windows) drivers. there are some differences. for example, the chroma comb filter appears to be implemented a bit differently in bttv as compared to bktr. however, I don't have any specific suggestions; I really don't know much about RISC programming. > I am not advocating adding a ring buffer there since that > it is more appropriate for application level than kernel driver > interface. Though it is alwaays something to propose in both > FreeBSD-arch and FreeBSD-multimedia the original meteor(4) had one. there are definitions in ioctl_meteor.h for the interface. there's a kernel option to allocate memory for the buffers. but it doesn't exist. I agree though, that whether this belongs in kernel- or user-space is debatable. I would imaging Julian's plans will require some kind of bufferring, if for nothing but sync correction. > I am open for suggestions. Let me know if there are other > hacks you think would be helpful. I'll have to learn RISC first ;) -- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 08:48:47 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D1E616A4D0 for ; Mon, 25 Apr 2005 08:48:47 +0000 (GMT) Received: from sohara.org (sohara.org [192.220.64.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id A13DA43D62 for ; Mon, 25 Apr 2005 08:48:46 +0000 (GMT) (envelope-from steve@sohara.org) Received: (qmail 55243 invoked by uid 16563); 25 Apr 2005 08:48:45 -0000 Received: from unknown (HELO STEVEOHS-LT) ([217.12.14.240]) (envelope-sender ) by 192.220.64.179 (qmail-ldap-1.03) with SMTP for ; 25 Apr 2005 08:48:45 -0000 Date: Mon, 25 Apr 2005 09:48:46 +0100 From: Steve O'Hara-Smith To: Mario Sergio Fujikawa Ferreira Message-Id: <20050425094846.32d60013.steve@sohara.org> In-Reply-To: <20050423063848.67278.qmail@exxodus.fedaykin.here> References: <20050421021909.28497.qmail@exxodus.fedaykin.here> <20050421102551.12ebb916.steve@sohara.org> <20050421163426.96546.qmail@exxodus.fedaykin.here> <20050422095554.35a3ff26.steve@sohara.org> <20050423063848.67278.qmail@exxodus.fedaykin.here> Organization: Steve O'Hara-Smith X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-interix3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: FreeBSD-multimedia@FreeBSD.org Subject: Re: Help with TV capture (mplayer/brooktree/audigy) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 08:48:47 -0000 On Sat, 23 Apr 2005 03:38:26 -0300 Mario Sergio Fujikawa Ferreira wrote: > I'just tried using VCR's RCA<->RCA cable I had lying around. > They are good grade custom made. Image improvement was not noticeable :( OK scratch that idea. > > Well I was hoping you could use an input that didn't require sync > > separation. Other than that the tweaks Jacob Meuser suggested are well > > worth trying. > > Well, if you think it is worth it. I'll order tomorrow > custom made 3 ways shielded cabling with "gold" platet male RCA > connectors. 1 for video and 2 for stereo audio (L/R). I wouldn't bother I've never noticed any improvement with cables like that - except to the vendors bank balance :) > I am still having choking effetcs and, despite, the improvement that I can now record with audigy2; > I have no idea how to tell mplayer to use the proper device :) > > I tried using adevice but it complained hardly For watching TV I usually tell mplayer not to do the audio (-noaudio IIRC - I'm not at my box) and just set the mixer controls so that I can hear it. For recording TV I use ffmpeg. As for the issue of signals - last I checked mplayer had similar grab code to ffmpeg to catch overdue signals. Try a recording with ffmpeg - if it's much better then something bad has happened to the mplayer grab code. If you get a lot of SLEPT messages on stderr then that will be a sure sign of poor sync detection. > I have a sample video using the following options. Let me > know what you think. In case you wonder about copyright issues. I'll watch it tonight - I'm at work now. The video bitrate seems very low. > It's just part of the "you should buy SKY cable, their informercial > channel" and it's a 10 secs sample... shouldn't be an issue. If I'd be very surprised if that were an issue, but IANAL. From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 09:02:41 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02B6E16A4CE for ; Mon, 25 Apr 2005 09:02:41 +0000 (GMT) Received: from tahoe.acn.waw.pl (tahoe.acn.waw.pl [212.76.41.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F8BA43D41 for ; Mon, 25 Apr 2005 09:02:40 +0000 (GMT) (envelope-from gregory@tahoe.acn.waw.pl) Received: by tahoe.acn.waw.pl (Postfix, from userid 1001) id 6CB231706B; Mon, 25 Apr 2005 11:02:39 +0200 (CEST) Date: Mon, 25 Apr 2005 11:02:39 +0200 From: Grzegorz Czaplinski To: freebsd-multimedia@freebsd.org Message-ID: <20050425090239.GB65240@czaplinski.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-PGP: http://www.czaplinski.net/key.asc X-URL: http://www.czaplinski.net/ X-Voice: +48 600 396 054 X-FreeBSD: Running FreeBSD? - Share the server config! - http://www.czaplinski.net/FreeBSD/ Subject: pcm0:record:0: record interrupt timeout X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 09:02:41 -0000 --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi there, Alexander Leidinger suggested to send this report here... I get this error while running skype: Apr 22 16:39:21 zulu kernel: pcm0:record:0: record interrupt timeout, = =20 channel dead The machine is FSC Lifebook E2010. zulu# cat /dev/sndstat = =20 FreeBSD Audio Driver (newpcm) = =20 Installed devices: = =20 pcm0: at io 0x1400 irq 11 kld snd_t4dwave (4p/1r/4v = =20 channels d = =20 uplex default) = =20 = =20 = =20 zulu# uname -a = =20 FreeBSD zulu 5.4-RC2 FreeBSD 5.4-RC2 #0: Sun Apr 10 09:08:14 UTC 2005 =20 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 zulu# pciconf -lv = =20 pcm0@pci0:4:0: class=3D0x040100 card=3D0x11c310cf chip=3D0x545110b9 rev=3D= 0x02 =20 hdr=3D0x00 = =20 vendor =3D 'Acer Labs Incorporated (ALi)' = =20 device =3D 'ALI M5451 PCI AC-Link Controller Audio Device' = =20 class =3D multimedia = =20 subclass =3D audio = =20 [...] Any help greatly appreciated. ;) Cheers, greg -- Grzegorz Czaplinski "The Power to Serve, Right for the Power Users!"-http://www.FreeBSD.org/ Fingerprint: 1AB9 B2C6 1865 B072 CE86 0E59 E777 B03D 9EBB AAC4 --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iQEVAwUBQmyyL+d3sD2eu6rEAQK3UAf/Z6jKfD9VtRL8VPgBSJjmjfawn72Vc/dd OJlsGqAtZXxvLXbwMRfecI7HJr6f6PC7dCPLb2zkaiJ97NCGkDffEYAsTMWR/grC 1K2M798pjq02cKAYNC/wHx2K5w8QUYwEa4uofCbuNFYoukDLf7EEcHAb4zb0LLbS Zd31PWTwYKG7iQ16I8ZrAMHhb+62PGsMDTlUSsAtKC+zjtFMVXQRP4vju/Bcbyex LtmwWUkWVCUo8MPTwfOkd9BpaxMmXjxY+GjK+/teWknvhKQeMRcjusuGSiQvuD1l l948VN0QWrr4alpEpbI8SEDu2QiBh/BIznzLGo1YUzf7PdFDLsOADQ== =Q3xk -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy-- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 11:49:46 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 12D3E16A4CE for ; Mon, 25 Apr 2005 11:49:46 +0000 (GMT) Received: from sohara.org (sohara.org [192.220.64.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id EE3F343D4C for ; Mon, 25 Apr 2005 11:49:45 +0000 (GMT) (envelope-from steve@sohara.org) Received: (qmail 85130 invoked by uid 16563); 25 Apr 2005 11:49:45 -0000 Received: from unknown (HELO STEVEOHS-LT) ([217.12.14.240]) (envelope-sender ) by 192.220.64.179 (qmail-ldap-1.03) with SMTP for ; 25 Apr 2005 11:49:45 -0000 Date: Mon, 25 Apr 2005 12:49:48 +0100 From: Steve O'Hara-Smith To: Chuck Robey Message-Id: <20050425124948.620d5505.steve@sohara.org> In-Reply-To: <426AC21B.2080205@chuckr.org> References: <426AC21B.2080205@chuckr.org> Organization: Steve O'Hara-Smith X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-interix3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-multimedia@FreeBSD.org Subject: Re: region code in cdrecord X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 11:49:46 -0000 On Sat, 23 Apr 2005 21:46:03 +0000 Chuck Robey wrote: > Now, I want to go for broke, and try for the one I've been after for > years, which is converting a region==2 dvd to a region==1 dvd AFAIK you can't region code a writeable DVD or CSS encode it. From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 18:05:30 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 741C016A4CE for ; Mon, 25 Apr 2005 18:05:30 +0000 (GMT) Received: from lakermmtao11.cox.net (lakermmtao11.cox.net [68.230.240.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id D5E7143D41 for ; Mon, 25 Apr 2005 18:05:29 +0000 (GMT) (envelope-from conrads@cox.net) Received: from dolphin.local.net ([68.11.70.216]) by lakermmtao11.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP <20050425180528.UBTR28600.lakermmtao11.cox.net@dolphin.local.net>; Mon, 25 Apr 2005 14:05:28 -0400 Received: from dolphin.local.net (conrads@localhost.local.net [127.0.0.1]) by dolphin.local.net (8.13.3/8.13.3) with ESMTP id j3PI5Ogp021073; Mon, 25 Apr 2005 13:05:28 -0500 (CDT) (envelope-from conrads@cox.net) Date: Mon, 25 Apr 2005 13:05:24 -0500 From: "Conrad J. Sabatier" To: "Robert Krten" Message-ID: <20050425130524.4c266039@dolphin.local.net> In-Reply-To: <200504250238.WAA25506@parse.com> References: <200504250238.WAA25506@parse.com> X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; amd64-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-multimedia@freebsd.org Subject: Re: Is it MIDI yet? (fwd) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 18:05:30 -0000 On Sun, 24 Apr 2005 22:38:45 -0400 (EDT), "Robert Krten" wrote: > > Hi Mat et al., > > My motherboard claims to have an MPU401-compatible midi port on it, > and I'm wondering if the stuff you've done will work with that? > If so, I'd be happy to be a trial tester of the new stuff. > > If not, can you tell me if the old framework would work with that h/w, > and, if so, how I'd go about enabling it? I've pulled down all the > CVS files that I can think of dating back to 10 months ago, but it > still doesn't work (he said, vaguely). It (midi.c, mpu.c) compiles > (with tweaks for dev_t -> struct cdev* etc.); the sequencer.c > doesn't compile yet (a few warnings left), but my device never > shows up in /dev, nor is there any message in dmesg about it. > This is on an i386. > Suggestions? Do you recall what I need to put into my conf file, > is just "device midi" sufficient, or are there other things? > > Thanks in advance! > > Cheers, > -RK I just posted a message to the "current" mailing list with Mat's latest MIDI patchset attached. You may want to have a go at that. You're bound to have better luck than with those older patches. Currently, only cmi and emu10k1-based cards are supported, unfortunately, but Mat is working on support for more cards. Look for "Subject: Latest MIDI patchset from Mat" in the current list. Let us know how it goes, OK? -- Conrad J. Sabatier -- "In Unix veritas" From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 21:54:55 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E75B16A4CE; Mon, 25 Apr 2005 21:54:55 +0000 (GMT) Received: from 21322530218.direct.eti.at (21322530218.direct.eti.at [213.225.30.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4612243D45; Mon, 25 Apr 2005 21:54:54 +0000 (GMT) (envelope-from tilman@arved.at) Received: from jim.arved.de (localhost [127.0.0.1])j3PLsrMT024687; Mon, 25 Apr 2005 23:54:53 +0200 (CEST) (envelope-from tilman@arved.at) Received: (from arved@localhost) by jim.arved.de (8.13.3/8.13.1/Submit) id j3PLsrQ1024686; Mon, 25 Apr 2005 23:54:53 +0200 (CEST) (envelope-from tilman@arved.at) X-Authentication-Warning: jim.arved.de: arved set sender to tilman@arved.at using -f Date: Mon, 25 Apr 2005 23:54:53 +0200 From: Tilman Linneweh To: freebsd-multimedia@freebsd.org Message-ID: <20050425215452.GB2894@arved.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i cc: sound@freebsd.org cc: freebsd-usb@freebsd.org Subject: Using uaudio(4) on systems withoug ISA bus X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 21:54:55 -0000 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi everyone, I have tried to use my USB Headphone on my Mac mini. Unfortunately the sound system seems to require an ISA Bus, because in channel.c sndbuf_dmasetdir and sndbuf_dmabounce are used, which are only compiled if there is an isa device. Without knowing what i am doing i commented out these lines and everything seems to compile and work, apart from mixer(8) saying Device not configured and the following LOR on the first sound output: Apr 25 23:31:45 minimac kernel: Sleeping on "usbsyn" with the following non-slee pable locks held: Apr 25 23:31:45 minimac kernel: exclusive sleep mutex pcm0:play:0 (pcm play chan nel) r = 0 (0xc0fbc0) locked @ /usr/src/sys/dev/sound/pcm/channel.c:335 Apr 25 23:31:45 minimac kernel: KDB: stack backtrace: Apr 25 23:31:45 minimac kernel: 0xdbf158e0: at witness_warn+0x274 Apr 25 23:31:45 minimac kernel: 0xdbf15990: at msleep+0x9c Apr 25 23:31:45 minimac kernel: 0xdbf159f0: at usbd_transfer+0x1c8 Apr 25 23:31:45 minimac kernel: 0xdbf15a20: at usbd_sync_transfer+0x20 Apr 25 23:31:45 minimac kernel: 0xdbf15a40: at usbd_do_request_flags_pipe+0xa0 Apr 25 23:31:45 minimac kernel: 0xdbf15a90: at usbd_do_request_flags+0x40 Apr 25 23:31:45 minimac kernel: 0xdbf15ab0: at usbd_do_request+0x20 Apr 25 23:31:45 minimac kernel: 0xdbf15ad0: at usbd_set_interface+0xac Apr 25 23:31:45 minimac kernel: 0xdbf15af0: at uaudio_chan_open+0x5c Apr 25 23:31:45 minimac kernel: 0xdbf15b20: at uaudio_trigger_output+0x74 Apr 25 23:31:45 minimac kernel: 0xdbf15b40: at ua_chan_trigger+0x54 Apr 25 23:31:45 minimac kernel: 0xdbf15b60: at chn_trigger+0x98 Apr 25 23:31:45 minimac kernel: 0xdbf15b90: at chn_start+0x130 Apr 25 23:31:45 minimac kernel: 0xdbf15bc0: at chn_write+0x270 Apr 25 23:31:45 minimac kernel: 0xdbf15bc0: at chn_write+0x270 Apr 25 23:31:45 minimac kernel: 0xdbf15c00: at dsp_write+0xb0 Apr 25 23:31:45 minimac kernel: 0xdbf15c20: at devfs_write_f+0xec Apr 25 23:31:45 minimac kernel: 0xdbf15c50: at dofilewrite+0xe4 Apr 25 23:31:45 minimac kernel: 0xdbf15cb0: at write+0x5c Apr 25 23:31:45 minimac kernel: 0xdbf15ce0: at syscall+0x29c Apr 25 23:31:45 minimac kernel: 0xdbf15d60: at trap+0x168 Apr 25 23:31:45 minimac kernel: 0xdbf15da0: at powerpc_interrupt+0xc0 Apr 25 23:31:45 minimac kernel: 0xdbf15dd0: user SC trap by 0x218f3e6c: srr1=0xf 032 Apr 25 23:31:45 minimac kernel: r1=0x7fff8fc0 cr=0x44288048 xer=0 ctr=0x218f3e64 Apr 25 23:31:45 minimac kernel: lock order reversal Apr 25 23:31:45 minimac kernel: 1st 0xc0fbc0 pcm0:play:0 (pcm play channel) @ /u sr/src/sys/dev/sound/pcm/channel.c:335 Apr 25 23:31:45 minimac kernel: 2nd 0x45c150 Giant (Giant) @ /usr/src/sys/kern/k ern_synch.c:236 [...] Anyone got an idea how to solve this better? regards tilman --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-channel.c" Index: channel.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/channel.c,v retrieving revision 1.98 diff -u -r1.98 channel.c --- channel.c 6 Jan 2005 01:43:20 -0000 1.98 +++ channel.c 25 Apr 2005 21:25:32 -0000 @@ -870,8 +870,9 @@ CHN_LOCKASSERT(c); c->direction = dir; r = CHANNEL_SETDIR(c->methods, c->devinfo, c->direction); - if (!r && SND_DMA(b)) - sndbuf_dmasetdir(b, c->direction); + if (!r && SND_DMA(b)) { + /* sndbuf_dmasetdir(b, c->direction); */ + } return r; } @@ -1123,8 +1124,9 @@ int ret; CHN_LOCKASSERT(c); - if (SND_DMA(b) && (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)) - sndbuf_dmabounce(b); + if (SND_DMA(b) && (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)) { + /* sndbuf_dmabounce(b); */ + } ret = CHANNEL_TRIGGER(c->methods, c->devinfo, go); return ret; --nFreZHaLTZJo0R7j-- From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 25 23:09:10 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5398816A4CE for ; Mon, 25 Apr 2005 23:09:10 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC37C43D2F for ; Mon, 25 Apr 2005 23:09:09 +0000 (GMT) (envelope-from cronopiolopez@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so1406754wra for ; Mon, 25 Apr 2005 16:09:09 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OsyWfOCt6Ratvta53r+Bl7GWRnOWP608Nn3bBIiCZ05zOvH1DTPjYW9RN37+lxMXGw6h5jh9t//PbzMfwvcyuscu2KM6f9aoaaQCuHNJdMDWE6XXkJTHFvQecOwHL9wrS0mUcUFiQbHXXPmJU/fByb/k0LMSnQja2JgmwbJ3fn4= Received: by 10.54.82.5 with SMTP id f5mr1578398wrb; Mon, 25 Apr 2005 16:09:09 -0700 (PDT) Received: by 10.54.32.71 with HTTP; Mon, 25 Apr 2005 16:09:06 -0700 (PDT) Message-ID: <8f8eb53e05042516091497cf90@mail.gmail.com> Date: Tue, 26 Apr 2005 01:09:06 +0200 From: =?ISO-8859-1?Q?Lluis_L=F3pez?= To: freebsd-multimedia@freebsd.org In-Reply-To: <8f8eb53e0504240844220ea350@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050423225506.GA25461@puff.jakemsr.gom> <426B23BA.6060206@elischer.org> <20050424052941.GA3339@puff.jakemsr.gom> <426B4876.6020307@elischer.org> <8f8eb53e0504240844220ea350@mail.gmail.com> Subject: cxm driver variant before:Re: patch for bktr(4): don't reset tuner on open/close X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: =?ISO-8859-1?Q?Lluis_L=F3pez?= List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 23:09:10 -0000 In http://lists.freebsd.org/pipermail/freebsd-multimedia/2005-April/002042.= html I talk about a cxm variant driver if you want test this download sources of= : http://www.documentanix.org/pvr250/ivtv4bsd-alpha.tar.gz Untar dist and see README before start. Some screenshots of GUI controler: http://www.documentanix.org/pvr250/Screenshot-input-enc_prof.png http://www.documentanix.org/pvr250/Screenshot-encoder-interface.png http://www.documentanix.org/pvr250/Screenshot-video-props.png Luis L=F3pez Sol=E9 From owner-freebsd-multimedia@FreeBSD.ORG Tue Apr 26 10:22:45 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34E5E16A4CF for ; Tue, 26 Apr 2005 10:22:45 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8AFDB43D4C for ; Tue, 26 Apr 2005 10:22:44 +0000 (GMT) (envelope-from lioux@uol.com.br) Received: from 200.140.3.246 (unknown [200.140.3.246]) by vette.gigo.com (Postfix) with ESMTP id C8EE35527 for ; Tue, 26 Apr 2005 03:22:43 -0700 (PDT) Received: (qmail 44620 invoked by uid 1001); 26 Apr 2005 10:11:18 -0000 Message-ID: <20050426101118.44617.qmail@exxodus.fedaykin.here> Date: Tue, 26 Apr 2005 07:10:56 -0300 From: Mario Sergio Fujikawa Ferreira To: freebsd-ports@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.5.9i cc: freebsd-multimedia@FreeBSD.org Subject: Sample multimedia/mplayer version MPlayer-1.0pre7 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 10:22:45 -0000 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, The port MAINTAINER is aware of the update and he is proofing any mistakes I might have made producing this sample port. I am sure his version will be cleaner and more complete. However, while most of us wait, I thought you guys would like to be using this sample update to the latest version of mplayer MPlayer-1.0pre7. The changelog is huge, so head over to http://www.mplayer.hu/ for more information. Please, take the time to read mplayer's team petiotion atht the front page. Well, the usual disclaimer applies. This sample port has been working for me for the past 2 days. I haven't had any problems but your mileage may vary. Despite of the disclaimer, it should work nicely. Regards, --=20 Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCbhPGrxEiaFLzGQwRAl27AJ9SynpeHYMZD8F896DV6hIzjU/tCwCfYsCX VhZZwB1v3+ukpsu8LZQVjAA= =exeH -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO-- From owner-freebsd-multimedia@FreeBSD.ORG Tue Apr 26 10:38:12 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 15B5F16A4E6 for ; Tue, 26 Apr 2005 10:38:12 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id F1E1543D2F for ; Tue, 26 Apr 2005 10:38:11 +0000 (GMT) (envelope-from lioux@uol.com.br) Received: from 200.140.3.246 (unknown [200.140.3.246]) by vette.gigo.com (Postfix) with ESMTP id AB8D35630 for ; Tue, 26 Apr 2005 03:38:11 -0700 (PDT) Received: (qmail 3956 invoked by uid 1001); 26 Apr 2005 10:36:38 -0000 Message-ID: <20050426103638.3955.qmail@exxodus.fedaykin.here> Date: Tue, 26 Apr 2005 07:36:16 -0300 From: Mario Sergio Fujikawa Ferreira To: Mario Sergio Fujikawa Ferreira References: <20050426101056.GA40346@exxodus.fedaykin.here> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050426101056.GA40346@exxodus.fedaykin.here> User-Agent: Mutt/1.5.9i cc: freebsd-multimedia@FreeBSD.org cc: freebsd-ports@FreeBSD.org Subject: Re: Sample multimedia/mplayer version MPlayer-1.0pre7 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 10:38:12 -0000 Forgot to mention the URL: http://people.FreeBSD.org/~lioux/mplayer.tgz -- Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature From owner-freebsd-multimedia@FreeBSD.ORG Tue Apr 26 14:02:07 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95C2916A4CE; Tue, 26 Apr 2005 14:02:07 +0000 (GMT) Received: from drizzle.CC.McGill.CA (drizzle.CC.McGill.CA [132.206.27.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30AC143D55; Tue, 26 Apr 2005 14:02:07 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan3.cc.mcgill.ca (mailscan3.CC.McGill.CA [132.216.77.250])j3QE1vgx011515; Tue, 26 Apr 2005 10:01:58 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3QE1acc007576; Tue, 26 Apr 2005 10:01:37 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3QE1Zif029367; Tue, 26 Apr 2005 10:01:36 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3QE1ZYL011723; Tue, 26 Apr 2005 10:01:35 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3QE1YEe011722; Tue, 26 Apr 2005 10:01:34 -0400 Date: Tue, 26 Apr 2005 10:01:34 -0400 From: Mathew Kanner To: Tilman Linneweh Message-ID: <20050426140134.GA11709@cnd.mcgill.ca> References: <20050425215452.GB2894@arved.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050425215452.GB2894@arved.at> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: freebsd-multimedia@freebsd.org cc: freebsd-usb@freebsd.org Subject: Re: Using uaudio(4) on systems withoug ISA bus X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 14:02:07 -0000 On Apr 25, Tilman Linneweh wrote: > Hi everyone, > > I have tried to use my USB Headphone on my Mac mini. > > Unfortunately the sound system seems to require an ISA Bus, because in > channel.c sndbuf_dmasetdir and sndbuf_dmabounce are used, which are only > compiled if there is an isa device. > > Without knowing what i am doing i commented out these lines and everything > seems to compile and work, apart from mixer(8) saying Device not configured > and the following LOR on the first sound output: Hi Tilman, I think you have two very interesting issues here. I'm busy right now but I'll try to get time to look at them, don't give up if you don't here from me :) I anticipate this hump will be over in a couple of days but maybe through 'till the weekend 1/ There is a dependency on ISA in the generic PCM code. This is news to me and we need to get rid of it. 2/ There is a lock order reversal. We haven't seen one of these in a while for the sound code. Just to clear things up for me, when you say Mac mini, this means you aren't running the standard i386/amd64, right? --Mat ps, i've removed sound the the list as I think it's only me at the moment. From owner-freebsd-multimedia@FreeBSD.ORG Tue Apr 26 14:57:46 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CCE316A4CE; Tue, 26 Apr 2005 14:57:46 +0000 (GMT) Received: from 21322530218.direct.eti.at (21322530218.direct.eti.at [213.225.30.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A1AD43D3F; Tue, 26 Apr 2005 14:57:45 +0000 (GMT) (envelope-from tilman@arved.at) Received: from jim.arved.de (localhost [127.0.0.1])j3QEvYwQ031745; Tue, 26 Apr 2005 16:57:34 +0200 (CEST) (envelope-from tilman@arved.at) Received: (from arved@localhost) by jim.arved.de (8.13.3/8.13.1/Submit) id j3QEvYco031744; Tue, 26 Apr 2005 16:57:34 +0200 (CEST) (envelope-from tilman@arved.at) X-Authentication-Warning: jim.arved.de: arved set sender to tilman@arved.at using -f Date: Tue, 26 Apr 2005 16:57:34 +0200 From: Tilman Linneweh To: Mathew Kanner Message-ID: <20050426145734.GC2894@arved.at> References: <20050425215452.GB2894@arved.at> <20050426140134.GA11709@cnd.mcgill.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050426140134.GA11709@cnd.mcgill.ca> User-Agent: Mutt/1.4.2.1i cc: freebsd-multimedia@freebsd.org cc: freebsd-usb@freebsd.org Subject: Re: Using uaudio(4) on systems withoug ISA bus X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 14:57:46 -0000 * Mathew Kanner [2005-04-26 16:02]: > > I have tried to use my USB Headphone on my Mac mini. > > > > Unfortunately the sound system seems to require an ISA Bus, because in > > channel.c sndbuf_dmasetdir and sndbuf_dmabounce are used, which are only > > compiled if there is an isa device. > > > > Without knowing what i am doing i commented out these lines and everything > > seems to compile and work, apart from mixer(8) saying Device not configured > > and the following LOR on the first sound output: > > I think you have two very interesting issues here. I'm busy > right now but I'll try to get time to look at them, don't give up if > you don't here from me :) I anticipate this hump will be over in a > couple of days but maybe through 'till the weekend > 1/ There is a dependency on ISA in the generic PCM code. This > is news to me and we need to get rid of it. Well, i was a bit surprised too, because i have not figured out yet, how yongari resolved this for the sparc64 cs4231 driver. (His original patch at http://lists.freebsd.org/pipermail/freebsd-sparc64/2004-July/001823.html works around the problem, see the first XXX, but he did not commit this part) Unfortunately i don't understand much of the soundsystem code yet. > 2/ There is a lock order reversal. We haven't seen one of > these in a while for the sound code. > > Just to clear things up for me, when you say Mac mini, this > means you aren't running the standard i386/amd64, right? > --Mat Exactly, this is FreeBSD/powerpc. Thanks for your quick reply regards tilman From owner-freebsd-multimedia@FreeBSD.ORG Wed Apr 27 08:14:03 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46B7616A4CE for ; Wed, 27 Apr 2005 08:14:03 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0AB1D43D41 for ; Wed, 27 Apr 2005 08:14:03 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id D0AB51F63C3; Wed, 27 Apr 2005 01:14:02 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j3R8DuSp012374; Wed, 27 Apr 2005 01:13:56 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <426F49C3.1020009@elischer.org> Date: Wed, 27 Apr 2005 01:13:55 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050424 X-Accept-Language: en, hu MIME-Version: 1.0 To: Julian Elischer References: <20050306171027.GE4237@cnd.mcgill.ca> <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> In-Reply-To: <426F4280.9030206@elischer.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: FreeBSD Multimedia cc: Alexander@Leidinger.net cc: mat@cnd.mcgill.ca Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2005 08:14:03 -0000 Julian Elischer wrote: > Julian Elischer wrote: > >> Kazuhito HONDA wrote: >> >>> Hello, >>> >>> From: Pyun YongHyeon >>> Subject: Re: uaudio patch, configurable buffer size >>> Date: Mon, 7 Mar 2005 12:04:19 +0900 >>> >>> >>>> AFAIK, we already have format converter in kernel. >>>> See feeder_fmt.c. The converter detects differences between hardware >>>> capabilities and audio samples and automatically converts it(e.g. >>>> big endian <->little endian, mono <-> stereo, signed <-> unsigned, >>>> ulaw<->alow etc). >>> >>> >>> >>> >>> Ah, I haven't found it for a long time. I tried to change the caps >>> in uaudio_pcm.c, and a sampling rate can be converted correctly as >>> you wrote. >>> >>> I'll challenge to use this converter in uaudio, too. >>> If I or someone will succeed in it, I'll write to PR usb/78028 that >>> it should be closed except applied. >> >> >> >> while I closed this, I have sort of changed my mind.. >> this PR gives teh following result: >> >> At least they work and produce the following output: >> ---snip--- >> pcm0: at addr ? (1p/1r/0v channels duplex default) >> playback: 2ch, 16/16bit, pcm, 44100Hz >> playback: 2ch, 24/24bit, pcm, 44100Hz >> playback: 4ch, 16/16bit, pcm, 44100Hz >> playback: 4ch, 24/24bit, pcm, 44100Hz >> playback: 6ch, 16/16bit, pcm, 44100Hz >> playback: 6ch, 24/24bit, pcm, 44100Hz >> playback: 2ch, 16/16bit, pcm, 48000Hz >> playback: 2ch, 24/24bit, pcm, 48000Hz >> playback: 4ch, 16/16bit, pcm, 48000Hz >> playback: 4ch, 24/24bit, pcm, 48000Hz >> playback: 6ch, 16/16bit, pcm, 48000Hz >> playback: 6ch, 24/24bit, pcm, 48000Hz >> playback: 2ch, 16/16bit, pcm, 96000Hz >> playback: 2ch, 24/24bit, pcm, 96000Hz >> recording: 2ch, 16/16bit, pcm, 44100Hz >> recording: 2ch, 24/24bit, pcm, 44100Hz >> recording: 2ch, 16/16bit, pcm, 48000Hz >> recording: 2ch, 24/24bit, pcm, 48000Hz >> recording: 2ch, 16/16bit, pcm, 96000Hz >> recording: 2ch, 24/24bit, pcm, 96000Hz >> >> >> I think this information is important and not available anywhere else. >> >> I tried applying it but it didn't work on top of Matt's last patch. >> I'll have to try it with the unchanged version. > > > with uaudio out of -current I see: > pcm1: at addr ? (0p/1r/0v channels duplex) > recording: 1ch, 16/16bit, pcm, 44100Hz > recording: 1ch, 16/16bit, pcm, 22050Hz > recording: 1ch, 16/16bit, pcm, 11025Hz > recording: 1ch, 16/16bit, pcm, 8000Hz with a little change: # cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: pcm0: port 0x1400-0x14ff irq 5 at device 8.0 on pci0 (4p/1r/0v channels duplex default) pcm1: at addr ? (0p/1r/0v channels duplex) mode 1:(recording) 1ch, 16/16bit, pcm, 44100Hz mode 2:(recording) 1ch, 16/16bit, pcm, 22050Hz mode 3:(recording) 1ch, 16/16bit, pcm, 11025Hz mode 4:(recording) 1ch, 16/16bit, pcm, 8000Hz is this worth commiting? and would "input" be better than "recording"? > > The question now is: > "How the heck to I select which one to use?" > > > > > > >> >> Matt can you make a version of this that works with your change? >> (I guess the fact that your patch stopped my mic. might have made this >> fail as well. maybe it still works but your patch is the problem... >> >> julian >> From owner-freebsd-multimedia@FreeBSD.ORG Wed Apr 27 08:24:47 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1813F16A4CE for ; Wed, 27 Apr 2005 08:24:47 +0000 (GMT) Received: from sohara.org (sohara.org [192.220.64.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6E7943D4C for ; Wed, 27 Apr 2005 08:24:46 +0000 (GMT) (envelope-from steve@sohara.org) Received: (qmail 69315 invoked by uid 16563); 27 Apr 2005 08:24:46 -0000 Received: from unknown (HELO STEVEOHS-LT) ([217.12.14.240]) (envelope-sender ) by 192.220.64.179 (qmail-ldap-1.03) with SMTP for ; 27 Apr 2005 08:24:46 -0000 Date: Wed, 27 Apr 2005 09:24:47 +0100 From: Steve O'Hara-Smith To: lioux@FreeBSD.orgSteve O'Hara-Smith Message-Id: <20050427092447.3cf06b75.steve@sohara.org> In-Reply-To: <20050425094846.32d60013.steve@sohara.org> References: <20050421021909.28497.qmail@exxodus.fedaykin.here> <20050421102551.12ebb916.steve@sohara.org> <20050421163426.96546.qmail@exxodus.fedaykin.here> <20050422095554.35a3ff26.steve@sohara.org> <20050423063848.67278.qmail@exxodus.fedaykin.here> <20050425094846.32d60013.steve@sohara.org> Organization: Steve O'Hara-Smith X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-interix3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: FreeBSD-multimedia@FreeBSD.org Subject: Re: Help with TV capture (mplayer/brooktree/audigy) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2005 08:24:47 -0000 On Mon, 25 Apr 2005 09:48:46 +0100 Steve O'Hara-Smith wrote: > > I have a sample video using the following options. Let me > > know what you think. In case you wonder about copyright issues. > > I'll watch it tonight - I'm at work now. The video bitrate > seems very low. I finally got to watch it - after a battle royal with my LAN. The video is very pixellated and a bit jerky I suspect that mencoder is taking more than the frame time to encode some frames and so missing frames because the compression is too high. Definitely try with a much higher video bitrate - say at least 2400kbps or even 4800kbps. From owner-freebsd-multimedia@FreeBSD.ORG Wed Apr 27 18:42:33 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C05CD16A4CE for ; Wed, 27 Apr 2005 18:42:33 +0000 (GMT) Received: from torrent.cc.mcgill.ca (torrent.cc.mcgill.ca [132.206.27.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 50BE143D5C for ; Wed, 27 Apr 2005 18:42:33 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan1.cc.mcgill.ca (mailscan1.CC.McGill.CA [132.216.77.248])j3RIg6YM003846; Wed, 27 Apr 2005 14:42:10 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3RIfjDe025846; Wed, 27 Apr 2005 14:41:46 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3RIfXGW011102; Wed, 27 Apr 2005 14:41:33 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3RIfW2M014200; Wed, 27 Apr 2005 14:41:32 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3RIfG4A014199; Wed, 27 Apr 2005 14:41:16 -0400 Date: Wed, 27 Apr 2005 14:41:15 -0400 From: Mathew Kanner To: Julian Elischer Message-ID: <20050427184115.GC11709@cnd.mcgill.ca> References: <20050306171027.GE4237@cnd.mcgill.ca> <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <426F49C3.1020009@elischer.org> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: FreeBSD Multimedia cc: Alexander@Leidinger.net cc: mat@cnd.mcgill.ca Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2005 18:42:34 -0000 On Apr 27, Julian Elischer wrote: > Julian Elischer wrote: > >Julian Elischer wrote: > > > >>Kazuhito HONDA wrote: > >> > >>>Hello, > >>> > >>>From: Pyun YongHyeon > >>>Subject: Re: uaudio patch, configurable buffer size > >>>Date: Mon, 7 Mar 2005 12:04:19 +0900 > >>> > >>> > >>>>AFAIK, we already have format converter in kernel. > >>>>See feeder_fmt.c. The converter detects differences between hardware > >>>>capabilities and audio samples and automatically converts it(e.g. > >>>>big endian <->little endian, mono <-> stereo, signed <-> unsigned, > >>>>ulaw<->alow etc). > >>> > >>> > >>> > >>> > >>>Ah, I haven't found it for a long time. I tried to change the caps > >>>in uaudio_pcm.c, and a sampling rate can be converted correctly as > >>>you wrote. > >>> > >>>I'll challenge to use this converter in uaudio, too. > >>>If I or someone will succeed in it, I'll write to PR usb/78028 that > >>>it should be closed except applied. > >> > >> > >> > >>while I closed this, I have sort of changed my mind.. > >>this PR gives teh following result: > >> > >> At least they work and produce the following output: > >> ---snip--- > >> pcm0: at addr ? (1p/1r/0v channels duplex default) > >> playback: 2ch, 16/16bit, pcm, 44100Hz > >> playback: 2ch, 24/24bit, pcm, 44100Hz > >> playback: 4ch, 16/16bit, pcm, 44100Hz > >> playback: 4ch, 24/24bit, pcm, 44100Hz > >> playback: 6ch, 16/16bit, pcm, 44100Hz > >> playback: 6ch, 24/24bit, pcm, 44100Hz > >> playback: 2ch, 16/16bit, pcm, 48000Hz > >> playback: 2ch, 24/24bit, pcm, 48000Hz > >> playback: 4ch, 16/16bit, pcm, 48000Hz > >> playback: 4ch, 24/24bit, pcm, 48000Hz > >> playback: 6ch, 16/16bit, pcm, 48000Hz > >> playback: 6ch, 24/24bit, pcm, 48000Hz > >> playback: 2ch, 16/16bit, pcm, 96000Hz > >> playback: 2ch, 24/24bit, pcm, 96000Hz > >> recording: 2ch, 16/16bit, pcm, 44100Hz > >> recording: 2ch, 24/24bit, pcm, 44100Hz > >> recording: 2ch, 16/16bit, pcm, 48000Hz > >> recording: 2ch, 24/24bit, pcm, 48000Hz > >> recording: 2ch, 16/16bit, pcm, 96000Hz > >> recording: 2ch, 24/24bit, pcm, 96000Hz > >> > >> > >>I think this information is important and not available anywhere else. > >> > >>I tried applying it but it didn't work on top of Matt's last patch. > >>I'll have to try it with the unchanged version. This patch is no consistent with then rest of sound. You will notice that with my pending uaudio caps patch that I add this information in boot_verbose which is where it belongs. --Mat From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 09:07:19 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5711A16A4CE for ; Thu, 28 Apr 2005 09:07:19 +0000 (GMT) Received: from mailout09.sul.t-online.com (mailout09.sul.t-online.com [194.25.134.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id DECC243D55 for ; Thu, 28 Apr 2005 09:07:18 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from fwd32.aul.t-online.de by mailout09.sul.t-online.com with smtp id 1DR4zK-0008Ui-02; Thu, 28 Apr 2005 11:07:14 +0200 Received: from Andro-Beta.Leidinger.net (bKg13oZ68eXnwBZRkp0BgZv6BOFBqWzdegkY+snPWRfs45K5o0rpU1@[84.128.204.245]) by fwd32.sul.t-online.de with esmtp id 1DR4z0-299nLU0; Thu, 28 Apr 2005 11:06:54 +0200 Received: from localhost (localhost [127.0.0.1])j3S96uVg045061; Thu, 28 Apr 2005 11:06:56 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from 141.113.101.32 ([141.113.101.32]) by netchild.homeip.net (Horde MIME library) with HTTP for ; Thu, 28 Apr 2005 11:06:56 +0200 Message-ID: <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> X-Priority: 3 (Normal) Date: Thu, 28 Apr 2005 11:06:56 +0200 From: Alexander Leidinger To: Mathew Kanner References: <20050306171027.GE4237@cnd.mcgill.ca> <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> <20050427184115.GC11709@cnd.mcgill.ca> In-Reply-To: <20050427184115.GC11709@cnd.mcgill.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.2) / FreeBSD-4.11 X-ID: bKg13oZ68eXnwBZRkp0BgZv6BOFBqWzdegkY+snPWRfs45K5o0rpU1@t-dialin.net X-TOI-MSGID: 275b14c3-6145-4dde-af47-4a98194322e9 cc: FreeBSD Multimedia cc: Julian Elischer Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 09:07:19 -0000 Mathew Kanner wrote: > This patch is no consistent with then rest of sound. You will > notice that with my pending uaudio caps patch that I add this > information in boot_verbose which is where it belongs. I still don't understand why this belongs into the dmesg instead of sndstat... In my eyes it would be nice if every soundcard would list the features it offers in sndstat. This not only consists of it's capabilities, it also should list SPDIF output, EAX and so on (either when we gain support for those features, or with an explicit "not supported" text). I think this would be more userfriendly than printing this in the dmesg on verbose boot only. Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 guru, n: A computer owner who can read the manual. From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 11:28:23 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D2B516A4CE for ; Thu, 28 Apr 2005 11:28:23 +0000 (GMT) Received: from torrent.cc.mcgill.ca (torrent.cc.mcgill.ca [132.206.27.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id C8FDB43D5C for ; Thu, 28 Apr 2005 11:28:22 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan1.cc.mcgill.ca (mailscan1.CC.McGill.CA [132.216.77.248])j3SBSGCo019543; Thu, 28 Apr 2005 07:28:17 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3SBS88P011541; Thu, 28 Apr 2005 07:28:08 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3SBRvuI020223; Thu, 28 Apr 2005 07:27:58 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3SBRviv015504; Thu, 28 Apr 2005 07:27:57 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3SBRt5h015503; Thu, 28 Apr 2005 07:27:55 -0400 Date: Thu, 28 Apr 2005 07:27:54 -0400 From: Mathew Kanner To: Alexander Leidinger Message-ID: <20050428112754.GB14507@cnd.mcgill.ca> References: <20050306171027.GE4237@cnd.mcgill.ca> <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> <20050427184115.GC11709@cnd.mcgill.ca> <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: FreeBSD Multimedia cc: Julian Elischer cc: Mathew Kanner Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 11:28:23 -0000 On Apr 28, Alexander Leidinger wrote: > Mathew Kanner wrote: > > > This patch is no consistent with then rest of sound. You will > >notice that with my pending uaudio caps patch that I add this > >information in boot_verbose which is where it belongs. > > I still don't understand why this belongs into the dmesg instead of > sndstat... > > In my eyes it would be nice if every soundcard would list the features it > offers in sndstat. This not only consists of it's capabilities, it also > should list SPDIF output, EAX and so on (either when we gain support for > those features, or with an explicit "not supported" text). I think this > would be more userfriendly than printing this in the dmesg on verbose boot > only. I realise I'm the only one whose taken this position so I'll withdraw it. But for the record, this is my reasoning, what the heck are you going to do with this informaiton: it doesn't help you. Other interesting but often usesless information is printed in boot_verbose. The listed capablities are often way beyound what our sound interface can offer. If you want to know what avaiable then connect to the sound device and issue an ioctl like every other app. Anyway, as a general concept, I think we should start expanding our using sysctls. I've rerolled the uaudio caps patch to be compatible with this commit and I've sent it off the Julian, hopefully we can commit it asap. thi --Mat From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 11:33:54 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FC2116A4CE for ; Thu, 28 Apr 2005 11:33:54 +0000 (GMT) Received: from torrent.cc.mcgill.ca (torrent.cc.mcgill.ca [132.206.27.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D8C143D2F for ; Thu, 28 Apr 2005 11:33:54 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan3.cc.mcgill.ca (mailscan3.CC.McGill.CA [132.216.77.250])j3SBXrCs020464; Thu, 28 Apr 2005 07:33:53 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3SBXoYV023111; Thu, 28 Apr 2005 07:33:50 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3SBXnP0020266; Thu, 28 Apr 2005 07:33:50 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3SBXnu5015511; Thu, 28 Apr 2005 07:33:49 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3SBXn8k015510; Thu, 28 Apr 2005 07:33:49 -0400 Date: Thu, 28 Apr 2005 07:33:49 -0400 From: Mathew Kanner To: Luigi Rizzo Message-ID: <20050428113349.GC14507@cnd.mcgill.ca> References: <20050422154654.A72976@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050422154654.A72976@xorpc.icir.org> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: multimedia@freebsd.org Subject: Re: dev/sound patches to reduce latency X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 11:33:54 -0000 On Apr 22, Luigi Rizzo wrote: > attached are some patches for the sound driver to reduce latency > in the playback channel. > Background - by design, the driver tries to keep the "hard" buffer > (the one used by the hardware to play samples out) always full > even if userland supplied a small amount of data. While there is > an ioctl() to set the size of the buffer in terms of a blocksize > and number of blocks, the existing code failed in some cases to > push down the info to the hardware, and had the tendency to > use max-sized buffers in many cases. At 8khz, the 16k default buffers > could cause very large delays in the playback of audio. > > With this patches, we try to pass the user-specified blocksize down > to the hardware, and furthermore, use a small number of blocks in > the "hard" buffer to minimize latency. > > I'd appreciate if people could test this code and report any good > or bad news. I think it significantly improves what we have now. > It could still benefit from an additional improvement: > - make the choice of the number of buffers adaptive on the irq rate. > which is not a very complex thing to do, but should be done in all > individual drivers, so it takes a bit more testing. Hi Luigi, I've started to look at your patches by brining them up to 6.x. Integreating them is been hard because the 4.x code base does not have the (heroic) changes that truckman commited about a year ago that cleans up/changes the sound buffer. I'm not done yet, but I wanted to stop and ask: Have you tried 5-+? It should be a little better in regards to buffer allocation. --Mat From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 12:20:29 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 983C816A4D0 for ; Thu, 28 Apr 2005 12:20:29 +0000 (GMT) Received: from mailout04.sul.t-online.com (mailout04.sul.t-online.com [194.25.134.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 709F343D49 for ; Thu, 28 Apr 2005 12:20:28 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from fwd30.aul.t-online.de by mailout04.sul.t-online.com with smtp id 1DR80G-0002W5-01; Thu, 28 Apr 2005 14:20:24 +0200 Received: from Andro-Beta.Leidinger.net (Sgc4HUZB8eL0OLjQmMufhcuVxdblSjuicU9uQhfJqPnXU6VN8xdkcA@[84.128.204.245]) by fwd30.sul.t-online.de with esmtp id 1DR7zy-1aGVai0; Thu, 28 Apr 2005 14:20:06 +0200 Received: from localhost (localhost [127.0.0.1])j3SCK7Aw072885; Thu, 28 Apr 2005 14:20:07 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from 141.113.101.32 ([141.113.101.32]) by netchild.homeip.net (Horde MIME library) with HTTP for ; Thu, 28 Apr 2005 14:20:07 +0200 Message-ID: <20050428142007.11hjbs1pcgws4g0w@netchild.homeip.net> X-Priority: 3 (Normal) Date: Thu, 28 Apr 2005 14:20:07 +0200 From: Alexander Leidinger To: Mathew Kanner References: <20050306171027.GE4237@cnd.mcgill.ca> <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> <20050427184115.GC11709@cnd.mcgill.ca> <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> <20050428112754.GB14507@cnd.mcgill.ca> In-Reply-To: <20050428112754.GB14507@cnd.mcgill.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.2) / FreeBSD-4.11 X-ID: Sgc4HUZB8eL0OLjQmMufhcuVxdblSjuicU9uQhfJqPnXU6VN8xdkcA@t-dialin.net X-TOI-MSGID: d0ce803b-d3ba-4210-b8d3-f8c315149145 cc: FreeBSD Multimedia cc: Julian Elischer Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 12:20:29 -0000 Mathew Kanner wrote: > I realise I'm the only one whose taken this position so I'll > withdraw it. But for the record, this is my reasoning, what the heck > are you going to do with this informaiton: it doesn't help you. If you want to go to the soundcard directly, without any conversation, you need to know what you can use. > Other > interesting but often usesless information is printed in boot_verbose. > The listed capablities are often way beyound what our sound interface > can offer. Just because it can't offer it _yet_, it doesn't mean we don't teach the interface to use it later. And parts of this improvement can be addressed from both sides (step by step). > If you want to know what avaiable then connect to the > sound device and issue an ioctl like every other app. If I have an app which plays some audio files. And if I have the opportunity to generate the right file with a conversation program which converts "something" (e.g. text to speach) but doesn't knows about an output device, and I want to generate the right output, I have to know what I can use. A human being which just knows about tools, but not about ioctl(), I need something which tells me what I can use. Do we have an app which does this? Do we need such an app, or would it be convenient to just look at "cat /dev/sndstat"? > Anyway, as a general concept, I think we should start > expanding our using sysctls. I think it depends. For status/capabilities/static like output, we should look at enhancing existing interfaces (if they fit into the big picture of what we want to add), like our "sound status device". For general "mode switching" (whatever this means) which doesn't fit into the 4Front-OSS model, sysctl looks like a nice candidate. But another nice candidate would be a "sndctl" program which may interact with the device over /dev/dspX.ctl orsomething like this. Is there something specific you have in mind regarding the sysctl proposal? Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 BOFH excuse #152: My pony-tail hit the on/off switch on the power strip. From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 13:47:06 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BD7E16A4CE for ; Thu, 28 Apr 2005 13:47:06 +0000 (GMT) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC9DA43D53 for ; Thu, 28 Apr 2005 13:47:05 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-47-180.daxnet.no ([193.216.47.180] verified) by mailfe05.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 156488314 for freebsd-multimedia@freebsd.org; Thu, 28 Apr 2005 15:47:00 +0200 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Thu, 28 Apr 2005 15:47:41 +0200 User-Agent: KMail/1.7 References: <20050422.133916.343183478.kazuhito@ph.noda.tus.ac.jp> In-Reply-To: <20050422.133916.343183478.kazuhito@ph.noda.tus.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200504281547.42747.hselasky@c2i.net> Subject: Re: uaudio in full duplex X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 13:47:06 -0000 On Friday 22 April 2005 06:39, Kazuhito HONDA wrote: > Hello, > > the uaudio driver doesn't allow USB devices to > open playback and record channel pipe, simultaneously, > if in FreeBSD-stable, at line 3650 of uaudio.c as below: > > =A0 =A0 =A0 =A0 if ((sc->sc_playchan.pipe !=3D NULL) || (sc->sc_recchan.p= ipe !=3D > NULL)) return (-1); > > If you do comment-out it, you may be able to read and write several time. > But USB low-level driver soon freezes with eternal errors messages. > I haven't found its cause. What does the error messages say? It might be a bug in the UHCI driver,=20 because it does currently not check when isochronous transfers are=20 inserted in time ! Yours =A0 Hans Petter Selasky From owner-freebsd-multimedia@FreeBSD.ORG Thu Apr 28 17:02:53 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A33416A4CE for ; Thu, 28 Apr 2005 17:02:53 +0000 (GMT) Received: from torrent.cc.mcgill.ca (torrent.cc.mcgill.ca [132.206.27.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CAFF43D5F for ; Thu, 28 Apr 2005 17:02:52 +0000 (GMT) (envelope-from mat@cnd.mcgill.ca) Received: from mailscan2.cc.mcgill.ca (mailscan2.CC.McGill.CA [132.216.77.249])j3SH2fMN004920; Thu, 28 Apr 2005 13:02:43 -0400 Received: from cube.cnd.mcgill.ca (cube.CND.McGill.CA [132.216.25.196]) j3SH2OUk029085; Thu, 28 Apr 2005 13:02:24 -0400 (EDT) Received: from localhost.localdomain (acid.cnd.mcgill.ca [132.216.11.151]) by cube.cnd.mcgill.ca (8.12.11/8.12.11) with ESMTP id j3SH28jT023539; Thu, 28 Apr 2005 13:02:11 -0400 Received: from localhost.localdomain (acid [127.0.0.1]) j3SH28Tq015765; Thu, 28 Apr 2005 13:02:08 -0400 Received: (from mat@localhost) by localhost.localdomain (8.12.11/8.12.11/Submit) id j3SH1sVK015764; Thu, 28 Apr 2005 13:01:54 -0400 Date: Thu, 28 Apr 2005 13:01:54 -0400 From: Mathew Kanner To: Alexander Leidinger Message-ID: <20050428170154.GG14507@cnd.mcgill.ca> References: <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> <20050427184115.GC11709@cnd.mcgill.ca> <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> <20050428112754.GB14507@cnd.mcgill.ca> <20050428142007.11hjbs1pcgws4g0w@netchild.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050428142007.11hjbs1pcgws4g0w@netchild.homeip.net> User-Agent: Mutt/1.4.2i Organization: I speak for myself, operating in Montreal, CANADA cc: FreeBSD Multimedia cc: Julian Elischer cc: Mathew Kanner Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 17:02:53 -0000 On Apr 28, Alexander Leidinger wrote: > Mathew Kanner wrote: > > > I realise I'm the only one whose taken this position so I'll > >withdraw it. But for the record, this is my reasoning, what the heck > >are you going to do with this informaiton: it doesn't help you. > > If you want to go to the soundcard directly, without any conversation, you > need to know what you can use. But this doesn't help. At all. > > > Other > >interesting but often usesless information is printed in boot_verbose. > >The listed capablities are often way beyound what our sound interface > >can offer. > > Just because it can't offer it _yet_, it doesn't mean we don't teach the > interface to use it later. And parts of this improvement can be addressed > from both sides (step by step). But this doesn't help. At all. (Because it isn't an interface, it's only text output). Expanding our abilities for different formats and flagging which ones are hardware based is *completly* serperate project. > > > If you want to know what avaiable then connect to the > >sound device and issue an ioctl like every other app. > > If I have an app which plays some audio files. And if I have the opportunity > to generate the right file with a conversation program which converts > "something" (e.g. text to speach) but doesn't knows about an output device, > and I want to generate the right output, I have to know what I can use. A > human being which just knows about tools, but not about ioctl(), I need > something which tells me what I can use. Do we have an app which does this? > Do we need such an app, or would it be convenient to just look at "cat > /dev/sndstat"? I'm not sure I %100 understand here but I think we should have an app (say mixer) whihc will IOCTL for the caps and report to the user. This is a reporting tool only. Apps that need to know will IOCTL as usual. > > > Anyway, as a general concept, I think we should start > >expanding our using sysctls. > > I think it depends. For status/capabilities/static like output, we should > look at enhancing existing interfaces (if they fit into the big picture of > what we want to add), like our "sound status device". > > For general "mode switching" (whatever this means) which doesn't fit into > the > 4Front-OSS model, sysctl looks like a nice candidate. But another nice > candidate would be a "sndctl" program which may interact with the device > over /dev/dspX.ctl orsomething like this. Oo, a nice thought. > > Is there something specific you have in mind regarding the sysctl proposal? Yes, for now we need commit Kazuhito HONDA patch for uaudio that provices sysctls for all available mixer/device settings. I have a dream (just a dream, I doubt I'll ever achieve it) is that our sound model is based on what the uadio standard provides. When an app wants to know that caps they get a descriptor just like what uaudio gives. Their format has quite a bit of thought behind it and its very flexible. Really, one could take that uadio description and convert it and run it through 'dot' and get a block diagram of the soundcard. That block diagram is usually only available in comments in the source. --Mat From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 00:35:04 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4284A16A4E1 for ; Fri, 29 Apr 2005 00:35:04 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA5D843D66 for ; Fri, 29 Apr 2005 00:35:03 +0000 (GMT) (envelope-from lioux@FreeBSD.org) Received: from 201.14.99.206 (unknown [201.14.99.206]) by vette.gigo.com (Postfix) with ESMTP id BA32B5655 for ; Thu, 28 Apr 2005 17:35:00 -0700 (PDT) Received: (qmail 86283 invoked by uid 1001); 29 Apr 2005 00:33:39 -0000 Message-ID: <20050429003339.86226.qmail@exxodus.fedaykin.here> Date: Thu, 28 Apr 2005 21:33:17 -0300 From: Mario Sergio Fujikawa Ferreira To: freebsd-multimedia@freebsd.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline User-Agent: Mutt/1.5.9i cc: "Thomas E. Zander" Subject: Mplayer adevice option does work X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 00:35:04 -0000 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I am having a bit of trouble with TV capturing. My video source device is bktr0: Hauppauge Model 44001 C110 bktr0: Hauppauge WinCast/TV crw-rw---- 1 root bktr 239, 0 Apr 25 07:20 /dev/bktr0 whilst my audio source device is crw-rw-rw- 1 root wheel 30, 0x00010004 Apr 25 07:20 /dev/audio0.1 The following mplayer line can capture video but no audio. ------- $ mplayer -tv driver=3Dbsdbt848:width=3D640:height=3D480:input=3D0:norm=3Dn= tsc tv:// =20 MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team CPU: Advanced Micro Devices Athlon MP/XP/XP-M Barton (Family: 6, Stepping: = 0) Detected cache-line size is 64 bytes CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0 Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE Playing tv://. Cache fill: 0.00% (0 bytes) TV detected! ;-) Selected driver: bsdbt848 name: Brooktree848 Support author: Charles Henrich comment: in development START vo: X11 running at 1280x1024 with depth 24 and 32 bpp (":0.0" =3D> local di= splay) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 640 x 480 (preferred csp: Packed UYVY) VDec: using Packed UYVY as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 640x480 =3D> 640x480 Packed UYVY=20 Selected video codec: [rawuyvy] vfm:raw (RAW UYVY) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Audio: no sound Starting playback... V: 0.0 76/ 76 ??% ??% ??,?% 0 0 0% = =20 Exiting... (Quit) ------- But as you can notice, no audio. mplayer(1) man page mentions a adevice command line option. adevice=3D Set an audio device. should be /dev/xxx for OSS and a hardware ID for ALSA. See the -ao alsa documentation to find out how to specify the hardware ID. However, despite good reports from mplayer mailing lists (no FreeBSD reports), I am unable to use this option under FreeBSD. The option should allow me to get audio from a source other than the video source. For example, ------- $ mplayer -tv adevice=3D/dev/audio0.1:driver=3Dbsdbt848:width=3D640:height= =3D480:input=3D0:norm=3Dntsc tv:// MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team CPU: Advanced Micro Devices Athlon MP/XP/XP-M Barton (Family: 6, Stepping: = 0) Detected cache-line size is 64 bytes CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0 Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE Option tv: Unknown suboption adevice ------- Inquiries at irc.freenode.net#mplayer imply that this option works fine under Linux. Any ideas why I am unable to use it? Is it incidental to my system; i.e., does it work for everyone using FreeBSD but me? Or, is it just that this option does not work under FreeBSD? We should work at getting it fixed. Any ideas? Regards, --=20 Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCcYDjrxEiaFLzGQwRAkFMAJ0WZXedAURQnscnlCakyv8dUpaWDACfeYvH gBQzQpClcvcbrGfXMQK7uRI= =vBtF -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24-- From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 00:48:28 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A7B816A4CE for ; Fri, 29 Apr 2005 00:48:28 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by mx1.FreeBSD.org (Postfix) with SMTP id 6297E43D48 for ; Fri, 29 Apr 2005 00:48:27 +0000 (GMT) (envelope-from jakemsr@jakemsr.com) Received: (qmail 28541 invoked from network); 29 Apr 2005 00:54:25 -0000 Received: from unknown (HELO puff.jakemsr.gom) (63.111.27.87) by mail231.csoft.net with SMTP; 29 Apr 2005 00:54:25 -0000 Received: (from jakemsr@jakemsr.com) by puff.jakemsr.gom (mini_sendmail/1.3.5 16nov2003); Thu, 28 Apr 2005 17:48:25 PDT (sender jakemsr@puff.jakemsr.gom) Date: Thu, 28 Apr 2005 17:48:25 -0700 From: Jacob Meuser To: freebsd-multimedia@freebsd.org Message-ID: <20050429004825.GA20527@puff.jakemsr.gom> Mail-Followup-To: freebsd-multimedia@freebsd.org References: <20050429003339.86226.qmail@exxodus.fedaykin.here> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050429003339.86226.qmail@exxodus.fedaykin.here> User-Agent: Mutt/1.4.2i Subject: Re: Mplayer adevice option does work X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 00:48:28 -0000 On Thu, Apr 28, 2005 at 09:33:17PM -0300, Mario Sergio Fujikawa Ferreira wrote: > adevice= > Set an audio device. should be /dev/xxx for OSS and a > hardware ID for ALSA. See the -ao alsa documentation to find > out how to specify the hardware ID. > > However, despite good reports from mplayer mailing lists (no FreeBSD > reports), I am unable to use this option under FreeBSD. The option > should allow me to get audio from a source other than the video source. > > For example, > ------- > > $ mplayer -tv adevice=/dev/audio0.1:driver=bsdbt848:width=640:height=480:input=0:norm=ntsc tv:// > MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team > CPU: Advanced Micro Devices Athlon MP/XP/XP-M Barton (Family: 6, Stepping: 0) > Detected cache-line size is 64 bytes > CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0 > Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE > > > Option tv: Unknown suboption adevice > ------- > > Inquiries at irc.freenode.net#mplayer imply that this option > works fine under Linux. Any ideas why I am unable to use it? Is it > incidental to my system; i.e., does it work for everyone using FreeBSD > but me? Or, is it just that this option does not work under FreeBSD? > > We should work at getting it fixed. Any ideas? Hi. I see this on OpenBSD too (same driver, etc). does anyone else see a constant "twitch" when capturing from bktr with mplayer? it seems to me that about once every second, a frame skips or gets repeated, or something ... -- From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 06:23:50 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5950416A4CE; Fri, 29 Apr 2005 06:23:50 +0000 (GMT) Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu [128.213.1.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF55343D4C; Fri, 29 Apr 2005 06:23:49 +0000 (GMT) (envelope-from crossd@cs.rpi.edu) Received: from localhost.localdomain (cpe-24-195-32-214.nycap.res.rr.com [24.195.32.214]) (authenticated bits=0)j3T6NcCU092079 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Fri, 29 Apr 2005 02:23:46 -0400 (EDT) From: David Cross To: re@freebsd.org, freebsd-multimedia@freebsd.org Content-Type: text/plain Date: Fri, 29 Apr 2005 02:22:04 -0400 Message-Id: <1114755724.983.1.camel@kagome> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Score: 4.948 (****) RCVD_IN_DSBL,RCVD_IN_DYNABLOCK,RCVD_IN_NJABL,RCVD_IN_NJABL_PROXY,RCVD_IN_SORBS X-Scanned-By: MIMEDefang 2.43 Subject: AD1888 patch... X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 06:23:50 -0000 Just wanted to make sure it makes it to 5.4 :) Its small, but a bit frustrating to remember to repatch every time I "make update". -- David E. Cross From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 08:50:40 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50C0416A4D6 for ; Fri, 29 Apr 2005 08:50:39 +0000 (GMT) Received: from mailout07.sul.t-online.com (mailout07.sul.t-online.com [194.25.134.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F86143D68 for ; Fri, 29 Apr 2005 08:50:37 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from fwd18.aul.t-online.de by mailout07.sul.t-online.com with smtp id 1DRRCi-0002dV-01; Fri, 29 Apr 2005 10:50:32 +0200 Received: from Andro-Beta.Leidinger.net (X6T+mrZHwe7JmAoy6eMcEiqJD1XYP2HZqy8JPh9vt7EV7E6YnRALr6@[217.229.217.78]) by fwd18.sul.t-online.de with esmtp id 1DRRCR-0MJi6K0; Fri, 29 Apr 2005 10:50:15 +0200 Received: from localhost (localhost [127.0.0.1])j3T8oDLC048565; Fri, 29 Apr 2005 10:50:13 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from 141.113.101.32 ([141.113.101.32]) by netchild.homeip.net (Horde MIME library) with HTTP for ; Fri, 29 Apr 2005 10:50:13 +0200 Message-ID: <20050429105013.t6r88igogs44gsk8@netchild.homeip.net> X-Priority: 3 (Normal) Date: Fri, 29 Apr 2005 10:50:13 +0200 From: Alexander Leidinger To: Mathew Kanner References: <20050306184416.5603976c@Magellan.Leidinger.net> <20050307030419.GC951@kt-is.co.kr> <20050308.121415.847025091.kazuhito@ph.noda.tus.ac.jp> <426F409D.6010007@elischer.org> <426F4280.9030206@elischer.org> <426F49C3.1020009@elischer.org> <20050427184115.GC11709@cnd.mcgill.ca> <20050428110656.wqnp94nnwosc80ck@netchild.homeip.net> <20050428112754.GB14507@cnd.mcgill.ca> <20050428142007.11hjbs1pcgws4g0w@netchild.homeip.net> <20050428170154.GG14507@cnd.mcgill.ca> In-Reply-To: <20050428170154.GG14507@cnd.mcgill.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.2) / FreeBSD-4.11 X-ID: X6T+mrZHwe7JmAoy6eMcEiqJD1XYP2HZqy8JPh9vt7EV7E6YnRALr6@t-dialin.net X-TOI-MSGID: d07222f5-81e5-43fb-b70e-3d46939d9101 cc: FreeBSD Multimedia cc: Julian Elischer Subject: Re: uaudio patch, X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 08:50:40 -0000 Mathew Kanner wrote: > On Apr 28, Alexander Leidinger wrote: >> Mathew Kanner wrote: >> >> > I realise I'm the only one whose taken this position so I'll >> >withdraw it. But for the record, this is my reasoning, what the heck >> >are you going to do with this informaiton: it doesn't help you. >> >> If you want to go to the soundcard directly, without any conversation, you >> need to know what you can use. > > But this doesn't help. At all. Think about latencity. Or teach me that our in-kernel conversation routines are invoked even when there's nothing to do. Or tell me that it isn't wasting clock-cycles if a sound generating app without any connection to the soundcard produces a format which needs conversation instead of a format which doesn't need conversation. >> > Other >> >interesting but often usesless information is printed in boot_verbose. >> >The listed capablities are often way beyound what our sound interface >> >can offer. >> >> Just because it can't offer it _yet_, it doesn't mean we don't teach the >> interface to use it later. And parts of this improvement can be addressed >> from both sides (step by step). > > But this doesn't help. At all. (Because it isn't an > interface, it's only text output). Expanding our abilities for > different formats and flagging which ones are hardware based is > *completly* serperate project. Yes. And as long as nobody invests time into this project, the text output is much better than nothing at all. And for the above mentioned case (app generates sound, has no connection to the soundcard, maybe because it runs on a different system) the user needs to know the capabilities. This means at one point he needs to see text. /dev/sndstat is our "sound device status" interface, and I think the capabilities of the soundcard are part of the status. >> > If you want to know what avaiable then connect to the >> >sound device and issue an ioctl like every other app. >> >> If I have an app which plays some audio files. And if I have the opportunity >> to generate the right file with a conversation program which converts >> "something" (e.g. text to speach) but doesn't knows about an output device, >> and I want to generate the right output, I have to know what I can use. A >> human being which just knows about tools, but not about ioctl(), I need >> something which tells me what I can use. Do we have an app which does this? >> Do we need such an app, or would it be convenient to just look at "cat >> /dev/sndstat"? > > I'm not sure I %100 understand here but I think we should have > an app (say mixer) whihc will IOCTL for the caps and report to the > user. This is a reporting tool only. Apps that need to know will > IOCTL as usual. Any way of presenting the capabilities to the use is ok for me. One way may be better then the other way. I don't think the mixer app is ok for this, as it traditionally is used to change the volume or change the recording source. I think about it as a channel control utility. Yes, it reports some properties, the volume and the recording channel, but those are 1. variable properties 2. falls withhin an ergonomic interface (report back what you do) /dev/sndstat traditionally reports static properties (please let's think about the number of virtual channels as a semi-static property; it's subject to sysctl modifications, and you have to be root to change it). The volume isn't a static property, the capabilities of a sound device are static properties. >> > Anyway, as a general concept, I think we should start >> >expanding our using sysctls. >> >> I think it depends. For status/capabilities/static like output, we should >> look at enhancing existing interfaces (if they fit into the big picture of >> what we want to add), like our "sound status device". >> >> For general "mode switching" (whatever this means) which doesn't fit into >> the >> 4Front-OSS model, sysctl looks like a nice candidate. But another nice >> candidate would be a "sndctl" program which may interact with the device >> over /dev/dspX.ctl orsomething like this. > > Oo, a nice thought. Thanks. It's really preferable over the sysctl approach, since it allows an user to change various aspects. A sysctl should only be used for "non user servicable parts". I haven't througly thought about what this means, but e.g. the vchans affect the behavior of the entire sound system regardles who uses it, so an users shouldn't be allowed to change it. >> Is there something specific you have in mind regarding the sysctl proposal? > > Yes, for now we need commit Kazuhito HONDA patch for uaudio > that provices sysctls for all available mixer/device settings. I think this is the wrong approach. The mixer settings belong into the mixer (and I've already thought about enhaning our mixer.. it's just the lack of time). > I have a dream (just a dream, I doubt I'll ever achieve it) is > that our sound model is based on what the uadio standard provides. I've thought about this already. The above mentioned enhancement of our mixer was based upon looking at what channels uaudio is able to differentiate and about what our mixer does display. > When an app wants to know that caps they get a descriptor just like > what uaudio gives. Their format has quite a bit of thought behind it > and its very flexible. Really, one could take that uadio description > and convert it and run it through 'dot' and get a block diagram of the > soundcard. That block diagram is usually only available in comments > in the source. Sounds interesting... such an descriptor export could be done with a sysctl or as part of sndctl. Even if it is static status, it doesn't belongs into /dev/sndstat, since I think about the uaudio description as a blob... or as xml data if you like. Should we start to join our ideas in the FreeBSD wiki and form a design document or TODO list out of it? Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 You cannot achieve the impossible without attempting the absurd. From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 09:32:22 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C227716A4CF for ; Fri, 29 Apr 2005 09:32:22 +0000 (GMT) Received: from sohara.org (sohara.org [192.220.64.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FDDD43D4C for ; Fri, 29 Apr 2005 09:32:20 +0000 (GMT) (envelope-from steve@sohara.org) Received: (qmail 64147 invoked by uid 16563); 29 Apr 2005 09:32:19 -0000 Received: from unknown (HELO STEVEOHS-LT) ([217.12.14.240]) (envelope-sender ) by 192.220.64.179 (qmail-ldap-1.03) with SMTP for ; 29 Apr 2005 09:32:19 -0000 Date: Fri, 29 Apr 2005 10:32:23 +0100 From: Steve O'Hara-Smith To: Mario Sergio Fujikawa Ferreira Message-Id: <20050429103223.72e3a65b.steve@sohara.org> In-Reply-To: <20050429003339.86226.qmail@exxodus.fedaykin.here> References: <20050429003339.86226.qmail@exxodus.fedaykin.here> Organization: Steve O'Hara-Smith X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-interix3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-multimedia@freebsd.org cc: riggs@rrr.de Subject: Re: Mplayer adevice option does work X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 09:32:22 -0000 On Thu, 28 Apr 2005 21:33:17 -0300 Mario Sergio Fujikawa Ferreira wrote: > However, despite good reports from mplayer mailing lists (no FreeBSD > reports), I am unable to use this option under FreeBSD. The option > should allow me to get audio from a source other than the video source. AFAICS from a quick read of the source the audio device is hardcoded to /dev/dsp (or /dev/sound for NetBSD) - presumably it fails to open in mplayer because /dev/dsp is already opened for the audio output. Try with -ao oss:dsp-device=/dev/dsp0.1 to force the output to a different device. > Option tv: Unknown suboption adevice > ------- > > Inquiries at irc.freenode.net#mplayer imply that this option > works fine under Linux. Any ideas why I am unable to use it? Is it > incidental to my system; i.e., does it work for everyone using FreeBSD > but me? Or, is it just that this option does not work under FreeBSD? > > We should work at getting it fixed. Any ideas? Charles Heinrich wrote the bsd capture for mplayer - he didn't add support for it. It looks easy enough to fix though. From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 22:51:08 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A9FE16A4D5 for ; Fri, 29 Apr 2005 22:51:08 +0000 (GMT) Received: from feith1.FEITH.COM (feith1.FEITH.COM [192.251.93.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73D9F43D64 for ; Fri, 29 Apr 2005 22:51:06 +0000 (GMT) (envelope-from john@feith.com) Received: from jwlab.FEITH.COM (jwlab.FEITH.COM [192.251.93.16]) by feith1.FEITH.COM (8.12.10+Sun/8.12.9) with ESMTP id j3TMp4f8020666 for ; Fri, 29 Apr 2005 18:51:04 -0400 (EDT) Received: from jwlab.FEITH.COM (localhost [127.0.0.1]) by jwlab.FEITH.COM (8.12.10+Sun/8.12.10) with ESMTP id j3TMp452020337 for ; Fri, 29 Apr 2005 18:51:04 -0400 (EDT) Received: (from john@localhost) by jwlab.FEITH.COM (8.12.10+Sun/8.12.10/Submit) id j3TMp3Hi020336 for multimedia@freebsd.org; Fri, 29 Apr 2005 18:51:03 -0400 (EDT) Date: Fri, 29 Apr 2005 18:51:03 -0400 (EDT) From: John Wehle Message-Id: <200504292251.j3TMp3Hi020336@jwlab.FEITH.COM> To: multimedia@freebsd.org Content-Type: text X-Scanned-By: MIMEDefang 2.48 on 192.251.93.1 X-Archived: cashew.FEITH.COM Subject: FreeBSD 4.9 / 5.2 Hauppauge PVR-250 / 350 Driver Patch (Apr 12, 2005) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 22:51:08 -0000 [ This is the Apr 12, 2005 snapshot of my source tree. Included are changes to support the half D1 DVD format, the radio present on some models, the Philips FQ1216ME MK3 and FM1216ME MK3 multi-standard tuners, the LG Innotek TAPE-H001F tuner, the MSP3415D audio decoder used on some older cards, using the iicbus / iicbb modules instead of statically linking them into the kernel, the TVTUNER_GETTYPE / TVTUNER_SETTYPE ioctls, B/G cable channel map, as well as Japan air and cable channel maps. ] To use the Hauppauge PVR-250 / 350 on FreeBSD 4.9 / 5.2 / 5.3: 1) Use patch to apply the appropriate Patch.iicbb so cxm can use the i2c bus and avoid a crash when unloading. 2) Unshar the enclosed archive into /sys. 3) Place a current version of hcwpvrp2.sys from the Hauppauge drivers into /sys/dev/cxm. Extract the the firmware by: # cd /sys/dev/cxm # cc -o cxm_extract_fw cxm_extract_fw.c # ./cxm_extract_fw hcwpvrp2.sys 4) On FreeBSD 4.x add: device iicbus device iicbb to your kernel configuration. On all versions of FreeBSD rebuilt the kernel and modules to ensure the iicbb patch takes effect. 5) Install the new kernel and modules. Reboot. 6) Make and install the cxm driver by: # cd /sys/modules/cxm # make # cp cxm/cxm.ko cxm_iic/cxm_iic.ko /modules # kldload cxm_iic # kldload cxm At which point your console should say something like: cxm0: mem 0xd8000000-0xdbffffff irq 12 at device 10 .0 on pci0 cxm_iic0: on cxm0 iicbb0: on cxm_iic0 cxm0: Philips FI1236 MK2 tuner cxm0: SAA7115 rev 1 video decoder cxm0: MSP3435G-B6 audio decoder cxm0: IR Remote cxm0: encoder firmware version 0x2050032 cxm0: decoder firmware version 0x2020023 7) On FreeBSD 4.x make the device nodes by: # cd /dev # ./MAKEDEV bktr0 On FreeBSD 5.2 and later the device node is /dev/cxm0 and magically appears when the cxm modules is loaded. A subset of the bt848 and meteor ioctls are supported. The more interesting ones being: TVTUNER_SETTYPE - Set the channel map / system (default is tuner specific). TVTUNER_SETCHNL - Set the channel (default to 4). BT848_SCAPAREA - Set the capture area / format (defaults to DVD). VCD: 352 x 240 or 352 x 288 SVCD: 480 x 480 or 480 x 576 DVD half D1: 352 x 480 or 352 x 576 DVD full D1: 720 x 480 or 720 x 576 METEORCAPTUR - Start / stop the capture. Capture is also started if a read occurs when the data buffer is empty. To capture a MPEG program stream from the current channel simply cat /dev/cxm0 > filename.mpeg. Though to ensure a clean capture you probably want to do something like: 1) Read data until the TV show has ended. 2) Use METEORCAPTUR to end the capture. 3) Use poll to determine if there is any data remaining in the device. Read the data as long as poll says there's data in the buffer. otherwise the end of the mpeg program stream will probably be corrupt. Enjoy, John Wehle ------------------8<------------------------8<------------------------ # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # dev/cxm # dev/cxm/Patch.iicbb-fbsd4 # dev/cxm/Patch.iicbb-fbsd5 # dev/cxm/cxm.c # dev/cxm/cxm.h # dev/cxm/cxm_audio.c # dev/cxm/cxm_eeprom.c # dev/cxm/cxm_i2c.c # dev/cxm/cxm_ir.c # dev/cxm/cxm_tuner.c # dev/cxm/cxm_video.c # dev/cxm/cxm_extract_fw.c # modules/cxm # modules/cxm/Makefile # modules/cxm/cxm # modules/cxm/cxm/Makefile # modules/cxm/cxm_iic # modules/cxm/cxm_iic/Makefile # echo c - dev/cxm mkdir -p dev/cxm > /dev/null 2>&1 echo x - dev/cxm/Patch.iicbb-fbsd4 sed 's/^X//' >dev/cxm/Patch.iicbb-fbsd4 << 'END-of-dev/cxm/Patch.iicbb-fbsd4' X*** dev/iicbus/iicbb.c.ORIGINAL Sat Apr 20 12:38:43 2002 X--- dev/iicbus/iicbb.c Thu Jan 29 01:46:55 2004 X*************** struct iicbb_softc { X*** 71,76 **** X--- 71,77 ---- X static int iicbb_probe(device_t); X static int iicbb_attach(device_t); X static int iicbb_detach(device_t); X+ static void iicbb_child_detached(device_t, device_t); X static int iicbb_print_child(device_t, device_t); X X static int iicbb_callback(device_t, int, caddr_t); X*************** static device_method_t iicbb_methods[] = X*** 87,92 **** X--- 88,94 ---- X DEVMETHOD(device_detach, iicbb_detach), X X /* bus interface */ X+ DEVMETHOD(bus_child_detached, iicbb_child_detached), X DEVMETHOD(bus_print_child, iicbb_print_child), X X /* iicbus interface */ X*************** static int iicbb_attach(device_t dev) X*** 135,149 **** X static int iicbb_detach(device_t dev) X { X struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X X! if (sc->iicbus) { X! bus_generic_detach(dev); X! device_delete_child(dev, sc->iicbus); X! } X X return (0); X } X X static int X iicbb_print_child(device_t bus, device_t dev) X { X--- 137,170 ---- X static int iicbb_detach(device_t dev) X { X struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X+ device_t child; X X! /* X! * Detach the children before recursively deleting X! * in case a child has a pointer to a grandchild X! * which is used by the child's detach routine. X! * X! * Remember the child before detaching so we can X! * delete it (bus_generic_detach indirectly zeroes X! * sc->child_dev). X! */ X! child = sc->iicbus; X! bus_generic_detach(dev); X! if (child) X! device_delete_child(dev, child); X X return (0); X } X X+ static void X+ iicbb_child_detached( device_t dev, device_t child ) X+ { X+ struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X+ X+ if (child == sc->iicbus) X+ sc->iicbus = NULL; X+ } X+ X static int X iicbb_print_child(device_t bus, device_t dev) X { X*************** static int iicbb_read(device_t dev, char X*** 345,349 **** X--- 366,371 ---- X } X X DRIVER_MODULE(iicbb, bti2c, iicbb_driver, iicbb_devclass, 0, 0); X+ DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0); X DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0); X DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0); END-of-dev/cxm/Patch.iicbb-fbsd4 echo x - dev/cxm/Patch.iicbb-fbsd5 sed 's/^X//' >dev/cxm/Patch.iicbb-fbsd5 << 'END-of-dev/cxm/Patch.iicbb-fbsd5' X*** dev/iicbus/iicbb.c.ORIGINAL Sun Aug 24 13:49:13 2003 X--- dev/iicbus/iicbb.c Sat Jun 19 01:43:13 2004 X*************** struct iicbb_softc { X*** 66,71 **** X--- 66,72 ---- X static int iicbb_probe(device_t); X static int iicbb_attach(device_t); X static int iicbb_detach(device_t); X+ static void iicbb_child_detached(device_t, device_t); X static int iicbb_print_child(device_t, device_t); X X static int iicbb_callback(device_t, int, caddr_t); X*************** static device_method_t iicbb_methods[] = X*** 82,87 **** X--- 83,89 ---- X DEVMETHOD(device_detach, iicbb_detach), X X /* bus interface */ X+ DEVMETHOD(bus_child_detached, iicbb_child_detached), X DEVMETHOD(bus_print_child, iicbb_print_child), X X /* iicbus interface */ X*************** static int iicbb_attach(device_t dev) X*** 130,144 **** X static int iicbb_detach(device_t dev) X { X struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X X! if (sc->iicbus) { X! bus_generic_detach(dev); X! device_delete_child(dev, sc->iicbus); X! } X X return (0); X } X X static int X iicbb_print_child(device_t bus, device_t dev) X { X--- 132,165 ---- X static int iicbb_detach(device_t dev) X { X struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X+ device_t child; X X! /* X! * Detach the children before recursively deleting X! * in case a child has a pointer to a grandchild X! * which is used by the child's detach routine. X! * X! * Remember the child before detaching so we can X! * delete it (bus_generic_detach indirectly zeroes X! * sc->child_dev). X! */ X! child = sc->iicbus; X! bus_generic_detach(dev); X! if (child) X! device_delete_child(dev, child); X X return (0); X } X X+ static void X+ iicbb_child_detached( device_t dev, device_t child ) X+ { X+ struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); X+ X+ if (child == sc->iicbus) X+ sc->iicbus = NULL; X+ } X+ X static int X iicbb_print_child(device_t bus, device_t dev) X { X*************** static int iicbb_read(device_t dev, char X*** 383,388 **** X--- 404,410 ---- X } X X DRIVER_MODULE(iicbb, bktr, iicbb_driver, iicbb_devclass, 0, 0); X+ DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0); X DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0); X DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0); X END-of-dev/cxm/Patch.iicbb-fbsd5 echo x - dev/cxm/cxm.c sed 's/^X//' >dev/cxm/cxm.c << 'END-of-dev/cxm/cxm.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Conexant MPEG-2 Codec driver. Supports the CX23415 / CX23416 X * chips that are on the Hauppauge PVR-250 and PVR-350 video X * capture cards. Currently only the encoder is supported. X * X * This driver was written using the invaluable information X * compiled by The IvyTV Project (ivtv.sourceforge.net). X */ X X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#if __FreeBSD_version < 503001 X# include X# include X#else X# include X# include X#endif X X#include X#include X X#if __FreeBSD_version < 500000 X# include X# include X#else X# include X# include X#endif X X#include X X#include X X X/* X * Various supported device vendors/types and their names. X */ Xstatic struct cxm_dev cxm_devs[] = { X { CXM_VENDORID_CONEXANT, CXM_DEVICEID_CONEXANT_iTVC15, X "Conexant iTVC15 MPEG Coder" }, X { CXM_VENDORID_CONEXANT, CXM_DEVICEID_CONEXANT_iTVC16, X "Conexant iTVC16 MPEG Coder" }, X { 0, 0, NULL } X}; X X Xstatic int cxm_probe( device_t dev ); Xstatic int cxm_attach( device_t dev ); Xstatic int cxm_detach( device_t dev ); Xstatic int cxm_shutdown( device_t dev ); Xstatic void cxm_intr( void *arg ); X Xstatic void cxm_child_detached( device_t dev, device_t child ); Xstatic int cxm_read_ivar( device_t bus, device_t dev, X int index, uintptr_t* val); Xstatic int cxm_write_ivar( device_t bus, device_t dev, X int index, uintptr_t val); X X Xstatic device_method_t cxm_methods[] = { X /* Device interface */ X DEVMETHOD(device_probe, cxm_probe), X DEVMETHOD(device_attach, cxm_attach), X DEVMETHOD(device_detach, cxm_detach), X DEVMETHOD(device_shutdown, cxm_shutdown), X X /* bus interface */ X DEVMETHOD(bus_child_detached, cxm_child_detached), X DEVMETHOD(bus_print_child, bus_generic_print_child), X DEVMETHOD(bus_driver_added, bus_generic_driver_added), X DEVMETHOD(bus_read_ivar, cxm_read_ivar), X DEVMETHOD(bus_write_ivar, cxm_write_ivar), X X { 0, 0 } X}; X Xstatic driver_t cxm_driver = { X "cxm", X cxm_methods, X sizeof(struct cxm_softc), X}; X Xstatic devclass_t cxm_devclass; X Xstatic d_open_t cxm_open; Xstatic d_close_t cxm_close; Xstatic d_read_t cxm_read; Xstatic d_ioctl_t cxm_ioctl; Xstatic d_poll_t cxm_poll; X X#if __FreeBSD_version < 500000 X# define CDEV_MAJOR 92 X#else X# define CDEV_MAJOR MAJOR_AUTO X#endif X Xstatic struct cdevsw cxm_cdevsw = { X#if __FreeBSD_version < 500000 X .d_bmaj = -1, X#elif __FreeBSD_version >= 502103 X .d_version = D_VERSION, X .d_flags = D_NEEDGIANT, X#endif X .d_maj = CDEV_MAJOR, X .d_name = "cxm", X .d_open = cxm_open, X .d_close = cxm_close, X .d_read = cxm_read, X .d_ioctl = cxm_ioctl, X .d_poll = cxm_poll X}; X XMODULE_DEPEND(cxm, cxm_iic, 1, 1, 1); X#if __FreeBSD_version >= 500000 XMODULE_DEPEND(cxm, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); X#endif XDRIVER_MODULE(cxm, pci, cxm_driver, cxm_devclass, 0, 0); X X Xstatic struct cxm_codec_audio_format codec_audio_formats[] = { X { 44100, 0xb8 }, /* 44.1 Khz, MPEG-1 Layer II, 224 kb/s */ X { 48000, 0xe9 } /* 48 Khz, MPEG-1 Layer II, 384 kb/s */ X}; X X X/* X * Various profiles. X */ Xstatic struct cxm_codec_profile vcd_ntsc_profile = { X "MPEG-1 VideoCD NTSC video and MPEG audio", X CXM_FW_STREAM_TYPE_VCD, X 30, X 352, 240, 480, X { 10, 12, 21 }, X 12, X 0, X { 1, 1150000, 0 }, X { 1, 15, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 44100 X}; X Xstatic struct cxm_codec_profile vcd_pal_profile = { X "MPEG-1 VideoCD PAL video and MPEG audio", X CXM_FW_STREAM_TYPE_VCD, X 25, X 352, 288, 576, X { 6, 17, 22 }, X 8, X 0, X { 1, 1150000, 0 }, X { 1, 12, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 44100 X}; X Xstatic struct cxm_codec_profile svcd_ntsc_profile = { X "MPEG-2 SuperVCD NTSC video and MPEG audio", X CXM_FW_STREAM_TYPE_SVCD, X 30, X 480, 480, 480, X { 10, 12, 21 }, X 2, X 0, X /* 2.5 Mb/s peak limit to keep bbdmux followed by mplex -f 4 happy */ X { 0, 1150000, 2500000 }, X { 1, 15, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 44100 X}; X Xstatic struct cxm_codec_profile svcd_pal_profile = { X "MPEG-2 SuperVCD PAL video and MPEG audio", X CXM_FW_STREAM_TYPE_SVCD, X 25, X 480, 576, 576, X { 6, 17, 22 }, X 2, X 0, X /* 2.5 Mb/s peak limit to keep bbdmux followed by mplex -f 4 happy */ X { 0, 1150000, 2500000 }, X { 1, 12, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 44100 X}; X Xstatic struct cxm_codec_profile dvd_half_d1_ntsc_profile = { X "MPEG-2 DVD NTSC video and MPEG audio", X CXM_FW_STREAM_TYPE_DVD, X 30, X 352, 480, 480, X { 10, 12, 21 }, X 2, X 0, X { 0, 4000000, 4520000 }, /* 4 hours on 8.54 GB media */ X { 1, 15, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 48000 X}; X Xstatic struct cxm_codec_profile dvd_half_d1_pal_profile = { X "MPEG-2 DVD PAL video and MPEG audio", X CXM_FW_STREAM_TYPE_DVD, X 25, X 352, 576, 576, X { 6, 17, 22 }, X 2, X 0, X { 0, 4000000, 4520000 }, /* 4 hours on 8.54 GB media */ X { 1, 12, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 48000 X}; X Xstatic struct cxm_codec_profile dvd_full_d1_ntsc_profile = { X "MPEG-2 DVD NTSC video and MPEG audio", X CXM_FW_STREAM_TYPE_DVD, X 30, X 720, 480, 480, X { 10, 12, 21 }, X 2, X 0, X /* 9.52 Mb/s peak limit to keep bbdmux followed by mplex -f 8 happy */ X { 0, 9000000, 9520000 }, /* 1 hour on 4.7 GB media */ X { 1, 15, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 48000 X}; X Xstatic struct cxm_codec_profile dvd_full_d1_pal_profile = { X "MPEG-2 DVD PAL video and MPEG audio", X CXM_FW_STREAM_TYPE_DVD, X 25, X 720, 576, 576, X { 6, 17, 22 }, X 2, X 0, X /* 9.52 Mb/s peak limit to keep bbdmux followed by mplex -f 8 happy */ X { 0, 9000000, 9520000 }, /* 1 hour on 4.7 GB media */ X { 1, 12, 3}, X /* X * Spatial filter = Manual, Temporal filter = Manual X * Median filter = Horizontal / Vertical X * Spatial filter value = 1, Temporal filter value = 4 X */ X { 0, 3, 1, 4 }, X 48000 X}; X X Xstatic const struct cxm_codec_profile X*codec_profiles[] = { X &vcd_ntsc_profile, X &vcd_pal_profile, X &svcd_ntsc_profile, X &svcd_pal_profile, X &dvd_half_d1_ntsc_profile, X &dvd_half_d1_pal_profile, X &dvd_full_d1_ntsc_profile, X &dvd_full_d1_pal_profile X}; X X Xstatic unsigned int Xcxm_queue_firmware_command( struct cxm_softc *sc, X enum cxm_mailbox_name mbx_name, u_int32_t cmd, X u_int32_t *parameters, unsigned int nparameters ) X{ X unsigned int i; X unsigned int mailbox; X u_int32_t completed_command; X u_int32_t flags; X intrmask_t s; X X if (nparameters > CXM_MBX_MAX_PARAMETERS) { X printf("%s: too many parameters for mailbox\n", sc->name); X return -1; X } X X mailbox = 0; X X switch (mbx_name) { X case cxm_dec_mailbox: X mailbox = sc->dec_mbx X + CXM_MBX_FW_CMD_MAILBOX *sizeof(struct cxm_mailbox); X break; X X case cxm_enc_mailbox: X mailbox = sc->enc_mbx X + CXM_MBX_FW_CMD_MAILBOX *sizeof(struct cxm_mailbox); X break; X X default: X return -1; X } X X s = spltty(); X for (i = 0; i < CXM_MBX_FW_CMD_MAILBOXES; i++) { X flags = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, flags)); X if (! (flags & CXM_MBX_FLAG_IN_USE) ) X break; X X /* X * Mail boxes containing certain completed commands X * for which the results are never needed can be reused. X */ X X if ((flags & (CXM_MBX_FLAG_DRV_DONE | CXM_MBX_FLAG_FW_DONE)) X == (CXM_MBX_FLAG_DRV_DONE | CXM_MBX_FLAG_FW_DONE)) { X completed_command X = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, command)); X X /* X * DMA results are always check by reading the X * DMA status register ... never by checking X * the mailbox after the command has completed. X */ X X if (completed_command == CXM_FW_CMD_SCHED_DMA_TO_HOST) X break; X } X X mailbox += sizeof(struct cxm_mailbox); X } X X if (i >= CXM_MBX_FW_CMD_MAILBOXES) { X splx(s); X return -1; X } X X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, flags), X CXM_MBX_FLAG_IN_USE); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, mailbox + offsetof(struct cxm_mailbox, flags)); X X splx(s); X X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, command), cmd); X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, timeout), X CXM_FW_STD_TIMEOUT); X X for (i = 0; i < nparameters; i++) X CSR_WRITE_4(sc, X mailbox X + offsetof(struct cxm_mailbox, parameters) X + i * sizeof(u_int32_t), X *(parameters + i)); X X for ( ; i < CXM_MBX_MAX_PARAMETERS; i++) X CSR_WRITE_4(sc, X mailbox X + offsetof(struct cxm_mailbox, parameters) X + i * sizeof(u_int32_t), 0); X X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, flags), X CXM_MBX_FLAG_IN_USE | CXM_MBX_FLAG_DRV_DONE); X X return mailbox; X} X X Xstatic int Xcxm_firmware_command( struct cxm_softc *sc, X enum cxm_mailbox_name mbx_name, u_int32_t cmd, X u_int32_t *parameters, unsigned int nparameters ) X{ X const char *wmesg; X unsigned int *bmp; X unsigned int i; X unsigned int mailbox; X u_int32_t flags; X u_int32_t result; X X bmp = NULL; X wmesg = ""; X X switch (mbx_name) { X case cxm_dec_mailbox: X bmp = &sc->dec_mbx; X wmesg = "cxmdfw"; X break; X X case cxm_enc_mailbox: X bmp = &sc->enc_mbx; X wmesg = "cxmefw"; X break; X X default: X return -1; X } X X mailbox = cxm_queue_firmware_command(sc, mbx_name, cmd, X parameters, nparameters); X if (mailbox == -1) { X printf("%s: no free mailboxes\n", sc->name); X return -1; X } X X /* Give the firmware a chance to start processing the request */ X (void)tsleep(bmp, PWAIT, wmesg, hz / 100); X X for (i = 0; i < 100; i++) { X flags = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, flags)); X if ( (flags & CXM_MBX_FLAG_FW_DONE) ) X break; X X /* Wait for 10ms */ X (void)tsleep(bmp, PWAIT, wmesg, hz / 100); X } X X if (i >= 100) { X printf("%s: timeout\n", sc->name); X return -1; X } X X result = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, result)); X X for (i = 0; i < nparameters; i++) X *(parameters + i) X = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, parameters) X + i * sizeof(u_int32_t)); X X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, flags), 0); X X return result == 0 ? 0 : -1; X} X X Xstatic int Xcxm_firmware_command_nosleep( struct cxm_softc *sc, X enum cxm_mailbox_name mbx_name, u_int32_t cmd, X u_int32_t *parameters, unsigned int nparameters ) X{ X unsigned int i; X unsigned int mailbox; X u_int32_t flags; X u_int32_t result; X X for (i = 0; i < 100; i++) { X mailbox = cxm_queue_firmware_command(sc, mbx_name, cmd, X parameters, nparameters); X if (mailbox != -1) X break; X X /* Wait for 10ms */ X DELAY(10000); X } X X if (i >= 100) { X printf("%s: no free mailboxes\n", sc->name); X return -1; X } X X /* Give the firmware a chance to start processing the request */ X DELAY(10000); X X for (i = 0; i < 100; i++) { X flags = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, flags)); X if ( (flags & CXM_MBX_FLAG_FW_DONE) ) X break; X X /* Wait for 10ms */ X DELAY(10000); X } X X if (i >= 100) { X printf("%s: timeout\n", sc->name); X return -1; X } X X result = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, result)); X X for (i = 0; i < nparameters; i++) X *(parameters + i) X = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, parameters) X + i * sizeof(u_int32_t)); X X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, flags), 0); X X return result == 0 ? 0 : -1; X} X X Xstatic int Xcxm_stop_firmware( struct cxm_softc *sc ) X{ X X if (cxm_firmware_command_nosleep(sc, cxm_enc_mailbox, X CXM_FW_CMD_ENC_HALT_FW, NULL, 0) < 0) X return -1; X X if (sc->type == cxm_iTVC15_type X && cxm_firmware_command_nosleep(sc, cxm_dec_mailbox, X CXM_FW_CMD_DEC_HALT_FW, X NULL, 0) < 0) X return -1; X X /* Wait for 10ms */ X DELAY(10000); X X return 0; X} X X Xstatic void Xcxm_set_irq_mask( struct cxm_softc *sc, u_int32_t mask ) X{ X intrmask_t s; X X s = spltty(); X X CSR_WRITE_4(sc, CXM_REG_IRQ_MASK, mask); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, CXM_REG_IRQ_MASK); X X sc->irq_mask = mask; X X splx(s); X} X X Xstatic void Xcxm_set_irq_status( struct cxm_softc *sc, u_int32_t status ) X{ X X CSR_WRITE_4(sc, CXM_REG_IRQ_STATUS, status); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, CXM_REG_IRQ_STATUS); X} X X Xstatic int Xcxm_stop_hardware( struct cxm_softc *sc ) X{ X X if (sc->cxm_iic) { X if (cxm_saa7115_mute(sc) < 0) X return -1; X if (cxm_msp_mute(sc) < 0) X return -1; X } X X /* Halt the firmware */ X if (sc->enc_mbx != -1) { X if (cxm_stop_firmware(sc) < 0) X return -1; X } X X /* Mask all interrupts */ X cxm_set_irq_mask(sc, 0xffffffff); X X /* Stop VDM */ X CSR_WRITE_4(sc, CXM_REG_VDM, CXM_CMD_VDM_STOP); X X /* Stop AO */ X CSR_WRITE_4(sc, CXM_REG_AO, CXM_CMD_AO_STOP); X X /* Ping (?) APU */ X CSR_WRITE_4(sc, CXM_REG_APU, CXM_CMD_APU_PING); X X /* Stop VPU */ X CSR_WRITE_4(sc, CXM_REG_VPU, sc->type == cxm_iTVC15_type X ? CXM_CMD_VPU_STOP15 X : CXM_CMD_VPU_STOP16); X X /* Reset Hw Blocks */ X CSR_WRITE_4(sc, CXM_REG_HW_BLOCKS, CXM_CMD_HW_BLOCKS_RST); X X /* Stop SPU */ X CSR_WRITE_4(sc, CXM_REG_SPU, CXM_CMD_SPU_STOP); X X /* Wait for 10ms */ X DELAY(10000); X X return 0; X} X X Xstatic int Xcxm_download_firmware( struct cxm_softc *sc ) X{ X unsigned int i; X const u_int32_t *fw; X X /* Download the encoder firmware */ X fw = (const u_int32_t *)cxm_enc_fw; X for (i = 0; i < CXM_FW_SIZE; i += sizeof(*fw)) X CSR_WRITE_4(sc, CXM_MEM_ENC + i, *fw++); X X /* Download the decoder firmware */ X if (sc->type == cxm_iTVC15_type) { X fw = (const u_int32_t *)cxm_dec_fw; X for (i = 0; i < CXM_FW_SIZE; i += sizeof(*fw)) X CSR_WRITE_4(sc, CXM_MEM_DEC + i, *fw++); X } X X return 0; X} X X Xstatic int Xcxm_init_hardware( struct cxm_softc *sc ) X{ X unsigned int i; X unsigned int mailbox; X u_int32_t parameter; X X if (cxm_stop_hardware(sc) < 0) X return -1; X X /* Initialize encoder SDRAM pre-charge */ X CSR_WRITE_4(sc, CXM_REG_ENC_SDRAM_PRECHARGE, X CXM_CMD_SDRAM_PRECHARGE_INIT); X X /* Initialize encoder SDRAM refresh to 1us */ X CSR_WRITE_4(sc, CXM_REG_ENC_SDRAM_REFRESH, X CXM_CMD_SDRAM_REFRESH_INIT); X X /* Initialize decoder SDRAM pre-charge */ X CSR_WRITE_4(sc, CXM_REG_DEC_SDRAM_PRECHARGE, X CXM_CMD_SDRAM_PRECHARGE_INIT); X X /* Initialize decoder SDRAM refresh to 1us */ X CSR_WRITE_4(sc, CXM_REG_DEC_SDRAM_REFRESH, X CXM_CMD_SDRAM_REFRESH_INIT); X X /* Wait for 600ms */ X DELAY(600000); X X if (cxm_download_firmware(sc) < 0) X return -1; X X /* Enable SPU */ X CSR_WRITE_4(sc, CXM_REG_SPU, X CSR_READ_4(sc, CXM_REG_SPU) & CXM_MASK_SPU_ENABLE); X X /* Wait for 1 second */ X DELAY(1000000); X X /* Enable VPU */ X CSR_WRITE_4(sc, CXM_REG_VPU, X CSR_READ_4(sc, CXM_REG_VPU) X & (sc->type == cxm_iTVC15_type X ? CXM_MASK_VPU_ENABLE15 X : CXM_MASK_VPU_ENABLE16)); X X /* Wait for 1 second */ X DELAY(1000000); X X /* Locate encoder mailbox */ X mailbox = CXM_MEM_ENC; X for (i = 0; i < CXM_MEM_ENC_SIZE; i += 0x100) X if (CSR_READ_4(sc, mailbox + i) == 0x12345678 X && CSR_READ_4(sc, mailbox + i + 4) == 0x34567812 X && CSR_READ_4(sc, mailbox + i + 8) == 0x56781234 X && CSR_READ_4(sc, mailbox + i + 12) == 0x78123456) X break; X X if (i >= CXM_MEM_ENC_SIZE) X return -1; X X sc->enc_mbx = mailbox + i + 16; X X /* Locate decoder mailbox */ X if (sc->type == cxm_iTVC15_type) { X mailbox = CXM_MEM_DEC; X for (i = 0; i < CXM_MEM_DEC_SIZE; i += 0x100) X if (CSR_READ_4(sc, mailbox + i) == 0x12345678 X && CSR_READ_4(sc, mailbox + i + 4) == 0x34567812 X && CSR_READ_4(sc, mailbox + i + 8) == 0x56781234 X && CSR_READ_4(sc, mailbox + i + 12) == 0x78123456) X break; X X if (i >= CXM_MEM_DEC_SIZE) X return -1; X X sc->dec_mbx = mailbox + i + 16; X } X X /* Get encoder firmware version */ X parameter = 0; X if (cxm_firmware_command_nosleep(sc, cxm_enc_mailbox, X CXM_FW_CMD_ENC_GET_FW_VER, X ¶meter, 1) < 0) X return -1; X X printf("%s: encoder firmware version %#x\n", X sc->name, (unsigned int)parameter); X X /* Get decoder firmware version */ X if (sc->type == cxm_iTVC15_type) { X parameter = 0; X if (cxm_firmware_command_nosleep(sc, cxm_dec_mailbox, X CXM_FW_CMD_DEC_GET_FW_VER, X ¶meter, 1) < 0) X return -1; X X printf("%s: decoder firmware version %#x\n", X sc->name, (unsigned int)parameter); X } X X return 0; X} X X Xstatic int Xcxm_configure_encoder( struct cxm_softc *sc ) X{ X int fps; X unsigned int i; X u_int32_t parameters[12]; X const struct cxm_codec_profile *cpp; X X if (sc->source == cxm_fm_source) X switch (cxm_tuner_selected_channel_set(sc)) { X case CHNLSET_NABCST: X case CHNLSET_CABLEIRC: X case CHNLSET_JPNBCST: X case CHNLSET_JPNCABLE: X fps = 30; X break; X X default: X fps = 25; X break; X } X else X fps = cxm_saa7115_detected_fps(sc); X X if (fps < 0) X return -1; X X if (sc->profile->fps != fps) { X X /* X * Pick a profile with the correct fps using the X * chosen stream type and width to decide between X * the VCD, SVCD, or DVD profiles. X */ X X for (i = 0; i < NUM_ELEMENTS(codec_profiles); i++) X if (codec_profiles[i]->fps == fps X && codec_profiles[i]->stream_type X == sc->profile->stream_type X && codec_profiles[i]->width == sc->profile->width) X break; X X if (i >= NUM_ELEMENTS(codec_profiles)) X return -1; X X sc->profile = codec_profiles[i]; X } X X cpp = sc->profile; X X if (cxm_saa7115_configure(sc, X cpp->width, cpp->source_height, fps, X cpp->audio_sample_rate) < 0) X return -1; X X /* assign dma block len */ X parameters[0] = 1; /* Transfer block size = 1 */ X parameters[1] = 1; /* Units = 1 (frames) */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_DMA_BLOCKLEN, X parameters, 2) != 0) X return -1; X X X /* assign program index info */ X parameters[0] = 0; /* Picture mask = 0 (don't generate index) */ X parameters[1] = 0; /* Num_req = 0 */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_PGM_INDEX_INFO, X parameters, 2) != 0) X return -1; X X /* assign stream type */ X parameters[0] = cpp->stream_type; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_STREAM_TYPE, X parameters, 1) != 0) X return -1; X X /* assign output port */ X parameters[0] = 0; /* 0 (Memory) */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_OUTPUT_PORT, X parameters, 1) != 0) X return -1; X X /* assign framerate */ X parameters[0] = cpp->fps == 30 ? 0 : 1; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_FRAME_RATE, X parameters, 1) != 0) X return -1; X X /* assign frame size */ X parameters[0] = cpp->height; X parameters[1] = cpp->width; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_FRAME_SIZE, X parameters, 2) != 0) X return -1; X X /* assign aspect ratio */ X parameters[0] = cpp->aspect; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_ASPECT_RATIO, X parameters, 1) != 0) X return -1; X X /* assign bitrates */ X parameters[0] = cpp->bitrate.mode; X parameters[1] = cpp->bitrate.average; X parameters[2] = cpp->bitrate.peak / 400; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_BITRATES, X parameters, 3) != 0) X return -1; X X /* assign gop closure */ X parameters[0] = cpp->gop.closure; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_GOP_CLOSURE, X parameters, 1) != 0) X return -1; X X /* assign gop properties */ X parameters[0] = cpp->gop.frames; X parameters[1] = cpp->gop.bframes; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_GOP_PROPERTIES, X parameters, 2) != 0) X return -1; X X /* assign 3 2 pulldown */ X parameters[0] = cpp->pulldown; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_3_2_PULLDOWN, X parameters, 1) != 0) X return -1; X X /* assign dnr filter mode */ X parameters[0] = cpp->dnr.mode; X parameters[1] = cpp->dnr.type; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_DNR_FILTER_MODE, X parameters, 2) != 0) X return -1; X X /* assign dnr filter props */ X parameters[0] = cpp->dnr.spatial; X parameters[1] = cpp->dnr.temporal; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_DNR_FILTER_PROPERTIES, X parameters, 2) != 0) X return -1; X X /* X * assign audio properties X */ X X for (i = 0; i < NUM_ELEMENTS(codec_audio_formats); i++) X if (codec_audio_formats[i].sample_rate X == cpp->audio_sample_rate) X break; X X if (i >= NUM_ELEMENTS(codec_audio_formats)) X return -1; X X parameters[0] = codec_audio_formats[i].format; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_AUDIO_PROPERTIES, X parameters, 1) != 0) X return -1; X X /* assign coring levels */ X parameters[0] = 0; /* luma_h */ X parameters[1] = 255; /* luma_l */ X parameters[2] = 0; /* chroma_h */ X parameters[3] = 255; /* chroma_l */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_CORING_LEVELS, X parameters, 4) != 0) X return -1; X X /* assign spatial filter type */ X parameters[0] = 3; /* Luminance filter = 3 (2D H/V Separable) */ X parameters[1] = 1; /* Chrominance filter = 1 (1D Horizontal) */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_SPATIAL_FILTER_TYPE, X parameters, 2) != 0) X return -1; X X /* assign frame drop rate */ X parameters[0] = 0; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_FRAME_DROP_RATE, X parameters, 1) != 0) X return -1; X X /* assign placeholder */ X parameters[0] = 0; /* type = 0 (Extension / UserData) */ X parameters[1] = 0; /* period */ X parameters[2] = 0; /* size_t */ X parameters[3] = 0; /* arg0 */ X parameters[4] = 0; /* arg1 */ X parameters[5] = 0; /* arg2 */ X parameters[6] = 0; /* arg3 */ X parameters[7] = 0; /* arg4 */ X parameters[8] = 0; /* arg5 */ X parameters[9] = 0; /* arg6 */ X parameters[10] = 0; /* arg7 */ X parameters[11] = 0; /* arg8 */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_PLACEHOLDER, X parameters, 12) != 0) X return -1; X X /* assign VBI properties */ X parameters[0] = 0xbd04; /* mode = 0 (sliced), stream and user data */ X parameters[1] = 0; /* frames per interrupt (only valid in raw mode) */ X parameters[2] = 0; /* total raw VBI frames (only valid in raw mode) */ X parameters[3] = 0x25256262; /* ITU 656 start codes (saa7115 table 24)*/ X parameters[4] = 0x38387f7f; /* ITU 656 stop codes (saa7115 table 24) */ X parameters[5] = cpp->vbi.nlines; /* lines per frame */ X parameters[6] = 1440; /* bytes per line = 720 pixels */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_VBI_PROPERTIES, X parameters, 7) != 0) X return -1; X X /* assign VBI lines */ X parameters[0] = 0xffffffff; /* all lines */ X parameters[1] = 0; /* disable VBI features */ X parameters[2] = 0; X parameters[3] = 0; X parameters[4] = 0; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_VBI_LINE, X parameters, 5) != 0) X return -1; X X /* assign number of lines in fields 1 and 2 */ X parameters[0] = cpp->source_height / 2 + cpp->vbi.nlines; X parameters[1] = cpp->source_height / 2 + cpp->vbi.nlines; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ASSIGN_NUM_VSYNC_LINES, X parameters, 2) != 0) X return -1; X X return 0; X} X X Xstatic int Xcxm_start_encoder( struct cxm_softc *sc ) X{ X u_int32_t parameters[4]; X u_int32_t subtype; X u_int32_t type; X X if (sc->encoding) X return 0; X X if (cxm_configure_encoder(sc) < 0) X return -1; X X /* Mute the video input if necessary. */ X parameters[0] = sc->source == cxm_fm_source ? 1 : 0; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_MUTE_VIDEO_INPUT, X parameters, 1) != 0) X return -1; X X /* Clear pending encoder interrupts (which are currently masked) */ X cxm_set_irq_status(sc, CXM_IRQ_ENC); X X /* Enable event notification */ X parameters[0] = 0; /* Event = 0 (refresh encoder input) */ X parameters[1] = 1; /* Notification = 1 (enable) */ X parameters[2] = 0x10000000; /* Interrupt bit */ X parameters[3] = -1; /* Mailbox = -1 (no mailbox) */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ENC_EVENT_NOTIFICATION, X parameters, 4) != 0) X return -1; X X if (cxm_saa7115_mute(sc) < 0) X return -1; X if (cxm_msp_mute(sc) < 0) X return -1; X X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_INITIALIZE_VIDEO_INPUT, X NULL, 0) < 0) X return -1; X X if (cxm_saa7115_unmute(sc) < 0) X return -1; X if (cxm_msp_unmute(sc) < 0) X return -1; X X /* Wait for 100ms */ X (void)tsleep(&sc->encoding, PWAIT, "cxmce", hz / 10); X X type = sc->mpeg ? CXM_FW_CAPTURE_STREAM_TYPE_MPEG X : CXM_FW_CAPTURE_STREAM_TYPE_RAW; X subtype = ((sc->mpeg || sc->source == cxm_fm_source) X ? CXM_FW_CAPTURE_STREAM_PCM_AUDIO : 0) X | ((sc->mpeg || sc->source != cxm_fm_source) X ? CXM_FW_CAPTURE_STREAM_YUV : 0); X X /* Start the encoder */ X parameters[0] = type; X parameters[1] = subtype; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_BEGIN_CAPTURE, parameters, 2) != 0) X return -1; X X sc->enc_pool.offset = 0; X sc->enc_pool.read = 0; X sc->enc_pool.write = 0; X X sc->encoding_eos = 0; X X sc->encoding = 1; X X /* Enable interrupts */ X cxm_set_irq_mask(sc, sc->irq_mask & ~CXM_IRQ_ENC); X X return 0; X} X X Xstatic int Xcxm_stop_encoder( struct cxm_softc *sc ) X{ X u_int32_t parameters[4]; X u_int32_t subtype; X u_int32_t type; X intrmask_t s; X X if (! sc->encoding ) X return 0; X X type = sc->mpeg ? CXM_FW_CAPTURE_STREAM_TYPE_MPEG X : CXM_FW_CAPTURE_STREAM_TYPE_RAW; X subtype = ((sc->mpeg || sc->source == cxm_fm_source) X ? CXM_FW_CAPTURE_STREAM_PCM_AUDIO : 0) X | ((sc->mpeg || sc->source != cxm_fm_source) X ? CXM_FW_CAPTURE_STREAM_YUV : 0); X X /* Stop the encoder */ X parameters[0] = sc->mpeg ? 0 : 1; /* When = 0 (end of GOP) */ X parameters[1] = type; X parameters[2] = subtype; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_END_CAPTURE, parameters, 3) != 0) X return -1; X X /* Wait for up to 1 second */ X s = spltty(); X if (! sc->encoding_eos ) X (void)tsleep(&sc->encoding_eos, PWAIT, "cxmeos", hz); X splx(s); X X if (sc->mpeg && ! sc->encoding_eos ) X printf("%s: missing encoder EOS\n", sc->name); X X /* Disable event notification */ X parameters[0] = 0; /* Event = 0 (refresh encoder input) */ X parameters[1] = 0; /* Notification = 0 (disable) */ X parameters[2] = 0x10000000; /* Interrupt bit */ X parameters[3] = -1; /* Mailbox = -1 (no mailbox) */ X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_ENC_EVENT_NOTIFICATION, X parameters, 4) != 0) X return -1; X X /* Disable interrupts */ X cxm_set_irq_mask(sc, sc->irq_mask | CXM_IRQ_ENC); X X sc->encoding = 0; X X return 0; X} X X Xstatic int Xcxm_pause_encoder( struct cxm_softc *sc ) X{ X u_int32_t parameter; X X /* Pause the encoder */ X parameter = 0; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_PAUSE_ENCODER, ¶meter, 1) != 0) X return -1; X X return 0; X} X X Xstatic int Xcxm_unpause_encoder( struct cxm_softc *sc ) X{ X u_int32_t parameter; X X /* Unpause the encoder */ X parameter = 1; X if (cxm_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_PAUSE_ENCODER, ¶meter, 1) != 0) X return -1; X X return 0; X} X X Xstatic unsigned int Xcxm_encoder_fixup_byte_order( struct cxm_softc *sc, X unsigned int current, size_t offset) X{ X unsigned int strips; X unsigned int i; X unsigned int j; X unsigned int k; X unsigned int macroblocks_per_line; X unsigned int scratch; X unsigned int words_per_line; X u_int32_t *ptr; X u_int32_t *src; X size_t nbytes; X X switch (sc->enc_pool.bufs[current].byte_order) { X case cxm_device_mpeg_byte_order: X X /* X * Convert each 32 bit word to the proper byte ordering. X */ X X for (nbytes = 0, X ptr = (u_int32_t *)sc->enc_pool.bufs[current].vaddr; X nbytes != sc->enc_pool.bufs[current].size; X nbytes += sizeof(*ptr), ptr++) X *ptr = bswap32(*ptr); X X break; X X case cxm_device_yuv12_byte_order: X X /* X * Convert each macro block to planar using X * a scratch buffer (the buffer prior to the X * current buffer is always free since it marks X * the end of the ring buffer). X */ X X scratch = (current + (CXM_SG_BUFFERS - 1)) % CXM_SG_BUFFERS; X X if (offset) { X current = scratch; X break; X } X X src = (u_int32_t *)sc->enc_pool.bufs[current].vaddr; X words_per_line = sc->profile->width / sizeof(*ptr); X macroblocks_per_line X = sc->profile->width / CXM_MACROBLOCK_WIDTH; X strips = sc->enc_pool.bufs[current].size X / (macroblocks_per_line * CXM_MACROBLOCK_SIZE); X X for (i = 0; i < strips; i++) { X ptr = (u_int32_t *)sc->enc_pool.bufs[scratch].vaddr X + i * macroblocks_per_line * CXM_MACROBLOCK_SIZE X / sizeof(*ptr); X for (j = 0; j < macroblocks_per_line; j++) { X for (k = 0; k < CXM_MACROBLOCK_HEIGHT; k++) { X#if CXM_MACROBLOCK_WIDTH != 16 X# error CXM_MACROBLOCK_WIDTH != 16 X#endif X *(ptr + k * words_per_line) X = *src++; X *(ptr + k * words_per_line + 1) X = *src++; X *(ptr + k * words_per_line + 2) X = *src++; X *(ptr + k * words_per_line + 3) X = *src++; X } X ptr += CXM_MACROBLOCK_WIDTH / sizeof(*ptr); X } X } X X sc->enc_pool.bufs[scratch].size X = sc->enc_pool.bufs[current].size; X X current = scratch; X break; X X default: X break; X } X X sc->enc_pool.bufs[current].byte_order = cxm_host_byte_order; X X return current; X} X X Xstatic void Xcxm_encoder_dma_discard( struct cxm_softc *sc ) X{ X u_int32_t parameters[3]; X X /* Discard the DMA request */ X parameters[0] = 0; X parameters[1] = 0; X parameters[2] = 0; X if (cxm_queue_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_SCHED_DMA_TO_HOST, X parameters, 3) == -1) { X printf("%s: failed to discard encoder dma request\n", X sc->name); X return; X } X X sc->encoding_dma = -1; X} X X Xstatic void Xcxm_encoder_dma_done( struct cxm_softc *sc ) X{ X int buffers_pending; X u_int32_t status; X intrmask_t s; X X if (! sc->encoding_dma) { X printf("%s: encoder dma not already in progress\n", X sc->name); X return; X } X X buffers_pending = sc->encoding_dma; X sc->encoding_dma = 0; X X if (buffers_pending < 0) X return; X X status = CSR_READ_4(sc, CXM_REG_DMA_STATUS) & 0x0000000f; X X if ((status X & (CXM_DMA_ERROR_LIST | CXM_DMA_ERROR_WRITE | CXM_DMA_SUCCESS)) X != CXM_DMA_SUCCESS) { X printf("%s: encoder dma status %#x\n", X sc->name, (unsigned int)status); X return; X } X X /* Update the books (spl is used since mutex is not available) */ X s = spltty(); X sc->enc_pool.write = (sc->enc_pool.write + buffers_pending) X % CXM_SG_BUFFERS; X splx(s); X X /* signal anyone requesting notification */ X if (sc->enc_proc) X psignal (sc->enc_proc, sc->enc_signal); X X /* wakeup anyone waiting for data */ X wakeup(&sc->enc_pool.read); X X /* wakeup anyone polling for data */ X selwakeup(&sc->enc_sel); X} X X Xstatic void Xcxm_encoder_dma_request( struct cxm_softc *sc ) X{ X enum cxm_byte_order byte_order; X int buffers_free; X int buffers_pending; X unsigned int current; X unsigned int i; X unsigned int mailbox; X unsigned int macroblocks_per_line; X unsigned int nrequests; X unsigned int strips; X u_int32_t parameters[CXM_MBX_MAX_PARAMETERS]; X u_int32_t type; X size_t max_sg_segment; X struct { X size_t offset; X size_t size; X } requests[2]; X intrmask_t s; X X if (sc->encoding_dma) { X printf("%s: encoder dma already in progress\n", X sc->name); X cxm_encoder_dma_discard(sc); X return; X } X X mailbox = sc->enc_mbx X + CXM_MBX_FW_DMA_MAILBOX * sizeof(struct cxm_mailbox); X X for (i = 0; i < CXM_MBX_MAX_PARAMETERS; i++) X parameters[i] X = CSR_READ_4(sc, X mailbox X + offsetof(struct cxm_mailbox, parameters) X + i * sizeof(u_int32_t)); X X byte_order = cxm_device_mpeg_byte_order; X max_sg_segment = CXM_SG_SEGMENT; X nrequests = 0; X type = parameters[0]; X X switch (type) { X case 0: /* MPEG */ X requests[nrequests].offset = parameters[1]; X requests[nrequests++].size = parameters[2]; X break; X X case 1: /* YUV */ X byte_order = cxm_device_yuv12_byte_order; X X /* X * Simplify macroblock unpacking by ensuring X * that strips don't span buffers. X */ X X#if CXM_MACROBLOCK_SIZE % 256 X# error CXM_MACROBLOCK_SIZE not a multiple of 256 X#endif X X macroblocks_per_line = sc->profile->width X / CXM_MACROBLOCK_WIDTH; X strips = CXM_SG_SEGMENT X / (macroblocks_per_line * CXM_MACROBLOCK_SIZE); X max_sg_segment = strips X * macroblocks_per_line * CXM_MACROBLOCK_SIZE; X X requests[nrequests].offset = parameters[1]; /* Y */ X requests[nrequests++].size = parameters[2]; X requests[nrequests].offset = parameters[3]; /* UV */ X requests[nrequests++].size = parameters[4]; X break; X X case 2: /* PCM (audio) */ X case 3: /* VBI */ X default: X printf("%s: encoder dma type %#x unsupported\n", X sc->name, (unsigned int)type); X cxm_encoder_dma_discard(sc); X return; X } X X /* X * Determine the number of buffers free at this * instant * X * taking into consideration that the ring buffer wraps. X */ X s = spltty(); X buffers_free = sc->enc_pool.read - sc->enc_pool.write; X if (buffers_free <= 0) X buffers_free += CXM_SG_BUFFERS; X splx(s); X X /* X * Build the scatter / gather list taking in X * consideration that the ring buffer wraps, X * at least one free buffer must always be X * present to mark the end of the ring buffer, X * and each transfer must be a multiple of 256. X */ X X buffers_pending = 0; X current = sc->enc_pool.write; X X for (i = 0; i < nrequests; i++) { X if (! requests[i].size ) { X printf("%s: encoder dma size is zero\n", sc->name); X cxm_encoder_dma_discard(sc); X return; X } X X while (requests[i].size) { X sc->enc_pool.bufs[current].size X = requests[i].size > max_sg_segment X ? max_sg_segment : requests[i].size; X sc->enc_pool.bufs[current].byte_order = byte_order; X X sc->enc_sg.vaddr[buffers_pending].src X = requests[i].offset; X sc->enc_sg.vaddr[buffers_pending].dst X = sc->enc_pool.bufs[current].baddr; X sc->enc_sg.vaddr[buffers_pending].size X = (sc->enc_pool.bufs[current].size + 0x000000ff) X & 0xffffff00; X X requests[i].offset += sc->enc_pool.bufs[current].size; X requests[i].size -= sc->enc_pool.bufs[current].size; X buffers_pending++; X current = (current + 1) % CXM_SG_BUFFERS; X X if (buffers_pending >= buffers_free) { X printf( X "%s: encoder dma not enough buffer space free\n", X sc->name); X cxm_encoder_dma_discard(sc); X return; X } X } X } X X /* Mark the last transfer in the list */ X sc->enc_sg.vaddr[buffers_pending - 1].size |= 0x80000000; X X /* Schedule the DMA */ X parameters[0] = sc->enc_sg.baddr; X parameters[1] = buffers_pending * sizeof(sc->enc_sg.vaddr[0]); X parameters[2] = type; X if (cxm_queue_firmware_command(sc, cxm_enc_mailbox, X CXM_FW_CMD_SCHED_DMA_TO_HOST, X parameters, 3) == -1) { X printf("%s: failed to schedule encoder dma request\n", X sc->name); X return; X } X X /* X * Record the number of pending buffers for the X * benefit of cxm_encoder_dma_done. Doing this X * after queuing the command doesn't introduce X * a race condition since we're already in the X * interrupt handler. X */ X X sc->encoding_dma = buffers_pending; X} X X Xstatic int Xcxm_encoder_wait_for_lock( struct cxm_softc *sc ) X{ X int muted; X int locked; X int result; X X locked = 1; X X /* X * Wait for the tuner to lock. X */ X if (sc->source == cxm_fm_source || sc->source == cxm_tuner_source) { X result = cxm_tuner_wait_for_lock(sc); X if (result <= 0) X return result; X } X X /* X * Wait for the video decoder to lock. X */ X if (sc->source != cxm_fm_source) { X result = cxm_saa7115_wait_for_lock(sc); X if (result < 0) X return result; X else if (result == 0) X locked = 0; X } X X /* X * Wait for the audio decoder to lock. X */ X if (sc->source == cxm_tuner_source) { X muted = cxm_msp_is_muted(sc); X X result = cxm_msp_autodetect_standard(sc); X if (result < 0) X return result; X else if (result == 0) X locked = 0; X X if (muted == 0 && cxm_msp_unmute(sc) < 0) X return -1; X } X X return locked; X} X X Xstatic void Xcxm_mapmem(void *arg, bus_dma_segment_t *segs, int nseg, int error) X{ X bus_addr_t *busaddrp; X X /* X * Only the first bus space address is needed X * since it's known that the memory is physically X * contiguous due to bus_dmamem_alloc. X */ X X busaddrp = (bus_addr_t *)arg; X *busaddrp = segs->ds_addr; X} X X X/* X * the boot time probe routine. X */ Xstatic int Xcxm_probe( device_t dev ) X{ X struct cxm_dev *t; X X t = cxm_devs; X X while(t->name != NULL) { X if ((pci_get_vendor(dev) == t->vid) && X (pci_get_device(dev) == t->did)) { X device_set_desc(dev, t->name); X return 0; X } X t++; X } X X return ENXIO; X} X X X/* X * the attach routine. X */ Xstatic int Xcxm_attach( device_t dev ) X{ X int error; X int rid; X int unit; X unsigned int i; X u_int32_t command; X struct cxm_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X unit = device_get_unit(dev); X X sc->type = cxm_iTVC15_type; X switch(pci_get_device(dev)) { X case CXM_DEVICEID_CONEXANT_iTVC16: X sc->type = cxm_iTVC16_type; X break; X X default: X break; X } X X /* build the device name */ X snprintf(sc->name, sizeof(sc->name), "cxm%d",unit); X X /* X * Enable bus mastering and memory mapped I/O. X */ X pci_enable_busmaster(dev); X pci_enable_io(dev, SYS_RES_MEMORY); X command = pci_read_config(dev, PCIR_COMMAND, 4); X X if (! (command & PCIM_CMD_MEMEN) ) { X device_printf(dev, "failed to enable memory mappings\n"); X error = ENXIO; X goto fail; X } X X /* X * Map control/status registers. X */ X rid = CXM_RID; X sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, X 0, ~0, 1, RF_ACTIVE); X X if (! sc->mem_res ) { X device_printf(dev, "could not map memory\n"); X error = ENXIO; X goto fail; X } X X sc->btag = rman_get_bustag(sc->mem_res); X sc->bhandle = rman_get_bushandle(sc->mem_res); X X /* X * Attach the I2C bus. X */ X sc->cxm_iic = device_add_child(dev, "cxm_iic", unit); X X if (! sc->cxm_iic ) { X device_printf(dev, "could not add cxm_iic\n"); X error = ENXIO; X goto fail; X } X X error = device_probe_and_attach(sc->cxm_iic); X X if (error) { X device_printf(dev, "could not attach cxm_iic\n"); X goto fail; X } X X /* X * Initialize the tuner. X */ X if (cxm_tuner_init(sc) < 0) { X device_printf(dev, "could not initialize tuner\n"); X error = ENXIO; X goto fail; X } X X /* X * Initialize the SAA7115. X */ X if (cxm_saa7115_init(sc) < 0) { X device_printf(dev, "could not initialize video decoder\n"); X error = ENXIO; X goto fail; X } X X /* X * Initialize the MSP3400. X */ X if (cxm_msp_init(sc) < 0) { X device_printf(dev, "could not initialize audio decoder\n"); X error = ENXIO; X goto fail; X } X X /* X * Initialize the IR Remote. X */ X if (cxm_ir_init(sc) < 0) { X device_printf(dev, "could not initialize IR remote\n"); X error = ENXIO; X goto fail; X } X X sc->dec_mbx = -1; X sc->enc_mbx = -1; X X /* X * Disable the Conexant device. X * X * This is done * after * attaching the I2C bus so X * cxm_stop_hardware can mute the video and audio X * decoders. X */ X cxm_stop_hardware(sc); X X /* X * Allocate our interrupt. X */ X rid = 0; X sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, X 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); X X if (sc->irq_res == NULL) { X device_printf(dev, "could not map interrupt\n"); X error = ENXIO; X goto fail; X } X X error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_TTY, X cxm_intr, sc, &sc->ih_cookie); X if (error) { X device_printf(dev, "could not setup irq\n"); X goto fail; X X } X X /* X * Allocate a DMA tag for the parent bus. X */ X error = bus_dma_tag_create(NULL, 1, 0, X BUS_SPACE_MAXADDR_32BIT, X BUS_SPACE_MAXADDR, NULL, NULL, X BUS_SPACE_MAXSIZE_32BIT, 1, X BUS_SPACE_MAXSIZE_32BIT, 0, X#if __FreeBSD_version >= 501102 X busdma_lock_mutex, &Giant, X#endif X &sc->parent_dmat); X if (error) { X device_printf(dev, "could not create parent bus DMA tag\n"); X goto fail; X } X X /* X * Allocate a DMA tag for the encoder buffers. X */ X error = bus_dma_tag_create(sc->parent_dmat, 256, 0, X BUS_SPACE_MAXADDR_32BIT, X BUS_SPACE_MAXADDR, NULL, NULL, X CXM_SG_SEGMENT, 1, X BUS_SPACE_MAXSIZE_32BIT, 0, X#if __FreeBSD_version >= 501102 X busdma_lock_mutex, &Giant, X#endif X &sc->enc_pool.dmat); X if (error) { X device_printf(dev, X "could not create encoder buffer DMA tag\n"); X goto fail; X } X X for (i = 0; i < CXM_SG_BUFFERS; i++) { X X /* X * Allocate the encoder buffer. X */ X error = bus_dmamem_alloc(sc->enc_pool.dmat, X (void **)&sc->enc_pool.bufs[i].vaddr, X BUS_DMA_NOWAIT, X &sc->enc_pool.bufs[i].dmamap); X if (error) { X device_printf(dev, X "could not allocate encoder buffer\n"); X goto fail; X } X X /* X * Map the encoder buffer. X */ X error = bus_dmamap_load(sc->enc_pool.dmat, X sc->enc_pool.bufs[i].dmamap, X sc->enc_pool.bufs[i].vaddr, X CXM_SG_SEGMENT, X cxm_mapmem, X &sc->enc_pool.bufs[i].baddr, 0); X if (error) { X device_printf(dev, "could not map encoder buffer\n"); X goto fail; X } X } X X /* X * Allocate a DMA tag for the scatter / gather list. X */ X error = bus_dma_tag_create(sc->parent_dmat, 1, 0, X BUS_SPACE_MAXADDR_32BIT, X BUS_SPACE_MAXADDR, NULL, NULL, X CXM_SG_BUFFERS X * sizeof(struct cxm_sg_entry), 1, X BUS_SPACE_MAXSIZE_32BIT, 0, X#if __FreeBSD_version >= 501102 X busdma_lock_mutex, &Giant, X#endif X &sc->enc_sg.dmat); X if (error) { X device_printf(dev, X "could not create scatter / gather DMA tag\n"); X goto fail; X } X X /* X * Allocate the scatter / gather list. X */ X error = bus_dmamem_alloc(sc->enc_sg.dmat, (void **)&sc->enc_sg.vaddr, X BUS_DMA_NOWAIT, &sc->enc_sg.dmamap); X if (error) { X device_printf(dev, X "could not allocate scatter / gather list\n"); X goto fail; X } X X /* X * Map the scatter / gather list. X */ X error = bus_dmamap_load(sc->enc_sg.dmat, sc->enc_sg.dmamap, X sc->enc_sg.vaddr, X CXM_SG_BUFFERS * sizeof(struct cxm_sg_entry), X cxm_mapmem, &sc->enc_sg.baddr, 0); X if (error) { X device_printf(dev, "could not map scatter / gather list\n"); X goto fail; X } X X /* X * Initialize the hardware. X */ X if (cxm_init_hardware(sc) < 0) { X device_printf(dev, "could not initialize hardware\n"); X error = ENXIO; X goto fail; X } X X sc->profile = &dvd_full_d1_ntsc_profile; X X sc->source = cxm_tuner_source; X X /* make the device entries */ X sc->cxm_dev = make_dev(&cxm_cdevsw, unit, X 0, 0, 0444, "cxm%d", unit); X X return 0; X Xfail: X if (sc->enc_sg.baddr) X bus_dmamap_unload(sc->enc_sg.dmat, sc->enc_sg.dmamap); X if (sc->enc_sg.vaddr) X bus_dmamem_free(sc->enc_sg.dmat, sc->enc_sg.vaddr, X sc->enc_sg.dmamap); X if (sc->enc_sg.dmat) X bus_dma_tag_destroy(sc->enc_sg.dmat); X X for (i = 0; i < CXM_SG_BUFFERS; i++) { X if (sc->enc_pool.bufs[i].baddr) X bus_dmamap_unload(sc->enc_pool.dmat, X sc->enc_pool.bufs[i].dmamap); X if (sc->enc_pool.bufs[i].vaddr) X bus_dmamem_free(sc->enc_pool.dmat, X sc->enc_pool.bufs[i].vaddr, X sc->enc_pool.bufs[i].dmamap); X } X X if (sc->enc_pool.dmat) X bus_dma_tag_destroy(sc->enc_pool.dmat); X X if (sc->parent_dmat) X bus_dma_tag_destroy(sc->parent_dmat); X X /* X * Detach the I2C bus. X * X * This is done * after * deallocating the scatter / gather X * list and buffers so the kernel has a better chance of X * gracefully handling a memory shortage. X * X * Detach the children before recursively deleting X * in case a child has a pointer to a grandchild X * which is used by the child's detach routine. X */ X bus_generic_detach(dev); X if (sc->cxm_iic) X device_delete_child(dev, sc->cxm_iic); X X if (sc->ih_cookie) X bus_teardown_intr(dev, sc->irq_res, sc->ih_cookie); X if (sc->irq_res) X bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); X if (sc->mem_res) X bus_release_resource(dev, SYS_RES_MEMORY, CXM_RID, sc->mem_res); X X return error; X} X X/* X * the detach routine. X */ Xstatic int Xcxm_detach( device_t dev ) X{ X unsigned int i; X struct cxm_softc *sc; X device_t child; X X /* Get the device data */ X sc = device_get_softc(dev); X X /* Disable the Conexant device. */ X cxm_stop_hardware(sc); X X /* Unregister the /dev/cxmN device. */ X destroy_dev(sc->cxm_dev); X X /* X * Deallocate scatter / gather list and buffers. X */ X bus_dmamap_unload(sc->enc_sg.dmat, sc->enc_sg.dmamap); X bus_dmamem_free(sc->enc_sg.dmat, sc->enc_sg.vaddr, sc->enc_sg.dmamap); X X bus_dma_tag_destroy(sc->enc_sg.dmat); X X for (i = 0; i < CXM_SG_BUFFERS; i++) { X bus_dmamap_unload(sc->enc_pool.dmat, X sc->enc_pool.bufs[i].dmamap); X bus_dmamem_free(sc->enc_pool.dmat, sc->enc_pool.bufs[i].vaddr, X sc->enc_pool.bufs[i].dmamap); X } X X bus_dma_tag_destroy(sc->enc_pool.dmat); X X bus_dma_tag_destroy(sc->parent_dmat); X X /* X * Detach the I2C bus. X * X * This is done * after * deallocating the scatter / gather X * list and buffers so the kernel has a better chance of X * gracefully handling a memory shortage. X * X * Detach the children before recursively deleting X * in case a child has a pointer to a grandchild X * which is used by the child's detach routine. X * X * Remember the child before detaching so we can X * delete it (bus_generic_detach indirectly zeroes X * sc->child_dev). X */ X child = sc->cxm_iic; X bus_generic_detach(dev); X if (child) X device_delete_child(dev, child); X X /* Deallocate resources. */ X bus_teardown_intr(dev, sc->irq_res, sc->ih_cookie); X bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); X bus_release_resource(dev, SYS_RES_MEMORY, CXM_RID, sc->mem_res); X X return 0; X} X X/* X * the shutdown routine. X */ Xstatic int Xcxm_shutdown( device_t dev ) X{ X struct cxm_softc *sc = device_get_softc(dev); X X /* Disable the Conexant device. */ X cxm_stop_hardware(sc); X X return 0; X} X X/* X * the interrupt routine. X */ Xstatic void Xcxm_intr( void *arg ) X{ X u_int32_t status; X struct cxm_softc *sc; X X /* Get the device data */ X sc = (struct cxm_softc *)arg; X X status = CSR_READ_4(sc, CXM_REG_IRQ_STATUS); X X status &= ~sc->irq_mask; X X if (! status ) X return; X X /* Process DMA done before handling a new DMA request or EOS */ X if (status & CXM_IRQ_ENC_DMA_DONE) X cxm_encoder_dma_done(sc); X X if (status & CXM_IRQ_ENC_DMA_REQUEST) X cxm_encoder_dma_request(sc); X X if (status & CXM_IRQ_ENC_EOS) { X sc->encoding_eos = 1; X wakeup(&sc->encoding_eos); X } X X cxm_set_irq_status(sc, status); X} X X X/* X * the child detached routine. X */ Xstatic void Xcxm_child_detached( device_t dev, device_t child ) X{ X struct cxm_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X X if (child == sc->cxm_iic) X sc->cxm_iic = NULL; X} X X Xstatic int Xcxm_read_ivar( device_t dev, device_t child, int index, uintptr_t* val) X{ X struct cxm_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X X switch (index) { X case CXM_IVAR_BHANDLE: X *val = sc->bhandle; X break; X X case CXM_IVAR_BTAG: X *val = sc->btag; X break; X X case CXM_IVAR_IICBUS: X *val = (uintptr_t)sc->iicbus; X break; X X default: X return ENOENT; X } X X return 0; X} X X Xstatic int Xcxm_write_ivar( device_t dev, device_t child, int index, uintptr_t val) X{ X struct cxm_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X X switch (index) { X case CXM_IVAR_BHANDLE: X return EINVAL; X X case CXM_IVAR_BTAG: X return EINVAL; X X case CXM_IVAR_IICBUS: X if (sc->iicbus) X return EINVAL; X sc->iicbus = (device_t)val; X break; X X default: X return ENOENT; X } X X return 0; X} X X X/*--------------------------------------------------------- X** X** Conexant iTVC15 / iTVC16 character device driver routines X** X**--------------------------------------------------------- X*/ X X#define UNIT(x) ((x) & 0x0f) X#define FUNCTION(x) (x >> 4) X X/* X * X */ Xint Xcxm_open( dev_t dev, int flags, int fmt, d_thread_t *td ) X{ X int unit; X struct cxm_softc *sc; X X unit = UNIT( minor(dev) ); X X /* Get the device data */ X sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit); X if (sc == NULL) { X /* the device is no longer valid/functioning */ X return ENXIO; X } X X if (sc->is_opened) X return EBUSY; X X sc->is_opened = 1; X sc->mpeg = 1; X X /* Record that the device is now busy */ X device_busy(devclass_get_device(cxm_devclass, unit)); X X return 0; X} X X X/* X * X */ Xint Xcxm_close( dev_t dev, int flags, int fmt, d_thread_t *td ) X{ X int unit; X struct cxm_softc *sc; X X unit = UNIT( minor(dev) ); X X /* Get the device data */ X sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit); X if (sc == NULL) { X /* the device is no longer valid/functioning */ X return ENXIO; X } X X if (cxm_stop_encoder(sc) < 0) X return ENXIO; X X sc->enc_pool.offset = 0; X sc->enc_pool.read = 0; X sc->enc_pool.write = 0; X X sc->enc_proc = NULL; X sc->enc_signal = 0; X X device_unbusy(devclass_get_device(cxm_devclass, unit)); X X sc->is_opened = 0; X X return 0; X} X X X/* X * X */ Xint Xcxm_read( dev_t dev, struct uio *uio, int flag ) X{ X int buffers_available; X int buffers_read; X int error; X int unit; X unsigned int current; X unsigned int i; X size_t nbytes; X size_t offset; X struct cxm_softc *sc; X intrmask_t s; X X unit = UNIT( minor(dev) ); X X /* Get the device data */ X sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit); X if (sc == NULL) { X /* the device is no longer valid/functioning */ X return ENXIO; X } X X /* Only trigger the encoder if the ring buffer is empty */ X if (! sc->encoding && sc->enc_pool.read == sc->enc_pool.write) { X if (cxm_start_encoder(sc) < 0) X return ENXIO; X if (flag & IO_NDELAY) X return EWOULDBLOCK; X } X X buffers_available = 0; X X s = spltty(); X while (sc->enc_pool.read == sc->enc_pool.write) { X error = tsleep(&sc->enc_pool.read, PZERO | PCATCH, "cmxrd", 0); X if (error) { X splx(s); X return error; X } X } X X /* X * Determine the number of buffers available at this * instant * X * taking in consideration that the ring buffer wraps. X */ X buffers_available = sc->enc_pool.write - sc->enc_pool.read; X if (buffers_available < 0) X buffers_available += CXM_SG_BUFFERS; X splx(s); X X offset = sc->enc_pool.offset; X X for (buffers_read = 0, i = sc->enc_pool.read; X buffers_read != buffers_available && uio->uio_resid; X buffers_read++, i = (i + 1) % CXM_SG_BUFFERS) { X X current = cxm_encoder_fixup_byte_order (sc, i, offset); X X nbytes = sc->enc_pool.bufs[current].size - offset; X X /* Don't transfer more than requested */ X if (nbytes > uio->uio_resid) X nbytes = uio->uio_resid; X X error = uiomove(sc->enc_pool.bufs[current].vaddr + offset, X nbytes, uio); X if (error) X return error; X X offset += nbytes; X X /* Handle a partial read of a buffer */ X if (! uio->uio_resid && offset != sc->enc_pool.bufs[i].size) X break; X X offset = 0; X } X X sc->enc_pool.offset = offset; X X /* Update the books (spl is used since mutex is not available) */ X s = spltty(); X sc->enc_pool.read = (sc->enc_pool.read + buffers_read) X % CXM_SG_BUFFERS; X splx(s); X X return 0; X} X X X/* X * X */ Xint Xcxm_ioctl( dev_t dev, unsigned long cmd, caddr_t arg, X int flag, d_thread_t *td ) X{ X int brightness; X int chroma_saturation; X int contrast; X int fps; X int hue; X int result; X int status; X int unit; X unsigned int i; X unsigned int sig; X unsigned long freq; X struct cxm_softc *sc; X enum cxm_source source; X struct bktr_capture_area *cap; X struct bktr_remote *remote; X intrmask_t s; X X unit = UNIT( minor(dev) ); X X /* Get the device data */ X sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit); X if (sc == NULL) { X /* the device is no longer valid/functioning */ X return ENXIO; X } X X switch (cmd) { X case BT848_GAUDIO: X switch (cxm_msp_selected_source(sc)) { X case cxm_tuner_source: X *(int *) arg = AUDIO_TUNER; X break; X X case cxm_line_in_source_composite: X case cxm_line_in_source_svideo: X *(int *) arg = AUDIO_EXTERN; X break; X X case cxm_fm_source: X *(int *) arg = AUDIO_INTERN; X break; X X default: X return ENXIO; X } X X if (cxm_msp_is_muted(sc) == 1) X *(int *) arg |= AUDIO_MUTE; X break; X X case BT848_SAUDIO: X source = cxm_unknown_source; X X switch (*(int *) arg) { X case AUDIO_TUNER: X source = cxm_tuner_source; X break; X X case AUDIO_EXTERN: X source = cxm_line_in_source_composite; X break; X X case AUDIO_INTERN: X source = cxm_fm_source; X break; X X case AUDIO_MUTE: X if (cxm_msp_mute(sc) < 0) X return ENXIO; X return 0; X X case AUDIO_UNMUTE: X if (cxm_msp_unmute(sc) < 0) X return ENXIO; X return 0; X X default: X return EINVAL; X } X X if (sc->encoding) { X X /* X * Switching between audio + video and audio only X * subtypes isn't supported while encoding. X */ X X if (source != sc->source X && (source == cxm_fm_source X || sc->source == cxm_fm_source)) X return EBUSY; X } X X if (cxm_pause_encoder(sc) < 0) X return ENXIO; X X if (cxm_msp_select_source(sc, source) < 0) X return ENXIO; X X if (source == cxm_fm_source) X sc->source = source; X X result = cxm_encoder_wait_for_lock(sc); X if (result < 0) X return ENXIO; X else if (result == 0) X return EINVAL; X X if (cxm_unpause_encoder(sc) < 0) X return ENXIO; X break; X X case BT848_GBRIG: X brightness = cxm_saa7115_get_brightness(sc); X X if (brightness < 0) X return ENXIO; X X /* X * Brooktree brightness: X * 0x80 = -50.0%, 0x00 = +0.0%, 0x7f = +49.6% X */ X *(int *)arg = (int)(unsigned char)brightness - 128; X break; X X case BT848_SBRIG: X X /* X * Brooktree brightness: X * 0x80 = -50.0%, 0x00 = +0.0%, 0x7f = +49.6% X */ X brightness = *(int *)arg + 128; X X if (cxm_saa7115_set_brightness(sc, brightness) < 0) X return ENXIO; X break; X X case METEORGBRIG: X brightness = cxm_saa7115_get_brightness(sc); X X if (brightness < 0) X return ENXIO; X X *(unsigned char *)arg = (unsigned char)brightness; X break; X X case METEORSBRIG: X brightness = *(unsigned char *)arg; X X if (cxm_saa7115_set_brightness(sc, brightness) < 0) X return ENXIO; X break; X X case BT848_GCSAT: X chroma_saturation = cxm_saa7115_get_chroma_saturation(sc); X X if (chroma_saturation < 0) X return ENXIO; X X /* X * Brooktree chroma saturation: X * 0x000 = 0%, 0x0fe = 100%, 0x1ff = 201.18% X */ X *(int *)arg = ((signed char)chroma_saturation > 0) X ? (chroma_saturation * 4 - 2) : 0; X break; X X case BT848_SCSAT: X X /* X * Brooktree chroma saturation: X * 0x000 = 0%, 0x0fe = 100%, 0x1ff = 201.18% X */ X chroma_saturation = (*(int *)arg & 0x1ff) < 510 X ? ((*(int *)arg & 0x1ff) + 2) / 4 : 127; X X if (cxm_saa7115_set_chroma_saturation(sc, chroma_saturation) X < 0) X return ENXIO; X X break; X X case METEORGCSAT: X chroma_saturation = cxm_saa7115_get_chroma_saturation(sc); X X if (chroma_saturation < 0) X return ENXIO; X X *(unsigned char *)arg = (unsigned char)chroma_saturation; X break; X X case METEORSCSAT: X chroma_saturation = *(unsigned char *)arg; X X if (cxm_saa7115_set_chroma_saturation(sc, chroma_saturation) X < 0) X return ENXIO; X break; X X case METEORGCONT: X contrast = cxm_saa7115_get_contrast(sc); X X if (contrast < 0) X return ENXIO; X X *(unsigned char *)arg = (unsigned char)contrast; X break; X X case METEORSCONT: X contrast = *(unsigned char *)arg; X X if (cxm_saa7115_set_contrast(sc, contrast) < 0) X return ENXIO; X break; X X case BT848_GHUE: X hue = cxm_saa7115_get_hue(sc); X X if (hue < 0) X return ENXIO; X X *(int *)arg = (signed char)hue; X break; X X case BT848_SHUE: X hue = *(int *)arg; X X if (cxm_saa7115_set_hue(sc, hue) < 0) X return ENXIO; X break; X X case METEORGHUE: X hue = cxm_saa7115_get_hue(sc); X X if (hue < 0) X return ENXIO; X X *(signed char *)arg = (signed char)hue; X break; X X case METEORSHUE: X hue = *(signed char *)arg; X X if (cxm_saa7115_set_hue(sc, hue) < 0) X return ENXIO; X break; X X case METEORCAPTUR: X switch (*(int *) arg) { X case METEOR_CAP_CONTINOUS: X if (cxm_start_encoder(sc) < 0) X return ENXIO; X break; X X case METEOR_CAP_STOP_CONT: X if (cxm_stop_encoder(sc) < 0) X return ENXIO; X break; X X default: X return EINVAL; X } X break; X X case BT848_GCAPAREA: X cap = (struct bktr_capture_area *)arg; X memset (cap, 0, sizeof (*cap)); X cap->x_offset = 0; X cap->y_offset = 0; X cap->x_size = sc->profile->width; X cap->y_size = sc->profile->height; X break; X X case BT848_SCAPAREA: X if (sc->encoding) X return EBUSY; X X cap = (struct bktr_capture_area *)arg; X if (cap->x_offset || cap->y_offset X || (cap->x_size % CXM_MACROBLOCK_WIDTH) X || (cap->y_size % CXM_MACROBLOCK_HEIGHT)) X return EINVAL; X X /* X * Setting the width and height has the side effect of X * chosing between the VCD, SVCD, and DVD profiles. X */ X X for (i = 0; i < NUM_ELEMENTS(codec_profiles); i++) X if (codec_profiles[i]->width == cap->x_size X && codec_profiles[i]->height == cap->y_size) X break; X X if (i >= NUM_ELEMENTS(codec_profiles)) X return EINVAL; X X sc->profile = codec_profiles[i]; X break; X X case BT848GFMT: X switch (cxm_saa7115_detected_format(sc)) { X case cxm_ntsc_60hz_source_format: X *(unsigned long *)arg = BT848_IFORM_F_NTSCM; X break; X X case cxm_pal_50hz_source_format: X *(unsigned long *)arg = BT848_IFORM_F_PALBDGHI; X break; X X case cxm_secam_50hz_source_format: X *(unsigned long *)arg = BT848_IFORM_F_SECAM; X break; X X case cxm_pal_60hz_source_format: X *(unsigned long *)arg = BT848_IFORM_F_PALM; X break; X X case cxm_bw_50hz_source_format: X case cxm_bw_60hz_source_format: X case cxm_ntsc_50hz_source_format: X *(unsigned long *)arg = BT848_IFORM_F_AUTO; X break; X X default: X return ENXIO; X } X break; X X case METEORGFMT: X switch (cxm_saa7115_detected_format(sc)) { X case cxm_ntsc_60hz_source_format: X *(unsigned long *)arg = METEOR_FMT_NTSC; X break; X X case cxm_pal_50hz_source_format: X *(unsigned long *)arg = METEOR_FMT_PAL; X break; X X case cxm_secam_50hz_source_format: X *(unsigned long *)arg = METEOR_FMT_SECAM; X break; X X case cxm_bw_50hz_source_format: X case cxm_bw_60hz_source_format: X case cxm_ntsc_50hz_source_format: X case cxm_pal_60hz_source_format: X *(unsigned long *)arg = METEOR_FMT_AUTOMODE; X break; X X default: X return ENXIO; X } X break; X X case METEORGFPS: X fps = cxm_saa7115_detected_fps(sc); X X if (fps < 0) X return ENXIO; X X *(unsigned short *)arg = fps; X break; X X case METEORGINPUT: X switch (sc->source) { X case cxm_tuner_source: X *(unsigned long *)arg = METEOR_INPUT_DEV1; X break; X X case cxm_line_in_source_composite: X *(unsigned long *)arg = METEOR_INPUT_DEV2; X break; X X case cxm_line_in_source_svideo: X *(unsigned long *)arg = METEOR_INPUT_DEV_SVIDEO; X break; X X default: X return ENXIO; X } X break; X X case METEORSINPUT: X source = cxm_unknown_source; X X switch (*(unsigned long *)arg & 0xf000) { X case METEOR_INPUT_DEV1: X source = cxm_tuner_source; X break; X X case METEOR_INPUT_DEV2: X source = cxm_line_in_source_composite; X break; X X case METEOR_INPUT_DEV_SVIDEO: X source = cxm_line_in_source_svideo; X break; X X default: X return EINVAL; X } X X if (sc->encoding) { X X /* X * Switching between audio + video and audio only X * subtypes isn't supported while encoding. X */ X X if (source != sc->source X && (source == cxm_fm_source X || sc->source == cxm_fm_source)) X return EBUSY; X } X X if (cxm_pause_encoder(sc) < 0) X return ENXIO; X X if (cxm_saa7115_select_source(sc, source) < 0) X return ENXIO; X if (cxm_msp_select_source(sc, source) < 0) X return ENXIO; X X sc->source = source; X X result = cxm_encoder_wait_for_lock(sc); X if (result < 0) X return ENXIO; X else if (result == 0) X return EINVAL; X X if (cxm_unpause_encoder(sc) < 0) X return ENXIO; X break; X X case METEORGSIGNAL: X *(unsigned int *)arg = sc->enc_signal; X break; X X case METEORSSIGNAL: X sig = *(unsigned int *)arg; X X if (! _SIG_VALID(sig) ) X return EINVAL; X X /* X * Historically, applications used METEOR_SIG_MODE_MASK X * to reset signal delivery. X */ X if (sig == METEOR_SIG_MODE_MASK) X sig = 0; X X s = spltty(); X#if __FreeBSD_version < 500000 X sc->enc_proc = sig ? td : NULL; X#else X sc->enc_proc = sig ? td->td_proc : NULL; X#endif X sc->enc_signal = sig; X splx (s); X break; X X case RADIO_GETFREQ: X /* Convert from kHz to MHz * 100 */ X freq = sc->tuner_freq / 10; X X *(unsigned int *)arg = freq; X break; X X case RADIO_SETFREQ: X if (sc->source == cxm_fm_source) X if (cxm_pause_encoder(sc) < 0) X return ENXIO; X X /* Convert from MHz * 100 to kHz */ X freq = *(unsigned int *)arg * 10; X X if (cxm_tuner_select_frequency(sc, cxm_tuner_fm_freq_type, X freq) < 0) X return ENXIO; X X /* X * Explicitly wait for the tuner lock so we X * can indicate if there's a station present. X */ X if (cxm_tuner_wait_for_lock(sc) < 0) X return EINVAL; X X result = cxm_encoder_wait_for_lock(sc); X if (result < 0) X return ENXIO; X else if (result == 0) X return EINVAL; X X if (sc->source == cxm_fm_source) X if (cxm_unpause_encoder(sc) < 0) X return ENXIO; X break; X X case TVTUNER_GETAFC: X *(int *)arg = sc->tuner_afc; X break; X X case TVTUNER_SETAFC: X sc->tuner_afc = (*(int *)arg != 0); X break; X X case TVTUNER_GETTYPE: X *(unsigned int *)arg = cxm_tuner_selected_channel_set(sc); X break; X X case TVTUNER_SETTYPE: X if (cxm_tuner_select_channel_set(sc, *(unsigned int *)arg) < 0) X return EINVAL; X break; X X case TVTUNER_SETCHNL: X if (sc->source == cxm_tuner_source) X if (cxm_pause_encoder(sc) < 0) X return ENXIO; X X if (cxm_tuner_select_channel(sc, *(unsigned int *)arg) < 0) X return ENXIO; X X if (sc->tuner_afc) X if (cxm_tuner_apply_afc(sc) < 0) X return EINVAL; X X /* X * Explicitly wait for the tuner lock so we X * can indicate if there's a station present. X */ X if (cxm_tuner_wait_for_lock(sc) < 0) X return EINVAL; X X result = cxm_encoder_wait_for_lock(sc); X if (result < 0) X return ENXIO; X else if (result == 0) X return EINVAL; X X if (sc->source == cxm_tuner_source) X if (cxm_unpause_encoder(sc) < 0) X return ENXIO; X break; X X case TVTUNER_GETFREQ: X /* Convert from kHz to MHz * 16 */ X freq = (sc->tuner_freq * 16) / 1000; X X *(unsigned int *)arg = freq; X break; X X case TVTUNER_SETFREQ: X if (sc->source == cxm_tuner_source) X if (cxm_pause_encoder(sc) < 0) X return ENXIO; X X /* Convert from MHz * 16 to kHz */ X freq = (*(unsigned int *)arg * 1000) / 16; X X if (cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, X freq) < 0) X return ENXIO; X X /* X * Explicitly wait for the tuner lock so we X * can indicate if there's a station present. X */ X if (cxm_tuner_wait_for_lock(sc) < 0) X return EINVAL; X X result = cxm_encoder_wait_for_lock(sc); X if (result < 0) X return ENXIO; X else if (result == 0) X return EINVAL; X X if (sc->source == cxm_tuner_source) X if (cxm_unpause_encoder(sc) < 0) X return ENXIO; X break; X X case TVTUNER_GETSTATUS: X status = cxm_tuner_status(sc); X if (status < 0) X return ENXIO; X *(unsigned long *)arg = status & 0xff; X break; X X case REMOTE_GETKEY: X remote = (struct bktr_remote *)arg; X if (cxm_ir_key(sc, (char *)remote, sizeof(*remote)) < 0) X return ENXIO; X break; X X default: X return ENOTTY; X } X X return 0; X} X X Xint cxm_poll( dev_t dev, int events, d_thread_t *td) X{ X int revents; X int unit; X struct cxm_softc *sc; X intrmask_t s; X X unit = UNIT( minor(dev) ); X X /* Get the device data */ X sc = (struct cxm_softc*)devclass_get_softc(cxm_devclass, unit); X if (sc == NULL) { X /* the device is no longer valid/functioning */ X return POLLHUP; X } X X revents = 0; X X s = spltty(); X if (events & (POLLIN | POLLRDNORM)) { X if (sc->enc_pool.read == sc->enc_pool.write) X selrecord(td, &sc->enc_sel); X else X revents = events & (POLLIN | POLLRDNORM); X } X splx(s); X X return revents; X} END-of-dev/cxm/cxm.c echo x - dev/cxm/cxm.h sed 's/^X//' >dev/cxm/cxm.h << 'END-of-dev/cxm/cxm.h' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Header file for the Conexant MPEG-2 Codec driver. X */ X X#if __FreeBSD_version >= 503001 X# define dev_t struct cdev * X#endif X X#define bswap32(X) ntohl(X) X X#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array)) X X/* X * For simplicity several large buffers allocate during X * driver attachment which normally occurs early on X * (when large areas of memory are available) are used X * to move data to / from the card. It's not unusual X * for the memory allocation to fail due to fragmentation X * if the driver is loaded after the system has been X * running for a while. One solution is to allocate X * several PAGE_SIZE buffers instead, however it doesn't X * seem worth the trouble. X */ Xenum cxm_byte_order { cxm_unknown_byte_order, X cxm_device_mpeg_byte_order, cxm_device_yuv12_byte_order, X cxm_host_byte_order }; X Xstruct cxm_buffer { X char *vaddr; X bus_addr_t baddr; X bus_dmamap_t dmamap; X size_t size; X enum cxm_byte_order byte_order; X}; X X#define CXM_SG_BUFFERS 50 X Xstruct cxm_buffer_pool { X bus_dma_tag_t dmat; X size_t offset; X volatile unsigned int read; X volatile unsigned int write; X struct cxm_buffer bufs[CXM_SG_BUFFERS]; X}; X X/* X * Audio format encoding X * X * 7 6 5 4 3 2 1 0 X * X * 0 0 44.1 kHz X * 0 1 48 kHz X * 1 0 32 kHz X * X * 0 1 Layer 1 X * 1 0 Layer 2 X * 1 1 Layer 3 X * X * L1 / L2 X * 0 0 0 0 Free fmt X * 0 0 0 1 32k / 32k X * 0 0 1 0 64k / 48k X * 0 0 1 1 96k / 56k X * 0 1 0 0 128k / 64k X * 0 1 0 1 160k / 80k X * 0 1 1 0 192k / 96k X * 0 1 1 1 224k / 112k X * 1 0 0 0 256k / 128k X * 1 0 0 1 288k / 160k X * 1 0 1 0 320k / 192k X * 1 0 1 1 352k / 224k X * 1 1 0 0 384k / 256k X * 1 1 0 1 416k / 320k X * 1 1 1 0 448k / 384k X */ Xstruct cxm_codec_audio_format { X unsigned int sample_rate; X u_int32_t format; X}; X Xstruct cxm_codec_profile { X const char *name; X u_int32_t stream_type; X u_int32_t fps; X u_int32_t width; X u_int32_t height; X u_int32_t source_height; X struct { X u_int32_t start; X u_int32_t nlines; X u_int32_t cc; X } vbi; X u_int32_t aspect; X u_int32_t pulldown; X struct { X u_int32_t mode; X u_int32_t average; X u_int32_t peak; X } bitrate; X struct { X u_int32_t closure; X u_int32_t frames; X u_int32_t bframes; X } gop; X struct { X u_int32_t mode; X u_int32_t type; X u_int32_t spatial; X u_int32_t temporal; X } dnr; X X unsigned int audio_sample_rate; X}; X X#define CXM_VENDORID_CONEXANT 0x4444 X#define CXM_DEVICEID_CONEXANT_iTVC15 0x0803 X#define CXM_DEVICEID_CONEXANT_iTVC16 0x0016 X X#define CXM_VENDORID_HAUPPAUGE 0x0070 X Xstruct cxm_dev { X u_int16_t vid; X u_int16_t did; X char *name; X}; X X#define CXM_MBX_FW_CMD_MAILBOX 0 X#define CXM_MBX_FW_CMD_MAILBOXES 6 X X#define CXM_MBX_FW_DMA_MAILBOX 9 X X#define CXM_MBX_MAX_PARAMETERS 16 X X/* Mailbox flags bit definitions */ X#define CXM_MBX_FLAG_DRV_DONE 0x00000002 X#define CXM_MBX_FLAG_FW_DONE 0x00000004 X#define CXM_MBX_FLAG_IN_USE 0x00000001 X Xstruct cxm_mailbox { X u_int32_t flags; X u_int32_t command; X u_int32_t result; X u_int32_t timeout; X u_int32_t parameters[CXM_MBX_MAX_PARAMETERS]; X} __attribute__ ((packed)); X Xenum cxm_mailbox_name { cxm_unknown_mailbox, X cxm_dec_mailbox, cxm_enc_mailbox }; X X/* X * Scatter / gather is supported with the restriction X * that the size of each piece must be a multiple of X * 256 and less than 64k. X */ X#define CXM_SG_SEGMENT (0xff00 & ~(PAGE_SIZE - 1)) X Xstruct cxm_sg_entry { X u_int32_t src; X u_int32_t dst; X u_int32_t size; X} __attribute__ ((packed)); X Xstruct cxm_sg_list { X bus_dma_tag_t dmat; X struct cxm_sg_entry *vaddr; X bus_addr_t baddr; X bus_dmamap_t dmamap; X X}; X Xenum cxm_source { cxm_unknown_source, cxm_fm_source, cxm_tuner_source, X cxm_line_in_source_composite, cxm_line_in_source_svideo }; X Xenum cxm_source_format { cxm_unknown_source_format, X cxm_bw_50hz_source_format, X cxm_bw_60hz_source_format, X cxm_ntsc_50hz_source_format, X cxm_ntsc_60hz_source_format, X cxm_pal_50hz_source_format, X cxm_pal_60hz_source_format, X cxm_secam_50hz_source_format }; X Xextern const struct cxm_tuner cxm_tuners[]; X Xenum cxm_type { cxm_unknown_type, cxm_iTVC15_type, cxm_iTVC16_type }; X X/* X * Conexant iTVC15 / iTVC16 info structure, one per card installed. X */ Xstruct cxm_softc { X enum cxm_type type; X char name[10]; /* Device name and unit number */ X X struct resource *mem_res; /* Resource descriptor for registers */ X bus_space_tag_t btag; /* Bus space access functions */ X bus_space_handle_t bhandle; /* Bus space access functions */ X X struct resource *irq_res; /* Resource descriptor for interrupt */ X void *ih_cookie; /* Newbus interrupt handler cookie */ X X u_int32_t irq_mask; X X bus_dma_tag_t parent_dmat; X X struct cxm_buffer_pool enc_pool; X struct cxm_sg_list enc_sg; X X struct selinfo enc_sel; X X struct proc *enc_proc; X int enc_signal; X X unsigned int dec_mbx; X unsigned int enc_mbx; X X device_t cxm_iic; X device_t iicbus; X X const struct cxm_tuner *tuner; X const struct cxm_tuner_channels *tuner_channels; X int tuner_afc; X unsigned long tuner_freq; X X char msp_name[10]; X X const struct cxm_codec_profile *profile; X X enum cxm_source source; X X dev_t cxm_dev; /* Device entry for /dev/cxmN */ X X int is_opened; X int mpeg; X X int encoding; X int encoding_dma; X volatile int encoding_eos; X}; X X/* X * Conexant iTVC15 / iTVC16 I2C info structure, one per card installed. X */ Xstruct cxm_iic_softc { X char name[10]; /* Device name and unit number */ X bus_space_tag_t btag; /* Bus space access functions */ X bus_space_handle_t bhandle; /* Bus space access functions */ X X device_t iicbb; X X}; X X/* X * List of IVARS available to the I2C device driver X */ X#define CXM_IVAR_BHANDLE 0 X#define CXM_IVAR_BTAG 1 X#define CXM_IVAR_IICBUS 2 X X/* X * Bus resource id X */ X#define CXM_RID PCIR_MAPS X X/* X * Access macros X */ X#define CSR_WRITE_4(sc, reg, val) \ X bus_space_write_4((sc)->btag, (sc)->bhandle, (reg), (val)) X#define CSR_WRITE_2(sc, reg, val) \ X bus_space_write_2((sc)->btag, (sc)->bhandle, (reg), val)) X#define CSR_WRITE_1(sc, reg, val) \ X bus_space_write_1((sc)->btag, (sc)->bhandle, (reg), val)) X#define CSR_READ_4(sc, reg) \ X bus_space_read_4((sc)->btag, (sc)->bhandle, (reg)) X#define CSR_READ_2(sc, reg) \ X bus_space_read_2((sc)->btag, (sc)->bhandle, (reg)) X#define CSR_READ_1(sc, reg) \ X bus_space_read_1((sc)->btag, (sc)->bhandle, (reg)) X X/* X * Decoder / encoder firmware X */ Xextern const char cxm_dec_fw[]; Xextern const char cxm_enc_fw[]; X X#define CXM_FW_SIZE (256 * 1024) X X/* X * Decoder / encoder memory offsets X */ X#define CXM_MEM_DEC 0x01000000 X#define CXM_MEM_ENC 0x00000000 X X#define CXM_MEM_DEC_SIZE 0x01000000 X#define CXM_MEM_ENC_SIZE 0x01000000 X X/* X * Register offsets X */ X#define CXM_REG_AO 0x2002d00 X#define CXM_REG_APU 0x200a064 X#define CXM_REG_DEC_SDRAM_PRECHARGE 0x20008fc X#define CXM_REG_DEC_SDRAM_REFRESH 0x20008f8 X#define CXM_REG_DMA_STATUS 0x2000004 X#define CXM_REG_ENC_SDRAM_PRECHARGE 0x20007fc X#define CXM_REG_ENC_SDRAM_REFRESH 0x20007f8 X#define CXM_REG_HW_BLOCKS 0x2009054 X#define CXM_REG_I2C_GETSCL 0x2007008 X#define CXM_REG_I2C_GETSDA 0x200700c X#define CXM_REG_I2C_SETSCL 0x2007000 X#define CXM_REG_I2C_SETSDA 0x2007004 X#define CXM_REG_IRQ_MASK 0x2000048 X#define CXM_REG_IRQ_STATUS 0x2000040 X#define CXM_REG_SPU 0x2009050 X#define CXM_REG_VDM 0x2002800 X#define CXM_REG_VPU 0x2009058 X X/* X * Register values X */ X#define CXM_CMD_AO_STOP 0x00000005 X#define CXM_CMD_APU_PING 0x00000000 X#define CXM_CMD_HW_BLOCKS_RST 0xffffffff X#define CXM_CMD_SDRAM_PRECHARGE_INIT 0x0000001a X#define CXM_CMD_SDRAM_REFRESH_INIT 0x80000640 X#define CXM_CMD_SPU_STOP 0x00000001 X#define CXM_CMD_VDM_STOP 0x00000000 X#define CXM_CMD_VPU_STOP15 0xfffffffe X#define CXM_CMD_VPU_STOP16 0xffffffee X X#define CXM_DMA_ERROR_LIST 0x00000008 X#define CXM_DMA_ERROR_READ 0x00000002 X#define CXM_DMA_ERROR_WRITE 0x00000004 X#define CXM_DMA_SUCCESS 0x00000001 X X#define CXM_IRQ_DEC_DMA_DONE (1 << 20) X#define CXM_IRQ_DEC_DMA_REQUEST (1 << 22) X#define CXM_IRQ_DEC_VSYNC (1 << 10) X#define CXM_IRQ_ENC_DMA_DONE (1 << 27) X#define CXM_IRQ_ENC_DMA_REQUEST (1 << 31) X#define CXM_IRQ_ENC_EOS (1 << 30) X#define CXM_IRQ_ENC_EVENT (1 << 28) X X#define CXM_IRQ_ENC (CXM_IRQ_ENC_DMA_REQUEST | CXM_IRQ_ENC_DMA_DONE \ X | CXM_IRQ_ENC_EOS | CXM_IRQ_ENC_EVENT) X X/* X * Register masks X */ X#define CXM_MASK_SPU_ENABLE 0xfffffffe X#define CXM_MASK_VPU_ENABLE15 0xfffffff6 X#define CXM_MASK_VPU_ENABLE16 0xfffffffb X X/* X * Firmware commands X */ X#define CXM_FW_CMD_ASSIGN_3_2_PULLDOWN 0x000000b1 X#define CXM_FW_CMD_ASSIGN_ASPECT_RATIO 0x00000099 X#define CXM_FW_CMD_ASSIGN_AUDIO_PROPERTIES 0x000000bd X#define CXM_FW_CMD_ASSIGN_BITRATES 0x00000095 X#define CXM_FW_CMD_ASSIGN_CORING_LEVELS 0x0000009f X#define CXM_FW_CMD_ASSIGN_DMA_BLOCKLEN 0x000000c9 X#define CXM_FW_CMD_ASSIGN_DNR_FILTER_MODE 0x0000009b X#define CXM_FW_CMD_ASSIGN_DNR_FILTER_PROPERTIES 0x0000009d X#define CXM_FW_CMD_ASSIGN_FRAME_DROP_RATE 0x000000d0 X#define CXM_FW_CMD_ASSIGN_FRAME_RATE 0x0000008f X#define CXM_FW_CMD_ASSIGN_FRAME_SIZE 0x00000091 X#define CXM_FW_CMD_ASSIGN_GOP_CLOSURE 0x000000c5 X#define CXM_FW_CMD_ASSIGN_GOP_PROPERTIES 0x00000097 X#define CXM_FW_CMD_ASSIGN_NUM_VSYNC_LINES 0x000000d6 X#define CXM_FW_CMD_ASSIGN_OUTPUT_PORT 0x000000bb X#define CXM_FW_CMD_ASSIGN_PGM_INDEX_INFO 0x000000c7 X#define CXM_FW_CMD_ASSIGN_PLACEHOLDER 0x000000d8 X#define CXM_FW_CMD_ASSIGN_SPATIAL_FILTER_TYPE 0x000000a1 X#define CXM_FW_CMD_ASSIGN_STREAM_TYPE 0x000000b9 X#define CXM_FW_CMD_ASSIGN_VBI_LINE 0x000000b7 X#define CXM_FW_CMD_ASSIGN_VBI_PROPERTIES 0x000000c8 X#define CXM_FW_CMD_BEGIN_CAPTURE 0x00000081 X#define CXM_FW_CMD_DEC_EVENT_NOTIFICATION 0x00000017 X#define CXM_FW_CMD_DEC_GET_FW_VER 0x00000011 X#define CXM_FW_CMD_DEC_HALT_FW 0x0000000e X#define CXM_FW_CMD_ENC_EVENT_NOTIFICATION 0x000000d5 X#define CXM_FW_CMD_ENC_GET_FW_VER 0x000000c4 X#define CXM_FW_CMD_ENC_HALT_FW 0x000000c3 X#define CXM_FW_CMD_END_CAPTURE 0x00000082 X#define CXM_FW_CMD_INITIALIZE_VIDEO_INPUT 0x000000cd X#define CXM_FW_CMD_MUTE_VIDEO_INPUT 0x000000d9 X#define CXM_FW_CMD_PAUSE_ENCODER 0x000000d2 X#define CXM_FW_CMD_SCHED_DMA_TO_HOST 0x000000cc X X#define CXM_FW_STD_TIMEOUT 0x00010000 X X#define CXM_FW_CAPTURE_STREAM_TYPE_MPEG 0x00000000 X#define CXM_FW_CAPTURE_STREAM_TYPE_RAW 0x00000001 X#define CXM_FW_CAPTURE_STREAM_TYPE_RAW_PASSTHROUGH 0x00000002 X#define CXM_FW_CAPTURE_STREAM_TYPE_VBI 0x00000003 X X#define CXM_FW_CAPTURE_STREAM_YUV 0x00000001 X#define CXM_FW_CAPTURE_STREAM_PCM_AUDIO 0x00000002 X#define CXM_FW_CAPTURE_STREAM_VBI 0x00000004 X X#define CXM_FW_STREAM_TYPE_DVD 0x0000000a X#define CXM_FW_STREAM_TYPE_MPEG1 0x00000002 X#define CXM_FW_STREAM_TYPE_MPEG2_PROGRAM 0x00000000 X#define CXM_FW_STREAM_TYPE_SVCD 0x0000000c X#define CXM_FW_STREAM_TYPE_VCD 0x0000000b X X#define CXM_MACROBLOCK_HEIGHT 16 X#define CXM_MACROBLOCK_WIDTH 16 X#define CXM_MACROBLOCK_SIZE (CXM_MACROBLOCK_HEIGHT * CXM_MACROBLOCK_WIDTH) X X/* X * I2C addresses X */ X#define CXM_I2C_EEPROM 0xa0 X#define CXM_I2C_IR 0x30 X#define CXM_I2C_MSP3400 0x80 X#define CXM_I2C_SAA7115 0x42 X#define CXM_I2C_TUNER 0xc2 X#define CXM_I2C_TUNER_IF 0x86 X X/* The maximum wait time of the MSP X is 1 ms during normal operations. */ X#define CXM_I2C_TIMEOUT 1000 X X/* X * EEPROM X */ Xint cxm_eeprom_init( struct cxm_softc *sc ); Xint cxm_eeprom_tuner_type( struct cxm_softc *sc ); X X/* X * Infrared remote X */ Xint cxm_ir_init( struct cxm_softc *sc ); Xint cxm_ir_key( struct cxm_softc *sc, char *buf, int len ); X X/* X * Audio decoder X */ X#define CXM_MSP3400C_DEM 0x10 X#define CXM_MSP3400C_DFP 0x12 X Xstruct cxm_msp_setting { X unsigned char dev; X unsigned int addr; X char value[2]; X}; X Xstruct cxm_msp_command { X unsigned int nsettings; X struct cxm_msp_setting settings[5]; X}; X Xint cxm_msp_init( struct cxm_softc *sc ); Xint cxm_msp_mute( struct cxm_softc *sc ); Xint cxm_msp_unmute( struct cxm_softc *sc ); Xint cxm_msp_is_muted( struct cxm_softc *sc ); Xint cxm_msp_select_source( struct cxm_softc *sc, enum cxm_source source ); Xenum cxm_source cxm_msp_selected_source( struct cxm_softc *sc ); Xint cxm_msp_autodetect_standard( struct cxm_softc *sc ); Xint cxm_msp_is_locked( struct cxm_softc *sc ); Xint cxm_msp_wait_for_lock( struct cxm_softc *sc ); X X/* X * Tuner X */ X#define CXM_TUNER_PHILIPS_FI1216_MK2 0 X#define CXM_TUNER_PHILIPS_FM1216 1 X#define CXM_TUNER_PHILIPS_FQ1216ME 2 X#define CXM_TUNER_PHILIPS_FQ1216ME_MK3 3 X#define CXM_TUNER_PHILIPS_FM1216ME_MK3 4 X#define CXM_TUNER_PHILIPS_FI1236_MK2 5 X#define CXM_TUNER_PHILIPS_FM1236 6 X#define CXM_TUNER_PHILIPS_FI1246_MK2 7 X#define CXM_TUNER_PHILIPS_FM1246 8 X#define CXM_TUNER_TEMIC_4006_FH5 9 X#define CXM_TUNER_TEMIC_4009_FR5 10 X#define CXM_TUNER_TEMIC_4036_FY5 11 X#define CXM_TUNER_TEMIC_4039_FR5 12 X#define CXM_TUNER_TEMIC_4066_FY5 13 X#define CXM_TUNER_LG_TPI8PSB11D 14 X#define CXM_TUNER_LG_TPI8PSB01N 15 X#define CXM_TUNER_LG_TAPC_H701F 16 X#define CXM_TUNER_LG_TAPC_H001F 17 X#define CXM_TUNER_LG_TAPE_H001F 18 X#define CXM_TUNER_MICROTUNE_4049_FM5 19 X#define CXM_TUNER_TCL_2002N_6A 20 X X#define CXM_TUNER_TYPES 21 X X#define CXM_TUNER_AFC_MASK 0x07 X X#define CXM_TUNER_AFC_FREQ_MINUS_125 0x00 X#define CXM_TUNER_AFC_FREQ_MINUS_62 0x01 X#define CXM_TUNER_AFC_FREQ_CENTERED 0x02 X#define CXM_TUNER_AFC_FREQ_PLUS_62 0x03 X#define CXM_TUNER_AFC_FREQ_PLUS_125 0x04 X X#define CXM_TUNER_PHASE_LOCKED 0x40 X X#define CXM_TUNER_FM_SYSTEM 0x01 X#define CXM_TUNER_TV_SYSTEM_BG 0x02 X#define CXM_TUNER_TV_SYSTEM_DK 0x04 X#define CXM_TUNER_TV_SYSTEM_I 0x08 X#define CXM_TUNER_TV_SYSTEM_MN 0x10 X#define CXM_TUNER_TV_SYSTEM_L 0x20 X#define CXM_TUNER_TV_SYSTEM_L_PRIME 0x40 X Xstruct cxm_tuner_band_code { X unsigned long freq; X unsigned char codes[2]; X}; X Xstruct cxm_tuner_channel_assignment { X unsigned int channel; X unsigned long freq; X unsigned long step; X}; X Xstruct cxm_tuner_channels { X const char *name; X unsigned int chnlset; X unsigned int system; X unsigned int min_channel; X unsigned int max_channel; X unsigned long if_freq; X struct cxm_tuner_channel_assignment assignments[17]; X}; X Xstruct cxm_tuner_system_code { X unsigned int system; X unsigned char codes[4]; X}; X Xenum cxm_tuner_system_code_style { cxm_unknown_system_code_style, X cxm_none_system_code_style, X cxm_port_system_code_style, X cxm_if_system_code_style, X cxm_if_system_with_aux_code_style }; X Xstruct cxm_tuner_system { X unsigned int supported; X enum cxm_tuner_system_code_style code_style; X struct cxm_tuner_system_code codes[6]; X}; X Xstruct cxm_tuner { X const char *name; X struct cxm_tuner_system systems; X unsigned long min_freq; X unsigned long max_freq; X struct cxm_tuner_band_code band_codes[3]; X unsigned long fm_min_freq; X unsigned long fm_max_freq; X struct cxm_tuner_band_code fm_band_code; X const struct cxm_tuner_channels *default_channels; X}; X Xenum cxm_tuner_freq_type { cxm_tuner_unknown_freq_type, cxm_tuner_fm_freq_type, X cxm_tuner_tv_freq_type }; X Xint cxm_tuner_init( struct cxm_softc *sc ); Xint cxm_tuner_select_channel_set( struct cxm_softc *sc, X unsigned int channel_set ); Xunsigned int cxm_tuner_selected_channel_set( struct cxm_softc *sc ); Xint cxm_tuner_select_frequency( struct cxm_softc *sc, X enum cxm_tuner_freq_type type, X unsigned long freq ); Xint cxm_tuner_select_channel( struct cxm_softc *sc, unsigned int channel ); Xint cxm_tuner_apply_afc( struct cxm_softc *sc ); Xint cxm_tuner_is_locked( struct cxm_softc *sc ); Xint cxm_tuner_wait_for_lock( struct cxm_softc *sc ); Xint cxm_tuner_status( struct cxm_softc *sc ); X X/* X * Video decoder X */ Xstruct cxm_saa7115_setting { X unsigned char addr; X unsigned int nvalues; X char values[32]; X}; X Xstruct cxm_saa7115_command { X unsigned int nsettings; X struct cxm_saa7115_setting settings[20]; X}; X Xstruct cxm_saa7115_audio_clock { X unsigned int sample_rate; X unsigned int fps; X const struct cxm_saa7115_command *clock; X}; X Xstruct cxm_saa7115_scaling { X unsigned int width; X unsigned int height; X unsigned int fps; X const struct cxm_saa7115_command *scaling; X}; X Xint cxm_saa7115_init( struct cxm_softc *sc ); Xint cxm_saa7115_mute( struct cxm_softc *sc ); Xint cxm_saa7115_unmute( struct cxm_softc *sc ); Xint cxm_saa7115_select_source( struct cxm_softc *sc, enum cxm_source source ); Xint cxm_saa7115_configure( struct cxm_softc *sc, X unsigned int width, unsigned int height, X unsigned int fps, unsigned int audio_sample_rate); Xenum cxm_source_format cxm_saa7115_detected_format( struct cxm_softc *sc ); Xint cxm_saa7115_detected_fps( struct cxm_softc *sc ); Xint cxm_saa7115_get_brightness( struct cxm_softc *sc ); Xint cxm_saa7115_set_brightness( struct cxm_softc *sc, X unsigned char brightness ); Xint cxm_saa7115_get_chroma_saturation( struct cxm_softc *sc ); Xint cxm_saa7115_set_chroma_saturation( struct cxm_softc *sc, X unsigned char chroma_saturation); Xint cxm_saa7115_get_contrast( struct cxm_softc *sc ); Xint cxm_saa7115_set_contrast( struct cxm_softc *sc, unsigned char contrast ); Xint cxm_saa7115_get_hue( struct cxm_softc *sc ); Xint cxm_saa7115_set_hue( struct cxm_softc *sc, unsigned char hue ); Xint cxm_saa7115_is_locked( struct cxm_softc *sc ); Xint cxm_saa7115_wait_for_lock( struct cxm_softc *sc ); END-of-dev/cxm/cxm.h echo x - dev/cxm/cxm_audio.c sed 's/^X//' >dev/cxm/cxm_audio.c << 'END-of-dev/cxm/cxm_audio.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Audio decoder routines for the Conexant MPEG-2 Codec driver. X * X * Ideally these routines should be implemented as a separate X * driver which has a generic audio decoder interface so that X * it's not necessary for each multimedia driver to re-invent X * the wheel. X */ X X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#include X#include X X#include X X#include X#include X X#include "iicbb_if.h" X X Xstatic const struct cxm_msp_command Xmsp34x5G_init = { X 5, X { X /* Enable Automatic Sound Select */ X { CXM_MSP3400C_DEM, 0x0030, { 0x20, 0x03 } }, X /* SCART Prescale = 0 dB */ X { CXM_MSP3400C_DFP, 0x000d, { 0x19, 0x00 } }, X /* FM / AM Prescale = 100 Khz and FM Matrix = Sound A Mono */ X { CXM_MSP3400C_DFP, 0x000e, { 0x24, 0x03 } }, X /* NICAM Prescale = 9 dB */ X { CXM_MSP3400C_DFP, 0x0010, { 0x5a, 0x00 } }, X /* Enable Automatic Standard Select */ X { CXM_MSP3400C_DEM, 0x0020, { 0x00, 0x01 } }, X } X}; X Xstatic const struct cxm_msp_command Xmsp34x5G_select_tuner = { X 3, X { X /* Loudspeaker Source = demodulator (St or A), Matrix = St */ X { CXM_MSP3400C_DFP, 0x0008, { 0x03, 0x20 } }, X /* SCART1_L/R Source = demodulator (St or A), Matrix = St */ X { CXM_MSP3400C_DFP, 0x000a, { 0x03, 0x20 } }, X /* DSP In = mute, SC1_OUT_L/R Source = SCART1_L/R */ X { CXM_MSP3400C_DFP, 0x0013, { 0x0f, 0x20 } } X } X}; X Xstatic const struct cxm_msp_command Xmsp34x5D_init = { X 4, X { X /* Enable Automatic NICAM-FM/AM Switching */ X { CXM_MSP3400C_DEM, 0x0021, { 0x00, 0x01 } }, X /* SCART Prescale = 0 dB */ X { CXM_MSP3400C_DFP, 0x000d, { 0x19, 0x00 } }, X /* NICAM Prescale = 9 dB */ X { CXM_MSP3400C_DFP, 0x0010, { 0x5a, 0x00 } }, X /* Enable Automatic Standard Select */ X { CXM_MSP3400C_DEM, 0x0020, { 0x00, 0x01 } }, X } X}; X Xstatic const struct cxm_msp_command Xmsp34x5D_select_tuner = { X 5, X { X /* Loudspeaker Source = demodulator (NICAM), Matrix = St */ X { CXM_MSP3400C_DFP, 0x0008, { 0x01, 0x20 } }, X /* SCART1_L/R Source = demodulator (NICAM), Matrix = St */ X { CXM_MSP3400C_DFP, 0x000a, { 0x01, 0x20 } }, X /* FM / AM Prescale = 100 Khz and FM Matrix = No Matrix */ X { CXM_MSP3400C_DFP, 0x000e, { 0x24, 0x00 } }, X /* FM Deemphasis = 50 us */ X { CXM_MSP3400C_DFP, 0x000f, { 0x00, 0x00 } }, X /* DSP In = mute, SC1_OUT_L/R Source = SCART1_L/R */ X { CXM_MSP3400C_DFP, 0x0013, { 0x0f, 0x20 } } X } X}; X Xstatic const struct cxm_msp_command Xmsp34xxx_mute = { X 2, X { X /* Loudspeaker volume = mute */ X { CXM_MSP3400C_DFP, 0x0000, { 0x00, 0x00 } }, X /* SC1_OUT_L/R volume = mute */ X { CXM_MSP3400C_DFP, 0x0007, { 0x00, 0x01 } } X } X}; X Xstatic const struct cxm_msp_command Xmsp34xxx_unmute = { X 2, X { X /* Loudspeaker volume = 0 db */ X { CXM_MSP3400C_DFP, 0x0000, { 0x73, 0x00 } }, X /* SC1_OUT_L/R volume = 0 db */ X { CXM_MSP3400C_DFP, 0x0007, { 0x73, 0x01 } } X } X}; X Xstatic const struct cxm_msp_command Xmsp34xxx_select_fm = { X 3, X { X /* Loudspeaker Source = SCART, Matrix = STEREO */ X { CXM_MSP3400C_DFP, 0x0008, { 0x02, 0x20 } }, X /* SCART1_L/R Source = SCART, Matrix = STEREO */ X { CXM_MSP3400C_DFP, 0x000a, { 0x02, 0x20 } }, X /* DSP In = SC2_IN_L/R, SC1_OUT_L/R Source = SCART1_L/R */ X { CXM_MSP3400C_DFP, 0x0013, { 0x0e, 0x00 } } X } X}; X Xstatic const struct cxm_msp_command Xmsp34xxx_select_line_in = { X 3, X { X /* Loudspeaker Source = SCART, Matrix = STEREO */ X { CXM_MSP3400C_DFP, 0x0008, { 0x02, 0x20 } }, X /* SCART1_L/R Source = SCART, Matrix = STEREO */ X { CXM_MSP3400C_DFP, 0x000a, { 0x02, 0x20 } }, X /* DSP In = SC1_IN_L/R, SC1_OUT_L/R Source = SCART1_L/R */ X { CXM_MSP3400C_DFP, 0x0013, { 0x0c, 0x00 } } X } X}; X X X/* Reset the MSP or DPL chip */ Xstatic int Xcxm_msp_dpl_reset( device_t iicbus, int i2c_addr ) X{ X unsigned char msg[3]; X int sent; X X /* put into reset mode */ X msg[0] = 0x00; X msg[1] = 0x80; X msg[2] = 0x00; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X iicbus_stop(iicbus); X X /* put back to operational mode */ X msg[0] = 0x00; X msg[1] = 0x00; X msg[2] = 0x00; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X iicbus_stop(iicbus); X X return 0; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X X/* Read from the MSP or DPL registers */ Xstatic int Xcxm_msp_dpl_read( device_t iicbus, int i2c_addr, X unsigned char dev, unsigned int addr, X char *buf, int len ) X{ X unsigned char msg[3]; X int received; X int sent; X X msg[0] = (unsigned char)(dev + 1); X msg[1] = (unsigned char)(addr >> 8); X msg[2] = (unsigned char)addr; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X if (iicbus_repeated_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) X goto fail; X X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) X goto fail; X X iicbus_stop(iicbus); X X return received; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X X/* Write to the MSP or DPL registers */ Xstatic int Xcxm_msp_dpl_write( device_t iicbus, int i2c_addr, X unsigned char dev, unsigned int addr, X const char *buf, int len ) X{ X unsigned char msg[3]; X int sent; X X msg[0] = (unsigned char)dev; X msg[1] = (unsigned char)(addr >> 8); X msg[2] = (unsigned char)addr; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X if (iicbus_write(iicbus, buf, len, &sent, CXM_I2C_TIMEOUT) != 0) X goto fail; X X iicbus_stop(iicbus); X X return sent; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X Xint Xcxm_msp_init( struct cxm_softc *sc ) X{ X unsigned char rev1[2]; X unsigned char rev2[2]; X unsigned int i; X unsigned int nsettings; X const struct cxm_msp_setting *settings; X X if (cxm_msp_dpl_reset (sc->iicbus, CXM_I2C_MSP3400) < 0) X return -1; X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x001e, rev1, sizeof(rev1)) != sizeof(rev1)) X return -1; X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x001f, rev2, sizeof(rev2)) != sizeof(rev2)) X return -1; X X snprintf(sc->msp_name, sizeof(sc->msp_name), "%c4%02d%c-%c%d", X ((rev1[1] >> 4) & 0x0f) + '3', rev2[0], X (rev1[1] & 0x0f) + '@', rev1[0] + '@', rev2[1] & 0x1f); X X /* X * MSP 34x5D, 34x5G, and MSP 44x8G are the X * only audio decoders currently supported. X */ X X if (strncmp(&sc->msp_name[0], "34", 2) == 0 X && strncmp(&sc->msp_name[3], "5D", 2) == 0) X ; X else if (strncmp(&sc->msp_name[0], "34", 2) == 0 X && strncmp(&sc->msp_name[3], "5G", 2) == 0) X ; X else if (strncmp(&sc->msp_name[0], "44", 2) == 0 X && strncmp(&sc->msp_name[3], "8G", 2) == 0) X ; X else { X printf("%s: unknown audio decoder MSP%s\n", X sc->name, sc->msp_name); X return -1; X } X X nsettings = msp34x5G_init.nsettings; X settings = msp34x5G_init.settings; X if (sc->msp_name[4] == 'D') { X nsettings = msp34x5D_init.nsettings; X settings = msp34x5D_init.settings; X } X X for (i = 0; i < nsettings; i++) X if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400, X settings[i].dev, settings[i].addr, X settings[i].value, X sizeof(settings[i].value)) X != sizeof(settings[i].value)) X return -1; X X if (cxm_msp_select_source(sc, cxm_tuner_source) < 0) X return -1; X X printf("%s: MSP%s audio decoder\n", sc->name, sc->msp_name); X X return 0; X} X X Xint Xcxm_msp_mute( struct cxm_softc *sc ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_msp_setting *settings; X X nsettings = msp34xxx_mute.nsettings; X settings = msp34xxx_mute.settings; X X for (i = 0; i < nsettings; i++) X if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400, X settings[i].dev, settings[i].addr, X settings[i].value, X sizeof(settings[i].value)) X != sizeof(settings[i].value)) X return -1; X X return 0; X} X X Xint Xcxm_msp_unmute( struct cxm_softc *sc ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_msp_setting *settings; X X nsettings = msp34xxx_unmute.nsettings; X settings = msp34xxx_unmute.settings; X X for (i = 0; i < nsettings; i++) X if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400, X settings[i].dev, settings[i].addr, X settings[i].value, X sizeof(settings[i].value)) X != sizeof(settings[i].value)) X return -1; X X return 0; X} X X Xint Xcxm_msp_is_muted( struct cxm_softc *sc ) X{ X unsigned char volume[2]; X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x0000, volume, sizeof(volume)) != sizeof(volume)) X return -1; X X return volume[0] == 0x00 || volume[0] == 0xff ? 1 : 0; X} X X Xint Xcxm_msp_select_source( struct cxm_softc *sc, enum cxm_source source ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_msp_setting *settings; X X switch (source) { X case cxm_fm_source: X nsettings = msp34xxx_select_fm.nsettings; X settings = msp34xxx_select_fm.settings; X break; X X case cxm_line_in_source_composite: X case cxm_line_in_source_svideo: X nsettings = msp34xxx_select_line_in.nsettings; X settings = msp34xxx_select_line_in.settings; X break; X X case cxm_tuner_source: X nsettings = msp34x5G_select_tuner.nsettings; X settings = msp34x5G_select_tuner.settings; X if (sc->msp_name[4] == 'D') { X nsettings = msp34x5D_select_tuner.nsettings; X settings = msp34x5D_select_tuner.settings; X } X break; X X default: X return -1; X } X X for (i = 0; i < nsettings; i++) X if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400, X settings[i].dev, settings[i].addr, X settings[i].value, X sizeof(settings[i].value)) X != sizeof(settings[i].value)) X return -1; X X return 0; X} X X Xenum cxm_source Xcxm_msp_selected_source( struct cxm_softc *sc ) X{ X unsigned char dsp[2]; X unsigned char source[2]; X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x0008, source, sizeof(source)) != sizeof(source)) X return cxm_unknown_source; X X switch (source[0]) { X case 0: /* FM / AM mono signal */ X case 1: /* Stereo or A / B */ X case 3: /* Stereo or A */ X case 4: /* Stereo or B */ X return cxm_tuner_source; X X case 2: /* SCART */ X break; X X default: X return cxm_unknown_source; X } X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x0013, dsp, sizeof(dsp)) != sizeof(dsp)) X return cxm_unknown_source; X X if (dsp[1] & 0x20) X return cxm_unknown_source; X X switch (dsp[0] & 0x03) { X case 0: X return cxm_line_in_source_composite; X X case 2: X return cxm_fm_source; X X default: X return cxm_unknown_source; X } X} X X Xint Xcxm_msp_autodetect_standard( struct cxm_softc *sc ) X{ X unsigned int i; X int locked; X unsigned int nsettings; X const struct cxm_msp_setting *settings; X X switch (cxm_msp_selected_source(sc)) { X case cxm_tuner_source: X break; X X case cxm_fm_source: X case cxm_line_in_source_composite: X case cxm_line_in_source_svideo: X return 1; X X default: X return -1; X } X X /* X * Section 3.3.2.2 of the data sheet states: X * X * A general refresh of the STANDARD SELECT X * register is not allowed. X */ X X if (cxm_msp_dpl_reset (sc->iicbus, CXM_I2C_MSP3400) < 0) X return -1; X X nsettings = msp34x5G_init.nsettings; X settings = msp34x5G_init.settings; X if (sc->msp_name[4] == 'D') { X nsettings = msp34x5D_init.nsettings; X settings = msp34x5D_init.settings; X } X X for (i = 0; i < nsettings; i++) X if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400, X settings[i].dev, settings[i].addr, X settings[i].value, X sizeof(settings[i].value)) X != sizeof(settings[i].value)) X return -1; X X locked = cxm_msp_wait_for_lock(sc); X X if (cxm_msp_select_source(sc, cxm_tuner_source) < 0) X return -1; X X return locked; X} X X Xint Xcxm_msp_is_locked( struct cxm_softc *sc ) X{ X unsigned char source[2]; X unsigned char standard[2]; X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DFP, X 0x0008, source, sizeof(source)) != sizeof(source)) X return -1; X X switch (source[0]) { X case 0: /* FM / AM mono signal */ X case 1: /* Stereo or A / B */ X case 3: /* Stereo or A */ X case 4: /* Stereo or B */ X break; X X default: X return 1; X } X X if (cxm_msp_dpl_read(sc->iicbus, CXM_I2C_MSP3400, CXM_MSP3400C_DEM, X 0x007e, standard, sizeof(standard)) X != sizeof(standard)) X return -1; X X if (standard[0] >= 8 || (standard[0] == 0 && standard[1] == 0)) X return 0; X X return 1; X} X X Xint Xcxm_msp_wait_for_lock( struct cxm_softc *sc ) X{ X unsigned int i; X X /* X * Section 3.3.2.1 of the data sheet states: X * X * Within 0.5 s the detection and setup of the actual X * TV sound standard is performed. The detected result X * can be read out of the STANDARD RESULT register by X * the control processor. X */ X X for (i = 0; i < 10; i++) { X X /* X * The input may have just changed (prior to X * cxm_msp_wait_for_lock) so start with the X * delay to give the audio decoder a chance X * to update its status. X */ X X tsleep(&sc->iicbus, PZERO, "audio", hz / 20 ); X X switch (cxm_msp_is_locked(sc)) { X case 1: X return 1; X X case 0: X break; X X default: X return -1; X } X } X X printf("%s: audio decoder failed to lock\n", sc->name); X X return 0; X} END-of-dev/cxm/cxm_audio.c echo x - dev/cxm/cxm_eeprom.c sed 's/^X//' >dev/cxm/cxm_eeprom.c << 'END-of-dev/cxm/cxm_eeprom.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * EEPROM routines for the Conexant MPEG-2 Codec driver. X * X * Ideally these routines should be implemented as a separate X * driver which has a generic EEPROM interface so that it's X * not necessary for each multimedia driver to re-invent the X * wheel. X */ X X X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#include X#include X X#include X X#include X#include X X#include "iicbb_if.h" X X Xstatic int Xcxm_eeprom_read( device_t iicbus, int i2c_addr, X char *buf, int len, unsigned int offset ) X{ X char msg[1]; X int received; X int sent; X X msg[0] = (unsigned char)offset; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X if (iicbus_repeated_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) X goto fail; X X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) X goto fail; X X iicbus_stop(iicbus); X X return received; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X Xint Xcxm_eeprom_init( struct cxm_softc *sc ) X{ X unsigned char eeprom[1]; X X if (cxm_eeprom_read(sc->iicbus, CXM_I2C_EEPROM, X eeprom, sizeof(eeprom), 0) != sizeof(eeprom)) X return -1; X X return 0; X} X X Xint Xcxm_eeprom_tuner_type( struct cxm_softc *sc ) X{ X unsigned char eeprom[256]; X unsigned int i; X unsigned int len; X unsigned int subsystem_vendor_id; X unsigned int tuner_code; X int tuner_type; X X if (cxm_eeprom_read(sc->iicbus, CXM_I2C_EEPROM, X eeprom, sizeof(eeprom), 0) != sizeof(eeprom)) X return -1; X X subsystem_vendor_id = (unsigned int)eeprom[254] << 8 | eeprom[255]; X tuner_type = -1; X X switch (subsystem_vendor_id) { X case CXM_VENDORID_HAUPPAUGE: X X /* X * The Hauppauge eeprom format is tagged. X */ X X if (eeprom[0] != 0x84) { X printf("%s: unknown Hauppauge eeprom format %#x\n", X sc->name, (unsigned int)eeprom[0]); X break; X } X X tuner_code = -1; X X for (i = 0; i < sizeof(eeprom); i += len) { X len = 0; X if (eeprom[i] == 0x84) { X len = (unsigned int)eeprom[i + 2] << 8 X | eeprom[i + 1]; X i += 3; X } X else if ((eeprom[i] & 0xf0) == 0x70) { X if (eeprom[i] & 0x08) X break; X len = eeprom[i] & 0x07; X i++; X } X else { X printf( X "%s: unknown Hauppauge eeprom packet %#x\n", X sc->name, (unsigned int)eeprom[i]); X return -1; X } X X if (i >= sizeof(eeprom) X || (i + len) > sizeof(eeprom)) { X printf("%s: corrupt Hauppauge eeprom packet\n", X sc->name); X return -1; X } X X switch (eeprom[i]) { X case 0x00: X tuner_code = eeprom[i + 6]; X break; X X case 0x0a: X tuner_code = eeprom[i + 2]; X break; X X default: X break; X } X } X X switch (tuner_code) { X case 0x03: /* Philips FI1216 */ X case 0x08: /* Philips FI1216 MK2 */ X tuner_type = CXM_TUNER_PHILIPS_FI1216_MK2; X break; X X case 0x22: /* Philips FQ1216ME */ X tuner_type = CXM_TUNER_PHILIPS_FQ1216ME; X break; X X case 0x37: /* Philips FQ1216ME MK3 */ X tuner_type = CXM_TUNER_PHILIPS_FQ1216ME_MK3; X break; X X case 0x1d: /* Temic 4006FH5 */ X tuner_type = CXM_TUNER_TEMIC_4006_FH5; X break; X X case 0x30: /* LG Innotek TPI8PSB11D */ X tuner_type = CXM_TUNER_LG_TPI8PSB11D; X break; X X case 0x34: /* Microtune 4049FM5 */ X tuner_type = CXM_TUNER_MICROTUNE_4049_FM5; X break; X X case 0x05: /* Philips FI1236 */ X case 0x0a: /* Philips FI1236 MK2 */ X tuner_type = CXM_TUNER_PHILIPS_FI1236_MK2; X break; X X case 0x1a: /* Temic 4036FY5 */ X tuner_type = CXM_TUNER_TEMIC_4036_FY5; X break; X X case 0x52: /* LG Innotek TAPC-H701F */ X tuner_type = CXM_TUNER_LG_TAPC_H701F; X break; X X case 0x55: /* TCL 2002N-6A */ X tuner_type = CXM_TUNER_TCL_2002N_6A; X break; X X case 0x06: /* Philips FI1246 */ X case 0x0b: /* Philips FI1246 MK2 */ X tuner_type = CXM_TUNER_PHILIPS_FI1246_MK2; X break; X X case 0x23: /* Temic 4066FY5 */ X tuner_type = CXM_TUNER_TEMIC_4066_FY5; X break; X X case 0x10: /* Philips FR1216 MK2 */ X case 0x15: /* Philips FM1216 */ X tuner_type = CXM_TUNER_PHILIPS_FM1216; X break; X X case 0x39: /* Philips FM1216ME MK3 */ X tuner_type = CXM_TUNER_PHILIPS_FM1216ME_MK3; X break; X X case 0x2a: /* Temic 4009FR5 */ X tuner_type = CXM_TUNER_TEMIC_4009_FR5; X break; X X case 0x2f: /* LG Innotek TPI8PSB01N */ X tuner_type = CXM_TUNER_LG_TPI8PSB01N; X break; X X case 0x12: /* Philips FR1236 MK2 */ X case 0x17: /* Philips FM1236 */ X tuner_type = CXM_TUNER_PHILIPS_FM1236; X break; X X case 0x21: /* Temic 4039FR5 */ X tuner_type = CXM_TUNER_TEMIC_4039_FR5; X break; X X case 0x44: /* LG Innotek TAPE-H001F */ X tuner_type = CXM_TUNER_LG_TAPE_H001F; X break; X X case 0x13: /* Philips FR1246 MK2 */ X case 0x18: /* Philips FM1246 */ X tuner_type = CXM_TUNER_PHILIPS_FM1246; X break; X X default: X printf("%s: unknown tuner code %#x\n", X sc->name, tuner_code); X break; X } X break; X X default: X printf("%s: unknown subsystem vendor id %#x\n", X sc->name, subsystem_vendor_id); X break; X } X X return tuner_type; X} END-of-dev/cxm/cxm_eeprom.c echo x - dev/cxm/cxm_i2c.c sed 's/^X//' >dev/cxm/cxm_i2c.c << 'END-of-dev/cxm/cxm_i2c.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * I2c routines for the Conexant MPEG-2 Codec driver. X */ X X#include X#include X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#include X#include X X#if __FreeBSD_version < 500000 X# include X# include X#else X# include X# include X#endif X X#include X X#include X X#include "iicbb_if.h" X X Xstatic int cxm_iic_probe( device_t dev ); Xstatic int cxm_iic_attach( device_t dev ); Xstatic int cxm_iic_detach( device_t dev ); Xstatic void cxm_iic_child_detached( device_t dev, device_t child ); X Xstatic int cxm_iic_callback( device_t, int, caddr_t * ); Xstatic int cxm_iic_reset( device_t, u_char, u_char, u_char * ); Xstatic int cxm_iic_getscl( device_t ); Xstatic int cxm_iic_getsda( device_t ); Xstatic void cxm_iic_setscl( device_t, int ); Xstatic void cxm_iic_setsda( device_t, int ); Xstatic void cxm_iic_setlines( device_t, int, int ); X Xstatic device_method_t cxm_iic_methods[] = { X /* Device interface */ X DEVMETHOD(device_probe, cxm_iic_probe), X DEVMETHOD(device_attach, cxm_iic_attach), X DEVMETHOD(device_detach, cxm_iic_detach), X X /* bus interface */ X DEVMETHOD(bus_child_detached, cxm_iic_child_detached), X DEVMETHOD(bus_print_child, bus_generic_print_child), X DEVMETHOD(bus_driver_added, bus_generic_driver_added), X X /* iicbb interface */ X DEVMETHOD(iicbb_callback, cxm_iic_callback), X DEVMETHOD(iicbb_reset, cxm_iic_reset), X X#if __FreeBSD_version < 500000 X DEVMETHOD(iicbb_getdataline, cxm_iic_getsda), X DEVMETHOD(iicbb_setlines, cxm_iic_setlines), X#else X DEVMETHOD(iicbb_getscl, cxm_iic_getscl), X DEVMETHOD(iicbb_getsda, cxm_iic_getsda), X DEVMETHOD(iicbb_setscl, cxm_iic_setscl), X DEVMETHOD(iicbb_setsda, cxm_iic_setsda), X#endif X X { 0, 0 } X}; X Xstatic driver_t cxm_iic_driver = { X "cxm_iic", X cxm_iic_methods, X sizeof(struct cxm_iic_softc), X}; X Xstatic devclass_t cxm_iic_devclass; X X#if __FreeBSD_version >= 500000 XMODULE_DEPEND(cxm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); X#endif XMODULE_VERSION(cxm_iic, 1); XDRIVER_MODULE(cxm_iic, cxm, cxm_iic_driver, cxm_iic_devclass, 0, 0); X X X/* X * the boot time probe routine. X * X * The cxm_iic device is only probed after it has X * been established that the cxm device is present X * which means that the cxm_iic device * must * X * be present since it's built into the cxm hardware. X */ Xstatic int Xcxm_iic_probe( device_t dev ) X{ X device_set_desc(dev, "Conexant iTVC15 / iTVC16 I2C controller"); X X return 0; X} X X X/* X * the attach routine. X */ Xstatic int Xcxm_iic_attach( device_t dev ) X{ X device_t *kids; X device_t iicbus; X int error; X int numkids; X int i; X int unit; X unsigned int bhandle; X unsigned int btag; X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X unit = device_get_unit(dev); X X /* build the device name */ X snprintf(sc->name, sizeof(sc->name), "cxm_iic%d",unit); X X /* retrieve the cxm btag and bhandle */ X if (BUS_READ_IVAR(device_get_parent(dev), dev, CXM_IVAR_BTAG, &btag) X || BUS_READ_IVAR(device_get_parent(dev), dev, X CXM_IVAR_BHANDLE, &bhandle)) { X device_printf(dev, X "could not retrieve bus space information\n"); X return ENXIO; X } X X sc->btag = btag; X sc->bhandle = bhandle; X X /* add bit-banging generic code onto cxm_iic interface */ X sc->iicbb = device_add_child(dev, "iicbb", -1); X X if (! sc->iicbb) { X device_printf(dev, "could not add iicbb\n"); X return ENXIO; X } X X /* probed and attached the bit-banging code */ X error = device_probe_and_attach(sc->iicbb); X X if (error) { X device_printf(dev, "could not attach iicbb\n"); X goto fail; X } X X /* locate iicbus which was attached by the bit-banging code */ X iicbus = NULL; X device_get_children(sc->iicbb, &kids, &numkids); X for (i = 0; i < numkids; i++) X if (strcmp(device_get_name(kids[i]), "iicbus") == 0) { X iicbus = kids[i]; X break; X } X free(kids, M_TEMP); X X if (! iicbus) { X device_printf(dev, "could not find iicbus\n"); X error = ENXIO; X goto fail; X } X X if (BUS_WRITE_IVAR(device_get_parent(dev), dev, X CXM_IVAR_IICBUS, (uintptr_t)iicbus)) { X device_printf(dev, "could not store iicbus information\n"); X error = ENXIO; X goto fail; X } X X return 0; X Xfail: X /* X * Detach the children before recursively deleting X * in case a child has a pointer to a grandchild X * which is used by the child's detach routine. X */ X bus_generic_detach(dev); X if (sc->iicbb) X device_delete_child(dev, sc->iicbb); X X return error; X} X X X/* X * the detach routine. X */ Xstatic int Xcxm_iic_detach( device_t dev ) X{ X struct cxm_iic_softc *sc; X device_t child; X X /* Get the device data */ X sc = device_get_softc(dev); X X (void)BUS_WRITE_IVAR(device_get_parent(dev), dev, CXM_IVAR_IICBUS, 0); X X /* X * Detach the children before recursively deleting X * in case a child has a pointer to a grandchild X * which is used by the child's detach routine. X * X * Remember the child before detaching so we can X * delete it (bus_generic_detach indirectly zeroes X * sc->child_dev). X */ X child = sc->iicbb; X bus_generic_detach(dev); X if (child) X device_delete_child(dev, child); X X return 0; X} X X X/* X * the child detached routine. X */ Xstatic void Xcxm_iic_child_detached( device_t dev, device_t child ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = device_get_softc(dev); X X if (child == sc->iicbb) X sc->iicbb = NULL; X} X X Xstatic int Xcxm_iic_callback( device_t dev, int index, caddr_t *data ) X{ X return 0; X} X X Xstatic int Xcxm_iic_reset( device_t dev, u_char speed, u_char addr, u_char * oldaddr ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = (struct cxm_iic_softc *)device_get_softc(dev); X X /* Set scl to 1 */ X CSR_WRITE_4(sc, CXM_REG_I2C_SETSCL, ~(int)1); X X /* Set sda to 1 */ X CSR_WRITE_4(sc, CXM_REG_I2C_SETSDA, ~(int)1); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, CXM_REG_I2C_SETSDA); X X /* Wait for 10 usec */ X DELAY(10); X X return IIC_ENOADDR; X} X X Xstatic int Xcxm_iic_getscl( device_t dev ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = (struct cxm_iic_softc *)device_get_softc(dev); X X /* Get sda */ X return CSR_READ_1(sc, CXM_REG_I2C_GETSCL); X} X X Xstatic int Xcxm_iic_getsda( device_t dev ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = (struct cxm_iic_softc *)device_get_softc(dev); X X /* Get sda */ X return CSR_READ_1(sc, CXM_REG_I2C_GETSDA); X} X X Xstatic void Xcxm_iic_setscl( device_t dev, int val ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = (struct cxm_iic_softc *)device_get_softc(dev); X X /* Set scl to the requested value */ X CSR_WRITE_4(sc, CXM_REG_I2C_SETSCL, ~(int)(val ? 1 : 0)); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, CXM_REG_I2C_SETSCL); X} X X Xstatic void Xcxm_iic_setsda( device_t dev, int val ) X{ X struct cxm_iic_softc *sc; X X /* Get the device data */ X sc = (struct cxm_iic_softc *)device_get_softc(dev); X X /* Set sda to the requested value */ X CSR_WRITE_4(sc, CXM_REG_I2C_SETSDA, ~(int)(val ? 1 : 0)); X X /* X * PCI writes may be buffered so force the X * write to complete by reading the last X * location written. X */ X X (void)CSR_READ_4(sc, CXM_REG_I2C_SETSDA); X} X X Xstatic void Xcxm_iic_setlines( device_t dev, int ctrl, int data ) X{ X X cxm_iic_setscl(dev, ctrl); X cxm_iic_setsda(dev, data); X X /* Wait for 10 usec */ X DELAY(10); X} END-of-dev/cxm/cxm_i2c.c echo x - dev/cxm/cxm_ir.c sed 's/^X//' >dev/cxm/cxm_ir.c << 'END-of-dev/cxm/cxm_ir.c' X/* X * Copyright (c) 2003, 2004 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Infrared remote routines for the Conexant MPEG-2 Codec driver. X * X * Ideally these routines should be implemented as a separate X * driver which has a generic infrared remote interface so that X * it's not necessary for each multimedia driver to re-invent X * the wheel. X */ X X X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#include X#include X X#include X X#include X#include X X#include "iicbb_if.h" X X Xstatic int Xcxm_ir_read( device_t iicbus, int i2c_addr, char *buf, int len ) X{ X int received; X X if (iicbus_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) X goto fail; X X iicbus_stop(iicbus); X X return received; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X Xint Xcxm_ir_init( struct cxm_softc *sc ) X{ X unsigned char key[1]; X X if (cxm_ir_read(sc->iicbus, CXM_I2C_IR, X key, sizeof(key)) != sizeof(key)) X return -1; X X printf("%s: IR Remote\n", sc->name); X X return 0; X} X X Xint Xcxm_ir_key( struct cxm_softc *sc, char *buf, int len ) X{ X int result; X X result = cxm_ir_read(sc->iicbus, CXM_I2C_IR, buf, len); X X if (result >= 0) X return result; X X /* X * If the IR receiver didn't respond, X * then wait 50 ms and try again. X */ X X tsleep(&sc->iicbus, PZERO, "IR", hz / 20 ); X X return cxm_ir_read(sc->iicbus, CXM_I2C_IR, buf, len); X} END-of-dev/cxm/cxm_ir.c echo x - dev/cxm/cxm_tuner.c sed 's/^X//' >dev/cxm/cxm_tuner.c << 'END-of-dev/cxm/cxm_tuner.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Tuner routines for the Conexant MPEG-2 Codec driver. X * X * Ideally these routines should be implemented as a separate X * driver which has a generic tuner interface so that it's X * not necessary for each multimedia driver to re-invent the X * wheel. X */ X X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#if __FreeBSD_version < 503001 X# include X# include X#else X# include X# include X#endif X X#include X#include X X#include X X#include X#include X X#include "iicbb_if.h" X X X/* X * Channel mappings derived from X * http://developer.apple.com/technotes/tn/tn1012.html X * X * B/G Cable mapping based the bktr Western European mapping X */ X Xstatic const struct cxm_tuner_channels Xus_air_channels = { X "US Broadcast", X CHNLSET_NABCST, X CXM_TUNER_TV_SYSTEM_MN, X 2, X 69, X 45750, X { { 14, 471250, 6000 }, X { 7, 175250, 6000 }, X { 5, 77250, 6000 }, X { 2, 55250, 6000 } } X}; X Xstatic const struct cxm_tuner_channels Xus_cable_channels = { X "US Cable", X CHNLSET_CABLEIRC, X CXM_TUNER_TV_SYSTEM_MN, X 1, X 125, X 45750, X { { 100, 649250, 6000 }, X { 95, 91250, 6000 }, X { 23, 217250, 6000 }, X { 14, 121250, 6000 }, X { 7, 175250, 6000 }, X { 5, 77250, 6000 }, X { 2, 55250, 6000 }, X { 1, 73250, 6000 } } X}; X Xstatic const struct cxm_tuner_channels Xbg_air_channels = { X "B/G Broadcast", X 0, X CXM_TUNER_TV_SYSTEM_BG, X 2, X 89, X 38900, X { { 82, 175250, 7000 }, X { 80, 55250, 7000 }, X { 79, 217250, 7000 }, X { 77, 209250, 7000 }, X { 76, 138250, 9000 }, X { 75, 102250, 9000 }, X { 73, 86250, 9000 }, X { 72, 64250, 7500 }, X { 70, 49750, 7500 }, X { 21, 471250, 8000 }, X { 20, 210250, 8500 }, X { 18, 192750, 8500 }, X { 16, 175250, 8000 }, X { 15, 82250, 8500 }, X { 13, 53750, 8500 }, X { 5, 175250, 7000 }, X { 2, 48250, 7000 } } X}; X Xstatic const struct cxm_tuner_channels Xbg_cable_channels = { X "B/G Cable", X CHNLSET_WEUROPE, X CXM_TUNER_TV_SYSTEM_BG, X 2, X 120, X 38900, X { { 100, 303250, 8000 }, X { 90, 231250, 7000 }, X { 80, 105250, 7000 }, X { 79, 0, 0 }, X { 78, 0, 0 }, X { 77, 0, 0 }, X { 74, 69250, 7000 }, X { 73, 0, 0 }, X { 70, 45750, 8000 }, X { 21, 471250, 8000 }, X { 20, 210250, 8500 }, X { 18, 192750, 8500 }, X { 16, 175250, 8000 }, X { 15, 82250, 8500 }, X { 13, 53750, 8500 }, X { 5, 175250, 7000 }, X { 2, 48250, 7000 } } X}; X Xstatic const struct cxm_tuner_channels Xbg_australia_channels = { X "B/G Australia", X CHNLSET_AUSTRALIA, X CXM_TUNER_TV_SYSTEM_BG, X 1, X 83, X 38900, X { { 28, 527250, 7000 }, X { 10, 209250, 7000 }, X { 6, 175250, 7000 }, X { 4, 95250, 7000 }, X { 3, 86250, 7000 }, X { 1, 57250, 7000 } } X}; X Xstatic const struct cxm_tuner_channels Xi_air_channels = { X "I Broadcast", X 0, X CXM_TUNER_TV_SYSTEM_I, X 1, X 83, X 38900, X { { 75, 179750, 5000 }, X { 71, 51750, 5000 }, X { 70, 45000, 5000 }, X { 21, 471250, 8000 }, X { 20, 0, 0 }, X { 19, 0, 0 }, X { 18, 0, 0 }, X { 17, 0, 0 }, X { 16, 0, 0 }, X { 15, 0, 0 }, X { 14, 0, 0 }, X { 13, 247250, 8000 }, X { 12, 0, 0 }, X { 4, 175250, 8000 }, X { 1, 45750, 8000 } } X}; X Xstatic const struct cxm_tuner_channels Xl_air_channels = { X "L Broadcast", X CHNLSET_FRANCE, X CXM_TUNER_TV_SYSTEM_L, X 1, X 69, X 38900, X { { 21, 471250, 8000 }, X { 20, 0, 0 }, X { 19, 0, 0 }, X { 18, 0, 0 }, X { 17, 0, 0 }, X { 16, 0, 0 }, X { 15, 0, 0 }, X { 14, 0, 0 }, X { 8, 176000, 8000 }, X { 5, 57250, 3250 }, X { 4, 55750, 1500 }, X { 3, 54000, 1750 }, X { 2, 49250, 4750 }, X { 1, 47750, 1500 } } X}; X Xstatic const struct cxm_tuner_channels Xjapan_air_channels = { X "Japan Broadcast", X CHNLSET_JPNBCST, X CXM_TUNER_TV_SYSTEM_MN, X 1, X 62, X 45750, X { { 13, 471250, 6000 }, X { 8, 193250, 6000 }, X { 4, 171250, 6000 }, X { 1, 91250, 6000 } } X}; X Xstatic const struct cxm_tuner_channels Xjapan_cable_channels = { X "Japan Cable", X CHNLSET_JPNCABLE, X CXM_TUNER_TV_SYSTEM_MN, X 1, X 63, X 45750, X { { 23, 223250, 6000 }, X { 22, 165250, 6000 }, X { 13, 109250, 6000 }, X { 8, 193250, 6000 }, X { 4, 171250, 6000 }, X { 1, 91250, 6000 } } X}; X X Xstatic const struct cxm_tuner_channels X*channel_sets[] = { X &us_air_channels, X &us_cable_channels, X &bg_air_channels, X &bg_cable_channels, X &bg_australia_channels, X &i_air_channels, X &l_air_channels, X &japan_air_channels, X &japan_cable_channels X}; X X Xconst struct cxm_tuner Xcxm_tuners[CXM_TUNER_TYPES] = { X { "Philips FI1216 MK2", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 450000, { 0x8e, 0x30 } }, X { 170000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &bg_air_channels }, X { "Philips FM1216", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 450000, { 0xce, 0x30 } }, X { 170000, { 0xce, 0x90 } }, X { 48250, { 0xce, 0xa0 } } }, X 87500, 108000, X { 87500, { 0x88, 0xa5 } }, X &bg_air_channels }, X { "Philips FQ1216ME", X { CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK X | CXM_TUNER_TV_SYSTEM_I X | CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME, X cxm_port_system_code_style, X { { CXM_TUNER_TV_SYSTEM_BG, { 0x09 } }, X { CXM_TUNER_TV_SYSTEM_DK, { 0x09 } }, X { CXM_TUNER_TV_SYSTEM_I, { 0x01 } }, X { CXM_TUNER_TV_SYSTEM_L, { 0x0b } }, X { CXM_TUNER_TV_SYSTEM_L_PRIME, { 0x0a } } } }, X 48250, 855250, X { { 450000, { 0x8e, 0x30 } }, X { 170000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &l_air_channels }, X { "Philips FQ1216ME MK3", X { CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK X | CXM_TUNER_TV_SYSTEM_I X | CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME, X cxm_if_system_with_aux_code_style, X { { CXM_TUNER_TV_SYSTEM_BG, { 0x16, 0x70, 0x49, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_DK, { 0x16, 0x70, 0x4b, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_I, { 0x16, 0x70, 0x4a, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_L, { 0x06, 0x50, 0x4b, 0x50 }}, X { CXM_TUNER_TV_SYSTEM_L_PRIME, { 0x86, 0x50, 0x53, 0x50 }} X } }, X 48250, 863250, X { { 442000, { 0xce, 0x04 } }, X { 160000, { 0xce, 0x02 } }, X { 48250, { 0xce, 0x01 } } }, X 0, 0, X { 0 }, X &l_air_channels }, X { "Philips FM1216ME MK3", X { CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK X | CXM_TUNER_TV_SYSTEM_I X | CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME, X cxm_if_system_with_aux_code_style, X { { CXM_TUNER_TV_SYSTEM_BG, { 0x16, 0x70, 0x49, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_DK, { 0x16, 0x70, 0x4b, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_I, { 0x16, 0x70, 0x4a, 0x40 }}, X { CXM_TUNER_TV_SYSTEM_L, { 0x06, 0x50, 0x4b, 0x50 }}, X { CXM_TUNER_TV_SYSTEM_L_PRIME, { 0x86, 0x50, 0x53, 0x50 }}, X { CXM_TUNER_FM_SYSTEM, { 0x0a, 0x90, 0x20, 0x40 }} X } }, X 48250, 863250, X { { 442000, { 0xce, 0x04 } }, X { 160000, { 0xce, 0x02 } }, X { 48250, { 0xce, 0x01 } } }, X 87500, 108000, X { 87500, { 0x88, 0x19 } }, X &l_air_channels }, X { "Philips FI1236 MK2", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 454000, { 0x8e, 0x30 } }, X { 160000, { 0x8e, 0x90 } }, X { 55250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &us_cable_channels }, X { "Philips FM1236", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 454000, { 0xce, 0x30 } }, X { 160000, { 0xce, 0x90 } }, X { 55250, { 0xce, 0xa0 } } }, X 76000, 108000, X { 76000, { 0x88, 0xa5 } }, X &us_cable_channels }, X { "Philips FI1246 MK2", X { CXM_TUNER_TV_SYSTEM_I, cxm_none_system_code_style }, X 45750, 855250, X { { 450000, { 0x8e, 0x30 } }, X { 170000, { 0x8e, 0x90 } }, X { 45750, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &i_air_channels }, X { "Philips FM1246", X { CXM_TUNER_TV_SYSTEM_I, cxm_none_system_code_style }, X 45750, 855250, X { { 450000, { 0xce, 0x30 } }, X { 170000, { 0xce, 0x90 } }, X { 45750, { 0xce, 0xa0 } } }, X 87500, 108000, X { 87500, { 0x88, 0xa5 } }, X &i_air_channels }, X { "Temic 4006 FH5", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 454000, { 0x8e, 0x30 } }, X { 169000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &bg_air_channels }, X { "Temic 4009 FR5", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 464000, { 0x8e, 0x30 } }, X { 141000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 87500, 108100, X { 87500, { 0x88, 0xa5 } }, X &bg_air_channels }, X { "Temic 4036 FY5", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 453000, { 0x8e, 0x30 } }, X { 158000, { 0x8e, 0x90 } }, X { 55250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &us_cable_channels }, X { "Temic 4039 FR5", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 453000, { 0x8e, 0x30 } }, X { 158000, { 0x8e, 0x90 } }, X { 55250, { 0x8e, 0xa0 } } }, X 75900, 108100, X { 75900, { 0x88, 0xa5 } }, X &us_cable_channels }, X { "Temic 4066 FY5", X { CXM_TUNER_TV_SYSTEM_I, cxm_none_system_code_style }, X 45750, 855250, X { { 454000, { 0x8e, 0x30 } }, X { 169000, { 0x8e, 0x90 } }, X { 45750, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &i_air_channels }, X { "LG Innotek TPI8PSB11D", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 450000, { 0x8e, 0x30 } }, X { 170000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 0, 0, X { 0 }, X &bg_air_channels }, X { "LG Innotek TPI8PSB01N", X { CXM_TUNER_TV_SYSTEM_BG, cxm_none_system_code_style }, X 48250, 855250, X { { 450000, { 0x8e, 0x30 } }, X { 170000, { 0x8e, 0x90 } }, X { 48250, { 0x8e, 0xa0 } } }, X 87500, 108000, X { 87500, { 0x88, 0xa5 } }, X &bg_air_channels }, X { "LG Innotek TAPC-H701F", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 450000, { 0xce, 0x08 } }, X { 165000, { 0xce, 0x02 } }, X { 55250, { 0xce, 0x01 } } }, X 0, 0, X { 0 }, X &us_cable_channels }, X { "LG Innotek TAPC-H001F", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 450000, { 0xce, 0x08 } }, X { 165000, { 0xce, 0x02 } }, X { 55250, { 0xce, 0x01 } } }, X 76000, 108000, X { 76000, { 0x88, 0x04 } }, X &us_cable_channels }, X { "LG Innotek TAPE-H001F", X { CXM_TUNER_TV_SYSTEM_MN, X cxm_if_system_with_aux_code_style, X { { CXM_TUNER_TV_SYSTEM_MN, { 0x16, 0x30, 0x44, 0x30 }}, X { CXM_TUNER_FM_SYSTEM, { 0x0a, 0x90, 0x20, 0x30 }} X } }, X 48250, 801250, X { { 442000, { 0xce, 0x04 } }, X { 160000, { 0xce, 0x02 } }, X { 48250, { 0xce, 0x01 } } }, X 88000, 108000, X { 88000, { 0x88, 0x19 } }, X &us_cable_channels }, X { "Microtune 4049 FM5", X { CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK X | CXM_TUNER_TV_SYSTEM_I X | CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME, X cxm_if_system_code_style, X { { CXM_TUNER_TV_SYSTEM_BG, { 0xd4, 0x70, 0x09 } }, X { CXM_TUNER_TV_SYSTEM_DK, { 0xd4, 0x70, 0x0b } }, X { CXM_TUNER_TV_SYSTEM_I, { 0xd4, 0x70, 0x0a } }, X { CXM_TUNER_TV_SYSTEM_L, { 0xc4, 0x10, 0x0b } }, X { CXM_TUNER_TV_SYSTEM_L_PRIME, { 0x84, 0x10, 0x13 } }, X { CXM_TUNER_FM_SYSTEM, { 0xdc, 0x10, 0x1d } } } }, X 45750, 855250, X { { 464000, { 0x8e, 0x30 } }, X { 141000, { 0x8e, 0x90 } }, X { 45750, { 0x8e, 0xa0 } } }, X 87500, 108100, X { 87500, { 0x88, 0xa4 } }, X &l_air_channels }, X { "TCL 2002N-6A", X { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, X 55250, 801250, X { { 446000, { 0x8e, 0x08 } }, X { 170000, { 0x8e, 0x02 } }, X { 55250, { 0x8e, 0x01 } } }, X 0, 0, X { 0 }, X &us_cable_channels } X}; X X X/* Read from the tuner registers */ Xstatic int Xcxm_tuner_read( device_t iicbus, int i2c_addr, char *buf, int len ) X{ X int received; X X if (iicbus_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) X goto fail; X X iicbus_stop(iicbus); X X return received; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X X/* Write to the tuner registers */ Xstatic int Xcxm_tuner_write( device_t iicbus, int i2c_addr, const char *buf, int len ) X{ X int sent; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, buf, len, &sent, CXM_I2C_TIMEOUT) != 0) X goto fail; X X iicbus_stop(iicbus); X X return sent; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X Xint Xcxm_tuner_init( struct cxm_softc *sc ) X{ X unsigned char status; X int tuner_type; X X if (cxm_eeprom_init(sc) < 0) X return -1; X X tuner_type = cxm_eeprom_tuner_type(sc); X X if (tuner_type < 0 || tuner_type >= NUM_ELEMENTS(cxm_tuners)) X return -1; X X sc->tuner = &cxm_tuners[tuner_type]; X sc->tuner_channels = sc->tuner->default_channels; X sc->tuner_freq = 0; X X if (cxm_tuner_read(sc->iicbus, CXM_I2C_TUNER, &status, sizeof(status)) X != sizeof(status)) X return -1; X X if (cxm_tuner_select_channel(sc, 4) < 0) X return -1; X X printf("%s: %s tuner\n", sc->name, sc->tuner->name); X X return 0; X} X X Xint Xcxm_tuner_select_channel_set( struct cxm_softc *sc, unsigned int channel_set ) X{ X unsigned int i; X X if (! channel_set) { X sc->tuner_channels = sc->tuner->default_channels; X return 0; X } X X for (i = 0; i < NUM_ELEMENTS(channel_sets); i++) X if (channel_sets[i]->chnlset == channel_set) X break; X X if (i >= NUM_ELEMENTS(channel_sets)) X return -1; X X if (! (sc->tuner->systems.supported & channel_sets[i]->system) ) X return -1; X X sc->tuner_channels = channel_sets[i]; X X return 0; X} X X Xunsigned int Xcxm_tuner_selected_channel_set( struct cxm_softc *sc ) X{ X return sc->tuner_channels->chnlset; X} X X Xint Xcxm_tuner_select_frequency( struct cxm_softc *sc, X enum cxm_tuner_freq_type freq_type, X unsigned long freq ) X{ X unsigned char msg[5]; X unsigned char aux; X unsigned char pb; X unsigned int i; X unsigned int system; X unsigned int tuner_msg_len; X unsigned long N; X unsigned long osc_freq; X const struct cxm_tuner_band_code *band_code; X const struct cxm_tuner_system_code *system_code; X X N = 0; X aux = 0; X pb = 0; X X system_code = NULL; X X tuner_msg_len = 4; X X if (sc->tuner->systems.code_style != cxm_none_system_code_style) { X system = freq_type == cxm_tuner_fm_freq_type X ? CXM_TUNER_FM_SYSTEM : sc->tuner_channels->system; X X for (i = 0; i < NUM_ELEMENTS (sc->tuner->systems.codes); i++) X if (sc->tuner->systems.codes[i].system & system) X break; X X if (i >= NUM_ELEMENTS (sc->tuner->systems.codes)) X return -1; X X switch (sc->tuner->systems.code_style) { X case cxm_port_system_code_style: X pb = sc->tuner->systems.codes[i].codes[0]; X break; X X case cxm_if_system_with_aux_code_style: X aux = sc->tuner->systems.codes[i].codes[3]; X tuner_msg_len = 5; X X /* FALLTHROUGH */ X X case cxm_if_system_code_style: X system_code = &sc->tuner->systems.codes[i]; X break; X X default: X return -1; X } X } X X switch (freq_type) { X case cxm_tuner_fm_freq_type: X X if (freq < sc->tuner->fm_min_freq X || freq > sc->tuner->fm_max_freq X || ! sc->tuner->fm_band_code.freq) X return -1; X X /* X * The Philips FM1216ME MK3 data sheet recommends X * first setting the tuner to TV mode at a high X * frequency (e.g. 150 MHz), then selecting the X * desired FM station in order to ensure that the X * tuning voltage does not stay locked at 0V. X */ X X if (cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, X 150000) < 0) X return -1; X X /* X * N = { fRF(pc) + fIF(pc) } / step_size X * X * fRF = RF frequency in MHz X * fIF = Intermediate frequency in MHz (FM = 10.70 MHz) X * step_size = Step size in MHz (FM = 50 kHz) X */ X X osc_freq = freq + 10700; X X N = (20 * osc_freq) / 1000; X X msg[0] = (unsigned char)(N >> 8); X msg[1] = (unsigned char)N; X msg[2] = sc->tuner->fm_band_code.codes[0]; X msg[3] = sc->tuner->fm_band_code.codes[1] | pb; X msg[4] = aux; X break; X X case cxm_tuner_tv_freq_type: X X if (freq < sc->tuner->min_freq X || freq > sc->tuner->max_freq) X return -1; X X /* X * N = 16 * { fRF(pc) + fIF(pc) } X * X * fRF = RF frequency in MHz X * fIF = Intermediate frequency in MHz X * X * The data sheet doesn't state it, however X * this is probably the same equation as X * FM simply with 62.5 kHz as the step size. X */ X X osc_freq = freq + sc->tuner_channels->if_freq; X X N = (16 * osc_freq) / 1000; X X for (band_code = sc->tuner->band_codes; X band_code->freq > freq; band_code++) X ; X X if (freq >= sc->tuner_freq) { X msg[0] = (unsigned char)(N >> 8); X msg[1] = (unsigned char)N; X msg[2] = band_code->codes[0]; X msg[3] = band_code->codes[1] | pb; X } X else { X msg[0] = band_code->codes[0]; X msg[1] = band_code->codes[1] | pb; X msg[2] = (unsigned char)(N >> 8); X msg[3] = (unsigned char)N; X } X msg[4] = aux; X break; X X default: X return -1; X } X X if (N > 32767) X return -1; X X if (cxm_tuner_write(sc->iicbus, CXM_I2C_TUNER, msg, tuner_msg_len) X != tuner_msg_len) X return -1; X X /* X * Program the IF processing after the tuner since some tuners X * use the control byte to set the address of the IF. X */ X X if (system_code) { X msg[0] = 0x00; X msg[1] = system_code->codes[0]; X msg[2] = system_code->codes[1]; X msg[3] = system_code->codes[2]; X X if (cxm_tuner_write(sc->iicbus, CXM_I2C_TUNER_IF, msg, 4) != 4) X return -1; X } X X sc->tuner_freq = freq; X X return 0; X} X X Xint Xcxm_tuner_select_channel( struct cxm_softc *sc, unsigned int channel ) X{ X unsigned long freq; X const struct cxm_tuner_channel_assignment *assignments; X const struct cxm_tuner_channels *channels; X X channels = sc->tuner_channels; X X if (! channels X || channel < channels->min_channel X || channel > channels->max_channel) X return -1; X X for (assignments = channels->assignments; X assignments->channel > channel; assignments++) X ; X X if (! assignments->freq) X return -1; X X freq = assignments->freq X + (channel - assignments->channel) * assignments->step; X X return cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, freq); X} X X Xint Xcxm_tuner_apply_afc( struct cxm_softc *sc ) X{ X unsigned int i; X int status; X unsigned long freq; X unsigned long max_offset; X unsigned long original_freq; X unsigned long prev_freq; X unsigned long step_size; X X if (cxm_tuner_wait_for_lock(sc) != 1) X return -1; X X original_freq = sc->tuner_freq; X X freq = sc->tuner_freq; X prev_freq = 0; X max_offset = 2000; X step_size = 63; X X for (i = 0; i < (max_offset / step_size); i++) { X status = cxm_tuner_status(sc); X X if (status == -1) X break; X X if (! (status & CXM_TUNER_PHASE_LOCKED) ) X break; X X switch (status & CXM_TUNER_AFC_MASK) { X case CXM_TUNER_AFC_FREQ_CENTERED: X return 0; X X case CXM_TUNER_AFC_FREQ_MINUS_125: X case CXM_TUNER_AFC_FREQ_MINUS_62: X freq -= step_size; X break; X X case CXM_TUNER_AFC_FREQ_PLUS_62: X case CXM_TUNER_AFC_FREQ_PLUS_125: X freq += step_size; X break; X X default: X goto fail; X } X X if (freq == prev_freq) X return 0; X prev_freq = sc->tuner_freq; X X if (cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, X freq) < 0) X break; X X /* X * Delay long enough for the tuner to update its status. X */ X X tsleep(&sc->iicbus, PZERO, "afc", hz / 10 ); X } X Xfail: X (void)cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, X original_freq); X return -1; X} X X Xint Xcxm_tuner_is_locked( struct cxm_softc *sc ) X{ X int status; X X status = cxm_tuner_status(sc); X X if (status == -1) X return -1; X X return (status & CXM_TUNER_PHASE_LOCKED) ? 1 : 0; X} X X Xint Xcxm_tuner_wait_for_lock( struct cxm_softc *sc ) X{ X unsigned int i; X X /* X * The data sheet states the maximum lock-in time X * is 150 ms using fast tuning ... unfortunately X * it doesn't state the maximum lock-in time using X * moderate tuning. Hopefully 300 ms is enough. X */ X X for (i = 0; i < 3; i++) { X X /* X * The frequency may have just changed (prior to X * cxm_tuner_wait_for_lock) so start with the delay X * to give the tuner a chance to update its status. X */ X X tsleep(&sc->iicbus, PZERO, "tuner", hz / 10); X X switch (cxm_tuner_is_locked(sc)) { X case 1: X return 1; X X case 0: X break; X X default: X return -1; X } X } X X printf("%s: tuner failed to lock\n", sc->name); X X return 0; X} X X Xstatic const unsigned char afcmap[16] = { X CXM_TUNER_AFC_FREQ_CENTERED, X CXM_TUNER_AFC_FREQ_MINUS_62, X CXM_TUNER_AFC_FREQ_MINUS_62, X CXM_TUNER_AFC_FREQ_MINUS_62, X CXM_TUNER_AFC_FREQ_MINUS_125, X CXM_TUNER_AFC_FREQ_MINUS_125, X CXM_TUNER_AFC_FREQ_MINUS_125, X CXM_TUNER_AFC_FREQ_MINUS_125, X CXM_TUNER_AFC_FREQ_PLUS_125, X CXM_TUNER_AFC_FREQ_PLUS_125, X CXM_TUNER_AFC_FREQ_PLUS_125, X CXM_TUNER_AFC_FREQ_PLUS_125, X CXM_TUNER_AFC_FREQ_PLUS_62, X CXM_TUNER_AFC_FREQ_PLUS_62, X CXM_TUNER_AFC_FREQ_PLUS_62, X CXM_TUNER_AFC_FREQ_CENTERED X}; X Xint Xcxm_tuner_status( struct cxm_softc *sc ) X{ X unsigned char status; X X if (cxm_tuner_read(sc->iicbus, CXM_I2C_TUNER, &status, sizeof(status)) X != sizeof(status)) X return -1; X X if (sc->tuner->systems.code_style == cxm_if_system_code_style X || sc->tuner->systems.code_style X == cxm_if_system_with_aux_code_style) { X unsigned char if_status; X X if (cxm_tuner_read(sc->iicbus, CXM_I2C_TUNER_IF, X &if_status, sizeof(if_status)) X != sizeof(if_status)) X return -1; X X status &= ~CXM_TUNER_AFC_MASK; X status |= afcmap[(if_status >> 1) & 0x0f]; X } X X return status; X} END-of-dev/cxm/cxm_tuner.c echo x - dev/cxm/cxm_video.c sed 's/^X//' >dev/cxm/cxm_video.c << 'END-of-dev/cxm/cxm_video.c' X/* X * Copyright (c) 2003, 2004, 2005 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Video decoder routines for the Conexant MPEG-2 Codec driver. X * X * Ideally these routines should be implemented as a separate X * driver which has a generic video decoder interface so that X * it's not necessary for each multimedia driver to re-invent X * the wheel. X */ X X#include X#include X#include X#include X#include X#include X X#if __FreeBSD_version >= 500014 X# include X#else X# include X#endif X X#include X#include X#include X#include X X#include X#include X X#include X X#include X#include X X#include "iicbb_if.h" X X Xstatic const struct cxm_saa7115_command Xsaa7115_init = { X 19, X { X /* Full auto mode for CVBS */ X { 0x01, 1, { 0x08 } }, X { 0x03, 18, { 0x20, 0x90, 0x90, 0xeb, 0xe0, 0xb0, 0x40, 0x80, X 0x44, 0x40, 0x00, 0x03, 0x2a, 0x06, 0x00, 0x9d, X 0x80, 0x01 } }, X { 0x17, 7, { 0x99, 0x40, 0x80, 0x77, 0x42, 0xa9, 0x01 } }, X X /* X * VBI data slicer X * X * NTSC raw VBI data on lines 10 through 21 X * PAL raw VBI data on lines 6 through 22 X * X * Actually lines 21 and 22 are set by the X * NTSC and PAL specific configurations. X */ X { 0x40, 20, { 0x40, 0x00, 0x00, 0x00, 0x00, 0xdd, 0xdd, 0xdd, X 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, X 0xdd, 0xdd, 0xdd, 0xdd } }, X { 0x56, 4, { 0x00, 0x00, 0x00, 0x47 } }, X { 0x5c, 3, { 0x00, 0x1f, 0x35 } }, X X /* I-port and X-port configuration */ X { 0x80, 2, { 0x00, 0x01 } }, X { 0x83, 5, { 0x00, 0x20, 0x21, 0xc5, 0x01 } }, X X /* Scaler input configuration and output format settings */ X { 0xc0, 4, { 0x00, 0x08, 0x00, 0x80 } }, X X /* VBI scaler configuration */ X { 0x90, 4, { 0x80, 0x48, 0x00, 0x84 } }, X { 0xa0, 3, { 0x01, 0x00, 0x00 } }, X { 0xa4, 3, { 0x80, 0x40, 0x40 } }, X { 0xa8, 3, { 0x00, 0x02, 0x00 } }, X { 0xac, 3, { 0x00, 0x01, 0x00 } }, X { 0xb0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X { 0xb8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* Audio Master Clock to Audio Serial Clock ratio */ X { 0x38, 3, { 0x03, 0x10, 0x00 } }, X X /* PLL2 target clock 27 MHz (using a 32.11 MHz crystal) */ X { 0xf1, 4, { 0x05, 0xd0, 0x35, 0x00 } }, X X /* Pulse generator */ X { 0xf6, 10, { 0x61, 0x0e, 0x60, 0x0e, 0x60, 0x0e, 0x00, X 0x00, 0x00, 0x88 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_mute = { X 1, X { X /* Disable I-port */ X { 0x87, 1, { 0x00 } }, X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_unmute = { X 1, X { X /* Enable I-port */ X { 0x87, 1, { 0x01 } }, X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_select_fm = { X 1, X { X /* Enable audio clock */ X { 0x88, 1, { 0x33 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_select_line_in_composite = { X 3, X { X /* Amp plus anti-alias filter, CVBS from AI11 */ X { 0x02, 1, { 0xc0 } }, X /* Adaptive luminance comb filter */ X { 0x09, 1, { 0x40 } }, X X /* Enable AD1, audio clock, scaler, decoder */ X { 0x88, 1, { 0x70 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_select_line_in_svideo = { X 3, X { X /* Amp plus anti-alias filter, Y / C from AI11 / AI21 */ X { 0x02, 1, { 0xc8 } }, X /* Bypass chrominance trap / comb filter */ X { 0x09, 1, { 0x80 } }, X X /* Enable AD1 & 2, audio clock, scaler, decoder */ X { 0x88, 1, { 0xf0 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_select_tuner = { X 3, X { X /* Amp plus anti-alias filter, CVBS (auto gain) from AI23 */ X { 0x02, 1, { 0xc4 } }, X /* Adaptive luminance comb filter */ X { 0x09, 1, { 0x40 } }, X X /* Enable AD2, audio clock, scaler, decoder */ X { 0x88, 1, { 0xb0 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_audio_clock_44100_ntsc = { X 2, X { X /* Audio clock 44.1 kHz NTSC (using a 32.11 MHz crystal) */ X { 0x30, 3, { 0xbc, 0xdf, 0x02 } }, X { 0x34, 3, { 0xf2, 0x00, 0x2d } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_audio_clock_44100_pal = { X 2, X { X /* Audio clock 44.1 kHz PAL (using a 32.11 MHz crystal) */ X { 0x30, 3, { 0x00, 0x72, 0x03 } }, X { 0x34, 3, { 0xf2, 0x00, 0x2d } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_audio_clock_48000_ntsc = { X 2, X { X /* Audio clock 48 kHz NTSC (using a 32.11 MHz crystal) */ X { 0x30, 3, { 0xcd, 0x20, 0x03 } }, X { 0x34, 3, { 0xce, 0xfb, 0x30 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_audio_clock_48000_pal = { X 2, X { X /* Audio clock 48 kHz PAL (using a 32.11 MHz crystal) */ X { 0x30, 3, { 0x00, 0xc0, 0x03 } }, X { 0x34, 3, { 0xce, 0xfb, 0x30 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_vcd_ntsc_double_lines = { X 13, X { X /* X * Input window = 720 x 240, output window = 352 x 240 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 5 and active video starting at line 23 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * NTSC active video should actually start at line 22, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x12, 0x00, 0xf2, 0x00, X 0x60, 0x01, 0xf0, 0x00 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x02, 0x02, 0xaa } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x18, 0x04, 0x00 } }, X { 0xdc, 3, { 0x0c, 0x02, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 12, output window = 1440 x 12. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x05, 0x00, 0x0c, 0x00, X 0xa0, 0x05, 0x0c, 0x00 } }, X X /* Inverted VGATE start at line 23, stop after line 263 */ X { 0x15, 2, { 0x02, 0x12 } }, X X /* VBI data slicer 525 lines, line 21 is closed caption */ X { 0x54, 2, { 0x4d, 0x00 } }, X { 0x5a, 2, { 0x06, 0x83 } }, X X /* PLL2 525 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xad } }, X X /* Pulse generator 525 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xad } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_vcd_pal_double_lines = { X 13, X { X /* X * Input window = 720 x 288, output window = 352 x 288 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 2 and active video starting at line 25 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * PAL active video should actually start at line 24, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x17, 0x00, 0x22, 0x01, X 0x60, 0x01, 0x20, 0x01 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x02, 0x02, 0xaa } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x18, 0x04, 0x00 } }, X { 0xdc, 3, { 0x0c, 0x02, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 17, output window = 1440 x 17. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x04, 0x00, 0x11, 0x00, X 0xa0, 0x05, 0x11, 0x00 } }, X X /* Inverted VGATE start at line 25, stop after line 313 */ X { 0x15, 2, { 0x37, 0x17 } }, X X /* VBI data slicer 625 lines, line 22 is closed caption */ X { 0x54, 2, { 0xdd, 0x4d } }, X { 0x5a, 2, { 0x03, 0x03 } }, X X /* PLL2 625 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xb0 } }, X X /* Pulse generator 625 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xb0 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_svcd_ntsc = { X 13, X { X /* X * Input window = 720 x 240, output window = 480 x 240 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 5 and active video starting at line 23 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * NTSC active video should actually start at line 22, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x12, 0x00, 0xf2, 0x00, X 0xe0, 0x01, 0xf0, 0x00 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x01, 0x00, 0x00 } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x00, 0x06, 0x00 } }, X { 0xdc, 3, { 0x00, 0x03, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 12, output window = 1440 x 12. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x05, 0x00, 0x0c, 0x00, X 0xa0, 0x05, 0x0c, 0x00 } }, X X /* Inverted VGATE start at line 23, stop after line 263 */ X { 0x15, 2, { 0x02, 0x12 } }, X X /* VBI data slicer 525 lines, line 21 is closed caption */ X { 0x54, 2, { 0x4d, 0x00 } }, X { 0x5a, 2, { 0x06, 0x83 } }, X X /* PLL2 525 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xad } }, X X /* Pulse generator 525 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xad } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_svcd_pal = { X 13, X { X /* X * Input window = 720 x 288, output window = 480 x 288 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 2 and active video starting at line 25 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * PAL active video should actually start at line 24, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x17, 0x00, 0x22, 0x01, X 0xe0, 0x01, 0x20, 0x01 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x01, 0x00, 0x00 } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x00, 0x06, 0x00 } }, X { 0xdc, 3, { 0x00, 0x03, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 17, output window = 1440 x 17. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x04, 0x00, 0x11, 0x00, X 0xa0, 0x05, 0x11, 0x00 } }, X X /* Inverted VGATE start at line 25, stop after line 313 */ X { 0x15, 2, { 0x37, 0x17 } }, X X /* VBI data slicer 625 lines, line 22 is closed caption */ X { 0x54, 2, { 0xdd, 0x4d } }, X { 0x5a, 2, { 0x03, 0x03 } }, X X /* PLL2 625 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xb0 } }, X X /* Pulse generator 625 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xb0 } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_dvd_ntsc = { X 13, X { X /* X * Input window = 720 x 240, output window = 720 x 240 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 5 and active video starting at line 23 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * NTSC active video should actually start at line 22, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x12, 0x00, 0xf2, 0x00, X 0xd0, 0x02, 0xf0, 0x00 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x01, 0x00, 0x00 } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x00, 0x04, 0x00 } }, X { 0xdc, 3, { 0x00, 0x02, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 12, output window = 1440 x 12. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x05, 0x00, 0x0c, 0x00, X 0xa0, 0x05, 0x0c, 0x00 } }, X X /* Inverted VGATE start at line 23, stop after line 263 */ X { 0x15, 2, { 0x02, 0x12 } }, X X /* VBI data slicer 525 lines, line 21 is closed caption */ X { 0x54, 2, { 0x4d, 0x00 } }, X { 0x5a, 2, { 0x06, 0x83 } }, X X /* PLL2 525 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xad } }, X X /* Pulse generator 525 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xad } } X } X}; X Xstatic const struct cxm_saa7115_command Xsaa7115_scaler_dvd_pal = { X 13, X { X /* X * Input window = 720 x 288, output window = 720 x 288 with X * YS extended by 2 as per section 17.4 of the data sheet X * and YO accounting for scaler processing triggering at X * line 2 and active video starting at line 25 (see section X * 8.2 table 8 and section 8.3.1.1 table 11 of the data sheet). X * PAL active video should actually start at line 24, however X * not all channels / programs do. X */ X { 0xc4, 12, { 0x02, 0x00, 0xd0, 0x02, 0x17, 0x00, 0x22, 0x01, X 0xd0, 0x02, 0x20, 0x01 } }, X X /* Prefiltering and prescaling */ X { 0xd0, 3, { 0x01, 0x00, 0x00 } }, X X /* Brightness, contrast, and saturation */ X { 0xd4, 3, { 0x80, 0x40, 0x40 } }, X X /* Horizontal phase scaling */ X { 0xd8, 3, { 0x00, 0x04, 0x00 } }, X { 0xdc, 3, { 0x00, 0x02, 0x00 } }, X X /* Vertical scaling */ X { 0xe0, 5, { 0x00, 0x04, 0x00, 0x04, 0x00 } }, X X /* Vertical phase offsets */ X { 0xe8, 8, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}, X X /* X * VBI input window = 720 x 17, output window = 1440 x 17. X */ X { 0x94, 12, { 0x02, 0x00, 0xd0, 0x02, 0x04, 0x00, 0x11, 0x00, X 0xa0, 0x05, 0x11, 0x00 } }, X X /* Inverted VGATE start at line 25, stop after line 313 */ X { 0x15, 2, { 0x37, 0x17 } }, X X /* VBI data slicer 625 lines, line 22 is closed caption */ X { 0x54, 2, { 0xdd, 0x4d } }, X { 0x5a, 2, { 0x03, 0x03 } }, X X /* PLL2 625 lines, 27 Mhz target clock */ X { 0xf0, 1, { 0xb0 } }, X X /* Pulse generator 625 lines, 27 Mhz target clock */ X { 0xf5, 1, { 0xb0 } } X } X}; X X Xstatic const struct cxm_saa7115_audio_clock Xsaa7115_audio_clock[] = { X { 44100, 30, &saa7115_audio_clock_44100_ntsc }, X { 44100, 25, &saa7115_audio_clock_44100_pal }, X { 48000, 30, &saa7115_audio_clock_48000_ntsc }, X { 48000, 25, &saa7115_audio_clock_48000_pal } X}; X Xstatic const struct cxm_saa7115_scaling Xsaa7115_scalings[] = { X { 352, 480, 30, &saa7115_scaler_vcd_ntsc_double_lines }, X { 352, 576, 25, &saa7115_scaler_vcd_pal_double_lines }, X { 480, 480, 30, &saa7115_scaler_svcd_ntsc }, X { 480, 576, 25, &saa7115_scaler_svcd_pal }, X { 720, 480, 30, &saa7115_scaler_dvd_ntsc }, X { 720, 576, 25, &saa7115_scaler_dvd_pal } X}; X X X/* Reset the SAA7115 chip */ Xstatic int Xcxm_saa7115_reset( device_t iicbus, int i2c_addr ) X{ X unsigned char msg[2]; X int sent; X X /* put into reset mode */ X msg[0] = 0x88; X msg[1] = 0x0b; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X iicbus_stop(iicbus); X X /* put back to operational mode */ X msg[0] = 0x88; X msg[1] = 0x2b; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X iicbus_stop(iicbus); X X return 0; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X X/* Read from the SAA7115 registers */ Xstatic int Xcxm_saa7115_read( device_t iicbus, int i2c_addr, X unsigned char addr, char *buf, int len ) X{ X unsigned char msg[1]; X int received; X int sent; X X msg[0] = addr; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X if (iicbus_repeated_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) X goto fail; X X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) X goto fail; X X iicbus_stop(iicbus); X X return received; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X X/* Write to the SAA7115 registers */ Xstatic int Xcxm_saa7115_write( device_t iicbus, int i2c_addr, X unsigned char addr, const char *buf, int len ) X{ X unsigned char msg[1]; X int sent; X X msg[0] = addr; X X if (iicbus_start(iicbus, i2c_addr, CXM_I2C_TIMEOUT) != 0) X return -1; X X if (iicbus_write(iicbus, msg, sizeof(msg), &sent, CXM_I2C_TIMEOUT) != 0 X || sent != sizeof(msg)) X goto fail; X X if (iicbus_write(iicbus, buf, len, &sent, CXM_I2C_TIMEOUT) != 0) X goto fail; X X iicbus_stop(iicbus); X X return sent; X Xfail: X iicbus_stop(iicbus); X return -1; X} X X Xint Xcxm_saa7115_init( struct cxm_softc *sc ) X{ X char name[5]; X unsigned char id[1]; X unsigned char rev; X unsigned int i; X unsigned int nsettings; X const struct cxm_saa7115_setting *settings; X X if (cxm_saa7115_reset (sc->iicbus, CXM_I2C_SAA7115) < 0) X return -1; X X name[4] = '\0'; X for (i = 0; i < 4; i++) { X id[0] = 2 + i; X X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x00, X id, sizeof(id)) != sizeof(id)) X return -1; X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x00, X id, sizeof(id)) != sizeof(id)) X return -1; X X name[i] = '0' + (id[0] & 0x0f); X rev = id[0] >> 4; X } X X /* X * SAA 7115 is the only video decoder currently supported. X */ X X nsettings = 0; X settings = NULL; X X if (strcmp(name, "7115") == 0) { X nsettings = saa7115_init.nsettings; X settings = saa7115_init.settings; X } X else { X printf("%s: unknown video decoder SAA%s\n", X sc->name, name); X return -1; X } X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X if (cxm_saa7115_select_source(sc, cxm_tuner_source) < 0) X return -1; X X printf("%s: SAA%s rev %u video decoder\n", X sc->name, name, (unsigned int)rev); X X return 0; X} X X Xint Xcxm_saa7115_mute( struct cxm_softc *sc ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_saa7115_setting *settings; X X nsettings = saa7115_mute.nsettings; X settings = saa7115_mute.settings; X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_unmute( struct cxm_softc *sc ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_saa7115_setting *settings; X X nsettings = saa7115_unmute.nsettings; X settings = saa7115_unmute.settings; X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_select_source( struct cxm_softc *sc, enum cxm_source source ) X{ X unsigned int i; X unsigned int nsettings; X const struct cxm_saa7115_setting *settings; X X switch (source) { X case cxm_fm_source: X nsettings = saa7115_select_fm.nsettings; X settings = saa7115_select_fm.settings; X break; X X case cxm_line_in_source_composite: X nsettings = saa7115_select_line_in_composite.nsettings; X settings = saa7115_select_line_in_composite.settings; X break; X X case cxm_line_in_source_svideo: X nsettings = saa7115_select_line_in_svideo.nsettings; X settings = saa7115_select_line_in_svideo.settings; X break; X X case cxm_tuner_source: X nsettings = saa7115_select_tuner.nsettings; X settings = saa7115_select_tuner.settings; X break; X X default: X return -1; X } X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_configure( struct cxm_softc *sc, X unsigned int width, unsigned int height, X unsigned int fps, unsigned int audio_sample_rate ) X{ X unsigned char power[1]; X unsigned char task[1]; X unsigned int i; X unsigned int nsettings; X const struct cxm_saa7115_setting *settings; X X for (i = 0; NUM_ELEMENTS(saa7115_scalings); i++) X if (saa7115_scalings[i].width == width X && saa7115_scalings[i].height == height X && saa7115_scalings[i].fps == fps) X break; X X if (i >= NUM_ELEMENTS(saa7115_scalings)) X return -1; X X nsettings = saa7115_scalings[i].scaling->nsettings; X settings = saa7115_scalings[i].scaling->settings; X X /* X * Reset the scaler. X */ X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x88, X power, sizeof(power)) != sizeof(power)) X return -1; X X power[0] &= ~0x20; X X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x88, X power, sizeof(power)) != sizeof(power)) X return -1; X X /* X * Configure the scaler. X */ X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X /* X * Enable task register set A and B. X */ X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x80, X task, sizeof(task)) != sizeof(task)) X return -1; X X task[0] |= 0x30; X X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x80, X task, sizeof(task)) != sizeof(task)) X return -1; X X /* X * Enable the scaler. X */ X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x88, X power, sizeof(power)) != sizeof(power)) X return -1; X X power[0] |= 0x20; X X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x88, X power, sizeof(power)) != sizeof(power)) X return -1; X X /* X * Configure the audio clock. X */ X X for (i = 0; NUM_ELEMENTS(saa7115_audio_clock); i++) X if (saa7115_audio_clock[i].sample_rate == audio_sample_rate X && saa7115_audio_clock[i].fps == fps) X break; X X if (i >= NUM_ELEMENTS(saa7115_audio_clock)) X return -1; X X nsettings = saa7115_audio_clock[i].clock->nsettings; X settings = saa7115_audio_clock[i].clock->settings; X X for (i = 0; i < nsettings; i++) X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, X settings[i].addr, X settings[i].values, settings[i].nvalues) X != settings[i].nvalues) X return -1; X X return 0; X} X X Xenum cxm_source_format Xcxm_saa7115_detected_format( struct cxm_softc *sc ) X{ X unsigned char status[2]; X enum cxm_source_format source_format; X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x1e, X status, sizeof(status)) != sizeof(status)) X return cxm_unknown_source_format; X X if (! (status[1] & 0x01) ) { X printf("%s: video decoder isn't locked\n", sc->name); X return cxm_unknown_source_format; X } X X source_format = cxm_unknown_source_format; X X if (! (status[1] & 0x20) ) X switch (status[0] & 0x03) { X case 0: X source_format = cxm_bw_50hz_source_format; X break; X X case 1: X source_format = cxm_ntsc_50hz_source_format; X break; X X case 2: X source_format = cxm_pal_50hz_source_format; X break; X X case 3: X source_format = cxm_secam_50hz_source_format; X break; X X default: X break; X } X else X switch (status[0] & 0x03) { X case 0: X source_format = cxm_bw_60hz_source_format; X break; X X case 1: X source_format = cxm_ntsc_60hz_source_format; X break; X X case 2: X source_format = cxm_pal_60hz_source_format; X break; X X default: X break; X } X X return source_format; X} X X Xint Xcxm_saa7115_detected_fps( struct cxm_softc *sc ) X{ X unsigned char status[1]; X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x1f, X status, sizeof(status)) != sizeof(status)) X return -1; X X if (! (status[0] & 0x01) ) { X printf("%s: video decoder isn't locked\n", sc->name); X return -1; X } X X return (status[0] & 0x20) ? 30 : 25; X} X X Xint Xcxm_saa7115_get_brightness( struct cxm_softc *sc ) X{ X unsigned char brightness; X X /* X * Brightness is treated as an unsigned value by the decoder. X * 0 = dark, 128 = ITU level, 255 = bright X */ X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x0a, X &brightness, sizeof(brightness)) X != sizeof(brightness)) X return -1; X X return brightness; X} X X Xint Xcxm_saa7115_set_brightness( struct cxm_softc *sc, unsigned char brightness ) X{ X X /* X * Brightness is treated as an unsigned value by the decoder. X * 0 = dark, 128 = ITU level, 255 = bright X */ X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x0a, X &brightness, sizeof(brightness)) X != sizeof(brightness)) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_get_chroma_saturation( struct cxm_softc *sc ) X{ X unsigned char chroma_saturation; X X /* X * Chroma saturation is treated as a signed value by the decoder. X * -128 = -2.0 (inverse chrominance), -64 = 1.0 (inverse chrominance), X * 0 = 0 (color off), 64 = 1.0 (ITU level), 127 = 1.984 (maximum) X */ X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x0c, X &chroma_saturation, sizeof(chroma_saturation)) X != sizeof(chroma_saturation)) X return -1; X X return chroma_saturation; X} X X Xint Xcxm_saa7115_set_chroma_saturation( struct cxm_softc *sc, X unsigned char chroma_saturation ) X{ X X /* X * Chroma saturation is treated as a signed value by the decoder. X * -128 = -2.0 (inverse chrominance), -64 = 1.0 (inverse chrominance), X * 0 = 0 (color off), 64 = 1.0 (ITU level), 127 = 1.984 (maximum) X */ X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x0c, X &chroma_saturation, sizeof(chroma_saturation)) X != sizeof(chroma_saturation)) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_get_contrast( struct cxm_softc *sc ) X{ X unsigned char contrast; X X /* X * Contrast is treated as a signed value by the decoder. X * -128 = -2.0 (inverse luminance), -64 = 1.0 (inverse luminance), X * 0 = 0 (luminance off), 64 = 1.0, 68 = 1.063 (ITU level), X * 127 = 1.984 (maximum) X */ X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x0b, X &contrast, sizeof(contrast)) != sizeof(contrast)) X return -1; X X return contrast; X} X X Xint Xcxm_saa7115_set_contrast( struct cxm_softc *sc, unsigned char contrast ) X{ X X /* X * Contrast is treated as a signed value by the decoder. X * -128 = -2.0 (inverse luminance), -64 = 1.0 (inverse luminance), X * 0 = 0 (luminance off), 64 = 1.0, 68 = 1.063 (ITU level), X * 127 = 1.984 (maximum) X */ X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x0b, X &contrast, sizeof(contrast)) != sizeof(contrast)) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_get_hue( struct cxm_softc *sc ) X{ X unsigned char hue; X X /* X * Hue is treated as a signed value by the decoder. X * -128 = -180.0, 0 = 0.0, 127 = +178.6 X */ X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x0d, X &hue, sizeof(hue)) X != sizeof(hue)) X return -1; X X return hue; X} X X Xint Xcxm_saa7115_set_hue( struct cxm_softc *sc, unsigned char hue ) X{ X X /* X * Hue is treated as a signed value by the decoder. X * -128 = -180.0, 0 = 0.0, 127 = +178.6 X */ X if (cxm_saa7115_write(sc->iicbus, CXM_I2C_SAA7115, 0x0d, X &hue, sizeof(hue)) X != sizeof(hue)) X return -1; X X return 0; X} X X Xint Xcxm_saa7115_is_locked( struct cxm_softc *sc ) X{ X unsigned char status[1]; X X if (cxm_saa7115_read(sc->iicbus, CXM_I2C_SAA7115, 0x1f, X status, sizeof(status)) != sizeof(status)) X return -1; X X return (status[0] & 0x01) ? 1 : 0; X} X X Xint Xcxm_saa7115_wait_for_lock( struct cxm_softc *sc ) X{ X unsigned int i; X X /* X * Section 2.7 of the data sheet states: X * X * Ultra-fast frame lock (almost 1 field) X * X * so hopefully 500 ms is enough (the lock X * sometimes takes a long time to occur ... X * possibly due to the time it takes to X * autodetect the format). X */ X X for (i = 0; i < 10; i++) { X X /* X * The input may have just changed (prior to X * cxm_saa7115_wait_for_lock) so start with X * the delay to give the video decoder a X * chance to update its status. X */ X X tsleep(&sc->iicbus, PZERO, "video", hz / 20 ); X X switch (cxm_saa7115_is_locked(sc)) { X case 1: X return 1; X X case 0: X break; X X default: X return -1; X } X } X X printf("%s: video decoder failed to lock\n", sc->name); X X return 0; X} END-of-dev/cxm/cxm_video.c echo x - dev/cxm/cxm_extract_fw.c sed 's/^X//' >dev/cxm/cxm_extract_fw.c << 'END-of-dev/cxm/cxm_extract_fw.c' X/* X * Copyright (c) 2003 X * John Wehle . All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software developed by John Wehle. X * 4. The name of the author may not be used to endorse or promote products X * derived from this software without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE X * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, X * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES X * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR X * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, X * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN X * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE X * POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * Conexant MPEG-2 Codec firmware extraction program. X * X * Generates cxm_dec_fw.c and cxm_enc_fw.c from the X * Hauppauge PVR-250 / PVR-350 Microsoft Windows driver X * (i.e. hcwpvrp2.sys). X * X * This was written using the invaluable information X * compiled by The IvyTV Project (ivtv.sourceforge.net). X */ X X#include X#include X#include X#include X#include X#include X#include X#include X X Xconst char *MyName = "cxm_extract_fw"; X Xconst u_int8_t decoder_magic[] = { X 0xa7, 0x03, 0x00, 0x00, 0x66, 0xbb, 0x55, 0xaa }; Xconst u_int8_t encoder_magic[] = { X 0xa7, 0x0d, 0x00, 0x00, 0x66, 0xbb, 0x55, 0xaa }; X X Xstatic int Xsave_firmware (const char *name, const u_int8_t *buf, size_t nbytes) X { X FILE *ofp; X char outfile[MAXPATHLEN]; X size_t i; X X if (nbytes < (256 * 1024)) { X fprintf (stderr, "%s: save_firmware -- firmware image isn't long enough\n", X MyName); X return -1; X } X X if (snprintf (outfile, sizeof (outfile), "%s.c", name) >= sizeof (outfile)) { X fprintf (stderr, "%s: save_firmware -- firmware name is too long\n", X MyName); X return -1; X } X X if (! (ofp = fopen (outfile, "w")) ) { X fprintf (stderr, "%s: save_firmware -- can't open output file <%s>\n", X MyName, outfile); X perror (MyName); X return -1; X } X X fprintf (ofp, "#include \n" X "\n" X "const u_int8_t %s[] __attribute__ ((aligned(4))) = {", X name); X X for (i = 0; i < (256 * 1024); i++) { X if (i) X fputc (',', ofp); X if ((i % 8) == 0) X fputs ("\n\t", ofp); X else X fputc (' ', ofp); X fprintf (ofp, "0x%.2x", buf[i]); X } X X fprintf (ofp, "\n};\n"); X X if (ferror (ofp)) { X fclose (ofp); X return -1; X } X X fclose (ofp); X return 0; X } X X Xint Xmain (int argc, char **argv) X { X const char *infile; X const u_int8_t *end; X const u_int8_t *ptr; X const u_int8_t *start; X int decoder_fw_saved; X int encoder_fw_saved; X int fd; X struct stat statbuf; X X if (argc != 2) { X fprintf (stderr, "Usage: %s \n", MyName); X exit (1); X } X X infile = argv[1]; X X /* X * Open the file. X */ X X if ((fd = open (infile, O_RDONLY)) < 0) { X fprintf (stderr, "%s: can't open %s for reading\n", MyName, infile); X perror (MyName); X exit (1); X } X X /* X * Determine how big it is. X */ X X if (fstat (fd, &statbuf) < 0) { X fprintf (stderr, "%s: can't fstat %s\n", MyName, infile); X perror (MyName); X close (fd); X exit (1); X } X X /* X * Map it into memory. X */ X X if ( !(start = (u_int8_t *)mmap (NULL, (size_t)statbuf.st_size, X PROT_READ, MAP_SHARED, fd, (off_t)0)) ) { X fprintf (stderr, "%s: can't mmap %s\n", MyName, infile); X perror (MyName); X close (fd); X exit (1); X } X X end = start + statbuf.st_size; X X close (fd); X X decoder_fw_saved = 0; X encoder_fw_saved = 0; X X for (ptr = start; ptr != end; ptr++) { X if ((end - ptr) >= sizeof (decoder_magic) X && memcmp (ptr, decoder_magic, sizeof (decoder_magic)) == 0) X if (! decoder_fw_saved) { X if (save_firmware ("cxm_dec_fw", ptr, end - ptr) < 0) { X fprintf (stderr, "%s: save_firmware failed\n", MyName); X exit (1); X } X decoder_fw_saved = 1; X } X else { X fprintf (stderr, "%s: multiple decoder images present\n", MyName); X exit (1); X } X X if ((end - ptr) >= sizeof (encoder_magic) X && memcmp (ptr, encoder_magic, sizeof (encoder_magic)) == 0) X if (! encoder_fw_saved) { X if (save_firmware ("cxm_enc_fw", ptr, end - ptr) < 0) { X fprintf (stderr, "%s: save_firmware failed\n", MyName); X exit (1); X } X encoder_fw_saved = 1; X } X else { X fprintf (stderr, "%s: multiple encoder images present\n", MyName); X exit (1); X } X } X X munmap ((caddr_t)start, (size_t)statbuf.st_size); X X if (! decoder_fw_saved) X fprintf (stderr, "%s: decoder image not present\n", MyName); X X if (! encoder_fw_saved) X fprintf (stderr, "%s: encoder image not present\n", MyName); X X if (! decoder_fw_saved || ! encoder_fw_saved) X exit (1); X X exit (0); X } END-of-dev/cxm/cxm_extract_fw.c echo c - modules/cxm mkdir -p modules/cxm > /dev/null 2>&1 echo x - modules/cxm/Makefile sed 's/^X//' >modules/cxm/Makefile << 'END-of-modules/cxm/Makefile' XSUBDIR = XSUBDIR += cxm XSUBDIR += cxm_iic X X.include END-of-modules/cxm/Makefile echo c - modules/cxm/cxm mkdir -p modules/cxm/cxm > /dev/null 2>&1 echo x - modules/cxm/cxm/Makefile sed 's/^X//' >modules/cxm/cxm/Makefile << 'END-of-modules/cxm/cxm/Makefile' X.PATH: ${.CURDIR}/../../../dev/cxm XKMOD = cxm XSRCS = cxm.c cxm.h cxm_dec_fw.c cxm_enc_fw.c cxm_audio.c cxm_eeprom.c \ X cxm_ir.c cxm_tuner.c cxm_video.c opt_cxm.h \ X bus_if.h device_if.h iicbb_if.h pci_if.h vnode_if.h X X.include END-of-modules/cxm/cxm/Makefile echo c - modules/cxm/cxm_iic mkdir -p modules/cxm/cxm_iic > /dev/null 2>&1 echo x - modules/cxm/cxm_iic/Makefile sed 's/^X//' >modules/cxm/cxm_iic/Makefile << 'END-of-modules/cxm/cxm_iic/Makefile' X.PATH: ${.CURDIR}/../../../dev/cxm XKMOD = cxm_iic XSRCS = cxm_i2c.c cxm.h \ X opt_cxm.h bus_if.h device_if.h iicbb_if.h pci_if.h X X.include END-of-modules/cxm/cxm_iic/Makefile exit ------------------------------------------------------------------------- | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com | | John Wehle | Fax: 1-215-540-5495 | | ------------------------------------------------------------------------- ------------------------------------------------------------------------- | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com | | John Wehle | Fax: 1-215-540-5495 | | ------------------------------------------------------------------------- From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 22:51:20 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 69D4A16A4FA for ; Fri, 29 Apr 2005 22:51:11 +0000 (GMT) Received: from feith1.FEITH.COM (feith1.FEITH.COM [192.251.93.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D001243D6B for ; Fri, 29 Apr 2005 22:51:09 +0000 (GMT) (envelope-from john@feith.com) Received: from jwlab.FEITH.COM (jwlab.FEITH.COM [192.251.93.16]) by feith1.FEITH.COM (8.12.10+Sun/8.12.9) with ESMTP id j3TMp8f8020670 for ; Fri, 29 Apr 2005 18:51:08 -0400 (EDT) Received: from jwlab.FEITH.COM (localhost [127.0.0.1]) by jwlab.FEITH.COM (8.12.10+Sun/8.12.10) with ESMTP id j3TMp852020342 for ; Fri, 29 Apr 2005 18:51:08 -0400 (EDT) Received: (from john@localhost) by jwlab.FEITH.COM (8.12.10+Sun/8.12.10/Submit) id j3TMp8hj020341 for multimedia@freebsd.org; Fri, 29 Apr 2005 18:51:08 -0400 (EDT) Date: Fri, 29 Apr 2005 18:51:08 -0400 (EDT) From: John Wehle Message-Id: <200504292251.j3TMp8hj020341@jwlab.FEITH.COM> To: multimedia@freebsd.org Content-Type: text X-Scanned-By: MIMEDefang 2.48 on 192.251.93.1 X-Archived: cashew.FEITH.COM Subject: FreeBSD 4.9 / 5.3 Hauppauge PVR-250 / 350 setchannel (Feb 09, 2005) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 22:51:20 -0000 This version supports: 1) Changing the channel map / TV standard used by the driver at runtime. $ setchannel -m 2 # Selects US Cable channel map / NTSC 2) The desired channel can now be specified either as a channel number or as a frequency in MHz. $ setchannel 4 # Selects channel 4 $ setchannel 229.25 # Select US Cable channel 25 3) The radio can be chosen as input (and is tuned by specifying the frequency in MHz). $ setchannel -r # Selects the radio $ setchannel 89.1 # Sets the radio to 89.1 MHz BTW: I noticed at least one posting talking about the "odd" non-standard sizes support by the driver ... all the size are in fact * standard * ... it's just a question of which standard. The relationship is: 352x240 VCD 352x480 DVD (half D1) 352x288 VCD 352x576 DVD (half D1) 480x480 SVCD 720x480 DVD (full D1) 480x576 SVCD 720x576 DVD (full D1) Enjoy, John Wehle ------------------8<------------------------8<------------------------ /* * Copyright (c) 2003, 2004, 2005 * John Wehle . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by John Wehle. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * Set the channel of the tuner card. */ #include #include #include #include #include #include #include #include #include #if __FreeBSD_version < 503001 # include # include #else # include # include #endif static void usage() { printf("Usage: setchannel [-a {on|off}] [-c | -r | -s | -t] [-g geom] [-m chnl_set] [chnl | freq]\n" " -a Enable / disable AFC.\n" " -c Select composite input.\n" " -r Select radio input.\n" " -s Select svideo input.\n" " -t Select tuner.\n" " -g Select geometry.\n" " 352x240 or 352x288 = VCD\n" " 480x480 or 480x576 = SVCD\n" " 352x480 or 352x576 = DVD (half D1)\n" " 720x480 or 720x576 = DVD (full D1)\n" " -m Select channel set / system.\n" " 0 = Tuner Default\n" " %u = US Broadcast / NTSC\n" " %u = US Cable / NTSC\n" " %u = Western Europe / PAL\n" " %u = Japan Broadcast / NTSC\n" " %u = Japan Cable / NTSC\n" " %u = Australia / PAL\n" " %u = France / SECAM\n" " chnl Channel\n" " freq Frequency in MHz (must include decimal point).\n", CHNLSET_NABCST, CHNLSET_CABLEIRC, CHNLSET_WEUROPE, CHNLSET_JPNBCST, CHNLSET_JPNCABLE, CHNLSET_AUSTRALIA, CHNLSET_FRANCE); } int main( int argc, char *argv[] ) { char *ptr; char *endptr; int afc; int audio; int c; int channel_set; int i; int status; int tfd; unsigned int channel; unsigned int fraction; unsigned int freq; unsigned int x_size; unsigned int y_size; unsigned long device; struct bktr_capture_area cap; afc = -1; audio = -1; channel = 0; channel_set = -1; device = 0; freq = 0; status = 0; x_size = 0; y_size = 0; while ((c = getopt (argc, argv, "a:crstg:m:")) != -1) switch (c) { case 'a': if (strcasecmp (optarg, "on") == 0) afc = 1; else if (strcasecmp (optarg, "off") == 0) afc = 0; else { usage (); exit (1); } break; case 'c': device = METEOR_INPUT_DEV2; audio = -1; break; case 'r': device = 0; audio = AUDIO_INTERN; break; case 's': device = METEOR_INPUT_DEV_SVIDEO; audio = -1; break; case 't': device = METEOR_INPUT_DEV1; audio = -1; break; case 'g': if (sscanf (optarg, "%ux%u", &x_size, &y_size) != 2 || x_size == 0 || y_size == 0) { usage (); exit (1); } break; case 'm': channel_set = atoi (optarg); if (channel_set < 0 || channel_set > CHNLSET_MAX) { usage (); exit (1); } break; default: usage (); exit (1); } if ( optind < argc) { /* * A number containing a decimal point is the frequency in MHz. */ if ((ptr = strchr( argv[optind], '.' )) != NULL) { freq = strtol( argv[optind], &endptr, 10) * 1000; if (ptr != endptr) { usage (); exit (1); } ptr++; fraction = strtol( ptr, &endptr, 10); if (! isdigit( *ptr ) || *endptr != '\0') { usage (); exit (1); } for (i = endptr - ptr; i > 3; i--) fraction /= 10; for ( ; i < 3; i++) fraction *= 10; freq += fraction; } /* * An integer is the channel. */ else channel = atoi( argv[optind] ); } if (afc == -1 && audio == -1 && ! device && x_size == 0 && y_size == 0 && channel_set == -1 && ! channel && ! freq) { usage (); exit (1); } tfd = open( "/dev/cxm0", O_RDONLY ); if ( tfd < 0 ) { perror( "open() of /dev/tuner0 failed." ); exit(1); } if (afc != -1) if ( ioctl( tfd, TVTUNER_SETAFC, &afc ) < 0 ) { perror( "ioctl( tfd, TVTUNER_SETAFC ) failed." ); status = 1; } if (device) if ( ioctl( tfd, METEORSINPUT, &device ) < 0 ) { perror( "ioctl( tfd, METEORSINPUT ) failed." ); status = 1; } if (audio != -1) if ( ioctl( tfd, BT848_SAUDIO, &audio ) < 0 ) { perror( "ioctl( tfd, BT848_SAUDIO ) failed." ); status = 1; } if ( ioctl( tfd, BT848_GAUDIO, &audio ) < 0 ) { perror( "ioctl( tfd, BT848_GAUDIO ) failed." ); status = 1; } if (x_size && y_size ) { memset (&cap, 0, sizeof (cap)); cap.x_size = x_size; cap.y_size = y_size; if ( ioctl( tfd, BT848_SCAPAREA, &cap ) < 0 ) { perror( "ioctl( tfd, BT848_SCAPAREA ) failed." ); status = 1; } } if (channel_set != -1) if ( ioctl( tfd, TVTUNER_SETTYPE, &channel_set ) < 0 ) { perror( "ioctl( tfd, TVTUNER_SETTYPE ) failed." ); status = 1; } if (channel) { if ( ioctl( tfd, TVTUNER_SETCHNL, &channel ) < 0 ) { perror( "ioctl( tfd, TVTUNER_SETCHNL ) failed." ); status = 1; } } else if (freq) { if (audio == AUDIO_INTERN) { /* Convert from kHz to MHz * 100 */ freq = freq / 10; if ( ioctl( tfd, RADIO_SETFREQ, &freq ) < 0 ) { perror( "ioctl( tfd, RADIO_SETFREQ ) failed." ); status = 1; } } else { /* Convert from kHz to MHz * 16 */ freq = (freq * 16) / 1000; if ( ioctl( tfd, TVTUNER_SETFREQ, &freq ) < 0 ) { perror( "ioctl( tfd, TVTUNER_SETFREQ ) failed." ); status = 1; } } } close ( tfd ); exit ( status ); } ------------------------------------------------------------------------- | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com | | John Wehle | Fax: 1-215-540-5495 | | ------------------------------------------------------------------------- From owner-freebsd-multimedia@FreeBSD.ORG Fri Apr 29 22:53:50 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A61D16A4CE; Fri, 29 Apr 2005 22:53:50 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDEFE43D41; Fri, 29 Apr 2005 22:53:49 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior-wifi.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.3/8.13.3) with ESMTP id j3TMvlhs033464; Fri, 29 Apr 2005 16:57:48 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4272BAF0.4020203@samsco.org> Date: Fri, 29 Apr 2005 16:53:36 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050218 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Cross References: <1114755724.983.1.camel@kagome> In-Reply-To: <1114755724.983.1.camel@kagome> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org cc: freebsd-multimedia@freebsd.org cc: re@freebsd.org Subject: Re: AD1888 patch... X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 22:53:50 -0000 David Cross wrote: > Just wanted to make sure it makes it to 5.4 :) > > Its small, but a bit frustrating to remember to repatch every time I > "make update". > I'll make sure that this gets addresses for the next RC. Scott From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 03:00:47 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D15316A4CE for ; Sat, 30 Apr 2005 03:00:47 +0000 (GMT) Received: from blackwater.lemis.com (wantadilla.lemis.com [192.109.197.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CD1A43D2F for ; Sat, 30 Apr 2005 03:00:45 +0000 (GMT) (envelope-from grog@lemis.com) Received: by blackwater.lemis.com (Postfix, from userid 1004) id 476AC85698; Sat, 30 Apr 2005 12:30:43 +0930 (CST) Date: Sat, 30 Apr 2005 12:30:43 +0930 From: Greg 'groggy' Lehey To: John Wehle Message-ID: <20050430030043.GD21950@wantadilla.lemis.com> References: <200504292251.j3TMp3Hi020336@jwlab.FEITH.COM> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GpGaEY17fSl8rd50" Content-Disposition: inline In-Reply-To: <200504292251.j3TMp3Hi020336@jwlab.FEITH.COM> User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 cc: multimedia@freebsd.org Subject: Re: FreeBSD 4.9 / 5.2 Hauppauge PVR-250 / 350 Driver Patch (Apr 12, 2005) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 03:00:47 -0000 --GpGaEY17fSl8rd50 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Friday, 29 April 2005 at 18:51:03 -0400, John Wehle wrote: > [ This is the Apr 12, 2005 snapshot of my source tree. ...] Included > > To use the Hauppauge PVR-250 / 350 on FreeBSD 4.9 / 5.2 / 5.3: > > 3) Place a current version of hcwpvrp2.sys from the > Hauppauge drivers into /sys/dev/cxm. Extract the > the firmware by: > > # cd /sys/dev/cxm > # cc -o cxm_extract_fw cxm_extract_fw.c > # ./cxm_extract_fw hcwpvrp2.sys I bought what was supposed to be a PVR-250 by mail order. What arrived was a PVR-150MCE. Looking at what's on the CD, the closest I can find is: -r-xr-xr-x 1 root wheel 26972 Nov 18 12:23 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88bar.sys -r-xr-xr-x 1 root wheel 142400 Nov 18 12:36 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88bda.sys -r-xr-xr-x 1 root wheel 307267 Nov 18 12:21 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88enc.sys -r-xr-xr-x 1 root wheel 8387 Nov 18 12:22 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88r9x.sys -r-xr-xr-x 1 root wheel 11719 Nov 22 12:20 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88rc5.sys -r-xr-xr-x 1 root wheel 14016 Nov 18 12:22 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88ts.sys -r-xr-xr-x 1 root wheel 128577 Nov 18 12:33 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88tun.sys -r-xr-xr-x 1 root wheel 579004 Nov 18 12:23 /cdrom/WinTV-NOVA-TMCE_2_10= 2_22323_WHQL_signed/hcw88vid.sys -r-xr-xr-x 1 root wheel 131840 Nov 11 12:43 /cdrom/WinTV-PVR-150500MCE_= 2.0.18.22316_WHQL_signed/hcwPP2.sys -r-xr-xr-x 1 root wheel 814464 Sep 22 2004 /cdrom/WinTV-PVR-250_retail= 1_1_18_22266/hcwPVRP2.sys -r-xr-xr-x 1 root wheel 1433280 Oct 21 2004 /cdrom/WinTVPVRUSB2_22_73_2= 2295_WHQL_signed/HCWUSB2.sys cxm_extract_fw runs fine against WinTV-PVR-250_retail1_1_18_22266/hcwPVRP2.sys, but with WinTV-PVR-150500MCE_2.0.18.22316_WHQL_signed/hcwPP2.sys it says: =3D=3D=3D root@teevee (/dev/ttyp0) /usr/src/sys/dev/cxm 22 -> ./cxm_extract= _fw hcwPP2.sys=20 cxm_extract_fw: decoder image not present cxm_extract_fw: encoder image not present I don't know anything about the content of these files, but if you do, and if I can help, let me know. I'm assuming that the cards are different enough that I can't use the -250 firmware on the -150. Greg -- See complete headers for address and phone numbers. --GpGaEY17fSl8rd50 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFCcvTbIubykFB6QiMRAlTxAJ9BS1hgY2LoSGj//VJyVBIGgbmzFQCbBjor jC6F84XO7JoF25CvUmddTuI= =UvK2 -----END PGP SIGNATURE----- --GpGaEY17fSl8rd50-- From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 05:12:59 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 394BC16A4CE for ; Sat, 30 Apr 2005 05:12:59 +0000 (GMT) Received: from blackwater.lemis.com (wantadilla.lemis.com [192.109.197.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B93243D39 for ; Sat, 30 Apr 2005 05:12:57 +0000 (GMT) (envelope-from grog@lemis.com) Received: by blackwater.lemis.com (Postfix, from userid 1004) id 621AC85609; Sat, 30 Apr 2005 14:42:55 +0930 (CST) Date: Sat, 30 Apr 2005 14:42:55 +0930 From: Greg 'groggy' Lehey To: multimedia@FreeBSD.org Message-ID: <20050430051255.GE21950@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VUDLurXRWRKrGuMn" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Subject: TV tuner woes X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 05:12:59 -0000 --VUDLurXRWRKrGuMn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I've been having troubles with three different TV tuner cards, none of which I can get to work. Here's an overview: 1. A Hauppauge PVR-150 card. This seems to be a cheaper version of the PVR-250, which is supported outside the tree. I sent a message to this mailing list about this card a few hours ago, so I won't repeat. If you haven't already read it (Subject: Re: FreeBSD 4.9 / 5.3 Hauppauge PVR-250 / 350 ...), take a look. 2. An el cheapo BT 878 card. The card itself is recognized and supported by the bktr driver: bktr0: mem 0xdddfe000-0xdddfefff irq 17 at device 6.0 on pci0 bktr0: [GIANT-LOCKED] bktr0: Card has no configuration EEPROM. Cannot determine card make. bktr0: Tuner address 194 bktr0: Pinnacle/Miro TV, Temic PAL I tuner. pciconf says: bktr0@pci0:6:0: class=0x040000 card=0x00000000 chip=0x036e109e rev=0x11 hdr=0x00 vendor = 'Brooktree Corporation' device = 'Bt878 MediaStream Controller' class = multimedia subclass = video none0@pci0:6:1: class=0x048000 card=0x00000000 chip=0x0878109e rev=0x11 hdr=0x00 vendor = 'Brooktree Corporation' device = 'Bt878/Fusion878A Video Capture (Audio Section)' class = multimedia This card sort of works with the exception of the tuner. See http://www.lemis.com/grog/videorecorder/log.html#12 for the gory details; basically, it appears that the tuner address is non-standard. http://www.lemoncube.com/354.html describes how somebody got it to run under Linux: However, after some trial and error I put this in my modules.conf options bttv card=0x25 tuner=38 options tuner force=0,0x61 ignore=0,0x60 debug=1 Did a modprobe bttv and tried recording something and now it works perfectly. My problem is that I don't understand how this relates to the FreeBSD driver. Can anybody clarify? 3. An MSI "Tv@nywhere Master" board, the latter with a chip that could be a Connexant CX 23881. I can't find any driver at all for this, and it's currently on loan to somebody. If anybody has some pointers, I can get it back and try things. Greg -- See complete headers for address and phone numbers. --VUDLurXRWRKrGuMn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFCcxPXIubykFB6QiMRAiecAJ45Fdd4Dnd2c15SdNtz0DuXYOiwGwCgpeiy l25YifWsi//ZRailmYpNPyI= =qKtg -----END PGP SIGNATURE----- --VUDLurXRWRKrGuMn-- From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 08:03:54 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E2D216A4CE for ; Sat, 30 Apr 2005 08:03:54 +0000 (GMT) Received: from mail231.csoft.net (resin.csoft.net [63.111.22.86]) by mx1.FreeBSD.org (Postfix) with SMTP id 2482D43D1D for ; Sat, 30 Apr 2005 08:03:53 +0000 (GMT) (envelope-from jakemsr@jakemsr.com) Received: (qmail 12007 invoked from network); 30 Apr 2005 08:09:53 -0000 Received: from unknown (HELO puff.jakemsr.gom) (63.111.27.87) by mail231.csoft.net with SMTP; 30 Apr 2005 08:09:53 -0000 Received: (from jakemsr@jakemsr.com) by puff.jakemsr.gom (mini_sendmail/1.3.5 16nov2003); Sat, 30 Apr 2005 01:03:51 PDT (sender jakemsr@puff.jakemsr.gom) Date: Sat, 30 Apr 2005 01:03:51 -0700 From: Jacob Meuser To: Greg 'groggy' Lehey Message-ID: <20050430080351.GA10144@puff.jakemsr.gom> References: <20050430051255.GE21950@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050430051255.GE21950@wantadilla.lemis.com> User-Agent: Mutt/1.4.2i cc: multimedia@freebsd.org Subject: Re: TV tuner woes X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 08:03:54 -0000 On Sat, Apr 30, 2005 at 02:42:55PM +0930, Greg 'groggy' Lehey wrote: > I've been having troubles with three different TV tuner cards, none of > which I can get to work. Here's an overview: > > 1. A Hauppauge PVR-150 card. This seems to be a cheaper version of > the PVR-250, which is supported outside the tree. I sent a > message to this mailing list about this card a few hours ago, so I > won't repeat. If you haven't already read it (Subject: Re: > FreeBSD 4.9 / 5.3 Hauppauge PVR-250 / 350 ...), take a look. > > 2. An el cheapo BT 878 card. The card itself is recognized and > supported by the bktr driver: > > bktr0: mem 0xdddfe000-0xdddfefff irq 17 at device 6.0 on pci0 > bktr0: [GIANT-LOCKED] > bktr0: Card has no configuration EEPROM. Cannot determine card make. > bktr0: Tuner address 194 > bktr0: Pinnacle/Miro TV, Temic PAL I tuner. > > pciconf says: > > bktr0@pci0:6:0: class=0x040000 card=0x00000000 chip=0x036e109e rev=0x11 hdr=0x00 > vendor = 'Brooktree Corporation' > device = 'Bt878 MediaStream Controller' > class = multimedia > subclass = video > none0@pci0:6:1: class=0x048000 card=0x00000000 chip=0x0878109e rev=0x11 hdr=0x00 > vendor = 'Brooktree Corporation' > device = 'Bt878/Fusion878A Video Capture (Audio Section)' > class = multimedia > > This card sort of works with the exception of the tuner. See > http://www.lemis.com/grog/videorecorder/log.html#12 for the gory > details; basically, it appears that the tuner address is > non-standard. http://www.lemoncube.com/354.html describes how > somebody got it to run under Linux: > > However, after some trial and error I put this in my > modules.conf > > options bttv card=0x25 tuner=38 card 0x25 == BTTV_PXELVWPLTVPRO tuner 38 == TUNER_PLILIPS_FM1216ME_MK3 > options tuner force=0,0x61 ignore=0,0x60 debug=1 no idea what that means. it looks like maybe you want to make bktr use tuner type PHILIPS_FR1216_PAL or PHILIPS_FR1236_SECAM bktr_card.c has a list of tuners and what bktr tuner type probably works best. -- > Did a modprobe bttv and tried recording something and now it > works perfectly. > > My problem is that I don't understand how this relates to the > FreeBSD driver. Can anybody clarify? > > 3. An MSI "Tv@nywhere Master" board, the latter with a chip that > could be a Connexant CX 23881. I can't find any driver at all for > this, and it's currently on loan to somebody. If anybody has some > pointers, I can get it back and try things. > > Greg > -- > See complete headers for address and phone numbers. From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 11:59:54 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8429616A4CE for ; Sat, 30 Apr 2005 11:59:54 +0000 (GMT) Received: from vette.gigo.com (vette.gigo.com [216.218.228.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5ADE243D54 for ; Sat, 30 Apr 2005 11:59:54 +0000 (GMT) (envelope-from lioux@FreeBSD.org) Received: from 201.24.51.9 (unknown [201.24.51.9]) by vette.gigo.com (Postfix) with ESMTP id 17D0155DD for ; Sat, 30 Apr 2005 04:59:53 -0700 (PDT) Received: (qmail 29322 invoked by uid 1001); 30 Apr 2005 11:52:43 -0000 Message-ID: <20050430115243.29294.qmail@exxodus.fedaykin.here> Date: Sat, 30 Apr 2005 08:52:21 -0300 From: Mario Sergio Fujikawa Ferreira To: Steve O'Hara-Smith References: <20050429003339.86226.qmail@exxodus.fedaykin.here> <20050429103223.72e3a65b.steve@sohara.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050429103223.72e3a65b.steve@sohara.org> User-Agent: Mutt/1.5.9i cc: freebsd-multimedia@freebsd.org cc: riggs@rrr.de Subject: Re: Mplayer adevice option does work X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 11:59:54 -0000 On Fri, Apr 29, 2005 at 10:32:01AM +0100, Steve O'Hara-Smith wrote: > On Thu, 28 Apr 2005 21:33:17 -0300 > Mario Sergio Fujikawa Ferreira wrote: > > > However, despite good reports from mplayer mailing lists (no FreeBSD > > reports), I am unable to use this option under FreeBSD. The option > > should allow me to get audio from a source other than the video source. > > AFAICS from a quick read of the source the audio device is > hardcoded to /dev/dsp (or /dev/sound for NetBSD) - presumably it fails > to open in mplayer because /dev/dsp is already opened for the audio > output. Try with -ao oss:dsp-device=/dev/dsp0.1 to force the output > to a different device. Actually, I was thinking more on the line of input audio source. :) Ouput audio source goes just fine. Though, I'll keep that line in mind. One thing, I recall you said that you watched TV in your bktr card heard the audio under FreeBSD. What mixers settings are you using? And, soundblaster audigy emuctrl too if you have it. > > > Option tv: Unknown suboption adevice > > ------- > > > > Inquiries at irc.freenode.net#mplayer imply that this option > > works fine under Linux. Any ideas why I am unable to use it? Is it > > incidental to my system; i.e., does it work for everyone using FreeBSD > > but me? Or, is it just that this option does not work under FreeBSD? > > > > We should work at getting it fixed. Any ideas? > > Charles Heinrich wrote the bsd capture for mplayer - he didn't > add support for it. It looks easy enough to fix though. I began a very naive addition of the audio support to mplayer. Basically, I made it aware of the option. Now, begins the hard work of telling mplayer to do something with it. http://people.FreeBSD.org/~lioux/mplayer.tgz Regards, -- Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 18:12:52 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2BC9616A4CE for ; Sat, 30 Apr 2005 18:12:52 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id C26D743D31 for ; Sat, 30 Apr 2005 18:12:51 +0000 (GMT) (envelope-from gustavodn@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so1171764wri for ; Sat, 30 Apr 2005 11:12:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cJbAtkxvTZSyqrb/BM/L5z7SRmyNzT7tIUT5gxmFx/Ji3DP18Ibepq0PTZfsgob2oQKikTvFiFa4HcAJpwLMYKWp7XouBUXJKpNVXCmvOYV3sPDesVzHWzeCaAhxZ4MXpGixFO1yzLnM2nn62blB+x8htN0+hvx1TDx35Z0bass= Received: by 10.54.79.5 with SMTP id c5mr2026375wrb; Sat, 30 Apr 2005 10:58:11 -0700 (PDT) Received: by 10.54.34.56 with HTTP; Sat, 30 Apr 2005 10:58:10 -0700 (PDT) Message-ID: <50af0a2605043010581aa777b6@mail.gmail.com> Date: Sat, 30 Apr 2005 14:58:10 -0300 From: Gustavo De Nardin To: multimedia@freebsd.org In-Reply-To: <20050430051255.GE21950@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050430051255.GE21950@wantadilla.lemis.com> Subject: Re: TV tuner woes X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Gustavo De Nardin List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 18:12:52 -0000 2005/4/30, Greg 'groggy' Lehey : > 2. An el cheapo BT 878 card. The card itself is recognized and > supported by the bktr driver: .. > options bttv card=3D0x25 tuner=3D38 > options tuner force=3D0,0x61 ignore=3D0,0x60 debug=3D1 >=20 > Did a modprobe bttv and tried recording something and now it > works perfectly. >=20 > My problem is that I don't understand how this relates to the > FreeBSD driver. Can anybody clarify? I started trying to make it work right on FreeBSD, but never finished... Here is what I believe was my last try. IIRC it worked, but channel numbers were "off by one". To get the right i2c adress I simply changed the probing order. I haven't really used the card for some time, so I didn't really tried it on FreeBSD 5. Hope it helps. From owner-freebsd-multimedia@FreeBSD.ORG Sat Apr 30 23:51:12 2005 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2896A16A4CE; Sat, 30 Apr 2005 23:51:12 +0000 (GMT) Received: from april.chuckr.org (april.chuckr.org [66.92.151.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id B257B43D2F; Sat, 30 Apr 2005 23:51:11 +0000 (GMT) (envelope-from chuckr@chuckr.org) Received: from [66.92.151.195] (july.chuckr.org [66.92.151.195]) by april.chuckr.org (Postfix) with ESMTP id BDAB6117BA; Sat, 30 Apr 2005 19:45:58 -0400 (EDT) Message-ID: <427419ED.3050804@chuckr.org> Date: Sat, 30 Apr 2005 23:51:09 +0000 From: Chuck Robey User-Agent: Mozilla Thunderbird 1.0 (X11/20050316) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg 'groggy' Lehey References: <200504292251.j3TMp3Hi020336@jwlab.FEITH.COM> <20050430030043.GD21950@wantadilla.lemis.com> In-Reply-To: <20050430030043.GD21950@wantadilla.lemis.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: John Wehle cc: multimedia@freebsd.org Subject: Re: FreeBSD 4.9 / 5.2 Hauppauge PVR-250 / 350 Driver Patch (Apr 12, 2005) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 23:51:12 -0000 Greg 'groggy' Lehey wrote: > On Friday, 29 April 2005 at 18:51:03 -0400, John Wehle wrote: > >>[ This is the Apr 12, 2005 snapshot of my source tree. ...] Included >> >>To use the Hauppauge PVR-250 / 350 on FreeBSD 4.9 / 5.2 / 5.3: >> >> 3) Place a current version of hcwpvrp2.sys from the >> Hauppauge drivers into /sys/dev/cxm. Extract the >> the firmware by: >> >> # cd /sys/dev/cxm >> # cc -o cxm_extract_fw cxm_extract_fw.c >> # ./cxm_extract_fw hcwpvrp2.sys > > > I bought what was supposed to be a PVR-250 by mail order. What > arrived was a PVR-150MCE. Looking at what's on the CD, the closest I Greg, I have two ways to go with video. The local computer store sells, from Hauppagauge, both the card you're using and something called the WinTV-PVR, which is a usb2 device that communicates 720x480 mpeg frames back to the computer. Do you know, does the application exist for free software, that would let this PVR card communicate with FreeBSD? I'm looking also, I find it very interesting. > can find is: > > -r-xr-xr-x 1 root wheel 26972 Nov 18 12:23 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88bar.sys > -r-xr-xr-x 1 root wheel 142400 Nov 18 12:36 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88bda.sys > -r-xr-xr-x 1 root wheel 307267 Nov 18 12:21 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88enc.sys > -r-xr-xr-x 1 root wheel 8387 Nov 18 12:22 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88r9x.sys > -r-xr-xr-x 1 root wheel 11719 Nov 22 12:20 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88rc5.sys > -r-xr-xr-x 1 root wheel 14016 Nov 18 12:22 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88ts.sys > -r-xr-xr-x 1 root wheel 128577 Nov 18 12:33 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88tun.sys > -r-xr-xr-x 1 root wheel 579004 Nov 18 12:23 /cdrom/WinTV-NOVA-TMCE_2_102_22323_WHQL_signed/hcw88vid.sys > -r-xr-xr-x 1 root wheel 131840 Nov 11 12:43 /cdrom/WinTV-PVR-150500MCE_2.0.18.22316_WHQL_signed/hcwPP2.sys > -r-xr-xr-x 1 root wheel 814464 Sep 22 2004 /cdrom/WinTV-PVR-250_retail1_1_18_22266/hcwPVRP2.sys > -r-xr-xr-x 1 root wheel 1433280 Oct 21 2004 /cdrom/WinTVPVRUSB2_22_73_22295_WHQL_signed/HCWUSB2.sys > > cxm_extract_fw runs fine against > WinTV-PVR-250_retail1_1_18_22266/hcwPVRP2.sys, but with > WinTV-PVR-150500MCE_2.0.18.22316_WHQL_signed/hcwPP2.sys it says: > > === root@teevee (/dev/ttyp0) /usr/src/sys/dev/cxm 22 -> ./cxm_extract_fw hcwPP2.sys > cxm_extract_fw: decoder image not present > cxm_extract_fw: encoder image not present > > I don't know anything about the content of these files, but if you do, > and if I can help, let me know. I'm assuming that the cards are > different enough that I can't use the -250 firmware on the -150. > > Greg > -- > See complete headers for address and phone numbers.