Help me provide more advice

Source: Internet
Author: User
For more information, see Linux general technology-Linux programming and kernel. I want to write a serial port driver. I have a linux Device Driver in my hand. I don't know much about it. Please help me! Some of my frameworks are as follows:
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include


# Include


Static struct tty_driver * serial_driver;

Static void serial_close (struct tty_struct * tty, struct file * filp)
{

}

Static void serial_unthrottle (struct tty_struct * tty)
{

}
Static int serial_write (struct tty_struct * tty, const unsigned char * buf, int count)
{

}

Static int serial_write_room (struct tty_struct * tty)
{

}

Static int serial_chars_in_buffer (struct tty_struct * tty)
{

}


Static int serial_set_lock (struct tty_struct * tty, int _ user * arg)
{

}

Static void serial_flush_buffer (struct tty_struct * tty)
{

}

Static int serial_open (struct tty_struct * tty, struct file * filp)
{

}

Static void serial_set_termios (struct tty_struct * tty, struct termios * old_termios)
{

}
Static struct tty_operations serial_ops = {
. Open = serial_open,
. Close = serial_close,
. Flush_buffer = serial_flush_buffer,
. Chars_in_buffer = serial_chars_in_buffer,
. Unthrottle = serial_unthrottle,
. Set_termios = serial_set_termios,

};

Static void _ init serial_driver_init (void)
{

Serial_driver = alloc_tty_driver ();

If (! Serial_driver)
{
Panic ("Couldn't allocate the driver ");
}

Serial_driver-> owner = THIS_MODULE;
Serial_driver-> driver_name =;
Serial_driver-> name =;
Serial_driver-> major =;
Serial_driver-> minor_start =;
Serial_driver-> type =;
Serial_driver-> subtype =;
Serial_driver-> init_termios =;
Serial_driver-> init_termios.c_iflag =;
Serial_driver-> init_termios.c_oflag =;
Serial_driver-> init_termios.c_cflag =;
Serial_driver-> init_termios.c_lflag =;
Serial_driver-> flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;

Serial_driver-> other =;
Serial_driver-> ioctl =;

Tty_set_operations (serial_driver, & serial_ops );

If (tty_register_driver (serial_driver ))
Panic ("Couldn't register the driver ");
}

Static void _ exit serial_driver_exit (void)
{

}

Module_init (serial_driver_init );
Module_exit (serial_driver_init );
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.