public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Alexandre <thekyz@gmail.com>
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] I2C Bus definition problem
Date: Fri, 07 Sep 2007 10:23:00 -0000	[thread overview]
Message-ID: <d5aafeec0709070323j338db350n6ad3d067d48b1672@mail.gmail.com> (raw)

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

             reply	other threads:[~2007-09-07 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-07 10:23 Alexandre [this message]
2007-09-07 11:22 ` Andrew Lunn
2007-09-07 12:50 ` Andrew Lunn
2007-09-07 12:53   ` Alexandre
2007-09-07 13:07     ` Andrew Lunn
2007-09-07 13:09       ` Alexandre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5aafeec0709070323j338db350n6ad3d067d48b1672@mail.gmail.com \
    --to=thekyz@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).