My Kernel v0.1.0
pit.h
Go to the documentation of this file.
1
30#ifndef KERNEL_ARCH_I686_DEVICES_PIT_H
31#define KERNEL_ARCH_I686_DEVICES_PIT_H
32
33#include <kernel/types.h>
34#include <kernel/error.h>
35
36#define PIT_INTERNAL_FREQUENCY (1193182)
37
38#define PIT_MIN_CHANNEL_FREQUENCY (19)
39#define PIT_MAX_CHANNEL_FREQUENCY (PIT_INTERNAL_FREQUENCY)
40
41#define PIT_CHANNELS_COUNT (3)
42
47typedef enum pit_channel {
48 PIT_CHANNEL_TIMER, //< CPU Timer
49 PIT_CHANNEL_DRAM, //< Legacy. Used to refresh DRAM
50 PIT_CHANNEL_SPEAKER, //< Connected to the PC speaker
52
57typedef enum {
58 PIT_TRIGGER_LOW = 0,
59 PIT_TRIGGER_HIGH,
60 PIT_RATE_GENERATOR,
61 PIT_PWM,
62 PIT_SW_STROBE,
63 PIT_HW_STROBE,
64} pit_mode;
65
81error_t pit_config_channel(pit_channel, u32 frequency, pit_mode);
82
85
86#endif /* KERNEL_ARCH_I686_DEVICES_PIT_H */
error_t pit_config_channel(pit_channel, u32 frequency, pit_mode)
Configure a single PIT channel.
Definition: pit.c:86
u16 pit_read_channel(pit_channel)
Read the current value inside the channel's counter.
Definition: pit.c:116
pit_channel
The different PIT channels available.
Definition: pit.h:47
pit_mode
The different programmable modes for a channel.
Definition: pit.h:57