You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
1.1 KiB

/* memory.h - roundmb, truncmb, freestk */
/* avr specific values. Original saved under orig/ folder */
#define PAGE_SIZE 1024 // TODO: unused?
/*----------------------------------------------------------------------
* roundmb, truncmb - Round or truncate address to memory block size
*----------------------------------------------------------------------
*/
#define roundmb(x) (char *)( (7 + (uint32)(x)) & (~7) )
#define truncmb(x) (char *)( ((uint32)(x)) & (~7) )
/*----------------------------------------------------------------------
* freestk -- Free stack memory allocated by getstk
*----------------------------------------------------------------------
*/
#define freestk(p,len) freemem((char *)((uint32)(p) \
- ((uint32)roundmb(len)) \
+ (uint32)sizeof(uint32)), \
(uint32)roundmb(len) )
struct memblk { /* See roundmb & truncmb */
struct memblk *mnext; /* Ptr to next free memory blk */
uint32 mlength; /* Size of blk (includes memblk)*/
};
extern struct memblk memlist; /* Head of free memory list */
extern void *minheap; /* Start of heap */
extern void *maxheap; /* Highest valid heap address */