This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Motorola Coldfire I2C driver patch
- From: Uwe Kindler <uwe dot kindler at cetoni dot de>
- To: ecos-patches at sourceware dot org, andrew at lunn dot ch, bartv at ecoscentric dot com
- Date: Wed, 05 Jul 2006 08:21:59 +0200
- Subject: Motorola Coldfire I2C driver patch
- Organization: cetoni GmbH
Hello Andrew, hello Bart,
attached is a patch for Bart's Coldfire I2C device driver that is still
(after 8 months) not part of the eCos CVS. I submitted the I2C device
driver in October 2005.
Now already other developers start to ask me about the I2C driver
because they found my I2C driver from October 2005 in the eCos patches
archives. I sent Bart's I2C driver to Rainer Arndt because he asked me
about the driver. He uses the driver with a number of I2C devices (not
only one single device like me) and sent me the following patch for
Bart's version of the I2C driver.
This is what he said about the patch:
"If a single byte is read from a missing device, the function
cyg_i2c_transaction_rx returned 1 and 0xFF as data because after sending
the addres byte the missing ACK was not detected. So the missing evice
was not detected"
It would be easier to provide patches if the driver would be part of the
CVS. I understand that Bart don't want to bring a buggy I2C device
driver into the CVS. But if it need's such a long time then maybe it
would be better to have the driver in the CVS and give other people a
chance to fix these bugs. We already use the driver in a final product
(only 1 I2C device) and Rainer Arndt uses the driver with a number of
I2C devices.
I know that a Coldfire port and device drivers are part of the
commercial eCos Pro version from eCosCentric. Is this the reason that
you don't include the driver into the official eCos repository?
Kind Regards, Uwe
Uwe Kindler
Software Engineering
--
cetoni GmbH
Am Wiesenring 6
D-07554 Korbussen
Tel.: +49 (0) 36602 338 28
Fax: +49 (0) 36602 338 11
uwe.kindler@cetoni.de
http://www.cetoni.de
Index: i2c_mcf52xx.c
===================================================================
RCS file: /server/cvsroot/projects/ecos-2.0.37/packages/devs/i2c/m68k/mcf52xx/v2_0_37/src/i2c_mcf52xx.c,v
retrieving revision 1.2
diff -b -U3 -r1.2 i2c_mcf52xx.c
--- i2c_mcf52xx.c 19 Jun 2006 08:57:00 -0000 1.2
+++ i2c_mcf52xx.c 4 Jul 2006 15:35:47 -0000
@@ -163,7 +163,17 @@
// Start followed by RX. The address byte has been sent, we
// need to switch to receiving.
if (sr & HAL_MCF52xx_I2C_SR_IAL) {
- // Looks like no device acknowledged the address.
+ // Looks like no device acknowledged the address. ????
+ result = CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
+ } else if (sr & HAL_MCF52xx_I2C_SR_RXAK) {
+ // No device acknowledged the address.
+ // We stop receiving now. If the calling code
+ // has one or more bytes requested, this error
+ // could be detected because the wrong byte count
+ // is returned by the rx func.
+ // If the calling code has zero bytes requested,
+ // this error could not be detected because the
+ // rx func will return zero anyway!
result = CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
} else {
extra->i2c_mode = CYG_MCF52xx_I2C_XFER_MODE_RX;