This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
bl_mcu_sdk/components/xz/xz_port.c

29 lines
532 B
C
Raw Normal View History

2021-06-04 17:51:55 +08:00
#include "bflb_platform.h"
static uint8_t *mallocBuf=NULL;
static uint32_t malloced=0;
static uint32_t bufsize=0;
void simple_malloc_init(uint8_t *buf, uint32_t len)
{
mallocBuf=buf;
malloced=0;
bufsize=len;
}
void * simple_malloc(uint32_t size)
{
uint8_t *p;
MSG_DBG("Simple Malloc %d\r\n",size);
if(malloced+size<bufsize){
p=mallocBuf+malloced;
malloced+=size;
return p;
}
return NULL;
}
void simple_free(void *p)
{
MSG_DBG("Simple Free %08x\r\n",p);
return ;
}