?? dev_i2c_local.h
字號:
/*=========================================================================== Copyright 2000, 2001 Holley Communications. All rights reserved.*//***************************************************************************** * * DEV_I2C_LOCAL.H - I2C Interface: Local Definitions * * PURPOSE: * To define local definitions used within the I2C communication * interface module. * * HISTORY: * V 1.00 - Mar 25, 1998 - G.Catt * Creation * - May 12, 1998 - G.Catt * Standardized symbol naming. * - Jul 17, 2000 - Yanbing * Performance improvements of I2C low level functions * * NOTE: * * *****************************************************************************/#ifndef DEV_I2C_LOCAL_H#define DEV_I2C_LOCAL_H#include "main_system.h"/*--- I2C Signal States ---*//* Data States */#define DEV_I2C_SIGNAL_HIGH 1 /* High (driven) */#define DEV_I2C_SIGNAL_LOW 0 /* Low (driven) *//* Control States */#define DEV_I2C_SIGNAL_INACTIVE DEV_I2C_SIGNAL_HIGH /* Signal floating */#define DEV_I2C_SIGNAL_ASSERT DEV_I2C_SIGNAL_LOW /* Asserted (driven) *//* Data Acknowledgements */#define DEV_I2C_SIGNAL_NOACK DEV_I2C_SIGNAL_INACTIVE/* No ACK (floating) */#define DEV_I2C_SIGNAL_ACK DEV_I2C_SIGNAL_ASSERT /* ACK (driven low) *//*********************************************************************** * Yanbing - The following defines are for I2C low level control. * It is modified to improve I2C performances. ***********************************************************************/#define MMI_I2C_SCL 13#define MMI_I2C_SDA 14#define DEV_PIO_SetDirection(dir, bit) { if (dir) REG32(GPIO_BASE+GPIO_DIR) |= BIT(bit); \ else REG32(GPIO_BASE+GPIO_DIR) &= ~BIT(bit); }#define DEV_PIO_WRITE_PIO(val, bit) { if (val) REG32(GPIO_BASE+GPIO_OUT) |= BIT(bit); \ else REG32(GPIO_BASE+GPIO_OUT) &= ~BIT(bit); }#define DEV_PIO_READ_PIO(bit) (REG32(GPIO_BASE+GPIO_PIN) & BIT(bit))#define SET_DIR_SCL(a) DEV_PIO_SetDirection(a,MMI_I2C_SCL)#define SET_DIR_SDA(a) DEV_PIO_SetDirection(a,MMI_I2C_SDA)#define WRITE_SCL(a) DEV_PIO_WRITE_PIO(a,MMI_I2C_SCL)#define WRITE_SDA(a) DEV_PIO_WRITE_PIO(a,MMI_I2C_SDA)#define READ_SCL() DEV_PIO_READ_PIO(MMI_I2C_SCL)#define READ_SDA() DEV_PIO_READ_PIO(MMI_I2C_SDA)#define READ_I2C_SLAVE_MUTE() DEV_PIO_READ_PIO(UIM_SLAVE_I2C_MUTE)#if BOARD_PHOENIX# define dev_i2c_io_scllow() { DEV_PIO_SetOutput(MMI_I2C_SCL); DEV_PIO_WRITE_LOW(MMI_I2C_SCL); }# define dev_i2c_io_scltristate() { DEV_PIO_SetInput(MMI_I2C_SCL); }# define dev_i2c_io_sdalow() { DEV_PIO_SetOutput(MMI_I2C_SDA); DEV_PIO_WRITE_LOW(MMI_I2C_SDA); }# define dev_i2c_io_sdatristate() { DEV_PIO_SetInput(MMI_I2C_SDA); }#else# define dev_i2c_io_scllow() { SET_DIR_SCL(PIO_OUTPUT); WRITE_SCL(PIO_LOW); }# define dev_i2c_io_scltristate() { SET_DIR_SCL(PIO_INPUT); }# define dev_i2c_io_sdalow() { SET_DIR_SDA(PIO_OUTPUT); WRITE_SDA(PIO_LOW); }# define dev_i2c_io_sdatristate() { SET_DIR_SDA(PIO_INPUT); }#endif/* Local function prototypes */void dev_i2c_io_initialize ( void );Bool dev_i2c_io_sclstate ( void );Bool dev_i2c_io_sdastate ( void );#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -