i2cgpio.h
来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· C头文件 代码 · 共 101 行
H
101 行
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1996 - 1997 Microsoft Corporation. All Rights Reserved.
//
//==========================================================================;
#ifndef __I2CGPIO_H__
#define __I2CGPIO_H__
//==========================================================================;
//
// I2C section
//
// I2C Commands
#define I2C_COMMAND_NULL 0X0000
#define I2C_COMMAND_READ 0X0001
#define I2C_COMMAND_WRITE 0X0002
#define I2C_COMMAND_STATUS 0X0004
#define I2C_COMMAND_RESET 0X0008
// The following flags are provided on a READ or WRITE command
#define I2C_FLAGS_START 0X0001 // START + addx
#define I2C_FLAGS_STOP 0X0002 // STOP
#define I2C_FLAGS_DATACHAINING 0X0004 // STOP, START + addx
#define I2C_FLAGS_ACK 0X0010 // ACKNOWLEDGE (normally set)
// The following status flags are returned on completion of the operation
#define I2C_STATUS_NOERROR 0X0000
#define I2C_STATUS_BUSY 0X0001
#define I2C_STATUS_ERROR 0X0002
typedef struct _I2CControl {
ULONG Command; // I2C_COMMAND_*
DWORD dwCookie; // Context identifier returned on Open
BYTE Data; // Data to write, or returned byte
BYTE Reserved[3]; // Filler
ULONG Flags; // I2C_FLAGS_*
ULONG Status; // I2C_STATUS_*
ULONG ClockRate; // Bus clockrate in Hz.
} I2CControl, *PI2CControl;
//==========================================================================;
//
// GPIO section
//
// GPIO Commands
#define GPIO_COMMAND_QUERY 0X0001 // get #pins and nBufferSize
#define GPIO_COMMAND_OPEN 0X0001 // old open
#define GPIO_COMMAND_OPEN_PINS 0X0002 // get dwCookie
#define GPIO_COMMAND_CLOSE_PINS 0X0004 // invalidate cookie
#define GPIO_COMMAND_READ_BUFFER 0X0008
#define GPIO_COMMAND_WRITE_BUFFER 0X0010
// The following flags are provided on a READ_BUFFER or WRITE_BUFFER command
// lpPins bits set MUST have contiguous bits set for a read/write command.
//
// On a READ, if the number of pins set in the bitmask does not fill a
// byte/word/dword, then zeros are returned for those positions.
// on a WRITE, if the number of pins set in the bitmask does not fill a
// byte/word/dword, a read/modify/write is done on the port/mmio position
// that represents those bits.
#define GPIO_FLAGS_BYTE 0x0001 // do byte read/write
#define GPIO_FLAGS_WORD 0x0002 // do word read/write
#define GPIO_FLAGS_DWORD 0x0004 // do dword read/write
// The following status flags are returned on completion of the operation
#define GPIO_STATUS_NOERROR 0X0000
#define GPIO_STATUS_BUSY 0X0001
#define GPIO_STATUS_ERROR 0X0002
#define GPIO_STATUS_NO_ASYNC 0X0004
typedef struct _GPIOControl {
ULONG Command; // GPIO_COMMAND_*
ULONG Flags; // GPIO_FLAGS_*
DWORD dwCookie; // Context identifier returned on Open
ULONG Status; // GPIO_STATUS_*
ULONG nBytes; // # of bytes to send or recieved
ULONG nBufferSize; // max size of buffer
ULONG nPins; // number of GPIO pins returned by Open
UCHAR *Pins; // pointer to bitmask of pins to read/write
UCHAR *Buffer; // pointer to GPIO data to send/recieve
void (*AsynchCompleteCallback)(UCHAR *Buffer);
// NULL if synchronous xfer, valid ptr if asynch.
GUID PrivateInterfaceType;
void (*PrivateInterface)();
} GPIOControl, *PGPIOControl;
#endif //__I2CGPIO_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?