X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=pico%2Fpico_int.h;h=ce6b499dae6dc5213b7f7b5602b8acfba233a2ae;hb=c987bb5c36d92c1441e4dcfd9bded3e5dc1f1ff6;hp=d28067b2eaaf2dcabc365f1a2af4fbfdfbaddac6;hpb=5e128c6d279ac90f7b6078740ab1d0ba516969b9;p=picodrive.git diff --git a/pico/pico_int.h b/pico/pico_int.h index d28067b..ce6b499 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -1,7 +1,7 @@ // Pico Library - Internal Header File // (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006-2008 Grazvydas "notaz" Ignotas, all rights reserved. +// (c) Copyright 2006-2009 Grazvydas "notaz" Ignotas, all rights reserved. // Free for non-commercial use. // For commercial use, separate licencing terms must be obtained. @@ -232,6 +232,7 @@ typedef void (z80_write_f)(unsigned int a, unsigned char data); SH2 msh2, ssh2; #define ash2_end_run(after) sh2_icount = after +#define ash2_cycles_done() (sh2->cycles_aim - sh2_icount) #define sh2_pc(c) (c) ? ssh2.ppc : msh2.ppc #define sh2_reg(c, x) (c) ? ssh2.r[x] : msh2.r[x] @@ -406,6 +407,7 @@ typedef struct #define P32XS2_ADEN (1<< 9) #define P32XS_FULL (1<< 7) // DREQ FIFO full #define P32XS_68S (1<< 2) +#define P32XS_DMA (1<< 1) #define P32XS_RV (1<< 0) #define P32XV_nPAL (1<<15) // VDP @@ -418,6 +420,9 @@ typedef struct #define P32XV_nFEN (1<< 1) #define P32XV_FS (1<< 0) +#define P32XP_FULL (1<<15) // PWM +#define P32XP_EMPTY (1<<14) + #define P32XF_68KPOLL (1 << 0) #define P32XF_MSH2POLL (1 << 1) #define P32XF_SSH2POLL (1 << 2) @@ -433,20 +438,22 @@ typedef struct // real one is 4*2, but we use more because we don't lockstep #define DMAC_FIFO_LEN (4*4) +#define PWM_BUFF_LEN 1024 // in one channel samples struct Pico32x { unsigned short regs[0x20]; unsigned short vdp_regs[0x10]; + unsigned short sh2_regs[3]; unsigned char pending_fb; unsigned char dirty_pal; - unsigned char pad[2]; unsigned int emu_flags; unsigned char sh2irq_mask[2]; unsigned char sh2irqi[2]; // individual unsigned int sh2irqs; // common irqs unsigned short dmac_fifo[DMAC_FIFO_LEN]; unsigned int dmac_ptr; + unsigned int pwm_irq_sample_cnt; }; struct Pico32xMem @@ -460,6 +467,7 @@ struct Pico32xMem unsigned short pal[0x100]; unsigned short pal_native[0x100]; // converted to native (for renderer) unsigned int sh2_peri_regs[2][0x200/4]; // periphereal regs of SH2s + signed short pwm[2*PWM_BUFF_LEN]; // PWM buffer for current frame }; // area.c @@ -666,11 +674,19 @@ void PicoWrite8_32x(unsigned int a, unsigned int d); void PicoWrite16_32x(unsigned int a, unsigned int d); void PicoMemSetup32x(void); void Pico32xSwapDRAM(int b); -void p32x_poll_event(int is_vdp); +void p32x_poll_event(int cpu_mask, int is_vdp); // 32x/draw.c void FinalizeLine32xRGB555(int sh, int line); +// 32x/pwm.c +unsigned int p32x_pwm_read16(unsigned int a); +void p32x_pwm_write16(unsigned int a, unsigned int d); +void p32x_pwm_refresh(void); +void p32x_pwm_irq_check(int new_line); +void p32x_pwm_update(int *buf32, int length, int stereo); +extern int pwm_frame_smp_cnt; + /* avoid dependency on newer glibc */ static __inline int isspace_(int c) { @@ -702,6 +718,7 @@ static __inline int isspace_(int c) #define EL_CDREGS 0x00020000 /* MCD: register access */ #define EL_CDREG3 0x00040000 /* MCD: register 3 only */ #define EL_32X 0x00080000 +#define EL_PWM 0x00100000 /* 32X PWM stuff (LOTS of output) */ #define EL_STATUS 0x40000000 /* status messages */ #define EL_ANOMALY 0x80000000 /* some unexpected conditions (during emulation) */