From eb9fecb1154901861b4f270b196bf572d9ebaf3d Mon Sep 17 00:00:00 2001 From: ariahiro64 Date: Sat, 21 Oct 2023 02:46:54 -0400 Subject: [PATCH] calculate fram size without seperate function --- src/flashcart/ed64/ed64_ll.c | 59 +++--------------------------------- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/src/flashcart/ed64/ed64_ll.c b/src/flashcart/ed64/ed64_ll.c index 973fca9d..d565e8af 100644 --- a/src/flashcart/ed64/ed64_ll.c +++ b/src/flashcart/ed64/ed64_ll.c @@ -221,33 +221,6 @@ void pi_dma_from_cart_safe (void *dest, void *src, unsigned long size) { } -int ed64_ll_get_sram128 (uint8_t *buffer, int size) { - - dma_wait(); - - io_write(PI_BSD_DOM2_LAT_REG, 0x05); - io_write(PI_BSD_DOM2_PWD_REG, 0x0C); - io_write(PI_BSD_DOM2_PGS_REG, 0x0D); - io_write(PI_BSD_DOM2_RLS_REG, 0x02); - - dma_wait(); - - pi_initialize(); - - dma_wait(); - - pi_dma_from_sram(buffer, 0 - (KiB(128) - KiB(32)), size) ; - - dma_wait(); - - io_write(PI_BSD_DOM2_LAT_REG, 0x40); - io_write(PI_BSD_DOM2_PWD_REG, 0x12); - io_write(PI_BSD_DOM2_PGS_REG, 0x07); - io_write(PI_BSD_DOM2_RLS_REG, 0x03); - - return 1; - -} int ed64_ll_get_sram (uint8_t *buffer, int size) { @@ -264,7 +237,7 @@ int ed64_ll_get_sram (uint8_t *buffer, int size) { dma_wait(); - pi_dma_from_sram(buffer, 0, size) ; + pi_dma_from_sram(buffer, 0 - (KiB(32) - size), size) ; dma_wait(); @@ -294,7 +267,7 @@ int ed64_ll_get_fram (uint8_t *buffer, int size) { ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K); //2 dma_wait(); - ed64_ll_get_sram128(buffer, size); + ed64_ll_get_sram(buffer, size); data_cache_hit_writeback_invalidate(buffer, size); dma_wait(); @@ -308,30 +281,6 @@ int ed64_ll_get_fram (uint8_t *buffer, int size) { sram upload */ -int ed64_ll_set_sram128 (uint8_t *buffer, int size) { - - //half working - dma_wait(); - //Timing - pi_initialize_sram(); - - //Readmode - pi_initialize(); - - data_cache_hit_writeback_invalidate(buffer,size); - dma_wait(); - - pi_dma_to_sram(buffer, 0 - (KiB(128) - KiB(32)), size); - data_cache_hit_writeback_invalidate(buffer,size); - - //Wait - dma_wait(); - //Restore evd Timing - ed64_ll_set_sdcard_timing(); - - return 1; - -} int ed64_ll_set_sram (uint8_t *buffer, int size) { @@ -346,7 +295,7 @@ int ed64_ll_set_sram (uint8_t *buffer, int size) { data_cache_hit_writeback_invalidate(buffer,size); dma_wait(); - pi_dma_to_sram(buffer, 0, size); + pi_dma_to_sram(buffer, 0 - (KiB(32) - size), size); data_cache_hit_writeback_invalidate(buffer,size); //Wait @@ -375,7 +324,7 @@ int ed64_ll_set_fram (uint8_t *buffer, int size) { ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K); dma_wait(); - ed64_ll_set_sram128(buffer, size); + ed64_ll_set_sram(buffer, size); data_cache_hit_writeback_invalidate(buffer, size); dma_wait();