Main Page | Directories | File List | Globals

i8254.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/adi.h>
#include <agnix/spinlock.h>
#include <asm/types.h>
#include <agnix/ioport.h>
#include <agnix/memory.h>

Include dependency graph for i8254.c:

Go to the source code of this file.

Functions

u16 i8254_read_count (struct chip_s *chip, u8 counter)
void i8254_write_count (struct chip_s *chip, u8 counter, u16 count)
void i8254_set_mode (struct chip_s *chip, u8 counter, u8 mode, u8 bcd)
int i8254_chip_init (struct chip_s *chip)
int i8254_chip_release (struct chip_s *chip)
int __init i8254_init (void)

Variables

chip_pit_ops_s i8254_pit_ops
chip_ops_s i8254_chip_ops
chip_s i8254_chip


Function Documentation

int i8254_chip_init struct chip_s *  chip  ) 
 

Definition at line 69 of file i8254.c.

References i8254_set_mode(), and i8254_write_count().

00070 {
00071     CHIP_LOCK;
00072 
00073     /* disable speaker, enable gate */
00074     outb((inb(0x61) & ~0x02) | 0x01, 0x61);
00075     
00076     /* counter 0, mode 2, binary */
00077     i8254_set_mode(chip, 0, 2, 0);
00078     i8254_write_count(chip, 0, i8254_RELOAD_COUNT);
00079     
00080     CHIP_UNLOCK;
00081         
00082     return 0;
00083 }

Here is the call graph for this function:

int i8254_chip_release struct chip_s *  chip  ) 
 

Definition at line 85 of file i8254.c.

00086 {
00087     return 0;
00088 }

int __init i8254_init void   ) 
 

Definition at line 105 of file i8254.c.

References adi_register_chip(), and i8254_chip.

Referenced by adi_chips_init().

00106 {
00107     adi_register_chip(&i8254_chip);
00108 
00109     return 0;    
00110 }

Here is the call graph for this function:

u16 i8254_read_count struct chip_s *  chip,
u8  counter
 

Definition at line 20 of file i8254.c.

00021 {
00022     u8 latch_word = 0;
00023     u8 lsb, msb;
00024     u16 count;
00025 
00026     CHIP_LOCK;
00027 
00028     latch_word |= (counter << 6);
00029     
00030     outb(latch_word, TCW);
00031     lsb = inb(TMRCNT + counter);
00032     msb = inb(TMRCNT + counter);
00033     count = (msb << 8) | lsb;
00034 
00035     CHIP_UNLOCK;
00036 
00037     return count;
00038 }

void i8254_set_mode struct chip_s *  chip,
u8  counter,
u8  mode,
u8  bcd
 

Definition at line 50 of file i8254.c.

Referenced by i8254_chip_init().

00051 {
00052     u8  tcw_word = 0;
00053 
00054     CHIP_LOCK;
00055 
00056     tcw_word |= (counter << 6) | (3 << 4) | (mode << 1) | bcd;
00057     outb(tcw_word, TCW);
00058 
00059     CHIP_UNLOCK;
00060 }

void i8254_write_count struct chip_s *  chip,
u8  counter,
u16  count
 

Definition at line 40 of file i8254.c.

Referenced by i8254_chip_init().

00041 {
00042     CHIP_LOCK;
00043 
00044     outb((count) & 0xFF, TMRCNT + counter);
00045     outb((count >> 8) & 0xFF, TMRCNT + counter);
00046     
00047     CHIP_UNLOCK;
00048 }


Variable Documentation

struct chip_s i8254_chip
 

Initial value:

 {
    .chip_name          = "i8254",
    .chip_class         = CHIP_CLASS_PIT,
    .chip_vendor        = 0x8086,
    .chip_priority      = 90,
    .chip_ops           = &i8254_chip_ops,
    .chip_pm_ops        = NULL,
    .internal_ops       = &i8254_pit_ops,
}

Definition at line 95 of file i8254.c.

Referenced by i8254_init(), timer_gettimeofday(), and timer_settimeofday().

struct chip_ops_s i8254_chip_ops
 

Initial value:

 {
    .init               = i8254_chip_init,
    .release            = i8254_chip_release
}

Definition at line 90 of file i8254.c.

struct chip_pit_ops_s i8254_pit_ops
 

Initial value:

Definition at line 62 of file i8254.c.

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix