X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=pico%2Fpico_int.h;h=4f62a66ee238dc97abda8620ab5fc335b88c1e7e;hb=a44737c1876a7ad906d45e4ab65bd97f29366a05;hp=afcc838ee88ea99b6e2daed00d7dd067d6930ca6;hpb=4ea707e1e38b7ca204a5012f617018d0ea5eced2;p=picodrive.git diff --git a/pico/pico_int.h b/pico/pico_int.h index afcc838..4f62a66 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. @@ -231,7 +231,6 @@ typedef void (z80_write_f)(unsigned int a, unsigned char data); #include "cpu/sh2mame/sh2.h" SH2 msh2, ssh2; -#define ash2_pc() msh2.ppc #define ash2_end_run(after) sh2_icount = after #define sh2_pc(c) (c) ? ssh2.ppc : msh2.ppc @@ -405,11 +404,11 @@ typedef struct // 32X #define P32XS_FM (1<<15) #define P32XS2_ADEN (1<< 9) -#define P32XS_FULL (1<< 7) +#define P32XS_FULL (1<< 7) // DREQ FIFO full #define P32XS_68S (1<< 2) #define P32XS_RV (1<< 0) -#define P32XV_nPAL (1<<15) +#define P32XV_nPAL (1<<15) // VDP #define P32XV_PRI (1<< 7) #define P32XV_Mx (3<< 0) // display mode mask @@ -419,6 +418,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) @@ -434,6 +436,7 @@ 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 { @@ -448,18 +451,21 @@ struct Pico32x unsigned int sh2irqs; // common irqs unsigned short dmac_fifo[DMAC_FIFO_LEN]; unsigned int dmac_ptr; + unsigned int pwm_irq_sample_cnt; }; struct Pico32xMem { unsigned char sdram[0x40000]; - unsigned short dram[2][0x20000/2]; // AKA fb - unsigned char m68k_rom[0x10000]; // 0x100; using M68K_BANK_SIZE + unsigned short dram[2][0x20000/2]; // AKA fb + unsigned char m68k_rom[0x10000]; // 0x100; using M68K_BANK_SIZE + unsigned char data_array[2][0x1000]; // cache in SH2s (can be used as RAM) unsigned char sh2_rom_m[0x800]; unsigned char sh2_rom_s[0x400]; unsigned short pal[0x100]; - unsigned short pal_native[0x100]; // converted to native (for renderer) + 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 @@ -534,6 +540,7 @@ extern struct Pico Pico; extern struct PicoSRAM SRam; extern int PicoPadInt[2]; extern int emustatus; +extern int scanlines_total; extern void (*PicoResetHook)(void); extern void (*PicoLineHook)(void); PICO_INTERNAL int CheckDMA(void); @@ -670,6 +677,14 @@ void p32x_poll_event(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(void); +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) {