娇小w搡bbbb搡bbb,《第一次の人妻》,中国成熟妇女毛茸茸,边啃奶头边躁狠狠躁视频免费观看

Tiny6410移植tslib

發(fā)布者:technology78最新更新時間:2024-09-20 來源: cnblogs關(guān)鍵字:Tiny6410  移植 手機(jī)看文章 掃描二維碼
隨時隨地手機(jī)看文章

一、將Tiny6410一線觸摸程序改成輸入設(shè)備(input device)


由于友善一線觸摸下位機(jī)不開源,所以只能在官方提供的內(nèi)核模塊上進(jìn)行修改。


官方源代碼:http://pan.baidu.com/s/1bog4rZD


1、修改模塊加載函數(shù)


 1 static int __init dev_init(void)

 2 {

 3     int ret;

 4 #ifdef TS_INPUT_DRIVER

 5     /* alloc input system device */

 6     ts.input = input_allocate_device();

 7     

 8     ts.input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);

 9     ts.input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);

10     

11     input_set_abs_params(ts.input, ABS_X, 0, 0xFFFF, 0, 0);

12     input_set_abs_params(ts.input, ABS_Y, 0, 0xFFFF, 0, 0);

13 

14     ts.input->name = 'Tiny6410 TouchScreen';

15     ts.input->id.bustype = BUS_HOST;

16     ts.input->id.vendor = 0xDEAD;

17     ts.input->id.product = 0xBEEF;

18     ts.input->id.version = 0x0102;

19 

20 

21     set_pin_up();

22     set_pin_value(1);

23     set_pin_as_output();

24     setup_irq(IRQ_TIMER3, &timer_for_1wire_irq);

25     ret = init_timer_for_1wire();

26     if(ret < 0)

27     {

28         printk(TOUCH_DEVICE_NAME'timer init failedn');

29         goto timer_err;

30     }

31     init_timer(&one_wire_timer);

32     one_wire_timer_proc(0);

33     create_proc_read_entry('driver/one-wire-info', 0, NULL, read_proc, NULL);

34 

35     /* register to the input system */

36     ret = input_register_device(ts.input);

37     if(ret < 0)

38     {

39         printk(TOUCH_DEVICE_NAME'failed to register input devicen');

40         goto timer_err;

41     }

42     

43     return 0;

44 timer_err:

45     free_irq(IRQ_TIMER3, &timer_for_1wire_irq);

46 

47 #else

48 

49     ret = misc_register(&ts_misc) | misc_register(&bl_misc) ;

50     set_pin_up();

51     set_pin_value(1);

52     set_pin_as_output();

53 

54     if (ret == 0) {

55         setup_irq(IRQ_TIMER3, &timer_for_1wire_irq);

56         ret = init_timer_for_1wire();

57         init_timer(&one_wire_timer);

58         one_wire_timer_proc(0);

59         create_proc_read_entry('driver/one-wire-info', 0, NULL, read_proc, NULL);

60     }

61     

62     if (ret == 0) {

63         printk (TOUCH_DEVICE_NAME'tinitializedn');

64         printk (BACKLIGHT_DEVICE_NAME'tinitializedn');

65     }

66 #endif

67 

68     return ret;

69 }


在這個函數(shù)中提交輸入的事件EV_KEY、EV_ABS、BTN_TOUCH,并注冊輸入設(shè)備到系統(tǒng)。


2、向輸入子系統(tǒng)報告輸入事件


修改源代碼notify_ts_data()函數(shù):


 1 static inline void notify_ts_data(unsigned x, unsigned y, unsigned down)

 2 {

 3     if (!down && !(ts_status &(1U << 31))) {

 4         // up repeat, give it up

 5 #ifdef TS_INPUT_DRIVER

 6         input_report_key(ts.input, BTN_TOUCH, 0);

 7         input_sync(ts.input);

 8 #endif

 9         return;

10     }

11 #ifdef TS_INPUT_DRIVER

12     ts.xp = x;

13     ts.yp = y;

14     //printk('ts.xp = %ld,ts.yp = %ldn',ts.xp,ts.yp);

15     input_report_abs(ts.input, ABS_X, ts.xp);

16     input_report_abs(ts.input, ABS_Y, ts.yp);

17 

18     input_report_key(ts.input, BTN_TOUCH, 1);

19     input_sync(ts.input);

20 #else

21     ts_status = ((x << 16) | (y)) | (down << 31);

22     ts_ready = 1;

23     wake_up_interruptible(&ts_waitq);

24 #endif

25 }


這個函數(shù)在按鍵按下時向輸入子系統(tǒng)報告X/Y軸坐標(biāo)的AD值和按鍵按下標(biāo)志,在按鍵釋放時報告按鍵釋放標(biāo)志。


3、修改模塊卸載函數(shù)


 1 static void __exit dev_exit(void)

 2 {

 3     exitting = 1;

 4 #ifdef TS_INPUT_DRIVER

 5     input_unregister_device(ts.input);

 6 #endif

 7     remove_proc_entry('driver/one-wire-info', NULL);

 8     del_timer_sync(&one_wire_timer);

 9     free_irq(IRQ_TIMER3, &timer_for_1wire_irq);

10 #ifndef TS_INPUT_DRIVER

11     misc_deregister(&ts_misc);

12     misc_deregister(&bl_misc);

13 #endif

14 }


在模塊卸載函數(shù)中卸載輸入設(shè)備。


二、移植tslib到開發(fā)板


tslib源碼下載:http://pan.baidu.com/s/1qXuqPdU


編譯工具:arm-linux-gcc


1、下載源碼并解壓


tar xzbf tslib-1.4.tar.gz

 

2、修改源碼


打開源碼tslib/plugins/input-raw.c文件


首先修改check_fd()函數(shù),由于設(shè)備驅(qū)動沒有用到ioctl,所以這個檢測函數(shù)直接返回0。但是設(shè)備驅(qū)動用到了同步所以要把using_syn = 1:


 1 static int check_fd(struct tslib_input *i)

 2 {

 3     struct tsdev *ts = i->module.dev;

 4     int version;

 5     u_int32_t bit;

 6     u_int64_t absbit;

 7 /*

 8     if (! ((ioctl(ts->fd, EVIOCGVERSION, &version) >= 0) &&

 9         (version == EV_VERSION) &&

10         (ioctl(ts->fd, EVIOCGBIT(0, sizeof(bit) * 8), &bit) >= 0) &&

11         (bit & (1 << EV_ABS)) &&

12         (ioctl(ts->fd, EVIOCGBIT(EV_ABS, sizeof(absbit) * 8), &absbit) >= 0) &&

13         (absbit & (1 << ABS_X)) &&

14         (absbit & (1 << ABS_Y)) && (absbit & (1 << ABS_PRESSURE)))) {

15         fprintf(stderr, 'selected device is not a touchscreen I understandn');

16         return -1;

17     }

18 */

19     printf('selected device!n');

20     //if (bit & (1 << EV_SYN))

21         i->using_syn = 1;

22 

23     return 0;

24 }


修改ts_input_read()函數(shù),根據(jù)設(shè)備驅(qū)動程序可以知道,設(shè)備驅(qū)動提交BTN_TOUCH表示觸摸屏有無按下,且設(shè)備驅(qū)動沒有提交ABS_PRESSURE


 1 static int ts_input_read(struct tslib_module_info *inf,

 2              struct ts_sample *samp, int nr)

 3 {

 4     struct tslib_input *i = (struct tslib_input *)inf;

 5     struct tsdev *ts = inf->dev;

 6     struct input_event ev;

 7     int ret = nr;

 8     int total = 0;

 9 

10     if (i->sane_fd == 0)

11         i->sane_fd = check_fd(i);

12 

13     if (i->sane_fd == -1)

14         return 0;

15 

16     if (i->using_syn) {

17         while (total < nr) 

18         {

19             ret = read(ts->fd, &ev, sizeof(struct input_event));

20             if (ret < (int)sizeof(struct input_event)) {

21                 total = -1;

22                 break;

23             }

24             switch (ev.type) 

25             {

26             case EV_KEY:

27                 switch (ev.code) 

28                 {

29                 case BTN_TOUCH:

30                     if (ev.value == 0) 

31                     {

32                         /* pen up */

33                         samp->x = 0;

34                         samp->y = 0;

35                         //samp->pressure = 0;

36                         i->current_p = 0;

37                         samp->tv = ev.time;

38                         //samp++;

39                         //total++;

40                         printf('key_upn');

41                     }

42                     else if(ev.value == 1)

43                     {

44                         i->current_p = 1;

45                         printf('key_downn');

46                     }

47                     break;

[1] [2]
關(guān)鍵字:Tiny6410  移植 引用地址:Tiny6410移植tslib

上一篇:Linux-2.6.39在Tiny6410上的移植
下一篇:Linux設(shè)備驅(qū)動開發(fā) - LCD設(shè)備驅(qū)動分析

推薦閱讀最新更新時間:2025-06-07 23:44

Tiny6410 交叉編譯helloworld程序
在工作目錄下建立helloworld.c文件 #include stdio.h main() { printf( helloworld!\n ); } 保存關(guān)閉后。 編譯helloworld文件: root@snail:/home/workdir/qt/project/helloworld# arm-linux-gcc helloworld.c -o helloworld 生成可執(zhí)行文件helloworld: 將可執(zhí)行文件helloworld拷貝到文件系統(tǒng)目錄,并執(zhí)行 執(zhí)行成功。 這是最簡單的交叉編譯示例。
[單片機(jī)]
<font color='red'>Tiny6410</font> 交叉編譯helloworld程序
u-boot 移植 --->5、友善之臂Tiny210底板王網(wǎng)卡驅(qū)動移植
網(wǎng)卡芯片的工作原理 DM9000AE具有以下主要性能: ①48管腳的LQFP封裝,管腳少體積??; ②支持8/16位數(shù)據(jù)總線; ③適用于10Base-T和100Base-T,10/100M自適應(yīng),適應(yīng)不同的網(wǎng)絡(luò)速度要求 ④內(nèi)置16KB的SRAM,用于收發(fā)緩沖,降低對主處理器的速度要求; ⑤支持IP /TCP /UDP加速,減輕了CPU負(fù)擔(dān),提高網(wǎng)絡(luò)速度;⑥支持Back pressure半雙工流量控制,與IEEE802.3u兼容,支持IEEE802.3x全雙工流量控制; ⑦20ns響應(yīng)時間,2.5V/3.3V低功耗。下圖是DM9000網(wǎng)卡芯片常用在嵌入式網(wǎng)絡(luò)系統(tǒng)上的結(jié)構(gòu)框圖。 數(shù)據(jù)支持8位和16位,不同模式下的PIN腳定義是不
[單片機(jī)]
u-boot <font color='red'>移植</font> --->5、友善之臂Tiny210底板王網(wǎng)卡驅(qū)動<font color='red'>移植</font>
linux-2.6.32在mini2440開發(fā)板上移植 LED 驅(qū)動程序移植
LED 驅(qū)動程序移植 編者;對于led的驅(qū)動程序,很多文章都有詳細(xì)的介紹,我的博客里面有一篇專門詳解這個的。需要看的,可以找下。led燈的驅(qū)動其實(shí)就代表了I/O口的驅(qū)動。在linux系統(tǒng)下,操作一個I/O口,可以說實(shí)在是麻煩至極與裸機(jī)操作相比較的話。這里簡介移植過程,沒寫分析。 1 LED 驅(qū)動原理 這個就給個圖就夠了,搞驅(qū)動要連這個都搞不懂,那就完了。 2、驅(qū)動的移植。 在drivers/char 目錄下,我們建立一個驅(qū)動程序文件mini2440_leds.c,內(nèi)容如下: span style= font-size: 18px; #include linux/miscdevice.h #include linux/dela
[單片機(jī)]
linux-2.6.32在mini2440開發(fā)板上<font color='red'>移植</font> LED 驅(qū)動程序<font color='red'>移植</font>
STM32CUBEMX(14)--SPI,TLC5947外部PWM移植
概述 SPI是串行外設(shè)接口(Serial Peripheral Interface)的縮寫,是一種高速的,全雙工,同步的通信總線,并且在芯片的管腳上只占用四根線,節(jié)約了芯片的管腳,同時為PCB的布局上節(jié)省空間,提供方便,正是出于這種簡單易用的特性,越來越多的芯片集成了這種通信協(xié)議,比如 EEPROM,F(xiàn)LASH,實(shí)時時鐘,AD轉(zhuǎn)換器。 TLC5947是一款SPI接口的PWM脈寬調(diào)制24路LED驅(qū)動模塊/RGB LED驅(qū)動器芯片,它能驅(qū)動24路的PWM。 硬件準(zhǔn)備 首先需要準(zhǔn)備一個開發(fā)板,這里我準(zhǔn)備的是NUCLEO-F030R8的開發(fā)板: 外部PWM模塊就是淘寶上SPI接口的TLC5947模塊。 選擇芯片型號 使用STM32C
[單片機(jī)]
STM32CUBEMX(14)--SPI,TLC5947外部PWM<font color='red'>移植</font>
u-boot-2016.03 在mini2440移植之nandflash讀寫
在“NorFlash啟動”一文中,我們把drivers/mtd/nand/s3c2410_nand.c文件復(fù)制為s3c2440_nand.c文件,并把該文件內(nèi)的所有有關(guān)“2410”的地方一律改為“2440”。這么修改僅僅是能夠讓系統(tǒng)編譯成功,并沒有真正實(shí)現(xiàn)NandFlash的讀寫。在這里,我們就來介紹如何讓u-boot支持NandFlash的讀寫。 由于s3c2410與s3c2440的NandFlash控制器不一樣,因此s3c2440_nand.c文件并不能直接應(yīng)用,需要進(jìn)行適當(dāng)?shù)男薷?,而主要修改的?nèi)容就是s3c2440的相關(guān)寄存器。 首先重新定義要用到的寄存器,把原文中第27行至第37行之間的宏定義去掉,改為下面的形式:
[單片機(jī)]
u-boot-2016.03 在mini2440<font color='red'>移植</font>之nandflash讀寫
OpenCV2.0.0移植到ARM9(一)(JZ2440----S3c2440)
Linux系統(tǒng):Ubuntu9.10 交叉編譯器:arm-linux-gcc-4.3.2(已安裝) OpenCV:OpenCV-2.0.0.tar.bz2(OpenCV for Linux/Mac) CMake:cmake-2.8.12-Linux-i386.tar.gz 1、OpenCV解壓 將OpenCV-2.0.0.tar.bz2放到/work/systems/下。 解壓命令: tar -jxvf OpenCV-2.0.0.tar.bz2 2、CMake解壓: 將cmake-2.8.12-Linux-i386.tar.gz放到/work/tools/目錄下 解壓命令 :tar -zxv
[單片機(jī)]
OpenCV2.0.0<font color='red'>移植</font>到ARM9(一)(JZ2440----S3c2440)
Linux2.6.32移植到MINI2440(1)初步移植
根據(jù)友善之臂提供的手冊——《MINI2440 Linux移植開發(fā)實(shí)戰(zhàn)指南-內(nèi)核部分-2010.9.9》以及網(wǎng)絡(luò)上一些帖子,在此對他們的工作表示感謝,基本過程大都一致,主要是為了熟悉內(nèi)核的基本移植方法,目的是為了能夠生成一個MINI2440上可用的內(nèi)核。 開發(fā)環(huán)境: 主機(jī):fedora 14 虛擬機(jī):vmware workstation 10 交叉編譯工具:arm-linux-gcc 4.3.2 開發(fā)板:mini2440(2m nor ,64m sdram,256m nand) 一、下載源碼包解壓到指定位置 下載地址:http://www.kernel.org/pub/l
[單片機(jī)]
u-boot-2009.08在mini2440上的移植(一)---建立mini2440工程環(huán)境(3)
根據(jù)啟動流程修改或添加基本的u-boot源碼,使其能夠在內(nèi)存中啟動 【1】增加對S3C2440一些寄存器的支持,添加中斷禁止部分和時鐘設(shè)置部分 用gedit打開cpu/arm920t/start.S,定位到134行附近,如下代碼 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) /* turn off the watchdog */ 由于2410和2440的寄存器及地址大部分是一致的,所以這里就直接在2410的基礎(chǔ)上再加上對2440的支持即可,修改后代碼如下: #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) |
[單片機(jī)]
u-boot-2009.08在mini2440上的<font color='red'>移植</font>(一)---建立mini2440工程環(huán)境(3)
小廣播
設(shè)計資源 培訓(xùn) 開發(fā)板 精華推薦

最新單片機(jī)文章

 
EEWorld訂閱號

 
EEWorld服務(wù)號

 
汽車開發(fā)圈

 
機(jī)器人開發(fā)圈

電子工程世界版權(quán)所有 京ICP證060456號 京ICP備10001474號-1 電信業(yè)務(wù)審批[2006]字第258號函 京公網(wǎng)安備 11010802033920號 Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 彩票| 铜川市| 株洲县| 息烽县| 洱源县| 闻喜县| 隆回县| 新龙县| 盐池县| 枞阳县| 吉安市| 彭州市| 秦安县| 镇安县| 斗六市| 渝北区| 鄂州市| 临颍县| 上蔡县| 济源市| 丹阳市| 虎林市| 阜平县| 精河县| 白玉县| 商河县| 建阳市| 都昌县| 敖汉旗| 库车县| 天峨县| 武夷山市| 康保县| 武胜县| 烟台市| 紫云| 谢通门县| 增城市| 上饶县| 图片| 南溪县|