移植到stm32f1,实现手动线赋码控制器功能

This commit is contained in:
ranchuan
2023-09-09 17:27:06 +08:00
parent 8d779a68f3
commit 7baa63de05
382 changed files with 36618 additions and 148064 deletions

View File

@@ -22,7 +22,7 @@ typedef struct
#define SRAM_USER_SIZE (80*1024)
#define SRAM_USER_SIZE (18*1024)
#define MEM_BLOCK_SIZE (32)
#define MEM_MAX_SIZE (((SRAM_USER_SIZE))*MEM_BLOCK_SIZE/(MEM_BLOCK_SIZE+2))
#define MEM_ALLOC_TABLE_SIZE ((MEM_MAX_SIZE/MEM_BLOCK_SIZE)&(~3))
@@ -192,6 +192,37 @@ void *realloc(void *p,size_t size)
}
/*
void *malloc(size_t size)
{
return rt_malloc_align(size,4);
}
void *calloc(size_t nmemb,size_t size)
{
return rt_calloc(nmemb,size);
}
void *realloc(void *p,size_t size)
{
return rt_realloc(p,size);
}
static void self_free(void *p)
{
rt_free(p);
}
void mem_init(void)
{
}
int mem_perused(void)
{
uint32_t used,total,max_used;
rt_memory_info(&total,&used,&max_used);
return used;
}
*/
#define MEM_TEMP_PTR_NUM 800
typedef void (*del_fun_def)(void *t);
@@ -318,12 +349,9 @@ void *tmalloc(uint32_t size)
// 把指针添加为临时指针
void *tappend(void *p,void *del)
{
mallco_dev *self=&g_self;
temp_def *t=&g_tempptr;
void *ret=NULL;
rt_mutex_take(t->mutex,RT_WAITING_FOREVER);
if(((uint32_t)p>=(uint32_t)self->membase)&&
((uint32_t)p<(uint32_t)(self->membase+self->memsize)))
{
if(tempptr_find(t,p)==0)
{
@@ -340,7 +368,6 @@ void *tappend(void *p,void *del)
void free(void *p)
{
if(p==NULL) return;
mallco_dev *self=&g_self;
temp_def *t=&g_tempptr;
int ret=0;
rt_mutex_take(t->mutex,RT_WAITING_FOREVER);