From 6fd10cdacb5cbe47a4fc339c20a733d4a9a384a1 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Sat, 26 Nov 2016 20:57:57 +0900 Subject: initial --- libopna/opnatimer.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 libopna/opnatimer.h (limited to 'libopna/opnatimer.h') diff --git a/libopna/opnatimer.h b/libopna/opnatimer.h new file mode 100644 index 0000000..f3094ba --- /dev/null +++ b/libopna/opnatimer.h @@ -0,0 +1,42 @@ +#ifndef LIBOPNA_OPNA_TIMER_H_INCLUDED +#define LIBOPNA_OPNA_TIMER_H_INCLUDED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*opna_timer_int_cb_t)(void *ptr); +typedef void (*opna_timer_mix_cb_t)(void *ptr, int16_t *buf, unsigned samples); + +struct opna; + +struct opna_timer { + struct opna *opna; + uint8_t status; + opna_timer_int_cb_t interrupt_cb; + void *interrupt_userptr; + opna_timer_mix_cb_t mix_cb; + void *mix_userptr; + uint8_t timerb; + bool timerb_load; + bool timerb_enable; + uint16_t timerb_cnt; +}; + +void opna_timer_reset(struct opna_timer *timer, struct opna *opna); +uint8_t opna_timer_status(const struct opna_timer *timer); +void opna_timer_set_int_callback(struct opna_timer *timer, + opna_timer_int_cb_t func, void *userptr); +void opna_timer_set_mix_callback(struct opna_timer *timer, + opna_timer_mix_cb_t func, void *userptr); +void opna_timer_writereg(struct opna_timer *timer, unsigned reg, unsigned val); +void opna_timer_mix(struct opna_timer *timer, int16_t *buf, unsigned samples); + +#ifdef __cplusplus +} +#endif + +#endif // LIBOPNA_OPNA_TIMER_H_INCLUDED -- cgit v1.2.3