touch
来源:互联网 发布:封狼居胥有几人 知乎 编辑:程序博客网 时间:2024/05/17 02:37
#ifndef __SAM_TOUCH_H
#define __SAM_TOUCH_H
#define EXYNOS4412_GPIO_PART1_BASE 0x11400000
#define EXYNOS4412_GPIO_PART2_BASE 0x11000000
/* GPX0 */
#define GPX0CON_OFFSET 0xc00
#define GPX0DAT_OFFSET 0xc04
#define GPX0PUD_OFFSET 0xc08
#define GPX0DRV_OFFSET 0xc0c
extern void touch_init(void);
#define readb(a) (*(volatile unsigned char*)(a))
#define readw(a) (*(volatile unsigned short*)(a))
#define readl(a) (*(volatile unsigned int*)(a))
#define writeb(v,a) (*(volatile unsigned char *)(a) = (v))
#define writew(v,a) (*(volatile unsigned short *)(a) =(v))
#define writel(v,a) (*(volatile unsigned int *)(a) = (v))
//LCD Clock Relate Register
#define CLK_DIV_LCD (*(volatile unsigned int *)0x1003c534)
#define CLK_SRC_MASK_LCD (*(volatile unsigned int *)0x1003c334)
#define CLK_GATE_IP_LCD (*(volatile unsigned int *)0x1003c934)
#define CLK_SRC_LCD0 (*(volatile unsigned int *)0x1003c234)
//LCD OP Control Regiester
#define GPF0CON (*(volatile unsigned int *)0x11400180)
#define GPF0DAT (*(volatile unsigned int *)0x11400184)
#define GPF0PUD (*(volatile unsigned int *)0x11400188)
#define GPF0DRV (*(volatile unsigned int *)0x1140018C)
//LCD Control Register
#define LCD_BASE 0x11C00000
#define VIDCON0 (*(volatile unsigned int *)(LCD_BASE +0x0000))
#define VIDCON1 (*(volatile unsigned int *)(LCD_BASE +0x0004))
#define VIDCON2 (*(volatile unsigned int *)(LCD_BASE +0x0008))
#define VIDCON3 (*(volatile unsigned int *)(LCD_BASE +0x000C))
/*
* Bit Definitions
*/
/* VIDCON0 */
#define EXYNOS_VIDCON0_DSI_DISABLE (0<< 30)
#define EXYNOS_VIDCON0_DSI_ENABLE (1 << 30)
#define EXYNOS_VIDCON0_SCAN_PROGRESSIVE (0<< 29)
#define EXYNOS_VIDCON0_SCAN_INTERLACE (1 << 29)
#define EXYNOS_VIDCON0_SCAN_MASK (1 << 29)
#define EXYNOS_VIDCON0_VIDOUT_RGB (0 << 26)
#define EXYNOS_VIDCON0_VIDOUT_ITU (1 << 26)
#define EXYNOS_VIDCON0_VIDOUT_I80LDI0 (2<< 26)
#define EXYNOS_VIDCON0_VIDOUT_I80LDI1 (3<< 26)
#define EXYNOS_VIDCON0_VIDOUT_WB_RGB (4<< 26)
#endif
#include <config.h>
#include <common.h>
#include<sam_ts2007.h>
void touch_cfg_i2c()
{
u32 cfg = 0;
int shift_bits = 0;
int set_bit = 0;
I2C_InitIp(I2C7, I2C_TX_CLOCK_125KHZ, I2C_TIMEOUT_INFINITY); //xxl
// -----CHG_EN == BK_VDD_EN-------
//-----EXYNOS4_GPL0(4)-----
//err = gpio_request(EXYNOS4_GPL0(4), "BK_VDD_EN");
//gpio_direction_output(EXYNOS4_GPL0(4), 1);
//s3c_gpio_cfgpin(EXYNOS4_GPL0(4), S3C_GPIO_OUTPUT);
//config as output and output 1
shift_bits = 4;
set_bit = 4;
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPL0CON_OFFSET);
cfg &= ~(0xf<<(set_bit* shift_bits)); //clear 4 bits
cfg |= (1<< (set_bit* shift_bits)); //config as output
printf("[%s] GPL0_4, CON, set, cfg= 0x%x \n", __FUNCTION__, cfg);
writel(cfg, (EXYNOS4412_GPIO_PART2_BASE + GPL0CON_OFFSET) );
udelay(100000);
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPL0CON_OFFSET);
printf("[%s] GPL0_4, CON, read, cfg= 0x%x \n", __FUNCTION__, cfg);
shift_bits = 1;
set_bit = 4;
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPL0DAT_OFFSET);
cfg &= ~(1<<(set_bit* shift_bits)); //clear 1 bits
cfg |= (1<< (set_bit* shift_bits)); //write 1 to data reg
printf("[%s] GPL0_4, DAT, set, cfg= 0x%x \n", __FUNCTION__, cfg);
writel(cfg, (EXYNOS4412_GPIO_PART2_BASE + GPL0DAT_OFFSET) );
udelay(100000);
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPL0DAT_OFFSET);
printf("[%s] GPL0_4, DAT, read, cfg= 0x%x \n", __FUNCTION__, cfg);
printf("[%s] CHG_EN == BK_VDD_EN \n", __FUNCTION__);
printf("[%s] complete ------------\n", __FUNCTION__);
}
void touch_init()
{
u32 cfg = 0;
int shift_bits = 0;
int set_bit = 0;
printf("[%s] begin------------------- \n", __FUNCTION__);
//err = gpio_request_one(EXYNOS4_GPX0(0), GPIOF_IN, "TSC2007_IRQ");
//s3c_gpio_cfgpin(EXYNOS4_GPX0(0), S3C_GPIO_SFN(0xF));
//s3c_gpio_setpull(EXYNOS4_GPX0(0), S3C_GPIO_PULL_NONE);
//config as wakeup INT and not pull
shift_bits = 4;
set_bit = 0;
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPX0CON_OFFSET);
cfg &= ~(0xf<<(set_bit* shift_bits)); //clear 4 bits
cfg |= (0xf<< (set_bit* shift_bits)); //config as WAKE_UP INT
printf("[%s] GPX0_0, CON, set, cfg= 0x%x \n", __FUNCTION__, cfg);
writel(cfg, (EXYNOS4412_GPIO_PART2_BASE + GPX0CON_OFFSET) );
udelay(100000);
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPX0CON_OFFSET);
printf("[%s] GPX0_0, CON, read, cfg= 0x%x \n", __FUNCTION__, cfg);
shift_bits = 2;
set_bit = 0;
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPX0PUD_OFFSET);
cfg &= ~(2<<(set_bit* shift_bits)); //clear 2 bits
cfg |= (0<< (set_bit* shift_bits)); //config as not pull
printf("[%s] GPX0_0, PUD, set, cfg= 0x%x \n", __FUNCTION__, cfg);
writel(cfg, (EXYNOS4412_GPIO_PART2_BASE + GPX0PUD_OFFSET) );
udelay(100000);
cfg = readl(EXYNOS4412_GPIO_PART2_BASE + GPX0PUD_OFFSET);
printf("[%s] GPX0_0, PUD, read, cfg= 0x%x \n", __FUNCTION__, cfg);
printf("[%s] complete ---------------------------\n", __FUNCTION__);
}
void do_touch_on()
{
int i= 0;
printf("[%s] begin ----------[---\n\n", __FUNCTION__);
touch_cfg_i2c();
touch_init();
lcd_draw_bmp(gImage_bmp);
for(i= 0; i<20; i++)
{
lcd_printf("abc,%d", i);
lcd_printf("efg,%d", i);
lcd_printf("hij,%d", i);
}
printf("[%s] complete -------]---\n\n", __FUNCTION__);
while(1) ;
}
- touch
- touch
- Touch
- TOUCH
- touch & >
- touch
- touch
- Touch
- touch
- touch
- touch
- touch
- touch
- Touch
- Touch
- touch
- touch
- touch
- 3月23日 晚十点 所思~想~感
- 使用IDEA构建Spark开发环境(支持maven)
- List<T>的各种排序方法
- jquery基础篇(三)— —DOM和事件
- C++第二次基础训练,加入类与对象
- touch
- systemserver探究笔记
- 函数
- 时间管理心法
- ubuntu无法启动的解决方法
- Java打开网页获取数据,自动访问,打开指定URL
- Median of Two Sorted Arrays(3)
- 程序员的自我修养——内存
- 19 API-IO流(异常,File)