在簡要介紹了led驅動相關頭檔案的基礎上(參考:點選打開連結),可以發現這些頭檔案裡面包含了很多gpio的宏定義和gpio的操作函數。利用這些宏定義和操作函數,我們就能夠很好地控制gpio以達到我們的目的。GPIO相關的的頭檔案包括<mach/gpio.h>、<plat/regs-gpio.h>和<plat/gpio-cfg.h>。下面是對這些頭檔案進行簡單的分析,如有不正确,希望留言指正:
一、<mach/gpio.h>頭檔案:
[cpp] view plain copy
- #define gpio_get_value __gpio_get_value //對gpio單個引腳的讀函數進行了宏定義
- #define gpio_set_value __gpio_set_value //對gpio單個引腳的寫函數進行了宏定義
- #define gpio_cansleep __gpio_cansleep //???
- #define gpio_to_irq __gpio_to_irq //???
- //這裡對每個端口(gpioa--gpioq)的引腳個數進行了宏定義
- #define S3C64XX_GPIO_A_NR (8)
- #define S3C64XX_GPIO_B_NR (7)
- #define S3C64XX_GPIO_C_NR (8)
- #define S3C64XX_GPIO_D_NR (5)
- #define S3C64XX_GPIO_E_NR (5)
- #define S3C64XX_GPIO_F_NR (16)
- #define S3C64XX_GPIO_G_NR (7)
- #define S3C64XX_GPIO_H_NR (10)
- #define S3C64XX_GPIO_I_NR (16)
- #define S3C64XX_GPIO_J_NR (12)
- #define S3C64XX_GPIO_K_NR (16)
- #define S3C64XX_GPIO_L_NR (15)
- #define S3C64XX_GPIO_M_NR (6)
- #define S3C64XX_GPIO_N_NR (16)
- #define S3C64XX_GPIO_O_NR (16)
- #define S3C64XX_GPIO_P_NR (15)
- #define S3C64XX_GPIO_Q_NR (9)
- #define S3C64XX_GPIO_NEXT(__gpio) \
- ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
- //用黏貼符号(雙#号)來運算的,以A組的0起始,依次加每組的GPIO個數
- enum s3c_gpio_number {
- S3C64XX_GPIO_A_START = 0,
- S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
- S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
- S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
- S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
- S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
- S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
- S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
- S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
- S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
- S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
- S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
- S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
- S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
- S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
- S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
- S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
- };
- //以下定義了單個引腳的号碼,在某些函數中我們可以直接這些宏定義通路單個引腳
- #define S3C64XX_GPA(_nr) (S3C64XX_GPIO_A_START + (_nr))
- #define S3C64XX_GPB(_nr) (S3C64XX_GPIO_B_START + (_nr))
- #define S3C64XX_GPC(_nr) (S3C64XX_GPIO_C_START + (_nr))
- #define S3C64XX_GPD(_nr) (S3C64XX_GPIO_D_START + (_nr))
- #define S3C64XX_GPE(_nr) (S3C64XX_GPIO_E_START + (_nr))
- #define S3C64XX_GPF(_nr) (S3C64XX_GPIO_F_START + (_nr))
- #define S3C64XX_GPG(_nr) (S3C64XX_GPIO_G_START + (_nr))
- #define S3C64XX_GPH(_nr) (S3C64XX_GPIO_H_START + (_nr))
- #define S3C64XX_GPI(_nr) (S3C64XX_GPIO_I_START + (_nr))
- #define S3C64XX_GPJ(_nr) (S3C64XX_GPIO_J_START + (_nr))
- #define S3C64XX_GPK(_nr) (S3C64XX_GPIO_K_START + (_nr))
- #define S3C64XX_GPL(_nr) (S3C64XX_GPIO_L_START + (_nr))
- #define S3C64XX_GPM(_nr) (S3C64XX_GPIO_M_START + (_nr))
- #define S3C64XX_GPN(_nr) (S3C64XX_GPIO_N_START + (_nr))
- #define S3C64XX_GPO(_nr) (S3C64XX_GPIO_O_START + (_nr))
- #define S3C64XX_GPP(_nr) (S3C64XX_GPIO_P_START + (_nr))
- #define S3C64XX_GPQ(_nr) (S3C64XX_GPIO_Q_START + (_nr))
- //定義了引腳号的範圍,引腳号必須小于這個數,不然就是無效的
- #define S3C64XX_GPIO_END (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
- #define S3C_GPIO_END S3C64XX_GPIO_END
- //與上面一樣,定義了引腳的總個數,引腳号不能超過這個數,我們可以利用它判斷某個引腳編号的有效性。
- #define ARCH_NR_GPIOS (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
- //由上面的分析可知,這個頭檔案對s3c64xx系列的晶片的引腳進行了統一的編号,按GPA-->GPQ的順序對給每個引腳編了個号。
- #include <asm-generic/gpio.h> //這個頭檔案是包含在此檔案中的,它裡面包含了許多gpio的操作函數,而這些函數可以直接使用上述宏定義對具體的單個引腳進行操作,如下:
[cpp] view plain copy
- #ifndef _ASM_GENERIC_GPIO_H
- #define _ASM_GENERIC_GPIO_H
- #include <linux/types.h>
- #include <linux/errno.h>
- #ifdef CONFIG_GPIOLIB
- #include <linux/compiler.h>
- #ifndef ARCH_NR_GPIOS
- #define ARCH_NR_GPIOS 256
- #endif
- static inline int gpio_is_valid(int number)
- {
- return ((unsigned)number) < ARCH_NR_GPIOS;
- }
- struct seq_file;
- struct module;
- struct gpio_chip {
- const char *label;
- struct device *dev;
- struct module *owner;
- int (*request)(struct gpio_chip *chip,
- unsigned offset);
- void (*free)(struct gpio_chip *chip,
- unsigned offset);
- int (*direction_input)(struct gpio_chip *chip,
- unsigned offset);
- int (*get)(struct gpio_chip *chip,
- unsigned offset);
- int (*direction_output)(struct gpio_chip *chip,
- unsigned offset, int value);
- void (*set)(struct gpio_chip *chip,
- unsigned offset, int value);
- int (*to_irq)(struct gpio_chip *chip,
- unsigned offset);
- void (*dbg_show)(struct seq_file *s,
- struct gpio_chip *chip);
- int base;
- u16 ngpio;
- unsigned can_sleep:1;
- unsigned exported:1;
- };
- extern const char *gpiochip_is_requested(struct gpio_chip *chip,
- unsigned offset);
- extern int __must_check gpiochip_reserve(int start, int ngpio);
- extern int gpiochip_add(struct gpio_chip *chip);
- extern int __must_check gpiochip_remove(struct gpio_chip *chip);
- extern int gpio_request(unsigned gpio, const char *label);
- //通過檢視該gpio儲存的記錄标志是否為NULL來判斷GPIO是否被占用,并為它去個*lable
- //例如:if(gpio_request(S3C64XX_GPB(0), "GPB"))
- extern void gpio_free(unsigned gpio);
- //釋放gpio,就是把對應GPIO口的控制标志FLAG_REQUESTED清掉,成NULL,之後可以再被其他調用。
- extern int gpio_direction_input(unsigned gpio);
- //将gpio配置成輸入模式
- extern int gpio_direction_output(unsigned gpio, int value);
- //将gpio配置成輸出模式,并且将gpio置為value,
- //例如:gpio_direction_output (S3C64XX_GPB(0), 1)
- extern int gpio_get_value_cansleep(unsigned gpio);//???
- extern void gpio_set_value_cansleep(unsigned gpio, int value);//???
- extern int __gpio_get_value(unsigned gpio);
- //讀取gpio的值
- extern void __gpio_set_value(unsigned gpio, int value);
- //設定gpio的值為value
- extern int __gpio_cansleep(unsigned gpio);//???
- extern int __gpio_to_irq(unsigned gpio);///???
- #ifdef CONFIG_GPIO_SYSFS
- extern int gpio_export(unsigned gpio, bool direction_may_change);
- extern void gpio_unexport(unsigned gpio);
- #endif
- #else
- static inline int gpio_is_valid(int number)
- {
- return number >= 0;
- }
- static inline int gpio_cansleep(unsigned gpio)
- {
- return 0;
- }
- static inline int gpio_get_value_cansleep(unsigned gpio)
- {
- might_sleep();
- return gpio_get_value(gpio);
- }
- static inline void gpio_set_value_cansleep(unsigned gpio, int value)
- {
- might_sleep();
- gpio_set_value(gpio, value);
- }
- #endif
- #ifndef CONFIG_GPIO_SYSFS
- static inline int gpio_export(unsigned gpio, bool direction_may_change)
- {
- return -ENOSYS;
- }
- static inline void gpio_unexport(unsigned gpio)
- {
- }
- #endif
- #endif
[cpp] view plain copy
- 二、<plat/regs-gpio.h>頭檔案:
[cpp] view plain copy
- #ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_H
- #define __ASM_PLAT_S3C64XX_REGS_GPIO_H __FILE__
- //這裡包含了從a-q的相關頭檔案,這些頭檔案裡分别是gpa-gpq相關的宏,
- //以下隻列出<plat/gpio-bank-m.h>中的内容
- #include <plat/gpio-bank-a.h>
- #include <plat/gpio-bank-b.h>
- #include <plat/gpio-bank-c.h>
- #include <plat/gpio-bank-d.h>
- #include <plat/gpio-bank-e.h>
- #include <plat/gpio-bank-f.h>
- #include <plat/gpio-bank-g.h>
- #include <plat/gpio-bank-h.h>
- #include <plat/gpio-bank-i.h>
- #include <plat/gpio-bank-j.h>
- #include <plat/gpio-bank-k.h>
- #include <plat/gpio-bank-l.h>
- #include <plat/gpio-bank-m.h>
- #include <plat/gpio-bank-n.h>
- #include <plat/gpio-bank-q.h>
- #include <plat/gpio-bank-o.h>
- #include <plat/gpio-bank-p.h>
- #include <plat/gpio-bank-q.h>
- #include <mach/map.h>
- //由虛拟位址加偏移位址計算基位址。以GPM的基位址計算為例:
- //gpm的虛拟位址是S3C64XX_VA_GPIO,定義在mach/map.h中:
- //#define S3C64XX_VA_GPIO S3C_ADDR(0x00500000)
- //S3C_ADDR(0x00500000)是定義在plat/map.h中的:
- //#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE+ (x))
- //S3C_ADDR_BASE是全局虛拟位址,它的定義是:#define S3C_ADDR_BASE (0xF4000000)
- //void __iomem __force *作用是強制轉化為位址
- //綜合以上,GPM的宏S3C64XX_GPM_BASE展開的情形是:
- //(0xF4000000+0x00500000)+ 0x0820 = 0xf4500820,括号裡面的是虛拟位址,後面的是
- //偏移量,查S3C6410的手冊會發現這個位址剛好是GPMCON寄存器的位址!!!!!
[cpp] view plain copy
- #define S3C64XX_GPA_BASE (S3C64XX_VA_GPIO + 0x0000)
- #define S3C64XX_GPB_BASE (S3C64XX_VA_GPIO + 0x0020)
- #define S3C64XX_GPC_BASE (S3C64XX_VA_GPIO + 0x0040)
- #define S3C64XX_GPD_BASE (S3C64XX_VA_GPIO + 0x0060)
- #define S3C64XX_GPE_BASE (S3C64XX_VA_GPIO + 0x0080)
- #define S3C64XX_GPF_BASE (S3C64XX_VA_GPIO + 0x00A0)
- #define S3C64XX_GPG_BASE (S3C64XX_VA_GPIO + 0x00C0)
- #define S3C64XX_GPH_BASE (S3C64XX_VA_GPIO + 0x00E0)
- #define S3C64XX_GPI_BASE (S3C64XX_VA_GPIO + 0x0100)
- #define S3C64XX_GPJ_BASE (S3C64XX_VA_GPIO + 0x0120)
- #define S3C64XX_GPK_BASE (S3C64XX_VA_GPIO + 0x0800)
- #define S3C64XX_GPL_BASE (S3C64XX_VA_GPIO + 0x0810)
- #define S3C64XX_GPM_BASE (S3C64XX_VA_GPIO + 0x0820)
- #define S3C64XX_GPN_BASE (S3C64XX_VA_GPIO + 0x0830)
- #define S3C64XX_GPO_BASE (S3C64XX_VA_GPIO + 0x0140)
- #define S3C64XX_GPP_BASE (S3C64XX_VA_GPIO + 0x0160)
- #define S3C64XX_GPQ_BASE (S3C64XX_VA_GPIO + 0x0180)
- #define S3C64XX_SPC_BASE (S3C64XX_VA_GPIO + 0x01A0)
- #define S3C64XX_MEM0CONSTOP (S3C64XX_VA_GPIO + 0x01B0)
- #define S3C64XX_MEM1CONSTOP (S3C64XX_VA_GPIO + 0x01B4)
- #define S3C64XX_MEM0CONSLP0 (S3C64XX_VA_GPIO + 0x01C0)
- #define S3C64XX_MEM0CONSLP1 (S3C64XX_VA_GPIO + 0x01C4)
- #define S3C64XX_MEM1CONSLP (S3C64XX_VA_GPIO + 0x01C8)
- #define S3C64XX_MEM0DRVCON (S3C64XX_VA_GPIO + 0x01D0)
- #define S3C64XX_MEM1DRVCON (S3C64XX_VA_GPIO + 0x01D4)
- #define S3C64XX_EINT0CON0 (S3C64XX_VA_GPIO + 0x0900)
- #define S3C64XX_EINT0CON1 (S3C64XX_VA_GPIO + 0x0904)
- #define S3C64XX_EINT0FLTCON0 (S3C64XX_VA_GPIO + 0x0910)
- #define S3C64XX_EINT0FLTCON1 (S3C64XX_VA_GPIO + 0x0914)
- #define S3C64XX_EINT0FLTCON2 (S3C64XX_VA_GPIO + 0x0918)
- #define S3C64XX_EINT0FLTCON3 (S3C64XX_VA_GPIO + 0x091C)
- #define S3C64XX_EINT0MASK (S3C64XX_VA_GPIO + 0x0920)
- #define S3C64XX_EINT0PEND (S3C64XX_VA_GPIO + 0x0924)
- #define S3C64XX_SPCONSLP (S3C64XX_VA_GPIO + 0x0880)
- #define S3C64XX_SLPEN (S3C64XX_VA_GPIO + 0x0930)
- #define S3C64XX_EINT12CON (S3C64XX_VA_GPIO + 0x0200)
- #define S3C64XX_EINT34CON (S3C64XX_VA_GPIO + 0x0204)
- #define S3C64XX_EINT56CON (S3C64XX_VA_GPIO + 0x0208)
- #define S3C64XX_EINT78CON (S3C64XX_VA_GPIO + 0x020C)
- #define S3C64XX_EINT9CON (S3C64XX_VA_GPIO + 0x0210)
- #define S3C64XX_EINT12FLTCON (S3C64XX_VA_GPIO + 0x0220)
- #define S3C64XX_EINT34FLTCON (S3C64XX_VA_GPIO + 0x0224)
- #define S3C64XX_EINT56FLTCON (S3C64XX_VA_GPIO + 0x0228)
- #define S3C64XX_EINT78FLTCON (S3C64XX_VA_GPIO + 0x022C)
- #define S3C64XX_EINT9FLTCON (S3C64XX_VA_GPIO + 0x0230)
- #define S3C64XX_EINT12MASK (S3C64XX_VA_GPIO + 0x0240)
- #define S3C64XX_EINT34MASK (S3C64XX_VA_GPIO + 0x0244)
- #define S3C64XX_EINT56MASK (S3C64XX_VA_GPIO + 0x0248)
- #define S3C64XX_EINT78MASK (S3C64XX_VA_GPIO + 0x024C)
- #define S3C64XX_EINT9MASK (S3C64XX_VA_GPIO + 0x0250)
- #define S3C64XX_EINT12PEND (S3C64XX_VA_GPIO + 0x0260)
- #define S3C64XX_EINT34PEND (S3C64XX_VA_GPIO + 0x0264)
- #define S3C64XX_EINT56PEND (S3C64XX_VA_GPIO + 0x0268)
- #define S3C64XX_EINT78PEND (S3C64XX_VA_GPIO + 0x026C)
- #define S3C64XX_EINT9PEND (S3C64XX_VA_GPIO + 0x0270)
- #define S3C64XX_PRIORITY (S3C64XX_VA_GPIO + 0x0280)
- #define S3C64XX_SERVICE (S3C64XX_VA_GPIO + 0x0284)
- #define S3C64XX_SERVICEPEND (S3C64XX_VA_GPIO + 0x0288)
- #define S3C64XX_EXTINT_LOWLEV (0x00)
- #define S3C64XX_EXTINT_HILEV (0x01)
- #define S3C64XX_EXTINT_FALLEDGE (0x02)
- #define S3C64XX_EXTINT_RISEEDGE (0x04)
- #define S3C64XX_EXTINT_BOTHEDGE (0x06)
- #endif
[cpp] view plain copy
- 以下僅列出<plat/gpio-bank-m.h>中的内容:
[cpp] view plain copy
- #define S3C64XX_GPMCON (S3C64XX_GPM_BASE + 0x00)
- //經過上面的計算容易知道,這個宏就是GPMCON的位址
- #define S3C64XX_GPMDAT (S3C64XX_GPM_BASE + 0x04)
- //GPMDAT的位址
- #define S3C64XX_GPMPUD (S3C64XX_GPM_BASE + 0x08)
- //GPMPUD的位址
- #define S3C64XX_GPM_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
- #define S3C64XX_GPM_INPUT(__gpio) (0x0 << ((__gpio) * 2))
- //輸入的配置資料宏,将GPMCON與之按位與就能将gpio位配置為輸入
- #define S3C64XX_GPM_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
- //輸出的配置資料宏,将GPMCON與之按位或就能将gpio位配置為輸出
- #define S3C64XX_GPM0_HOSTIF_CS (0x02 << 0)
- #define S3C64XX_GPM0_EINT23 (0x03 << 0)
- #define S3C64XX_GPM0_RESERVED1 (0x04 << 0)
- #define S3C64XX_GPM0_DATA_CF10 (0x05 << 0)
- #define S3C64XX_GPM0_CE_CF0 (0x06 << 0)
- #define S3C64XX_GPM0_RESERVED2 (0x07 << 0)
- #define S3C64XX_GPM1_HOSTIF_CS_M (0x02 << 0)
- #define S3C64XX_GPM1_EINT24 (0x03 << 0)
- #define S3C64XX_GPM1_RESERVED1 (0x04 << 0)
- #define S3C64XX_GPM1_DATA_CF11 (0x05 << 0)
- #define S3C64XX_GPM1_CE_CF1 (0x06 << 0)
- #define S3C64XX_GPM1_RESERVED2 (0x07 << 0)
- #define S3C64XX_GPM2_HOSTIF_IF_CS_S (0x02 << 0)
- #define S3C64XX_GPM2_EINT25 (0x03 << 0)
- #define S3C64XX_GPM2_HOSTIF_MDP_VSYNC (0x04 << 0)
- #define S3C64XX_GPM2_DATA_CF12 (0x05 << 0)
- #define S3C64XX_GPM2_IORD_CF (0x06 << 0)
- #define S3C64XX_GPM2_RESERVED2 (0x07 << 0)
- #define S3C64XX_GPM3_HOSTIF_WE (0x02 << 0)
- #define S3C64XX_GPM3_EINT26 (0x03 << 0)
- #define S3C64XX_GPM3_RESERVED1 (0x04 << 0)
- #define S3C64XX_GPM3_DATA_CF13 (0x05 << 0)
- #define S3C64XX_GPM3_IOWR_CF (0x06 << 0)
- #define S3C64XX_GPM3_RESERVED2 (0x07 << 0)
- #define S3C64XX_GPM4_HOSTIF_OE (0x02 << 0)
- #define S3C64XX_GPM4_EINT27 (0x03 << 0)
- #define S3C64XX_GPM4_RESERVED1 (0x04 << 0)
- #define S3C64XX_GPM4_DATA_CF14 (0x05 << 0)
- #define S3C64XX_GPM4_IORDY_CF (0x06 << 0)
- #define S3C64XX_GPM4_RESERVED2 (0x07 << 0)
- #define S3C64XX_GPM5_HOSTIF_INTR (0x02 << 0)
- #define S3C64XX_GPM5_CF_DATA_DIR (0x03 << 0)
- #define S3C64XX_GPM5_RESERVED1 (0x04 << 0)
- #define S3C64XX_GPM5_DATA_CF15 (0x05 << 0)
- #define S3C64XX_GPM5_RESERVED2 (0x06 << 0)
- #define S3C64XX_GPM5_RESERVED3 (0x07 << 0)
[cpp] view plain copy
[cpp] view plain copy
- 三、<plat/gpio-cfg.h>頭檔案:
- <pre class="cpp" name="code">
- #ifndef __PLAT_GPIO_CFG_H
- #define __PLAT_GPIO_CFG_H __FILE__
- typedef unsigned int __bitwise__ s3c_gpio_pull_t;
- struct s3c_gpio_chip;
- struct s3c_gpio_cfg {
- unsigned int cfg_eint;
- s3c_gpio_pull_t (*get_pull)(struct s3c_gpio_chip *chip, unsigned offs);
- int (*set_pull)(struct s3c_gpio_chip *chip, unsigned offs,
- s3c_gpio_pull_t pull);
- unsigned (*get_config)(struct s3c_gpio_chip *chip, unsigned offs);
- int (*set_config)(struct s3c_gpio_chip *chip, unsigned offs,
- unsigned config);
- };
- #define S3C_GPIO_SPECIAL_MARK (0xfffffff0)
- #define S3C_GPIO_SPECIAL(x) (S3C_GPIO_SPECIAL_MARK | (x))
- #define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
- #define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1))
- #define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x))
- #define s3c_gpio_is_cfg_special(_cfg) \
- (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
- extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
- //此宏函數将pin引腳配置成“to”功能,to可以取 中定義的值
- #define S3C_GPIO_PULL_NONE ((__force s3c_gpio_pull_t)0x00)
- #define S3C_GPIO_PULL_DOWN ((__force s3c_gpio_pull_t)0x01)
- #define S3C_GPIO_PULL_UP ((__force s3c_gpio_pull_t)0x02)
- extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
- //将pin引腳的上拉電阻設定成“pull”狀态,pull可以去上面宏定義的那些值
- extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
- //讀取pin引腳上拉電阻的狀态
- #endif