aboutsummaryrefslogtreecommitdiff
path: root/libopna/opnatimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'libopna/opnatimer.h')
-rw-r--r--libopna/opnatimer.h42
1 files changed, 42 insertions, 0 deletions
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 <stdint.h>
+#include <stdbool.h>
+
+#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