From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 374 invoked by alias); 22 Oct 2009 10:05:01 -0000 Received: (qmail 355 invoked by uid 22791); 22 Oct 2009 10:05:00 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Oct 2009 10:04:56 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id EDD332F78011; Thu, 22 Oct 2009 11:04:53 +0100 (BST) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ER6LzsJrn02; Thu, 22 Oct 2009 11:04:52 +0100 (BST) Message-ID: <4AE02E54.7000508@ecoscentric.com> Date: Thu, 22 Oct 2009 10:05:00 -0000 From: Ross Younger User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Jonathan Larmour CC: Rutger Hofman , eCos developers Subject: Re: NAND technical review References: <4ACB4B58.2040804@ecoscentric.com> <4ACC61F0.3020303@televic.com> <4AD3E92E.5020301@jifvik.org> <4AD47ADE.9010606@cs.vu.nl> <4AD6A7EC.8080703@jifvik.org> <4ADC452B.5040706@ecoscentric.com> <4ADD14E1.3050702@jifvik.org> <4ADD8E47.1080305@ecoscentric.com> <4ADE6C92.9060300@jifvik.org> In-Reply-To: <4ADE6C92.9060300@jifvik.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2009-10/txt/msg00045.txt.bz2 Jonathan Larmour wrote: > Can you at least shed light on the API changes (by cut'n'pasting > relevant sections of headers/code even if not the whole thing)? I have changed the device interface (nand_device.h) by carving up the read and write page functions into three. (The prototype changes are the same for both, with only the obvious semantic differences when writing, so I'll only paste in read for the sake of brevity.) Reading a page used to be an all-in-one call: int (*read_page) (cyg_nand_device *dev, cyg_nand_page_addr page, void * dest, size_t size, void * spare, size_t spare_size); Now, the NAND layer calls "begin" once to set up the read: int (*read_begin)(cyg_nand_device *dev, cyg_nand_page_addr page); ... "stride" one or more times to actually transfer data int (*read_stride)(cyg_nand_device *dev, void * dest, size_t size); ... and then "finish" once to do the spare area and any finishing up that may be necessary (e.g. send the "program confirm" command, unlock the device). int (*read_finish)(cyg_nand_device *dev, void * spare, size_t spare_size); The ECC interface (nand_ecc.h, not well documented) has also expanded slightly. I had had just a 'calc' call, but have now added an 'init' call so that any device-specific registers can be tweaked. The interaction is perhaps best sketched out as pseudocode; here's what the NAND library looks like in a call to read a page: dev->read_begin(page number); while (there are still bytes to send) { ecc->init(); // may be a no-op dev->read_stride(ecc->datasize bytes); if (ecc is hardware) ecc->calc(the block we've just read); } dev->read_finish(spare data); if (ecc is software) ecc->calc(the whole thing); ecc->repair(the whole block, looping as necessary, comparing the calculated ECC against what's in the spare area); I have renamed the device interface struct and macros on the grounds of "change the interface, change the name" (but not the ECC interface, because nothing outside that package had used it before now). >> [-funroll-loops] > OOI you could add it to the per-package CFLAGS (unless you meant you > already did and the bloat was noticeable even just there). Good point, I forgot about that. Will try when I get back around to the go-faster stripes. Ross -- Embedded Software Engineer, eCosCentric Limited. Barnwell House, Barnwell Drive, Cambridge CB5 8UU, UK. Registered in England no. 4422071. www.ecoscentric.com