第六章 android底层开发流程_从linux驱动到APK调用_图文详解.pdf

第六章 android底层开发流程_从linux驱动到APK调用_图文详解.pdf

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第一步:在 Linux 下编写驱动程序 1,在 Linux3.0/driver/ -mkdir hello_me 2,在 hello_me 目录下,新建编写 makefiel 和 Kconfig makefile 如下: [csharp] view plaincopyprint? 1. # 2. # Makefile for HELLO_ME_LEDS 3. # 4. 5. # SPI testing only for (using spidev driver) 6. # \file - spi_test.c 7. 8. # \version 1.0.0 9. 10. # \date 2014 年04 月23 日 11. 12. # \author jiangdou jiangdouu88@126.com 13. 14. # Copyright (c) 2014 jiangdou. All Rights Reserved. 15. 16. obj-$(CONFIG_HELLO_ME_LEDS) += leds.o Kconfig 如下: [cpp] view plaincopyprint? 1. # 2. # HSI driver configuration 3. # 4. 5. 6. 7. config HELLO_ME_LEDS 8. tristate HELLO_ME LEDS Driver 9. 10. help 11. Say Y here if you want to support the LEDS device leds.c 如下: [cpp] view plaincopyprint? 1. #include linux/module.h 2. #include linux/kernel.h 3. #include linux/errno.h 4. #include linux/fs.h 5. #include linux/init.h 6. #include linux/delay.h 7. #include linux/device.h 8. #include asm/uaccess.h 9. #include asm/irq.h 10. #include asm/io.h 11. 12. 13. #if 1 14. #define GPIO_BASE 0x01C20800 15. #define GPE_CFG0 (GPIO_BASE + 0x90) //PE CFG0 16. #define GPE06_CFG (1 24) //配置PE06 为输出模式 17. #define GPE_DATA (GPIO_BASE + 0xA0) 18. #endif 19. 20. /*自动创建设备节点结构体*/ 21. static struct class *leddrv_class; 22. /*cfg0 里面有PE06*/ 23. volatile unsigned long *gpe_cfg0 = NULL; 24. volatile unsigned long *gpe_date = NULL; 25. 26. 27. /*设备打开函数,当你在应用程序里面对led 执行open 函数这个函数就会被执行*/ 28. static int led_

文档评论(0)

kehan123 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档