diff options
| author | [email protected] <[email protected]> | 2012-06-13 17:00:09 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-06-13 17:00:09 +0000 |
| commit | ecc03bab6ac470c91af02303f484fc1a07048d75 (patch) | |
| tree | 91817ca76f0d52232762c3f2a46a8dfc3a4dec48 | |
| parent | 85169d7fe8850c2a299c135c0417b567ebdf03c6 (diff) | |
update AT91SAM9260 i2c driver
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2160 bbd45198-f89e-11dd-88c7-29a3b14d5316
| -rwxr-xr-x | bsp/at91sam9260/application.c | 10 | ||||
| -rw-r--r-- | bsp/at91sam9260/at91_i2c_gpio.c | 15 |
2 files changed, 6 insertions, 19 deletions
diff --git a/bsp/at91sam9260/application.c b/bsp/at91sam9260/application.c index 9edb781408..b440c16ac1 100755 --- a/bsp/at91sam9260/application.c +++ b/bsp/at91sam9260/application.c @@ -18,6 +18,7 @@ /*@{*/
#include <rtthread.h>
+#include <rtdevice.h>
#ifdef RT_USING_DFS
/* dfs init */
@@ -57,14 +58,6 @@ #include <dfs_romfs.h>
#endif
-#ifdef RT_USING_I2C
-#include <i2c.h>
-
-static struct rt_i2c_hardware_info hw_info[] = {
- { RT_I2C_HARDWARE_INFO("pcf8563", 0, 0xA2 >> 1, 0), },
-};
-#endif
-
void rt_init_thread_entry(void* parameter)
{
/* Filesystem Initialization */
@@ -145,7 +138,6 @@ void rt_init_thread_entry(void* parameter) #ifdef RT_USING_I2C
{
rt_i2c_core_init();
- rt_i2c_hw_info_register(hw_info, 1);
at91_i2c_init();
}
#endif
diff --git a/bsp/at91sam9260/at91_i2c_gpio.c b/bsp/at91sam9260/at91_i2c_gpio.c index 2aebe1b839..bbee2033aa 100644 --- a/bsp/at91sam9260/at91_i2c_gpio.c +++ b/bsp/at91sam9260/at91_i2c_gpio.c @@ -12,10 +12,8 @@ * 2012-04-25 weety first version */ -#include <rtthread.h> +#include <rtdevice.h> #include <rthw.h> -#include <i2c.h> -#include <i2c-bit-ops.h> #include <at91sam926x.h> @@ -98,25 +96,22 @@ static const struct rt_i2c_bit_ops bit_ops = { rt_err_t at91_i2c_init(void) { - struct rt_i2c_bus *bus; + struct rt_i2c_bus_device *bus; - bus = rt_malloc(sizeof(struct rt_i2c_bus)); + bus = rt_malloc(sizeof(struct rt_i2c_bus_device)); if (bus == RT_NULL) { rt_kprintf("rt_malloc failed\n"); return -RT_ENOMEM; } - rt_memset((void *)bus, 0, sizeof(struct rt_i2c_bus)); - bus->id = 0; - - rt_snprintf(bus->name, sizeof(bus->name), "i2c-gpio%d", bus->id); + rt_memset((void *)bus, 0, sizeof(struct rt_i2c_bus_device)); bus->priv = (void *)&bit_ops; at91_i2c_gpio_init(); - rt_i2c_bit_add_bus(bus); + rt_i2c_bit_add_bus(bus, "i2c0"); return RT_EOK; } |
