From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19543 invoked by alias); 23 Jun 2005 00:28:26 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 19536 invoked by uid 22791); 23 Jun 2005 00:28:22 -0000 Received: from ozhmx1.ozhosting.com (HELO ozhmx1.ozhosting.com) (203.30.164.229) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 23 Jun 2005 00:28:22 +0000 Received: from ozhmail1.ozhosting.com (ozhmail1.ozhosting.com [203.30.164.236]) by ozhmx1.ozhosting.com (Postfix) with ESMTP id A52D434408 for ; Thu, 23 Jun 2005 10:28:13 +1000 (EST) Received: from clarinox.com (unverified [127.0.0.1]) by ozhmail1.ozhosting.com (Vircom SMTPRS 4.1.361.9) with ESMTP id for ; Thu, 23 Jun 2005 10:28:10 +1000 Message-ID: <2415853226aa4e9ea1789842461c7ae1.clifford.joseph@clarinox.com> X-EM-APIVersion: 2, 0, 1, 0 From: "" To: ecos-discuss@ecos.sourceware.org Date: Thu, 23 Jun 2005 00:28:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [ECOS] i2c bit-banging implementation X-SW-Source: 2005-06/txt/msg00212.txt.bz2 Hi I am trying to implement an i2c transfer by bit-banging. I have successfully added the hardware package CYGPKG_IO_I2C to my configur= ation file. (.ecc) Iam working on the eb40a evaluation board which has already an i2c device a= t24c512 eeprom.=20 I am using arm-elf-gcc version 3.2.1 As described I have added this in the plf_io.h #define HAL_I2C_EXPORTED_DEVICES \ extern cyg_i2c_bus cyg_i2c_xyzzy_bus; \ extern cyg_i2c_device cyg_i2c_wallclock_ds1307; \ extern cyg_i2c_device cyg_i2c_eeprom; and in the application main.cpp file I have implemented the following func= tion static cyg_bool hal_alaia_i2c_bitbang(cyg_i2c_bus* bus, cyg_i2c_bitbang_op op) { cyg_bool result =3D 0; =20=20=20=20 switch(op)=20 { case CYG_I2C_BITBANG_INIT: { } case CYG_I2C_BITBANG_SCL_HIGH: { } =85.. =85.. =85. =85.. =2E } return result; } This is the definition in the i2c.h file typedef struct cyg_i2c_device { struct cyg_i2c_bus* i2c_bus; cyg_uint16 i2c_address; cyg_uint16 i2c_flags; cyg_uint32 i2c_delay; } cyg_i2c_device; #define CYG_I2C_DEFAULT_DELAY 10000 // A utility macro for defining an I2C device #define CYG_I2C_DEVICE(_name_, _bus_, _address_, _flags_, _delay_) \ cyg_i2c_device _name_ =3D { \ .i2c_bus =3D _bus_, \ .i2c_address =3D _address_, = \ .i2c_flags =3D _flags_, = \ .i2c_delay =3D _delay_ = \ } CYG_I2C_DEVICE(cyg_i2c_eeprom, &cyg_i2c_xyzzy_bus, 0xA0, 0x00,CYG_I2C_DEFAU= LT_DELAY); It still returns the same error when I compile=20 The error is parse error before =91.=92 token I am able create my own device without using the macro CYG_I2C_DEVICE by wr= iting the code extern cyg_i2c_device cyg_i2c_eeprom; cyg_i2c_eeprom.i2c_bus =3D &cyg_i2c_xyzzy_bus; cyg_i2c_eeprom.i2c_address =3D 0xA0; // 10100000; cyg_i2c_eeprom.i2c_flags =3D 0; cyg_i2c_eeprom.i2c_delay =3D CYG_I2C_DEFAULT_DELAY; but then i get an error at line.. CYG_I2C_BITBANG_BUS( &cyg_i2c_xyzzy_bus, &hal_alaia_i2c_bitbang); =20=20=20 parse error before =91.=92 Token looking at the i2c.h file the implementation of macro #define CYG_I2C_BUS(_name_, _init_fn_, _tx_fn_, _rx_fn_, _stop_fn_, _extra_= ) \ cyg_i2c_bus _name_ CYG_HAL_TABLE_ENTRY( i2c_buses ) =3D { = \ .i2c_init_fn =3D _init_fn_, = \ .i2c_tx_fn =3D _tx_fn_, = \ .i2c_rx_fn =3D _rx_fn_, = \ .i2c_stop_fn =3D _stop_fn_, = \ .i2c_extra =3D _extra_ = \ } Looking at the varios instances where the CYG_HAL_TABLE_ENTRY has been used= in the other files It has been implemented in this way Example: cyg_httpd_table_entry __name CYG_HAL_TABLE_ENTRY( httpd_table ) =3D { __pa= ttern, __handler, __arg } where __pattern, __handler, __arg are the arguments passed on to the httpd_= table Can somebody help me regarding this=20 Has anybody been successful in implementing a bit-banging using the i2c pac= kage.=20 Any idea why there is an error ?=20 parse error before =91.=92 Token -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss