From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13414 invoked by alias); 25 Dec 2012 21:32:09 -0000 Received: (qmail 13395 invoked by uid 22791); 25 Dec 2012 21:32:08 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW 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; Tue, 25 Dec 2012 21:32:03 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id A99FC4680019 for ; Tue, 25 Dec 2012 21:32:01 +0000 (GMT) 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 FS4uhKQIf8md; Tue, 25 Dec 2012 21:31:58 +0000 (GMT) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-patches@ecos.sourceware.org Subject: [Bug 1001397] I2C driver for Kinetic microcontrollers X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: Patches and contributions X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: ilijak@siva.com.mk X-Bugzilla-Status: NEEDINFO X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 25 Dec 2012 21:32:00 -0000 Message-Id: <20121225213158.6A8324680002@mail.ecoscentric.com> Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2012-12/txt/msg00030.txt.bz2 Please do not reply to this email. Use the web interface provided at: http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397 --- Comment #29 from Ilija Kocho 2012-12-25 21:31:55 GMT --- (In reply to comment #27) Hi again Tomas > > Thank you for your reply. > > (In reply to comment #23) > > (In reply to comment #22) > > > I am trying to clean up my backlog. Your I2C driver appears to be almost ready > > > for check in. I wander if you have tried the patch proposed in comment 21. > > > > The patch makes sense to me, though I have not had a chance to test it. > > As you may have seen I took the liberty to apply the patch from comment 21. It > compiles fine, but I haven't tested the runtime. > > One thing that bothers me is the WAIT_BUS_READY(), it looks like busy waiting, > but I can't estimate implications since I don't have enough insight into > I2C. Can you comment on this please? I looked through other I2C drivers and I found out that some of them have similar macro. So we have a precedent, but I would look for better solution. For instance what would happen if we replace the macro with something like this (untested): bool is_bus_free(freescale_i2c_extra *extra ) { bool bus_free; if (!extra->i2c_owner) { freescale_i2c_t *i2c_s = FREESCALE_I2C_P(extra->i2c_base); if(i2c_s->s & FREESCALE_I2C_S_BUSY_M){ bus_free = false; } else { extra->i2c_got_nack = 0; extra->i2c_owner = 1; bus_free = true; } } else { bus_free = true; } return bus_free; } Then something like this: static cyg_bool freescale_i2c_handle_xfer(const cyg_i2c_device * dev, int address) { freescale_i2c_device *fdev = (freescale_i2c_device*) dev; freescale_i2c_extra *extra = (freescale_i2c_extra *) dev->i2c_bus->i2c_extra; cyg_uint8 data = *extra->i2c_data.i2c_tx_data; freescale_i2c_t *i2c_s = FREESCALE_I2C_P (extra->i2c_base); // Nothing to do if (extra->i2c_count == 0) return 0; - // Take the bus ownership - WAIT_BUS_READY (extra); + // Check the bus ownership + if(!is_bus_free(extra)) + return 0; ..... } Ilija -- Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.