This commit is contained in:
刘可亮
2024-10-30 16:50:31 +08:00
parent 0ef85b55da
commit 661e71562d
458 changed files with 46555 additions and 12133 deletions

View File

@@ -7,7 +7,14 @@ if LPKG_USING_FREETYPE
bool "Compile using FREETYPE static link library"
default n
config TT_DISABLE_LOAD_HDMX
bool "Disable loading hdmx table"
default n
config TT_DISABLE_LOAD_HDMX
bool "Disable loading hdmx table"
default n
if AIC_PSRAM_SW_SIZE > 0 && AIC_CHIP_D13X
config TT_USE_MEM_PSRAM_SW_HEAP
bool "FreeType using Psram SW Heap"
default n
endif
endif

View File

@@ -100,6 +100,45 @@
#include <stdio.h>
#include <rtconfig.h>
#if defined(KERNEL_BAREMETAL)
#include <unistd.h>
#include <fcntl.h>
#define FT_FILE int
static inline FT_FILE *ft_fopen(const char *pathname, const char *mode)
{
(void)mode;
int file;
file = open(pathname, O_RDONLY);
if (file < 0)
return NULL;
else
return (FT_FILE *)(long)file;
}
static inline int ft_fclose(FT_FILE *stream)
{
return close((int)(long)stream);
}
static inline size_t ft_fread(void *ptr, size_t size, size_t nmemb, FT_FILE *stream)
{
return read((int)(long)stream, ptr, size * nmemb);
}
static inline int ft_fseek(FT_FILE *stream, size_t offset, int whence)
{
return lseek((int)(long)stream, offset, whence);
}
static inline long ft_ftell(FT_FILE *stream)
{
return lseek((int)(long)stream, 0, SEEK_CUR);
}
#else
#define FT_FILE FILE
#define ft_fclose fclose
@@ -107,6 +146,8 @@
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#endif
#define ft_sprintf sprintf
@@ -128,11 +169,56 @@
*
*/
#ifndef TT_USE_MEM_PSRAM_SW_HEAP
#define ft_scalloc calloc
#define ft_sfree free
#define ft_smalloc malloc
#define ft_srealloc realloc
#else
#include "aic_osal.h"
static inline void *ft_smalloc(size_t size)
{
return aicos_malloc(MEM_PSRAM_SW, size);
}
static inline void *ft_scalloc(size_t count, size_t size)
{
void *p = ft_smalloc(count * size);
if (p) {
memset(p, 0, count * size);
}
return p;
}
static inline void ft_sfree(void *rmem)
{
aicos_free(MEM_PSRAM_SW, rmem);
}
static inline void *ft_srealloc(void *rmem, size_t newsize)
{
(void)rmem;
(void)newsize;
return NULL;
}
static inline void *ft_srealloc_cur(long cur_size, long new_size, void *rmem)
{
void *p = 0;
if (new_size > cur_size) {
p = ft_smalloc(new_size);
if(p) {
memcpy(p, rmem, cur_size);
ft_sfree(rmem);
}
} else {
p = rmem;
}
return p;
}
#endif
/**************************************************************************

View File

@@ -108,9 +108,13 @@
void* block )
{
FT_UNUSED( memory );
#ifdef TT_USE_MEM_PSRAM_SW_HEAP
return ft_srealloc_cur(cur_size, new_size, block);
#else
FT_UNUSED( cur_size );
return ft_srealloc( block, (size_t)new_size );
#endif
}