Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
bfin_gpio.c File Reference
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/blackfin.h>
#include <asm/gpio.h>
#include <asm/portmux.h>
#include <linux/irq.h>
#include <asm/irq_handler.h>

Go to the source code of this file.

Data Structures

struct  str_ident
 

Macros

#define AWA_DUMMY_READ(...)   do { } while (0)
 
#define RESOURCE_LABEL_SIZE   16
 
#define map_entry(m, i)   reserved_##m##_map[gpio_bank(i)]
 
#define is_reserved(m, i, e)   (map_entry(m, i) & gpio_bit(i))
 
#define reserve(m, i)   (map_entry(m, i) |= gpio_bit(i))
 
#define unreserve(m, i)   (map_entry(m, i) &= ~gpio_bit(i))
 
#define DECLARE_RESERVED_MAP(m, c)   static unsigned short reserved_##m##_map[c]
 
#define portmux_setup(...)   do { } while (0)
 
#define SET_GPIO(name)
 
#define SET_GPIO_SC(name)
 
#define SET_GPIO_P(name)
 
#define GET_GPIO(name)
 
#define GET_GPIO_P(name)
 

Functions

 DECLARE_RESERVED_MAP (gpio, GPIO_BANK_NUM)
 
 DECLARE_RESERVED_MAP (peri, DIV_ROUND_UP(MAX_RESOURCES, GPIO_BANKSIZE))
 
 DECLARE_RESERVED_MAP (gpio_irq, GPIO_BANK_NUM)
 
int check_gpio (unsigned gpio)
 
 SET_GPIO (dir)
 
 EXPORT_SYMBOL (set_gpio_toggle)
 
int peripheral_request (unsigned short per, const char *label)
 
 EXPORT_SYMBOL (peripheral_request)
 
int peripheral_request_list (const unsigned short per[], const char *label)
 
 EXPORT_SYMBOL (peripheral_request_list)
 
void peripheral_free (unsigned short per)
 
 EXPORT_SYMBOL (peripheral_free)
 
void peripheral_free_list (const unsigned short per[])
 
 EXPORT_SYMBOL (peripheral_free_list)
 
int bfin_gpio_request (unsigned gpio, const char *label)
 
 EXPORT_SYMBOL (bfin_gpio_request)
 
void bfin_gpio_free (unsigned gpio)
 
 EXPORT_SYMBOL (bfin_gpio_free)
 
int bfin_gpio_irq_request (unsigned gpio, const char *label)
 
void bfin_gpio_irq_free (unsigned gpio)
 
int bfin_gpio_direction_input (unsigned gpio)
 
 EXPORT_SYMBOL (bfin_gpio_direction_input)
 
void bfin_gpio_irq_prepare (unsigned gpio)
 
void bfin_gpio_set_value (unsigned gpio, int arg)
 
 EXPORT_SYMBOL (bfin_gpio_set_value)
 
int bfin_gpio_direction_output (unsigned gpio, int value)
 
 EXPORT_SYMBOL (bfin_gpio_direction_output)
 
int bfin_gpio_get_value (unsigned gpio)
 
 EXPORT_SYMBOL (bfin_gpio_get_value)
 
void bfin_reset_boot_spi_cs (unsigned short pin)
 

Macro Definition Documentation

#define AWA_DUMMY_READ (   ...)    do { } while (0)

Definition at line 47 of file bfin_gpio.c.

#define DECLARE_RESERVED_MAP (   m,
  c 
)    static unsigned short reserved_##m##_map[c]

Definition at line 164 of file bfin_gpio.c.

#define GET_GPIO (   name)
Value:
unsigned short get_gpio_ ## name(unsigned gpio) \
{ \
unsigned long flags; \
unsigned short ret; \
flags = hard_local_irq_save(); \
ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
AWA_DUMMY_READ(name); \
hard_local_irq_restore(flags); \
} \
return ret; \
} \
EXPORT_SYMBOL(get_gpio_ ## name);

Definition at line 484 of file bfin_gpio.c.

#define GET_GPIO_P (   name)
Value:
unsigned short get_gpiop_ ## name(unsigned gpio) \
{ \
unsigned long flags; \
unsigned short ret; \
flags = hard_local_irq_save(); \
ret = (gpio_array[gpio_bank(gpio)]->name); \
AWA_DUMMY_READ(name); \
hard_local_irq_restore(flags); \
} \
return ret; \
} \
EXPORT_SYMBOL(get_gpiop_ ## name);

Definition at line 511 of file bfin_gpio.c.

#define is_reserved (   m,
  i,
  e 
)    (map_entry(m, i) & gpio_bit(i))

Definition at line 161 of file bfin_gpio.c.

#define map_entry (   m,
  i 
)    reserved_##m##_map[gpio_bank(i)]

Definition at line 160 of file bfin_gpio.c.

#define portmux_setup (   ...)    do { } while (0)

Definition at line 375 of file bfin_gpio.c.

#define reserve (   m,
  i 
)    (map_entry(m, i) |= gpio_bit(i))

Definition at line 162 of file bfin_gpio.c.

#define RESOURCE_LABEL_SIZE   16

Definition at line 115 of file bfin_gpio.c.

#define SET_GPIO (   name)
Value:
void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
{ \
unsigned long flags; \
flags = hard_local_irq_save(); \
if (arg) \
gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
else \
gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
AWA_DUMMY_READ(name); \
hard_local_irq_restore(flags); \
} \
EXPORT_SYMBOL(set_gpio_ ## name);

Definition at line 402 of file bfin_gpio.c.

#define SET_GPIO_P (   name)
Value:
void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
{ \
unsigned long flags; \
flags = hard_local_irq_save(); \
gpio_array[gpio_bank(gpio)]->name = arg; \
AWA_DUMMY_READ(name); \
hard_local_irq_restore(flags); \
} \
} \
EXPORT_SYMBOL(set_gpiop_ ## name);

Definition at line 460 of file bfin_gpio.c.

#define SET_GPIO_SC (   name)
Value:
void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
{ \
unsigned long flags; \
flags = hard_local_irq_save(); \
if (arg) \
gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
else \
gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
AWA_DUMMY_READ(name); \
hard_local_irq_restore(flags); \
} \
} \
EXPORT_SYMBOL(set_gpio_ ## name);
#define unreserve (   m,
  i 
)    (map_entry(m, i) &= ~gpio_bit(i))

Definition at line 163 of file bfin_gpio.c.

Function Documentation

int bfin_gpio_direction_input ( unsigned  gpio)

Definition at line 1123 of file bfin_gpio.c.

int bfin_gpio_direction_output ( unsigned  gpio,
int  value 
)

Definition at line 1165 of file bfin_gpio.c.

void bfin_gpio_free ( unsigned  gpio)

Definition at line 959 of file bfin_gpio.c.

int bfin_gpio_get_value ( unsigned  gpio)

Definition at line 1191 of file bfin_gpio.c.

void bfin_gpio_irq_free ( unsigned  gpio)

Definition at line 1089 of file bfin_gpio.c.

void bfin_gpio_irq_prepare ( unsigned  gpio)

Definition at line 1141 of file bfin_gpio.c.

int bfin_gpio_irq_request ( unsigned  gpio,
const char label 
)

Definition at line 1056 of file bfin_gpio.c.

int bfin_gpio_request ( unsigned  gpio,
const char label 
)

Definition at line 901 of file bfin_gpio.c.

void bfin_gpio_set_value ( unsigned  gpio,
int  arg 
)

Definition at line 1156 of file bfin_gpio.c.

void bfin_reset_boot_spi_cs ( unsigned short  pin)

Definition at line 1222 of file bfin_gpio.c.

int check_gpio ( unsigned  gpio)
inline

Definition at line 170 of file bfin_gpio.c.

DECLARE_RESERVED_MAP ( gpio  ,
GPIO_BANK_NUM   
)
DECLARE_RESERVED_MAP ( peri  ,
DIV_ROUND_UP(MAX_RESOURCES, GPIO_BANKSIZE  
)
DECLARE_RESERVED_MAP ( gpio_irq  ,
GPIO_BANK_NUM   
)
EXPORT_SYMBOL ( set_gpio_toggle  )
EXPORT_SYMBOL ( peripheral_request  )
EXPORT_SYMBOL ( peripheral_request_list  )
EXPORT_SYMBOL ( peripheral_free  )
EXPORT_SYMBOL ( peripheral_free_list  )
EXPORT_SYMBOL ( bfin_gpio_request  )
EXPORT_SYMBOL ( bfin_gpio_free  )
EXPORT_SYMBOL ( bfin_gpio_direction_input  )
EXPORT_SYMBOL ( bfin_gpio_set_value  )
EXPORT_SYMBOL ( bfin_gpio_direction_output  )
EXPORT_SYMBOL ( bfin_gpio_get_value  )
void peripheral_free ( unsigned short  per)

Definition at line 849 of file bfin_gpio.c.

void peripheral_free_list ( const unsigned short  per[])

Definition at line 878 of file bfin_gpio.c.

int peripheral_request ( unsigned short  per,
const char label 
)

Definition at line 749 of file bfin_gpio.c.

int peripheral_request_list ( const unsigned short  per[],
const char label 
)

Definition at line 828 of file bfin_gpio.c.

SET_GPIO ( dir  )

Definition at line 416 of file bfin_gpio.c.