i2c.h (f092f15d39d1a223b240eb83dc3f4c64a02a8ea6) | i2c.h (cd7b4e82a2969e3db4f9b7b902191a10661409bd) |
---|---|
1/* 2 * (C) Copyright 2001 3 * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com. 4 * 5 * See file CREDITS for list of people who contributed to this 6 * project. 7 * 8 * This program is free software; you can redistribute it and/or --- 32 unchanged lines hidden (view full) --- 41 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 42 */ 43 44/* 45 * Configuration items. 46 */ 47#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */ 48 | 1/* 2 * (C) Copyright 2001 3 * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com. 4 * 5 * See file CREDITS for list of people who contributed to this 6 * project. 7 * 8 * This program is free software; you can redistribute it and/or --- 32 unchanged lines hidden (view full) --- 41 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 42 */ 43 44/* 45 * Configuration items. 46 */ 47#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */ 48 |
49#if defined(CONFIG_I2C_MULTI_BUS) 50#if !defined(CONFIG_SYS_MAX_I2C_BUS) 51#define CONFIG_SYS_MAX_I2C_BUS 2 52#endif 53#define I2C_GET_BUS() i2c_get_bus_num() 54#define I2C_SET_BUS(a) i2c_set_bus_num(a) | 49#ifdef CONFIG_I2C_MULTI_BUS 50#define MAX_I2C_BUS 2 51#define I2C_MULTI_BUS 1 |
55#else | 52#else |
56#define CONFIG_SYS_MAX_I2C_BUS 1 57#define I2C_GET_BUS() 0 58#define I2C_SET_BUS(a) | 53#define MAX_I2C_BUS 1 54#define I2C_MULTI_BUS 0 |
59#endif 60 | 55#endif 56 |
57#if !defined(CONFIG_SYS_MAX_I2C_BUS) 58#define CONFIG_SYS_MAX_I2C_BUS MAX_I2C_BUS 59#endif 60 |
|
61/* define the I2C bus number for RTC and DTT if not already done */ 62#if !defined(CONFIG_SYS_RTC_BUS_NUM) 63#define CONFIG_SYS_RTC_BUS_NUM 0 64#endif 65#if !defined(CONFIG_SYS_DTT_BUS_NUM) 66#define CONFIG_SYS_DTT_BUS_NUM 0 67#endif 68#if !defined(CONFIG_SYS_SPD_BUS_NUM) --- 162 unchanged lines hidden (view full) --- 231/* 232 * i2c_get_bus_speed: 233 * 234 * Returns speed of currently active I2C bus in Hz 235 */ 236 237unsigned int i2c_get_bus_speed(void); 238 | 61/* define the I2C bus number for RTC and DTT if not already done */ 62#if !defined(CONFIG_SYS_RTC_BUS_NUM) 63#define CONFIG_SYS_RTC_BUS_NUM 0 64#endif 65#if !defined(CONFIG_SYS_DTT_BUS_NUM) 66#define CONFIG_SYS_DTT_BUS_NUM 0 67#endif 68#if !defined(CONFIG_SYS_SPD_BUS_NUM) --- 162 unchanged lines hidden (view full) --- 231/* 232 * i2c_get_bus_speed: 233 * 234 * Returns speed of currently active I2C bus in Hz 235 */ 236 237unsigned int i2c_get_bus_speed(void); 238 |
239/* NOTE: These two functions MUST be always_inline to avoid code growth! */ 240static inline unsigned int I2C_GET_BUS(void) __attribute__((always_inline)); 241static inline unsigned int I2C_GET_BUS(void) 242{ 243 return I2C_MULTI_BUS ? i2c_get_bus_num() : 0; 244} 245 246static inline void I2C_SET_BUS(unsigned int bus) __attribute__((always_inline)); 247static inline void I2C_SET_BUS(unsigned int bus) 248{ 249 if (I2C_MULTI_BUS) 250 i2c_set_bus_num(bus); 251} 252 |
|
239#endif /* _I2C_H_ */ | 253#endif /* _I2C_H_ */ |