Exemplo n.º 1
0
static int msp_gpio_get(struct gpio_chip *chip, unsigned offset)
{
    int reg, status;

    reg = MSP_GPIO_REG(offset);
    status = dm355evm_msp_read(reg);
    if (status < 0)
        return status;
    if (reg == DM355EVM_MSP_LED)
        msp_led_cache = status;
    return status & MSP_GPIO_MASK(offset);
}
Exemplo n.º 2
0
static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)
{
    int mask, bits;


    if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED)
        return -EINVAL;

    mask = MSP_GPIO_MASK(offset);
    bits = msp_led_cache;

    bits &= ~mask;
    if (value)
        bits |= mask;
    msp_led_cache = bits;

    return dm355evm_msp_write(bits, DM355EVM_MSP_LED);
}
Exemplo n.º 3
0
static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)
{
	int mask, bits;

	/* NOTE:  there are some other signals that could be
	 * packaged as output GPIOs, but they aren't as useful
	 * as the LEDs ... so for now we don't.
	 */
	if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED)
		return -EINVAL;

	mask = MSP_GPIO_MASK(offset);
	bits = msp_led_cache;

	bits &= ~mask;
	if (value)
		bits |= mask;
	msp_led_cache = bits;

	return dm355evm_msp_write(bits, DM355EVM_MSP_LED);
}