Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
9f22efdf
Commit
9f22efdf
authored
Dec 01, 2002
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SERIAL] Move the FIFO timeout calculations into uart_update_timeout()
parent
512c5637
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
32 deletions
+51
-32
drivers/serial/core.c
drivers/serial/core.c
+51
-32
No files found.
drivers/serial/core.c
View file @
9f22efdf
...
...
@@ -260,6 +260,56 @@ static void uart_shutdown(struct uart_info *info)
info
->
flags
&=
~
UIF_INITIALIZED
;
}
/**
* uart_update_timeout - update per-port FIFO timeout.
* @port: uart_port structure describing the port.
* @cflag: termios cflag value
* @quot: uart clock divisor quotient
*
* Set the port FIFO timeout value. The @cflag value should
* reflect the actual hardware settings.
*/
void
uart_update_timeout
(
struct
uart_port
*
port
,
unsigned
int
cflag
,
unsigned
int
quot
)
{
unsigned
int
bits
;
/* byte size and parity */
switch
(
cflag
&
CSIZE
)
{
case
CS5
:
bits
=
7
;
break
;
case
CS6
:
bits
=
8
;
break
;
case
CS7
:
bits
=
9
;
break
;
default:
bits
=
10
;
break
;
// CS8
}
if
(
cflag
&
CSTOPB
)
bits
++
;
if
(
cflag
&
PARENB
)
bits
++
;
/*
* The total number of bits to be transmitted in the fifo.
*/
bits
=
bits
*
port
->
fifosize
;
/*
* Figure the timeout to send the above number of bits.
* Add .02 seconds of slop
*/
port
->
timeout
=
(
HZ
*
bits
)
/
(
port
->
uartclk
/
(
16
*
quot
))
+
HZ
/
50
;
}
EXPORT_SYMBOL
(
uart_update_timeout
);
/**
* uart_get_baud_rate - return baud rate for a particular port
* @port: uart_port structure describing the port in question.
...
...
@@ -386,39 +436,8 @@ uart_change_speed(struct uart_info *info, struct termios *old_termios)
*/
cflag
=
info
->
tty
->
termios
->
c_cflag
;
/* byte size and parity */
switch
(
cflag
&
CSIZE
)
{
case
CS5
:
bits
=
7
;
break
;
case
CS6
:
bits
=
8
;
break
;
case
CS7
:
bits
=
9
;
break
;
default:
bits
=
10
;
break
;
// CS8
}
if
(
cflag
&
CSTOPB
)
bits
++
;
if
(
cflag
&
PARENB
)
bits
++
;
quot
=
uart_get_divisor
(
port
,
tty
,
old_termios
);
/*
* The total number of bits to be transmitted in the fifo.
*/
bits
=
bits
*
port
->
fifosize
;
/*
* Figure the timeout to send the above number of bits.
* Add .02 seconds of slop
*/
port
->
timeout
=
(
HZ
*
bits
)
/
(
port
->
uartclk
/
(
16
*
quot
))
+
HZ
/
50
;
uart_update_timeout
(
port
,
cflag
,
quot
);
if
(
cflag
&
CRTSCTS
)
info
->
flags
|=
UIF_CTS_FLOW
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment