From owner-freebsd-hackers Wed Apr 3 7:40:50 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from etek.chalmers.se (quarl0.etek.chalmers.se [129.16.32.20]) by hub.freebsd.org (Postfix) with ESMTP id 8AB4937B420; Wed, 3 Apr 2002 07:40:31 -0800 (PST) Received: from downy.etek.chalmers.se (_7-268@downy.etek.chalmers.se [129.16.32.207]) by etek.chalmers.se (8.10.0/8.8.8) with ESMTP id g33FeT223627; Wed, 3 Apr 2002 17:40:29 +0200 (MET DST) Received: from localhost (b@localhost) by downy.etek.chalmers.se (8.10.0/8.10.0) with ESMTP id g33FeTb15768; Wed, 3 Apr 2002 17:40:29 +0200 (MET DST) Date: Wed, 3 Apr 2002 17:40:29 +0200 (MET DST) From: Magnus B{ckstr|m To: "Kreider, Carl" Cc: freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: read a file from a driver In-Reply-To: <20020403101614.A12363@indy.doctordesign.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 3 Apr 2002, Kreider, Carl wrote: > I am working on an embedded project running FreeBSD, and my driver > for our custom card needs to load an FPGA with code. I know I can > compile the code in as data, but for ease of development, I would > rather fetch the FPGA code from a file. With a driver in kernel > space. Really. > > Can it be done? If so, how? open() and read() are obviously in libc > which rules them out. Do I have to write my own in assembler? The way this is usually done is by having the driver implement some interface (e. g. an ioctl) through which a user-mode utility can download the data to the hardware. Have the utility run at boot along with all other boot-time stuff, i. e. /etc/rc*. (Anecdote: I knew an Ultrix system years ago with a PXG (IIRC) accelerated graphics adapter that needed a firmware download at boot time. At one time the firmware file, or the dowload gizmo, somehow suffered bit rot -- which resulted in some really bizarre glitches in the graphics rendering...) Magnus To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message