ubinos
|
ubiclib heap API More...
Go to the source code of this file.
Classes | |
struct | __heap_tip_t |
Macros | |
#define | HEAP_ERR__POLLUTED_TOP -21 |
#define | HEAP_ERR__POLLUTED_BOTTOM -22 |
#define | HEAP_ERR__POLLUTED_HEADER -23 |
#define | HEAP_ERR__UNSUPPORTED -24 |
Typedefs | |
typedef struct __heap_tip_t | _heap_tip_t |
typedef _heap_tip_t * | heap_pt |
Functions | |
int | ubiclib_heap_comp_init (unsigned int addr, unsigned int size) |
int | ubiclib_heap_comp_init_reent (void) |
int | heap_create (heap_pt *heap_p, unsigned int addr, unsigned int size) |
int | heap_create_ext (heap_pt *heap_p, unsigned int addr, unsigned int size, int algorithm0, int locktype0, unsigned int m0, unsigned int fblcount0, int algorithm1, int locktype1, unsigned int m1, unsigned int fblcount1) |
int | heap_delete (heap_pt *heap_p) |
void * | heap_malloc (heap_pt heap, unsigned int size) |
void * | heap_mallocn (heap_pt heap, unsigned int size) |
void * | heap_mallocr (heap_pt heap, unsigned int size) |
int | heap_free (heap_pt heap, void *ptr) |
int | heap_checkblockboundary (heap_pt heap, void *ptr) |
int | heap_checkblockboundaryall (heap_pt heap) |
int | heap_getblocksize (heap_pt heap, void *ptr, unsigned int *size_p) |
void * | mallocn (size_t size) |
void * | mallocr (size_t size) |
int | heap_getsize (heap_pt heap, unsigned int *size_p) |
int | heap_getrequestedsize (heap_pt heap, unsigned int *size_p) |
int | heap_getrequestedsize_ext (heap_pt heap, unsigned int *size_p, unsigned int *nsize_p, unsigned int *rsize_p) |
int | heap_getrequestedsizemax (heap_pt heap, unsigned int *size_p) |
int | heap_getrequestedsizemax_ext (heap_pt heap, unsigned int *size_p, unsigned int *nsize_p, unsigned int *rsize_p) |
int | heap_getallocatedcount (heap_pt heap, unsigned int *count_p) |
int | heap_getallocatedcount_ext (heap_pt heap, unsigned int *count_p, unsigned int *ncount_p, unsigned int *rcount_p) |
int | heap_getallocatedcountmax (heap_pt heap, unsigned int *count_p) |
int | heap_getallocatedcountmax_ext (heap_pt heap, unsigned int *count_p, unsigned int *ncount_p, unsigned int *rcount_p) |
int | heap_getallocatedsize (heap_pt heap, unsigned int *size_p) |
int | heap_getallocatedsize_ext (heap_pt heap, unsigned int *size_p, unsigned int *nsize_p, unsigned int *rsize_p) |
int | heap_getallocatedsizemax (heap_pt heap, unsigned int *size_p) |
int | heap_getallocatedsizemax_ext (heap_pt heap, unsigned int *size_p, unsigned int *nsize_p, unsigned int *rsize_p) |
int | heap_getfreeblockcount (heap_pt heap, unsigned int *count_p) |
int | heap_getfreeblockcount_ext (heap_pt heap, unsigned int *count_p, unsigned int *ncount_p, unsigned int *rcount_p) |
int | heap_getblockoverhead (heap_pt heap, unsigned int *overhead_p) |
int | heap_printheapinfo (heap_pt heap) |
unsigned int | heap_group_calc_fblcount (unsigned int size, unsigned int m) |
unsigned int | heap_wbuddy_calc_fblcount (unsigned int size, unsigned int m) |
unsigned int | heap_pgroup_calc_fblcount (unsigned int size, unsigned int m) |
ubiclib heap API
ubiclib 힙 API를 정의합니다.
#define HEAP_ERR__POLLUTED_BOTTOM -22 |
하위 경계 영역이 오염되었음
#define HEAP_ERR__POLLUTED_HEADER -23 |
헤더 경계 영역이 오염되었음
#define HEAP_ERR__POLLUTED_TOP -21 |
상위 경계 영역이 오염되었음
#define HEAP_ERR__UNSUPPORTED -24 |
지원하지 않는 기능임
typedef struct __heap_tip_t _heap_tip_t |
API용 힙 구조체 정의
typedef _heap_tip_t* heap_pt |
API용 힙 포인터 형 정의
int heap_checkblockboundary | ( | heap_pt | heap, |
void * | ptr | ||
) |
메모리 블록의 경계 영역이 오염되었는지 여부를 검사하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
ptr | 대상 메모리 블록의 주소 |
메모리 블럭 구조
#if !(UBINOS__UBICLIB__EXCLUDE_HEAP_BOUNDARY_CHECK == 1) ----------------------------------- | header boundary | | -------- | | tag | | -------- | | ... | ----------------------------------- | top boundary | ----------------------------------- <---- memory address | memory | | | | | ----------------------------------- | tag | ----------------------------------- | bottom boundary | ----------------------------------- #else ----------------------------------- | header tag | | -------- | | ... | ----------------------------------- <---- memory address | memory | | | | | ----------------------------------- | tag | ----------------------------------- #endif
int heap_checkblockboundaryall | ( | heap_pt | heap | ) |
힙의 모든 메모리 블록들의 경계 영역이 오염되었는지 여부를 검사하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
int heap_create | ( | heap_pt * | heap_p, |
unsigned int | addr, | ||
unsigned int | size | ||
) |
힙을 생성하는 함수
heap_p | 생성한 힙의 주소를 저장할 포인터의 주소 |
addr | 힙으로 사용할 메모리의 주소 |
size | 힙으로 사용할 메모리의 크기 |
int heap_create_ext | ( | heap_pt * | heap_p, |
unsigned int | addr, | ||
unsigned int | size, | ||
int | algorithm0, | ||
int | locktype0, | ||
unsigned int | m0, | ||
unsigned int | fblcount0, | ||
int | algorithm1, | ||
int | locktype1, | ||
unsigned int | m1, | ||
unsigned int | fblcount1 | ||
) |
힙을 생성하는 함수의 확장형
heap_p | 생성한 힙의 주소를 저장할 포인터의 주소 |
addr | 힙으로 사용할 메모리의 주소 |
size | 힙으로 사용할 메모리의 크기 |
algorithm0 | 정방향 힙의 알고리즘 (UBINOS__UBICLIB__HEAP_ALGORITHM__...) |
locktype0 | 정방향 힙의 잠금 방식 (UBINOS__UBICLIB__HEAP_LOCK_TYPE__...) |
m0 | 정방향 힙의 그룹 시스템 M 값 |
fblcount0 | 정방향 힙의 사용가능 블록 리스트의 수 |
algorithm1 | 역방향 힙의 알고리즘 (UBINOS__UBICLIB__HEAP_ALGORITHM__...) |
locktype1 | 역방향 힙의 잠금 방식 (UBINOS__UBICLIB__HEAP_LOCK_TYPE__...) |
m1 | 역방향 힙의 그룹 시스템 M 값 |
fblcount1 | 역방향 힙의 사용가능 블록 리스트의 수 |
int heap_delete | ( | heap_pt * | heap_p | ) |
힙을 제거하는 함수
heap_p | 제거할 힙의 주소가 저장된 포인터의 주소 제거에 성공하면 *heap_p는 NULL이 됨 |
int heap_free | ( | heap_pt | heap, |
void * | ptr | ||
) |
메모리 블록을 해제하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
ptr | 대상 메모리 블록의 주소 |
int heap_getallocatedcount | ( | heap_pt | heap, |
unsigned int * | count_p | ||
) |
힙의 할당된 메모리 블록들의 총 수를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 수를 저장할 변수의 주소 |
int heap_getallocatedcount_ext | ( | heap_pt | heap, |
unsigned int * | count_p, | ||
unsigned int * | ncount_p, | ||
unsigned int * | rcount_p | ||
) |
힙의 할당된 메모리 블록들의 총 수를 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 수를 저장할 변수의 주소 NULL이면 무시함 |
ncount_p | 정방향으로 할당된 메모리 블록들의 총 수를 저장할 변수의 주소 NULL이면 무시함 |
rcount_p | 역방향으로 할당된 메모리 블록들의 총 수를 저장할 변수의 주소 NULL이면 무시함 |
int heap_getallocatedcountmax | ( | heap_pt | heap, |
unsigned int * | count_p | ||
) |
힙의 할당된 메모리 블록들의 총 수의 최고 기록을 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 수의 최고 기록을 저장할 변수의 주소 |
int heap_getallocatedcountmax_ext | ( | heap_pt | heap, |
unsigned int * | count_p, | ||
unsigned int * | ncount_p, | ||
unsigned int * | rcount_p | ||
) |
힙의 할당된 메모리 블록들의 총 수의 최고 기록을 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 수의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
ncount_p | 정방향으로 할당된 메모리 블록들의 총 수의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
rcount_p | 역방향으로 할당된 메모리 블록들의 총 수의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
int heap_getallocatedsize | ( | heap_pt | heap, |
unsigned int * | size_p | ||
) |
힙의 할당된 메모리 블록들의 총 크기를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 힙의 할당된 메모리 블록들의 총 크기를 저장할 변수의 주소 |
int heap_getallocatedsize_ext | ( | heap_pt | heap, |
unsigned int * | size_p, | ||
unsigned int * | nsize_p, | ||
unsigned int * | rsize_p | ||
) |
힙의 할당된 메모리 블록들의 총 크기를 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 힙의 할당된 메모리 블록들의 총 크기를 저장할 변수의 주소 NULL이면 무시함 |
nsize_p | 정방향으로 할당된 메모리 블록들의 총 크기를 저장할 변수의 주소 NULL이면 무시함 |
rsize_p | 역방향으로 할당된 메모리 블록들의 총 크기를 저장할 변수의 주소 NULL이면 무시함 |
int heap_getallocatedsizemax | ( | heap_pt | heap, |
unsigned int * | size_p | ||
) |
힙의 할당된 메모리 블록들의 총 크기의 최고 기록을 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 총 크기의 최고 기록을 저장할 변수의 주소 |
int heap_getallocatedsizemax_ext | ( | heap_pt | heap, |
unsigned int * | size_p, | ||
unsigned int * | nsize_p, | ||
unsigned int * | rsize_p | ||
) |
힙의 할당된 메모리 블록들의 총 크기의 최고 기록을 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 총 크기의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
nsize_p | 정방향으로 할당된 메모리 블록들의 총 크기의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
rsize_p | 역방향으로 할당된 메모리 블록들의 총 크기의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
int heap_getblockoverhead | ( | heap_pt | heap, |
unsigned int * | overhead_p | ||
) |
힙의 메모리 블록 당 부담(overhead)를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
overhead_p | 메모리 블럭 당 부담(overhead)를 저장할 변수의 주소 |
int heap_getblocksize | ( | heap_pt | heap, |
void * | ptr, | ||
unsigned int * | size_p | ||
) |
메모리 블록의 크기를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
ptr | 대상 메모리 블록의 주소 |
size_p | 크기를 저장할 변수의 주소 |
int heap_getfreeblockcount | ( | heap_pt | heap, |
unsigned int * | count_p | ||
) |
힙의 사용가능 블록의 수를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 사용가능 블록의 수를 저장할 변수의 주소 |
int heap_getfreeblockcount_ext | ( | heap_pt | heap, |
unsigned int * | count_p, | ||
unsigned int * | ncount_p, | ||
unsigned int * | rcount_p | ||
) |
힙의 사용가능 블록의 수를 돌려주는 확장형
heap | 대상 힙 NULL이면 기본 힙 |
count_p | 총 사용가능 블록의 수를 저장할 변수의 주소 NULL이면 무시함 |
ncount_p | 정방향 영역의 사용가능 블록의 수를 저장할 변수의 주소 NULL이면 무시함 |
rcount_p | 역방향 영역의 사용가능 블록의 수를 저장할 변수의 주소 NULL이면 무시함 |
int heap_getrequestedsize | ( | heap_pt | heap, |
unsigned int * | size_p | ||
) |
힙의 메모리 블록들의 요청 크기의 총 합을 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 요청 크기의 총 합을 저장할 변수의 주소 |
int heap_getrequestedsize_ext | ( | heap_pt | heap, |
unsigned int * | size_p, | ||
unsigned int * | nsize_p, | ||
unsigned int * | rsize_p | ||
) |
힙의 메모리 블록들의 요청 크기 총 합을 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 요청 크기의 총 합을 저장할 변수의 주소 NULL이면 무시함 |
nsize_p | 정방향으로 할당된 메모리 블록들의 요청 크기의 총 합을 저장할 변수의 주소 NULL이면 무시함 |
rsize_p | 역방향으로 할당된 메모리 블록들의 요청 크기의 총 합을 저장할 변수의 주소 NULL이면 무시함 |
int heap_getrequestedsizemax | ( | heap_pt | heap, |
unsigned int * | size_p | ||
) |
힙의 메모리 블록들의 요청 크기의 총 합의 최고 기록을 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 요청 크기의 총 합의 최고 기록을 저장할 변수의 주소 |
int heap_getrequestedsizemax_ext | ( | heap_pt | heap, |
unsigned int * | size_p, | ||
unsigned int * | nsize_p, | ||
unsigned int * | rsize_p | ||
) |
힙의 메모리 블록들의 요청 크기의 총 합의 최고 기록을 돌려주는 함수의 확장형
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 요청 크기의 총 합의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
nsize_p | 정방향으로 할당된 메모리 블록들의 요청 크기의 총 합의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
rsize_p | 역방향으로 할당된 메모리 블록들의 요청 크기의 총 합의 최고 기록을 저장할 변수의 주소 NULL이면 무시함 |
int heap_getsize | ( | heap_pt | heap, |
unsigned int * | size_p | ||
) |
힙의 크기를 돌려주는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size_p | 크기를 저장할 변수의 주소 |
unsigned int heap_group_calc_fblcount | ( | unsigned int | size, |
unsigned int | m | ||
) |
테일드 블록 그룹 시스템의 사용 가능 블록 리스트 수를 개산하는 함수
size | 최대 멤버 수 |
m | 최대 멤버 수 |
void* heap_malloc | ( | heap_pt | heap, |
unsigned int | size | ||
) |
메모리 블록을 할당하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size | 요청 크기 |
void* heap_mallocn | ( | heap_pt | heap, |
unsigned int | size | ||
) |
정방향으로 메모리 블록을 할당하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size | 요청 크기 |
void* heap_mallocr | ( | heap_pt | heap, |
unsigned int | size | ||
) |
역방향으로 메모리 블록을 할당하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
size | 요청 크기 |
unsigned int heap_pgroup_calc_fblcount | ( | unsigned int | size, |
unsigned int | m | ||
) |
그룹 시스템의 사용 가능 블록 리스트 수를 개산하는 함수
size | 최대 멤버 수 |
m | 최대 멤버 수 |
int heap_printheapinfo | ( | heap_pt | heap | ) |
힙의 정보를 출력하는 함수
heap | 대상 힙 NULL이면 기본 힙 |
unsigned int heap_wbuddy_calc_fblcount | ( | unsigned int | size, |
unsigned int | m | ||
) |
가중치 버디 시스템의 사용 가능 블록 리스트 수를 개산하는 함수
size | 최대 멤버 수 |
m | 의미 없음 |
void* mallocn | ( | size_t | size | ) |
기본 힙에서 정방향으로 메모리 블록을 할당하는 함수
size | 요청 크기 |
void* mallocr | ( | size_t | size | ) |
기본 힙에서 역방향으로 메모리 블록을 할당하는 함수
size | 요청 크기 |
int ubiclib_heap_comp_init | ( | unsigned int | addr, |
unsigned int | size | ||
) |
힙 컴포넌트를 초기화하는 함수
이 함수는 시스템 시작시 bsp 컴포넌트의 main 함수에서 자동적으로 호출됩니다.
addr | 기본 힙으로 사용할 메모리의 주소 |
size | 기본 힙으로 사용할 메모리의 크기 |
int ubiclib_heap_comp_init_reent | ( | void | ) |
힙 컴포넌트를 재진입(reenterance)이 가능하도록 초기화하는 함수
이 함수는 ubiclib_heap_comp_init 함수가 호출된 다음에 호출되어야 하며, 시스템 시작시 bsp 컴포넌트의 main 함수에서 자동적으로 호출됩니다.