/* linux/arch/mips/include/mach-loongson/gsc3280/timer.h * * Copyright (c) 2012 Loongson Co., Ltd. * * GSC3280 - Timer Driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __ASM_ARCH_TIMER_H #define __ASM_ARCH_TIMER_H __FILE__ typedef enum { ONCE, LOOP } GSC3280_TIMER_TYPE; struct gsc3280_hard_timer { GSC3280_TIMER_TYPE type; // ONCE or LOOP unsigned int value_type; //0:expires,ms 1:bps unsigned long expires; // accuracy 1ms unsigned long bps; void (*function)(unsigned long); // user init hocks unsigned long data; // func param }; /* *request a hard timer; U should Init h_timer Correctly */ int gsc3280_request_hard_timer(struct gsc3280_hard_timer *h_timer); /* *free a hard timer */ void gsc3280_free_hard_timer(struct gsc3280_hard_timer *h_timer); /* *Start Hard Timer; The Time Should Request First */ int gsc3280_timer_start(struct gsc3280_hard_timer *h_timer); /* *If The Timer Is Run; Do Stop */ void gsc3280_timer_stop(struct gsc3280_hard_timer *h_timer); /* *Modify Timer Param; if The Timer is in_use, Do Stop -> Modify -> Start */ int gsc3280_mod_timer(struct gsc3280_hard_timer *h_timer); #endif /* __ASM_ARCH_TIMER_H */