This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
I2C Bus definition problem
- From: Alexandre <thekyz at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 7 Sep 2007 12:23:17 +0200
- Subject: [ECOS] I2C Bus definition problem
- Reply-to: thekyz at gmail dot com
Hi everybody,
I'm near the end in my attempt to make an I2C driver for the LPC2XXX platform.
I'm trying to declare my i2c bus using the I2C generic macro CYG_I2C_BUS
Currently the declaration looks like this:
CYG_I2C_BUS(i2cBusLpc, cyg_lpc2xxx_i2c_init, cyg_lpc2xxx_i2c_tx,
cyg_lpc2xxx_i2c_rx, cyg_lpc2xxx_i2c_stop, ((void*)(&extra)) );
'extra' being declared two lines above like this:
static cyg_lpc2xxx_i2c_extra extra;
When I try to compile the code, the compiler says for the line where I
use the macro:
'section attribute cannot be specified for local variables'
I tried to look over the internet for hints on that error and found
nothing but error logs with the same error and nothing to get rid of
it.
Does someone have an idea of what i'm doing wrong ?
PS: For those of you unfamiliar with the ecos I2C interface, here is
what the declaration of the I2C bus structure looks like:
typedef struct cyg_i2c_bus {
cyg_drv_mutex_t i2c_lock;
#ifdef CYGDBG_USE_ASSERTS
const cyg_i2c_device* i2c_current_device;
#endif
// The hardware-specific functions that do the real work
void (*i2c_init_fn)(struct cyg_i2c_bus*);
cyg_uint32 (*i2c_tx_fn)(const cyg_i2c_device*,
cyg_bool, const cyg_uint8*, cyg_uint32, cyg_bool);
cyg_uint32 (*i2c_rx_fn)(const cyg_i2c_device*,
cyg_bool, cyg_uint8*, cyg_uint32, cyg_bool, cyg_bool);
void (*i2c_stop_fn)(const cyg_i2c_device*);
// A spare field for use by the driver
void* i2c_extra;
} CYG_HAL_TABLE_TYPE cyg_i2c_bus;
And the declaration 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 ) = {
\
.i2c_init_fn = _init_fn_,
\
.i2c_tx_fn = _tx_fn_,
\
.i2c_rx_fn = _rx_fn_,
\
.i2c_stop_fn = _stop_fn_,
\
.i2c_extra = _extra_
\
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss