/*
 * timer.h
 *
 * Copyright (C) 2013 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TIMER_H_
#define _TIMER_H_

#include <sdk/timer.h>
#include <irq.h>

#define TIMER_IRQ 0
#define TIMER_CHANNEL_PORT(x) (0x40 + (x))
#define TIMER_CMD_PORT 0x43
#define TIMER_FREQUENCY 1000
#define TIMER_BASE_FREQUENCY 1193182

#define TIMER_RATE_GENERATOR(x) (((x) << 6) | 0x34)
#define TIMER_SQUARE_WAVE(x) (((x) << 6) | 0x36)

void timer_init(void);

#endif
