Blame view
include/linux/scx200_gpio.h
2.34 KB
55b8c0455 [PATCH] chardev: ... |
1 |
u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear); |
1da177e4c Linux-2.6.12-rc2 |
2 3 |
extern unsigned scx200_gpio_base; |
64b33619a long vs. unsigned... |
4 |
extern unsigned long scx200_gpio_shadow[2]; |
58012cd78 [PATCH] scx200_gp... |
5 |
extern struct nsc_gpio_ops scx200_gpio_ops; |
1da177e4c Linux-2.6.12-rc2 |
6 7 8 9 10 11 |
#define scx200_gpio_present() (scx200_gpio_base!=0) /* Definitions to make sure I do the same thing in all functions */ #define __SCx200_GPIO_BANK unsigned bank = index>>5 #define __SCx200_GPIO_IOADDR unsigned short ioaddr = scx200_gpio_base+0x10*bank |
64b33619a long vs. unsigned... |
12 |
#define __SCx200_GPIO_SHADOW unsigned long *shadow = scx200_gpio_shadow+bank |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 16 17 |
#define __SCx200_GPIO_INDEX index &= 31 #define __SCx200_GPIO_OUT __asm__ __volatile__("outsl":"=mS" (shadow):"d" (ioaddr), "0" (shadow)) /* returns the value of the GPIO pin */ |
55b8c0455 [PATCH] chardev: ... |
18 |
static inline int scx200_gpio_get(unsigned index) { |
1da177e4c Linux-2.6.12-rc2 |
19 20 21 22 23 24 25 26 27 28 |
__SCx200_GPIO_BANK; __SCx200_GPIO_IOADDR + 0x04; __SCx200_GPIO_INDEX; return (inl(ioaddr) & (1<<index)) ? 1 : 0; } /* return the value driven on the GPIO signal (the value that will be driven if the GPIO is configured as an output, it might not be the state of the GPIO right now if the GPIO is configured as an input) */ |
55b8c0455 [PATCH] chardev: ... |
29 |
static inline int scx200_gpio_current(unsigned index) { |
1da177e4c Linux-2.6.12-rc2 |
30 31 32 33 34 35 36 |
__SCx200_GPIO_BANK; __SCx200_GPIO_INDEX; return (scx200_gpio_shadow[bank] & (1<<index)) ? 1 : 0; } /* drive the GPIO signal high */ |
55b8c0455 [PATCH] chardev: ... |
37 |
static inline void scx200_gpio_set_high(unsigned index) { |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 41 |
__SCx200_GPIO_BANK; __SCx200_GPIO_IOADDR; __SCx200_GPIO_SHADOW; __SCx200_GPIO_INDEX; |
64b33619a long vs. unsigned... |
42 |
set_bit(index, shadow); /* __set_bit()? */ |
1da177e4c Linux-2.6.12-rc2 |
43 44 45 46 |
__SCx200_GPIO_OUT; } /* drive the GPIO signal low */ |
55b8c0455 [PATCH] chardev: ... |
47 |
static inline void scx200_gpio_set_low(unsigned index) { |
1da177e4c Linux-2.6.12-rc2 |
48 49 50 51 |
__SCx200_GPIO_BANK; __SCx200_GPIO_IOADDR; __SCx200_GPIO_SHADOW; __SCx200_GPIO_INDEX; |
64b33619a long vs. unsigned... |
52 |
clear_bit(index, shadow); /* __clear_bit()? */ |
1da177e4c Linux-2.6.12-rc2 |
53 54 55 56 |
__SCx200_GPIO_OUT; } /* drive the GPIO signal to state */ |
55b8c0455 [PATCH] chardev: ... |
57 |
static inline void scx200_gpio_set(unsigned index, int state) { |
1da177e4c Linux-2.6.12-rc2 |
58 59 60 61 62 63 64 65 66 67 68 69 |
__SCx200_GPIO_BANK; __SCx200_GPIO_IOADDR; __SCx200_GPIO_SHADOW; __SCx200_GPIO_INDEX; if (state) set_bit(index, shadow); else clear_bit(index, shadow); __SCx200_GPIO_OUT; } /* toggle the GPIO signal */ |
55b8c0455 [PATCH] chardev: ... |
70 |
static inline void scx200_gpio_change(unsigned index) { |
1da177e4c Linux-2.6.12-rc2 |
71 72 73 74 75 76 77 78 79 80 81 82 83 |
__SCx200_GPIO_BANK; __SCx200_GPIO_IOADDR; __SCx200_GPIO_SHADOW; __SCx200_GPIO_INDEX; change_bit(index, shadow); __SCx200_GPIO_OUT; } #undef __SCx200_GPIO_BANK #undef __SCx200_GPIO_IOADDR #undef __SCx200_GPIO_SHADOW #undef __SCx200_GPIO_INDEX #undef __SCx200_GPIO_OUT |