|
|
Linux » Books » Developer »
Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)
table of contents | additional info | download find in page
Chapter 11. Time Management
All device drivers must eventually deal with issues of time and
timing. Chapter 6 of Linux Device Drivers provides
extensive time management information for Linux drivers. This chapter
highlights the architectural differences of SGI Altix systems in the interval
timer counter (ITC) and provides brief information about execution delays
in drivers.
Interval Timer Counter (ITC)
The ITC register is a
free running, 64-bit counter that counts up at a fixed relationship to
the processor clock. To retrieve elapsed cycles, Itanium 2 processors
provide this register to programs via the ia64_get_itc (void)
routine. Drivers should use the cycle_t get_cycles
(void); interface in order to be portable. On SGI systems,
these registers are not synchronized among the other CPUs on the system.
Callers of this routine must be very careful that these calls are made
within the same CPU. For more information regarding the ITC register,
see the Intel IA-64 Architecture Software Developer's Manual
, volume 2, “IA-64 System Architecture.”
For system-wide synchronized timing information, you
can use the do_gettimeofday() function.
Delaying Execution -- Short Delay
The Linux kernel also provides the following routines to allow
callers to delay for a specified amount of time: void udelay (unsigned long usecs)
void mdelay (unsigned long msecs)
void ndelay (unsigned long nsecs) |
The udelay() routine pauses for the specified
number of microseconds while the mdelay() routine pauses
for the specified number of milliseconds. The ndelay()
routine pauses for the specified number of nanoseconds. Because these
routines simply spin in the CPU, they should be used only for pausing
small amounts of time.
Delaying Execution -- Long Delay
If your driver requires longer delays than the delays that
the simple udelay() and mdelay()
commands provide, you must use other facilities provided by Linux that
will provide execution of your tasks at a later time without depending
on interrupts or spinning in a loop. Linux provides the following interfaces
for this purpose: Task queues
Tasklets
Kernel timers
For documentation on these features, see Linux Device
Drivers, chapter 6, “Flow of Time.” All of these
interfaces are supported on SGI Altix systems.
Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)
table of contents | additional info | download
Front Matter
New Features in This Guide
About This Guide
Chapter 1. Introduction
Chapter 2. Architecture
Chapter 3. PCI-X Device Attachment
Chapter 4. PCI System Initialization
Chapter 5. Finding Your PCI Device
Chapter 6. PCI/PCI-X Configuration Space
Chapter 7. PCI-X I/O and Memory Resources
Chapter 8. PCI-X Interrupt Mechanism
Chapter 9. PCI-X Direct Memory Access (DMA)
Chapter 10. Device Driver Memory Usage
Chapter 11. Time Management
Chapter 12. Building Linux Kernels and Modules
Appendix A. Memory Operation Ordering on SGI Altix Systems
Index
home/search |
what's new |
help
|
|
|