mc .c/.h - Added realloc to realloc backup memory on the fly

This commit is contained in:
normmatt234 2006-11-14 06:16:03 +00:00
parent 2d03f5a247
commit 2f9339df37
2 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include "MMU.h"
#include "debug.h"
#include "types.h"
#include "mc.h"
@ -83,6 +84,13 @@ void mc_reset_com(memory_chip_t *mc)
mc->com = 0;
}
void mc_realloc(int type, u32 size)
{
if(MMU.bupmem.data) free(MMU.bupmem.data);
mc_init(&MMU.bupmem, type);
mc_alloc(&MMU.bupmem, size);
}
void mc_read_file(memory_chip_t *mc, char* filename)
{
FILE* file = fopen(filename, "rb");

View File

@ -44,6 +44,7 @@ typedef struct
void mc_init(memory_chip_t *mc, int type); /* reset and init values for memory struct */
u8 *mc_alloc(memory_chip_t *mc, u32 size); /* alloc mc memory */
void mc_realloc(int type, u32 size); /* realloc mc memory */
void mc_free(memory_chip_t *mc); /* delete mc memory */
void mc_reset_com(memory_chip_t *mc); /* reset communication with mc */
u8 fw_transfer(memory_chip_t *mc, u8 data); /* transfer to, then receive data from firmware */