adm1026_impl.h revision d58fda4376e4bf67072ce2e69f6f47036f9dbb68
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ADM1026_IMPL_H
#define _ADM1026_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct adm1026_unit {
int adm1026_oflag;
/*
* ADM1026 has 4 GPIO Config registers used to set Polarity and Direction.
* To config a particular GPIO, the low 16 bits of the reg_mask member
* of the i2c_gpio_t struct is used as a logical mask to indicate which
* GPIO pins' P or D bit(s).
*
* GPIO# 3 2 1 0
* +--+--+--+--+
* |PD|PD|PD|PD| <-- ADM1026_GPIO_CFG1
* +--+--+--+--+ Logical Mask: 0x000f
*
* GPIO# 7 6 5 4
* +--+--+--+--+
* |PD|PD|PD|PD| <-- ADM1026_GPIO_CFG2
* +--+--+--+--+ Logical Mask: 0x00f0
*
* GPIO# 11 10 9 8
* +--+--+--+--+
* |PD|PD|PD|PD| <-- ADM1026_GPIO_CFG3
* +--+--+--+--+ Logical Mask: 0x0f00
*
* GPIO# 15 14 13 12
* +--+--+--+--+
* |PD|PD|PD|PD| <-- ADM1026_GPIO_CFG4
* +--+--+--+--+ Logical Mask: 0xf000
*/
/*
* ADM1026 has 2 GPIO Output registers to set GPIO pins.
* To set a particular GPIO pin, the low 16 bits of the reg_mask member
* of the i2c_gpio_t struct is used as a 1:1 mask of the 16 GPIO pin(s)
*
* GPIO# 76 54 32 10
*
* +--+--+--+--+
* |xx|xx|xx|xx| <-- ADM1026_STS_REG5
* +--+--+--+--+ Logical Mask: 0x00ff
*
* GPIO# 11 11 11 98
* 54 32 10
* +--+--+--+--+
* |xx|xx|xx|xx| <-- ADM1026_STS_REG6
* +--+--+--+--+ Logical Mask: 0xff00
*/
#define OUTPUT_SHIFT 8
#define BYTES_PER_OUTPUT 2
#define BYTES_PER_CONFIG 4
#define NUMBER_OF_GPIOS 16
#define GPIOS_PER_CFG_BYTE 4
#define GPIO_CFG_MASK 0xf
#ifdef DEBUG
static int adm1026_dbg = 0;
#else
#endif
#ifdef __cplusplus
}
#endif
#endif /* _ADM1026_IMPL_H */