ARM & amp; driver development section 2 in Linux

Source: Internet
Author: User

Driver file: qudong. c. make generates qudong. ko file, burned to the ARM Board <linux/module. h> <linux/kernel. h> <linux/poll. h> <linux/errno. h> DEV_NAME "rwtest" major = MAX_BUF_LEN = drv_buf [WRI_LENGTH = ssize_t dx_write (file * file, _ user * buffer, size_t count, loff_t * (count> MAX_BUF_LEN) count = ssize_t dx_read (file * filp, _ user * buffer, size_t count, loff_t * I =, j = (count> = (I = strlen (drv_buf ); i>; I -- = drv_buf [I-++ printk (dx_open (inode * inode, file * dx_release (inode * inode, file * file_operations file_opt = _ init qudong_init (= register_chrdev (, DEV_NAME, & (ret <= _ exit qudong_exit ();View Code

Makefile file:

-M: ==$ (shell uname-=-C/lib/modules/$ (UNAME)/build SUBDIRS =-f *-f. *-View Code

Or Makefile in ARM:

-M: =/usr/src/linux2.-C $ (KDIR) M = $ (PWD) modules ARCH = arm CROSS_COMPILE = arm-linux -- f *. ko *. o *. mod. o *. mod. c *. symvers modul *View Code

The test procedure is as follows:

<Stdlib. h> <fcntl. h> <unistd. h> <sys/ioctl. h> <. h> fd = ret = bufw [] = {bufr [] = {= open (fd <= (ret <= read (fd, bufr, (ret <View Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.