1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>uart_get_baud_rate</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="uart16x50.html" title="Chapter 6. 16x50 UART Driver"><link rel="prev" href="API-uart-update-timeout.html" title="uart_update_timeout"><link rel="next" href="API-uart-get-divisor.html" title="uart_get_divisor"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">uart_get_baud_rate</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-uart-update-timeout.html">Prev</a> </td><th width="60%" align="center">Chapter 6. 16x50 UART Driver</th><td width="20%" align="right"> <a accesskey="n" href="API-uart-get-divisor.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-uart-get-baud-rate"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>uart_get_baud_rate — 2 return baud rate for a particular port 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">unsigned int <b class="fsfunc">uart_get_baud_rate </b>(</code></td><td>struct uart_port * <var class="pdparam">port</var>, </td></tr><tr><td> </td><td>struct ktermios * <var class="pdparam">termios</var>, </td></tr><tr><td> </td><td>struct ktermios * <var class="pdparam">old</var>, </td></tr><tr><td> </td><td>unsigned int <var class="pdparam">min</var>, </td></tr><tr><td> </td><td>unsigned int <var class="pdparam">max</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1113776372"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>port</code></em></span></dt><dd><p> 4 uart_port structure describing the port in question. 5 </p></dd><dt><span class="term"><em class="parameter"><code>termios</code></em></span></dt><dd><p> 6 desired termios settings. 7 </p></dd><dt><span class="term"><em class="parameter"><code>old</code></em></span></dt><dd><p> 8 old termios (or NULL) 9 </p></dd><dt><span class="term"><em class="parameter"><code>min</code></em></span></dt><dd><p> 10 minimum acceptable baud rate 11 </p></dd><dt><span class="term"><em class="parameter"><code>max</code></em></span></dt><dd><p> 12 maximum acceptable baud rate 13 </p></dd></dl></div></div><div class="refsect1"><a name="idp1113782092"></a><h2>Description</h2><p> 14 Decode the termios structure into a numeric baud rate, 15 taking account of the magic 38400 baud rate (with spd_* 16 flags), and mapping the <code class="constant">B0</code> rate to 9600 baud. 17 </p><p> 18 19 If the new baud rate is invalid, try the old termios setting. 20 If it's still invalid, we try 9600 baud. 21 </p><p> 22 23 Update the <em class="parameter"><code>termios</code></em> structure to reflect the baud rate 24 we're actually going to be using. Don't do this for the case 25 where B0 is requested (<span class="quote">“<span class="quote">hang up</span>”</span>). 26</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-uart-update-timeout.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="uart16x50.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-uart-get-divisor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">uart_update_timeout</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">uart_get_divisor</span></td></tr></table></div></body></html> 27