Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Macros | Functions
page.h File Reference
#include "kconfig.h"
Include dependency graph for page.h:

Go to the source code of this file.

Macros

#define PAGE_ORDER_MAX   4
 
#define PAGE_SIZE_MIN   256
 

Functions

unsigned long get_page_total_size (void)
 
unsigned long get_page_total_free_size (void)
 
long size_to_page_order (unsigned long size)
 Calculate the page order by giving the size of a memory. More...
 
unsigned long page_order_to_size (long order)
 Calculate the page size by giving the page order. More...
 
void * alloc_pages (unsigned long order)
 Allocate a new memory page. More...
 
void free_pages (unsigned long addr, unsigned long order)
 Free an allocated memory page. More...
 

Function Documentation

◆ alloc_pages()

void* alloc_pages ( unsigned long  order)

Allocate a new memory page.

Parameters
longThe page order.
Return values
void*: The function returns NULL if the allocation failed; otherwise it returns the address of the allocated memory page.

◆ free_pages()

void free_pages ( unsigned long  addr,
unsigned long  order 
)

Free an allocated memory page.

Parameters
addrPointer to the memory page.
orderThe order of the memory page.
Return values
None

◆ page_order_to_size()

unsigned long page_order_to_size ( long  order)

Calculate the page size by giving the page order.

Parameters
longThe page order.
Return values
unsignedlong: The memory size of page in bytes.

◆ size_to_page_order()

long size_to_page_order ( unsigned long  size)

Calculate the page order by giving the size of a memory.

Parameters
sizeThe memory size in bytes.
Return values
longThe page order.