| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <stdint.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
#ifdef __cplusplus |
| 11 |
extern "C" { |
| 12 |
#endif |
| 13 |
|
| 14 |
void pcm_reset(void); |
| 15 |
void pcm_write_ctrl(uint8_t val); |
| 16 |
uint8_t pcm_read_ctrl(void); |
| 17 |
void pcm_write_rate(uint8_t val); |
| 18 |
uint8_t pcm_read_rate(void); |
| 19 |
void pcm_write_fifo(uint8_t val); |
| 20 |
void pcm_render(int16_t *buf, unsigned num_samples); |
| 21 |
bool pcm_is_fifo_almost_empty(void); |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#define PCM_FIFO_SIZE 4096 |
| 29 |
|
| 30 |
struct pcm_debug_state { |
| 31 |
uint8_t ctrl; |
| 32 |
uint8_t rate; |
| 33 |
bool loop; |
| 34 |
unsigned fifo_cnt; |
| 35 |
unsigned fifo_rdidx; |
| 36 |
unsigned fifo_wridx; |
| 37 |
unsigned fifo_size; |
| 38 |
int16_t cur_l, cur_r; |
| 39 |
uint8_t phase; |
| 40 |
bool almost_empty; |
| 41 |
}; |
| 42 |
|
| 43 |
void pcm_debug_get_state(struct pcm_debug_state *out); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
unsigned pcm_debug_peek_fifo(uint8_t *dest, unsigned offset, unsigned len); |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
#define PCM_SCOPE_SAMPLES 2048 |
| 56 |
#define PCM_SCOPE_L 0 |
| 57 |
#define PCM_SCOPE_R 1 |
| 58 |
#define PCM_SCOPE_STREAMS 2 |
| 59 |
|
| 60 |
unsigned pcm_debug_scope_read(int side, int16_t *dest, unsigned max_samples); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
unsigned pcm_debug_scope_predict(int16_t *dest_l, int16_t *dest_r, unsigned num_samples); |
| 82 |
|
| 83 |
#ifdef __cplusplus |
| 84 |
} |
| 85 |
#endif |