免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2196 | 回复: 6
打印 上一主题 下一主题

IRQ_ADC problem [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-14 10:54 |只看该作者 |倒序浏览
在IRQ_TC已经触发的情况下,出发IRQ_ADC中断触发失败为所么,代码如下
#include<g-bios.h>
#include<stdio.h>
#include <core/init.h>
#include <arch/s3c24xx.h>
#include <core/irq.h>
#include <core/io.h>

static int hello(void)
{
        printf("hello maxwit CHINA");
        return 0;
}

static int XYposition(void)
{
        printf("hello long");
        return 0;
}

static __INIT__  int S3cTouch(void)
{
        int ret;
        ret = GkRegisterIsr(IRQ_TC,hello,NULL);
        ret = GkRegisterIsr(IRQ_ADC,XYposition,NULL);
        writel(0xd3,VA(0x58000004));
        writel(0xd7,VA(0x58000004));
       
        return ret;
}

DRIVER_INIT(S3cTouch);

论坛徽章:
0
2 [报告]
发表于 2009-10-14 10:57 |只看该作者

回复 #1 longxinhui 的帖子

IRQ_ADC中断触发失败,我想可能的原因是你没有Enable ADC?你可以从这里去查查

论坛徽章:
0
3 [报告]
发表于 2009-10-14 11:27 |只看该作者
我以这种方式设置ADCCON,怎么还是没反应,就连IRQ_TC中断也不出发了。设置方式如下:

        ret = GkRegisterIsr(IRQ_TC,hello,NULL);
        ret = GkRegisterIsr(IRQ_ADC,XYposition,NULL);
        writel(0xd3,VA(0x58000004));
        writel(0xd7,VA(0x58000004));
        writel((1<<14)|(49<<6)|(4<<3)|(1<<1)|1,VA(0x58000000));

论坛徽章:
0
4 [报告]
发表于 2009-10-14 11:42 |只看该作者
解决了,把ADC中断出发了,现在就是怎么协调好TC中断和ADC中断

论坛徽章:
0
5 [报告]
发表于 2009-10-14 11:46 |只看该作者
ADC TOUCH SCREEN CONTROL REGISTER (ADCTSC) 0x58000004

S3C2440 datasheet上有介绍Touch Screen Interface Mode有四种:
1. Normal Conversion Mode
2. Separate X/Y position conversion Mode
3. Auto(Sequential) X/Y Position Conversion Mode
4. Waiting for Interrupt Mode
这四种模式是通过ADC TOUCH SCREEN CONTROL REGISTER (ADCTSC) 寄存器bit[0-2]控制的
bit[2]  : Automatically sequencing conversion of X-Position and Y-Position
            0 = Normal ADC conversion.
            1 = Auto Sequential measurement of X-position, Y-position
bit[1:0]:Manually measurement of X-Position or Y-Position.
             00 = No operation mode
             01 = X-position measurement
             10 = Y-position measurement
             11 = Waiting for Interrupt Mode

ADCTS寄存器被你写了两次,第一个值是0xd3(bit[0-1]:为0x11)Touch Screen Interface Mode为Waiting for Interrupt Mode
第二次写的值是0xd7(bit[2]=1)Touch Screen Interface Mode为Auto(Sequential) X/Y Position Conversion Mode
以第二次为准,也就是现在Touch Screen Interface Mode为Auto(Sequential) X/Y Position Conversion Mode,所以不会触发IRQ_TC中断

论坛徽章:
0
6 [报告]
发表于 2009-10-14 11:59 |只看该作者
新思路协调ADC中断和TC中断的方式,在TC中断的处理函数出发ADC中断

论坛徽章:
0
7 [报告]
发表于 2009-10-14 12:14 |只看该作者
新情况协调ADC中断和TC中断的方式时,在TC中断的处理函数触发ADC中断,但是在触发一次TC中断时,多次出发ADC中断,如TC中断处理函数里出发ADC中断同时还打印hello maxwit CHINA, ADC中断处理函数只打印hell long,现象如下:
hello maxwit CHINAhello longhello longhello longhello long

code:

static int XYposition(void)
{
        printf("hello long");                                                
        return 0;
}

static int hello(void)
{
        int ret;
        writel((1<<14)|(49<<6)|(4<<3)|1,VA(0x58000000));
        ret = GkRegisterIsr(IRQ_ADC,XYposition,NULL);
        //writel(0xd4,VA(0x58000004));
        //writel((1<<14)|(49<<6)|(4<<3)|1,VA(0x58000000));

        printf("hello maxwit CHINA");
        return 0;
}

static __INIT__  int S3cTouch(void)
{
        int ret;
       
        writel(0xd3,VA(0x58000004));
        ret = GkRegisterIsr(IRQ_TC,hello,NULL);
        //ret = GkRegisterIsr(IRQ_ADC,XYposition,NULL);
        //writel(0xd4,VA(0x58000004));
//        writel((1<<14)|(49<<6)|(4<<3)|1,VA(0x58000000));
       
        return ret;
}

DRIVER_INIT(S3cTouch);
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP