<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="Linux Device Drivers" /><link rel="up" href="ch06.html" title="Chapter 6. 16x50 UART Driver" /><link rel="prev" href="re656.html" title="uart_update_timeout" /><link rel="next" href="re658.html" title="uart_get_divisor" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>uart_get_baud_rate</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re656.html">Prev</a> </td><th width="60%" align="center">Chapter 6. 16x50 UART Driver</th><td width="20%" align="right"> <a accesskey="n" href="re658.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="uart_get_baud_rate"><a id="API-uart-get-baud-rate"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>uart_get_baud_rate — return baud rate for a particular port </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><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" title="Arguments"><a id="id2691162"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>port</code></em></span></dt><dd><p> uart_port structure describing the port in question. </p></dd><dt><span class="term"><em class="parameter"><code>termios</code></em></span></dt><dd><p> desired termios settings. </p></dd><dt><span class="term"><em class="parameter"><code>old</code></em></span></dt><dd><p> old termios (or NULL) </p></dd><dt><span class="term"><em class="parameter"><code>min</code></em></span></dt><dd><p> minimum acceptable baud rate </p></dd><dt><span class="term"><em class="parameter"><code>max</code></em></span></dt><dd><p> maximum acceptable baud rate </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2691257"></a><h2>Description</h2><p> Decode the termios structure into a numeric baud rate, taking account of the magic 38400 baud rate (with spd_* flags), and mapping the <code class="constant">B0</code> rate to 9600 baud. </p><p> If the new baud rate is invalid, try the old termios setting. If it's still invalid, we try 9600 baud. </p><p> Update the <em class="parameter"><code>termios</code></em> structure to reflect the baud rate we're actually going to be using. Don't do this for the case where B0 is requested (<span class="quote">“<span class="quote">hang up</span>”</span>). </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re656.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re658.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>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>uart_get_divisor</span></td></tr></table></div></body></html>