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
535f2150
Commit
535f2150
authored
Apr 17, 2003
by
Alan Cox
Committed by
Linus Torvalds
Apr 17, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] generalise more PIT usage
parent
6dc51b6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
arch/i386/kernel/timers/timer_pit.c
arch/i386/kernel/timers/timer_pit.c
+14
-11
No files found.
arch/i386/kernel/timers/timer_pit.c
View file @
535f2150
...
@@ -16,13 +16,17 @@
...
@@ -16,13 +16,17 @@
extern
spinlock_t
i8259A_lock
;
extern
spinlock_t
i8259A_lock
;
extern
spinlock_t
i8253_lock
;
extern
spinlock_t
i8253_lock
;
#include "do_timer.h"
#include "do_timer.h"
#include "io_ports.h"
static
int
count_p
;
/* counter in get_offset_pit() */
static
int
__init
init_pit
(
char
*
override
)
static
int
__init
init_pit
(
char
*
override
)
{
{
/* check clock override */
/* check clock override */
if
(
override
[
0
]
&&
strncmp
(
override
,
"pit"
,
3
))
if
(
override
[
0
]
&&
strncmp
(
override
,
"pit"
,
3
))
printk
(
KERN_ERR
"Warning: clock= override failed. Defaulting to PIT
\n
"
);
printk
(
KERN_ERR
"Warning: clock= override failed. Defaulting to PIT
\n
"
);
count_p
=
LATCH
;
return
0
;
return
0
;
}
}
...
@@ -86,7 +90,6 @@ static unsigned long get_offset_pit(void)
...
@@ -86,7 +90,6 @@ static unsigned long get_offset_pit(void)
{
{
int
count
;
int
count
;
unsigned
long
flags
;
unsigned
long
flags
;
static
int
count_p
=
LATCH
;
/* for the first call after boot */
static
unsigned
long
jiffies_p
=
0
;
static
unsigned
long
jiffies_p
=
0
;
/*
/*
...
@@ -96,9 +99,9 @@ static unsigned long get_offset_pit(void)
...
@@ -96,9 +99,9 @@ static unsigned long get_offset_pit(void)
spin_lock_irqsave
(
&
i8253_lock
,
flags
);
spin_lock_irqsave
(
&
i8253_lock
,
flags
);
/* timer count may underflow right here */
/* timer count may underflow right here */
outb_p
(
0x00
,
0x43
);
/* latch the count ASAP */
outb_p
(
0x00
,
PIT_MODE
);
/* latch the count ASAP */
count
=
inb_p
(
0x4
0
);
/* read the latched count */
count
=
inb_p
(
PIT_CH
0
);
/* read the latched count */
/*
/*
* We do this guaranteed double memory access instead of a _p
* We do this guaranteed double memory access instead of a _p
...
@@ -106,13 +109,13 @@ static unsigned long get_offset_pit(void)
...
@@ -106,13 +109,13 @@ static unsigned long get_offset_pit(void)
*/
*/
jiffies_t
=
jiffies
;
jiffies_t
=
jiffies
;
count
|=
inb_p
(
0x4
0
)
<<
8
;
count
|=
inb_p
(
PIT_CH
0
)
<<
8
;
/* VIA686a test code... reset the latch if count > max + 1 */
/* VIA686a test code... reset the latch if count > max + 1 */
if
(
count
>
LATCH
)
{
if
(
count
>
LATCH
)
{
outb_p
(
0x34
,
0x43
);
outb_p
(
0x34
,
PIT_MODE
);
outb_p
(
LATCH
&
0xff
,
0x4
0
);
outb_p
(
LATCH
&
0xff
,
PIT_CH
0
);
outb
(
LATCH
>>
8
,
0x4
0
);
outb
(
LATCH
>>
8
,
PIT_CH
0
);
count
=
LATCH
-
1
;
count
=
LATCH
-
1
;
}
}
...
...
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