| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#ifndef _OPM_H_ |
| 27 |
#define _OPM_H_ |
| 28 |
|
| 29 |
#include <stdint.h> |
| 30 |
|
| 31 |
#ifdef __cplusplus |
| 32 |
extern "C" { |
| 33 |
#endif |
| 34 |
|
| 35 |
typedef struct { |
| 36 |
uint32_t cycles; |
| 37 |
uint8_t ic; |
| 38 |
uint8_t ic2; |
| 39 |
|
| 40 |
uint8_t write_data; |
| 41 |
uint8_t write_a; |
| 42 |
uint8_t write_a_en; |
| 43 |
uint8_t write_d; |
| 44 |
uint8_t write_d_en; |
| 45 |
uint8_t write_busy; |
| 46 |
uint8_t write_busy_cnt; |
| 47 |
uint8_t mode_address; |
| 48 |
uint8_t io_ct1; |
| 49 |
uint8_t io_ct2; |
| 50 |
|
| 51 |
|
| 52 |
uint8_t lfo_am_lock; |
| 53 |
uint8_t lfo_pm_lock; |
| 54 |
uint8_t lfo_counter1; |
| 55 |
uint8_t lfo_counter1_of1; |
| 56 |
uint8_t lfo_counter1_of2; |
| 57 |
uint16_t lfo_counter2; |
| 58 |
uint8_t lfo_counter2_load; |
| 59 |
uint8_t lfo_counter2_of; |
| 60 |
uint8_t lfo_counter2_of_lock; |
| 61 |
uint8_t lfo_counter2_of_lock2; |
| 62 |
uint8_t lfo_counter3_clock; |
| 63 |
uint16_t lfo_counter3; |
| 64 |
uint8_t lfo_counter3_step; |
| 65 |
uint8_t lfo_frq_update; |
| 66 |
uint8_t lfo_clock; |
| 67 |
uint8_t lfo_clock_lock; |
| 68 |
uint8_t lfo_clock_test; |
| 69 |
uint8_t lfo_test; |
| 70 |
uint32_t lfo_val; |
| 71 |
uint8_t lfo_val_carry; |
| 72 |
uint32_t lfo_out1; |
| 73 |
uint32_t lfo_out2; |
| 74 |
uint32_t lfo_out2_b; |
| 75 |
uint8_t lfo_mult_carry; |
| 76 |
uint8_t lfo_trig_sign; |
| 77 |
uint8_t lfo_saw_sign; |
| 78 |
uint8_t lfo_bit_counter; |
| 79 |
|
| 80 |
|
| 81 |
uint8_t eg_state[32]; |
| 82 |
uint16_t eg_level[32]; |
| 83 |
uint8_t eg_rate[2]; |
| 84 |
uint8_t eg_sl[2]; |
| 85 |
uint8_t eg_tl[3]; |
| 86 |
uint8_t eg_zr[2]; |
| 87 |
uint8_t eg_timershift_lock; |
| 88 |
uint8_t eg_timer_lock; |
| 89 |
uint8_t eg_inchi; |
| 90 |
uint8_t eg_shift; |
| 91 |
uint8_t eg_clock; |
| 92 |
uint8_t eg_clockcnt; |
| 93 |
uint8_t eg_clockquotinent; |
| 94 |
uint8_t eg_inc; |
| 95 |
uint8_t eg_ratemax[2]; |
| 96 |
uint8_t eg_instantattack; |
| 97 |
uint8_t eg_inclinear; |
| 98 |
uint8_t eg_incattack; |
| 99 |
uint8_t eg_mute; |
| 100 |
uint16_t eg_outtemp[2]; |
| 101 |
uint16_t eg_out[2]; |
| 102 |
uint16_t eg_am; |
| 103 |
uint8_t eg_ams[2]; |
| 104 |
uint8_t eg_timercarry; |
| 105 |
uint32_t eg_timer; |
| 106 |
uint32_t eg_timer2; |
| 107 |
uint8_t eg_timerbstop; |
| 108 |
uint32_t eg_serial; |
| 109 |
uint8_t eg_serial_bit; |
| 110 |
uint8_t eg_test; |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
uint16_t pg_fnum[32]; |
| 115 |
uint8_t pg_kcode[32]; |
| 116 |
uint32_t pg_inc[32]; |
| 117 |
uint32_t pg_phase[32]; |
| 118 |
uint8_t pg_reset[32]; |
| 119 |
uint8_t pg_reset_latch[32]; |
| 120 |
uint32_t pg_serial; |
| 121 |
|
| 122 |
|
| 123 |
uint16_t op_phase_in; |
| 124 |
uint16_t op_mod_in; |
| 125 |
uint16_t op_phase; |
| 126 |
uint16_t op_logsin[3]; |
| 127 |
uint16_t op_atten; |
| 128 |
uint16_t op_exp[2]; |
| 129 |
uint8_t op_pow[2]; |
| 130 |
uint32_t op_sign; |
| 131 |
int16_t op_out[6]; |
| 132 |
uint32_t op_connect; |
| 133 |
uint8_t op_counter; |
| 134 |
uint8_t op_fbupdate; |
| 135 |
uint8_t op_fbshift; |
| 136 |
uint8_t op_c1update; |
| 137 |
uint8_t op_modtable[5]; |
| 138 |
int16_t op_m1[8][2]; |
| 139 |
int16_t op_c1[8]; |
| 140 |
int16_t op_mod[3]; |
| 141 |
int16_t op_fb[2]; |
| 142 |
uint8_t op_mixl; |
| 143 |
uint8_t op_mixr; |
| 144 |
uint16_t op_chmix[8]; |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
int32_t mix[2]; |
| 149 |
int32_t mix2[2]; |
| 150 |
int32_t mix_op; |
| 151 |
uint32_t mix_serial[2]; |
| 152 |
uint32_t mix_bits; |
| 153 |
uint32_t mix_top_bits_lock; |
| 154 |
uint8_t mix_sign_lock; |
| 155 |
uint8_t mix_sign_lock2; |
| 156 |
uint8_t mix_exp_lock; |
| 157 |
uint8_t mix_clamp_low[2]; |
| 158 |
uint8_t mix_clamp_high[2]; |
| 159 |
uint8_t mix_out_bit; |
| 160 |
|
| 161 |
|
| 162 |
uint8_t smp_so; |
| 163 |
uint8_t smp_sh1; |
| 164 |
uint8_t smp_sh2; |
| 165 |
uint16_t ch_out[8]; |
| 166 |
|
| 167 |
|
| 168 |
uint32_t noise_lfsr; |
| 169 |
uint32_t noise_timer; |
| 170 |
uint8_t noise_timer_of; |
| 171 |
uint8_t noise_update; |
| 172 |
uint8_t noise_temp; |
| 173 |
|
| 174 |
|
| 175 |
uint8_t mode_test[8]; |
| 176 |
uint8_t mode_kon_operator[4]; |
| 177 |
uint8_t mode_kon_channel; |
| 178 |
|
| 179 |
uint8_t reg_address; |
| 180 |
uint8_t reg_address_ready; |
| 181 |
uint8_t reg_data; |
| 182 |
uint8_t reg_data_ready; |
| 183 |
|
| 184 |
uint8_t ch_rl[8]; |
| 185 |
uint8_t ch_fb[8]; |
| 186 |
uint8_t ch_connect[8]; |
| 187 |
uint8_t ch_kc[8]; |
| 188 |
uint8_t ch_kf[8]; |
| 189 |
uint8_t ch_pms[8]; |
| 190 |
uint8_t ch_ams[8]; |
| 191 |
|
| 192 |
uint8_t sl_dt1[32]; |
| 193 |
uint8_t sl_mul[32]; |
| 194 |
uint8_t sl_tl[32]; |
| 195 |
uint8_t sl_ks[32]; |
| 196 |
uint8_t sl_ar[32]; |
| 197 |
uint8_t sl_am_e[32]; |
| 198 |
uint8_t sl_d1r[32]; |
| 199 |
uint8_t sl_dt2[32]; |
| 200 |
uint8_t sl_d2r[32]; |
| 201 |
uint8_t sl_d1l[32]; |
| 202 |
uint8_t sl_rr[32]; |
| 203 |
|
| 204 |
uint8_t noise_en; |
| 205 |
uint8_t noise_freq; |
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
uint16_t timer_a_reg; |
| 210 |
uint8_t timer_b_reg; |
| 211 |
uint8_t timer_a_temp; |
| 212 |
uint8_t timer_a_do_reset, timer_a_do_load; |
| 213 |
uint8_t timer_a_inc; |
| 214 |
uint16_t timer_a_val; |
| 215 |
uint8_t timer_a_of; |
| 216 |
uint8_t timer_a_load; |
| 217 |
uint8_t timer_a_status; |
| 218 |
|
| 219 |
uint8_t timer_b_sub; |
| 220 |
uint8_t timer_b_sub_of; |
| 221 |
uint8_t timer_b_inc; |
| 222 |
uint16_t timer_b_val; |
| 223 |
uint8_t timer_b_of; |
| 224 |
uint8_t timer_b_do_reset, timer_b_do_load; |
| 225 |
uint8_t timer_b_temp; |
| 226 |
uint8_t timer_b_status; |
| 227 |
uint8_t timer_irq; |
| 228 |
|
| 229 |
uint8_t lfo_freq_hi; |
| 230 |
uint8_t lfo_freq_lo; |
| 231 |
uint8_t lfo_pmd; |
| 232 |
uint8_t lfo_amd; |
| 233 |
uint8_t lfo_wave; |
| 234 |
|
| 235 |
uint8_t timer_irqa, timer_irqb; |
| 236 |
uint8_t timer_loada, timer_loadb; |
| 237 |
uint8_t timer_reseta, timer_resetb; |
| 238 |
uint8_t mode_csm; |
| 239 |
|
| 240 |
uint8_t nc_active, nc_active_lock, nc_sign, nc_sign_lock, nc_sign_lock2; |
| 241 |
uint8_t nc_bit; |
| 242 |
uint16_t nc_out; |
| 243 |
int16_t op_mix; |
| 244 |
|
| 245 |
uint8_t kon_csm, kon_csm_lock; |
| 246 |
uint8_t kon_do; |
| 247 |
uint8_t kon_chanmatch; |
| 248 |
uint8_t kon[32]; |
| 249 |
uint8_t kon2[32]; |
| 250 |
uint8_t mode_kon[32]; |
| 251 |
|
| 252 |
|
| 253 |
uint8_t dac_osh1, dac_osh2; |
| 254 |
uint16_t dac_bits; |
| 255 |
int32_t dac_output[2]; |
| 256 |
} opm_t; |
| 257 |
|
| 258 |
void OPM_Clock(opm_t *chip, int32_t *output, uint8_t *sh1, uint8_t *sh2, uint8_t *so); |
| 259 |
void OPM_Write(opm_t *chip, uint32_t port, uint8_t data); |
| 260 |
uint8_t OPM_Read(opm_t *chip, uint32_t port); |
| 261 |
uint8_t OPM_ReadIRQ(opm_t *chip); |
| 262 |
uint8_t OPM_ReadCT1(opm_t *chip); |
| 263 |
uint8_t OPM_ReadCT2(opm_t *chip); |
| 264 |
void OPM_SetIC(opm_t *chip, uint8_t ic); |
| 265 |
void OPM_Reset(opm_t *chip); |
| 266 |
|
| 267 |
#ifdef __cplusplus |
| 268 |
} |
| 269 |
#endif |
| 270 |
|
| 271 |
#endif |