alienwalker 3 лет назад
Родитель
Сommit
bfc19681f7
2 измененных файлов с 8 добавлено и 5 удалено
  1. 6 5
      application/src/luat_malloc_air105.c
  2. 2 0
      bsp/common/include/bsp_common.h

+ 6 - 5
application/src/luat_malloc_air105.c

@@ -53,12 +53,13 @@ void* luat_heap_realloc(void* ptr, size_t len) {
 }
 
 void* luat_heap_calloc(size_t count, size_t _size) {
-    void *ptr = luat_heap_malloc(count * _size);
-    if (ptr) {
-        memset(ptr, 0, _size);
-    }
-    return ptr;
+    return OS_Calloc(count,_size);
+}
+
+void* luat_heap_zalloc(size_t _size) {
+    return OS_Zalloc(_size);
 }
+
 //------------------------------------------------
 void luat_vm_pool_init(void)
 {

+ 2 - 0
bsp/common/include/bsp_common.h

@@ -211,6 +211,7 @@ enum
 #ifndef MIN
 #define MIN(X,Y)	(((X) < (Y))?(X):(Y))
 #endif
+typedef void (*IrqHandler)(int32_t IrqLine, void *pData);
 typedef void (* TaskFun_t)( void * );
 typedef void (* CommonFun_t)(void);
 typedef void(* CBDataFun_t)(uint8_t *Data, uint32_t Len);
@@ -327,6 +328,7 @@ uint8_t OS_IsSchedulerRun(void);
 uint32_t OS_EnterCritical(void);
 void OS_ExitCritical(uint32_t Critical);
 void *OS_Malloc(uint32_t Size);
+void *OS_Calloc(uint32_t count, uint32_t eltsize);
 void *OS_Zalloc(uint32_t Size);
 void OS_Free(void *p);
 void *OS_Realloc(void *buf, uint32_t size);