This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
i2c driver complie error
- From: "liu hua" <rongye_liu at hotmail dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Mon, 09 May 2005 22:12:52 +0800
- Subject: [ECOS] i2c driver complie error
- Bcc:
I need help for i2c driver.
In my project,I use the PCA9564 (I2C bus controller). So,I will write a
driver for PCA9564. I download the I2C driver code from eCos CVS server,and
write a test driver i2c_pca9564.c. This driver use the code from I2C doc
file. But,when I complie the eCos with configtool,there are some compile
error:
arm-elf-gcc -c -I/ecos-h/ecos20/9301ss_install/include
-I/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current
-I/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src
-I/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/tests -I.
-I/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/
-finline-limit=7000 -Wall -Wpointer-arith -Wstrict-prototypes -Winline
-Wundef -g -O2 -ffunction-sections -fdata-sections -fno-exceptions
-Wp,-MD,src/i2c_pca9564.tmp -o src/devs_i2c_i2c_pca9564.o
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c
make[1]: Leaving directory `/ecos-h/ecos20/9301ss_build/devs/i2c/current'
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:120:
warning: initialization from incompatible pointer type
make: Leaving directory `/ecos-h/ecos20/9301ss_build'
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:120:
warning: initialization from incompatible pointer type
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:126:
initializer element is not constant
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:126:
(near initialization for `cyg_i2c_wallclock_ds1307.i2c_bus')
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:132:
initializer element is not constant
/ecos-h/ecos-2.0/2005-02-27/ecos-2.0/packages/devs/i2c/current/src/i2c_pca9564.c:132:
(near initialization for `hal_alaia_i2c_fs6377.i2c_bus')
make[1]: *** [src/i2c_pca9564.o.d] Error 1
make: *** [build] Error 2
Can you tell me what error are in my driver?
Following is the i2c_pca9564.c:
//==========================================================================
#include <pkgconf/system.h>
#include <pkgconf/io_i2c_pca9564.h>
#include <stdio.h> /* printf */
#include <cyg/io/i2c.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_intr.h>
#include <string.h>
#include <cyg/infra/diag.h> // diagnostic output
#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 hal_alaia_i2c_fs6377;
struct xyzzy_data {
int test;
} *xyzzy_object;
static cyg_bool
xyzzy_i2c_extra(cyg_i2c_bus* bus)
{
cyg_bool result = 0;
return result;
}
static void
xyzzy_i2c_init(struct cyg_i2c_bus* bus)
{
printf("Init i2c xyzzy...\n");
}
static cyg_uint32
xyzzy_i2c_tx(const cyg_i2c_device* dev,
cyg_bool send_start,
cyg_uint8* tx_data, cyg_uint32 count,
cyg_bool send_stop)
{
printf("tx t2c xyzzy...\n");
}
static cyg_uint32
xyzzy_i2c_rx(const cyg_i2c_device* dev,
cyg_bool send_start,
cyg_uint8* tx_data, cyg_uint32 count,
cyg_bool send_stop)
{
printf("rx i2c xyzzy...\n");
}
static void
xyzzy_i2c_stop(const cyg_i2c_device* dev)
{
printf("stop i2c xyzzy...\n");
}
CYG_I2C_BUS(cyg_i2c_xyzzy_bus,
xyzzy_i2c_init,
xyzzy_i2c_tx,
xyzzy_i2c_rx,
xyzzy_i2c_stop,
(void *) xyzzy_i2c_extra); //line 120
CYG_I2C_DEVICE( cyg_i2c_wallclock_ds1307,
cyg_i2c_xyzzy_bus,
0x68,
0x00,
CYG_I2C_DEFAULT_DELAY); //line 126
CYG_I2C_DEVICE(hal_alaia_i2c_fs6377,
cyg_i2c_xyzzy_bus,
0x58,
0x00,
CYG_I2C_DEFAULT_DELAY); //line 132
-----------------------------------------------------------------------------
Following is the CDL file i2c-pca9564.cdl:
#========================================================================*/
cdl_package CYGPKG_IO_I2C_PCA9564 {
display "I2C device PCA9564 driver."
include_dir cyg/dev/i2c
requires CYGPKG_IO_I2C
parent CYGPKG_IO_I2C
description "I2C device PCA9564 driver."
compile -library=libextras.a i2c_pca9564.c
cdl_option CYGDAT_IO_I2C_PCA9564_NAME {
display "Device name for the I2C device PCA9564"
flavor data
default_value {"\"/dev/i2c/pca9564\""}
description "This option sets the device name for the
PCA9564."
}
}
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss