update AT91SAM9260 i2c driver
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2160 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
85169d7fe8
commit
ecc03bab6a
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue