//! \file timer.c
//! \author tkl
//! \date Jul 5, 2012
//! \brief Source file of the architecture independent timer implementation.
#include <stddef.h>

#include "timer.h"

int timer_open(const struct loki_timer *device)
{
	if(device == NULL)
		return -1;

	timer_fp_open_t open = device->fp->open;
	return open(device->arch_dep_device);
}

int timer_close(const struct loki_timer *device)
{
	if(device == NULL)
		return -1;

	timer_fp_close_t close = device->fp->close;
	return close(device->arch_dep_device);
}

int timer_set_it_callback(const struct loki_timer *device, const void *callback,
		const void *param)
{
	if((device == NULL) || (callback == NULL))
		return -1;

	timer_fp_set_cb_t set_cb = device->fp->set_cb;
	return set_cb(device->arch_dep_device, callback, param);
}
