/*
 * gpio.h
 *
 * (C) Copyright 2009 Andre McCurdy, NXP Semiconductors
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#ifndef __PNX833X_GPIO_H
#define __PNX833X_GPIO_H

#define GPIO_INT_NONE		0
#define GPIO_INT_LEVEL_LOW	1
#define GPIO_INT_LEVEL_HIGH	2
#define GPIO_INT_EDGE_RISING	3
#define GPIO_INT_EDGE_FALLING	4
#define GPIO_INT_EDGE_BOTH	5

extern void gpio_select_input (unsigned int pin);
extern void gpio_select_output (unsigned int pin);
extern void gpio_select_function_io (unsigned int pin);
extern void gpio_select_function_alt (unsigned int pin);
extern int gpio_read (unsigned int pin);
extern void gpio_write (unsigned int val, unsigned int pin);

extern void gpio_irq_init (void);
extern void gpio_setup_irq (int when, unsigned int pin);
extern void gpio_enable_irq (unsigned int pin);
extern void gpio_disable_irq (unsigned int pin);
extern void gpio_clear_irq (unsigned int pin);
extern void gpio_clear_and_enable_irq (unsigned int pin);
extern unsigned int gpio_irq_status_active (void);
extern unsigned int gpio_irq_status_active_and_unmasked (void);

#endif

