2004-02-19 11:34:18 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2004 Laurent Vivier <Laurent@lvivier.info>
|
2004-02-19 11:34:18 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-05-12 21:57:42 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
|
2005-10-20 21:12:13 +00:00
|
|
|
#if defined(USE_MMU030) || defined(USE_MMU040)
|
|
|
|
#define USE_MMU
|
|
|
|
#endif
|
|
|
|
|
2004-02-19 11:34:18 +00:00
|
|
|
/* physical memory information */
|
|
|
|
|
|
|
|
#define MAX_MEM_MAP_SIZE 26
|
2005-06-30 08:55:28 +00:00
|
|
|
#define KERNEL_BASEADDR 0x3000
|
2004-02-19 11:34:18 +00:00
|
|
|
|
|
|
|
typedef struct memory_bank {
|
|
|
|
unsigned long physAddr;
|
|
|
|
unsigned long logiAddr;
|
|
|
|
unsigned long size;
|
|
|
|
} memory_bank_t;
|
|
|
|
|
|
|
|
typedef struct memory_map {
|
|
|
|
memory_bank_t bank[MAX_MEM_MAP_SIZE];
|
|
|
|
unsigned long bank_number;
|
|
|
|
} memory_map_t;
|
|
|
|
|
|
|
|
extern memory_map_t memory_map;
|
|
|
|
|
2004-02-19 13:09:41 +00:00
|
|
|
extern void init_memory_map();
|
2004-02-23 00:24:05 +00:00
|
|
|
extern unsigned long bank_mem_avail();
|
2004-02-19 13:09:41 +00:00
|
|
|
extern void bank_dump();
|
2005-10-20 21:12:13 +00:00
|
|
|
#ifdef USE_MMU
|
2004-02-26 22:56:39 +00:00
|
|
|
extern int logical2physical(unsigned long logical, unsigned long *physical);
|
|
|
|
extern int physical2logical(unsigned long physical, unsigned long *logical);
|
2004-06-16 17:23:12 +00:00
|
|
|
extern int check_full_in_bank(unsigned long start, unsigned long size);
|
2004-07-12 21:32:44 +00:00
|
|
|
extern void *malloc_contiguous(size_t size);
|
2005-10-20 21:12:13 +00:00
|
|
|
#else
|
|
|
|
#define malloc_contiguous malloc
|
2005-10-20 22:01:29 +00:00
|
|
|
#define check_full_in_bank(a,b) (1)
|
2005-10-20 21:12:13 +00:00
|
|
|
#endif
|
2005-09-05 21:10:31 +00:00
|
|
|
extern void *malloc_top(size_t size);
|