The new code is based on timestamps, rather than delays. This eliminates the need to update every timer in timer_process(), which cost a non-trivial amount of CPU time on low-end machines. This involved changes to every user of the timer code, so this change almost certainly introduces bugs.
38 lines
800 B
C
38 lines
800 B
C
#include "timer.h"
|
|
|
|
typedef struct ad1848_t
|
|
{
|
|
int index;
|
|
uint8_t regs[16];
|
|
uint8_t status;
|
|
|
|
int trd;
|
|
int mce;
|
|
|
|
int count;
|
|
|
|
int16_t out_l, out_r;
|
|
|
|
int enable;
|
|
|
|
int irq, dma;
|
|
|
|
int freq;
|
|
|
|
pc_timer_t timer;
|
|
uint64_t timer_latch;
|
|
|
|
int16_t buffer[MAXSOUNDBUFLEN * 2];
|
|
int pos;
|
|
} ad1848_t;
|
|
|
|
void ad1848_setirq(ad1848_t *ad1848, int irq);
|
|
void ad1848_setdma(ad1848_t *ad1848, int dma);
|
|
|
|
uint8_t ad1848_read(uint16_t addr, void *p);
|
|
void ad1848_write(uint16_t addr, uint8_t val, void *p);
|
|
|
|
void ad1848_update(ad1848_t *ad1848);
|
|
void ad1848_speed_changed(ad1848_t *ad1848);
|
|
|
|
void ad1848_init(ad1848_t *ad1848);
|