aleix's blog

16C950 UART 9-bit and custom baud rates support for Linux

21 February 2010 9:06 am (c | linux)

Last friday I found myself patching the Linux kernel sources to be able to add custom baud rates support for 16C950 UART cards. I needed to communicate, via a serial port, with one of the devices built by the hardware guys at work. Unfortunately, a non-standard baud rate and 9-bits were needed.

The Sealevel Ultra COMM+422 PCI card we are using is already provided with a patch that adds 9-bit support. However, I was not able to found how to change the baud rate to a non-standard one.

Following the 9-bit patch approach, I added extra requests to ioctl in order to modify the 16C950 registers needed to achieve custom baud rates. Here is the list of added extra ioctl requests (also the 9-bit ones) with the necessary parameters and updated/accessed 16C950 registers:

Request Parameters 16C950 registers Description
TIOC9BITGET out: integer NMR Get current 9-bit status
TIOC9BITSET NMR Enable 9-bit support
TIOC9BITCLR NMR Disable 9-bit support
TIOCPRESCALERGET out: integer EFR, MCR Get prescaler status
TIOCPRESCALERSET EFR, MCR Enable prescaler
TIOCPRESCALERCLR EFR, MCR Disable prescaler
TIOCDIVLATCHGET out: integer LCR, DLL/DLM Get divisor latch register
TIOCDIVLATCHSET in: integer LCR, DLL/DLM Set divisor latch register
TIOCSAMPLINGCLKGET out: integer TCR Get sampling clock
TIOCSAMPLINGCLKSET in: integer TCR Set sampling clock
TIOCPRESCALERCLKGET out: integer CPR Get prescaler clock
TIOCPRESCALERCLKSET in: integer CPR Set prescaler clock

I'm not sure if this is the best way to do it, but it works. So, if you need 9-bit and custom baud rates support, apply one the following patches to the kernel (I have aslo updated the Sealevel patch for older and newer kernels than the one provided):

9-bit 2.6.24 2.6.26 2.6.31 2.6.32
9-bit and baud rate 2.6.24 2.6.26 2.6.31 2.6.32

I am not responsible for any damage that these patches can cause to your hardware. No warranty is provided, so use them at your own risk.

21 responses

  1. Jack William says:

    Nice one for reading.

  2. best resume ever written says:

    Linux work same as the way windows work in our computers and laptops. But mostly people use window because it's easy to install and easy to use.

  3. IP-address says:

    The great solution! Thanks for sharing 192.168.1.254

  4. lauren ebsary says:

    Probably nonetheless windows on a new machine. However according to custom essay writing service UK even they need to charge a fortune earlier than they even communicate to you after a couple pf months. At which point mac are higher. However linux has loads of loose boards managing any issues you've got with every distribution.

  5. Harvey Mac says:

    This is very useful and something we will take on board with my driveways company

  6. Buy Coursework Assignment Help says:

    This A Good Way To Appreciate The Teacher As They Put Their Efforts To Train Students. UK Dissertation Writers Appreciates The Teachers.

  7. Kanada Vizesi says:

    Kanada Vizesi

  8. Almanya Vizesi says:

    Almanya Vizesi

  9. Write my Essay for me Online says:

    this is a with a terrific degree lighting fixtures up article. I moreover agree with your publish name and you're genuinely well mild up your standpoint. I'm staggeringly exuberant to see this publish. A dedication of thankfulness is all together for share with us. keep it up and proportion the extra most associated publish.

    first-rate paintings!

  10. Essay Service says:

    This a great way to realize The trainer As They put Their Efforts To educate students. united kingdom Dissertation Writers Appreciates the lecturers.

  11. Essay Help Online UK says:

    That is a with a remarkable diploma lighting fixtures up article. I moreover consider your publish name and you are actually nicely slight up your point of view. i'm staggeringly exuberant to peer this post. A willpower of thankfulness is all collectively for proportion with us. preserve it up and proportion the extra most associated publish.

  12. UK Best Essays says:

    That is a with an astounding recognition lighting apparatuses up article. I, in addition, consider your distribute name and you are very slight up your perspective. i'm staggeringly rich to peer this post. A self-control of appreciation is all by and large for extent with us. save it up and extent the additional most related distribute.

  13. corporate car service says:

    I'd ride in one of those taxis....not. Can't wait for the sand to swallow up that shit hole middle east when oil dependence eventually goes away.

  14. Do my Essay Now says:

    The help portrayed beneath is 24x7 and accessible in English. Unless shrouded in the open source innovation bolster scope that takes after, the client should work with our Linux accomplices or programming sellers straightforwardly for situations that are not upheld by Microsoft. For instance: application advancement, investigating custom applications, and custom code. Also, Microsoft Support won't offer help with the plan, design, or organization of uses or arrangements on Azure.

  15. Best Essay Help says:

    Linux charge line. This is the shell – a charge procedure that enables you to control the PC through orders wrote into a content interface. This is the thing that, at one time, frightened individuals off from Linux the most (accepting they needed to take in an apparently antiquated summon line structure to influence Linux to work). This is not true anymore. With present day work area Linux, there is no compelling reason to ever touch the order line.

  16. Essay Help says:

    Linux is very. It's in your telephones, in your autos, in your fridges, your Roku gadgets. It runs the majority of the Internet, the supercomputers making logical leaps forward, and the world\'s stock trades. Be that as it may, before Linux turned into the stage to run work areas, servers, and installed frameworks over the globe, it was (and still is) a standout amongst the most solid, secure, and straightforward working frameworks accessible.

  17. Adam says:

    Thanks for the update. Regards from, http://treeserviceregina.com

  18. Zend Framework Assignment Help says:

    Hi Buddy, Your Blog' S Design Is Simple And Clean And I Like It. Your Blog Posts About Online Writing Help Are Superb. Please Keep Them Coming. Greets!

  19. Capacitance Electrical Project says:

    Such A Nice Post, Keep Up The Fantastic Work

  20. free robux says:

    Hey friends lets come on and check out this game free roblox with free robux generator. It gives the bestever experience to the gamer as it has a lot of things to discover and many sources and resourses in it.

  21. see page says:

    This is really interesting to read about

Leave a Reply