X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fmemory.h;h=ae7ae50dad2ce115112f6314ac9da935f62e8268;hb=refs%2Ftags%2Fv1.92;hp=44213714e53c008c29c1bbb3a9eeff06673ff785;hpb=77e58d93fe3fd60f3b0adc4b7364713db714c904;p=picodrive.git diff --git a/pico/memory.h b/pico/memory.h index 4421371..ae7ae50 100644 --- a/pico/memory.h +++ b/pico/memory.h @@ -45,7 +45,8 @@ void cpu68k_map_set(uptr *map, int start_addr, int end_addr, void cpu68k_map_all_ram(int start_addr, int end_addr, void *ptr, int is_sub); void m68k_map_unmap(int start_addr, int end_addr); -#define map_flag_set(x) ((x) & ((uptr)1 << (sizeof(uptr) * 8 - 1))) +#define MAP_FLAG ((uptr)1 << (sizeof(uptr) * 8 - 1)) +#define map_flag_set(x) ((x) & MAP_FLAG) #define MAKE_68K_READ8(name, map) \ u32 name(u32 a) \ @@ -132,6 +133,25 @@ void name(u32 a, u32 d) \ } \ } +#ifdef NEED_DMA_SOURCE // meh + +static __inline void *m68k_dma_source(u32 a) +{ + u8 *base; + uptr v; + v = m68k_read16_map[a >> M68K_MEM_SHIFT]; + if (map_flag_set(v)) { + if (a >= Pico.romsize) // Rom + return NULL; + base = Pico.rom; + } + else + base = (void *)(v << 1); + return base + (a & 0xfe0000); +} + +#endif + // 32x typedef struct { uptr addr; // stores (membase >> 1) or ((handler >> 1) | (1<<31))