WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_addr

函数

void * osal_kmalloc (unsigned long size, unsigned int osal_gfp_flag)
 Alloc dynamic memory.
 
void * osal_kzalloc (unsigned long size, unsigned int osal_gfp_flag)
 Alloc dynamic memory.
 
void * osal_kmalloc_align (unsigned int size, unsigned int osal_gfp_flag, unsigned int boundary)
 alloc aligned dynamic memory.
 
void * osal_kzalloc_align (unsigned int size, unsigned int osal_gfp_flag, unsigned int boundary)
 alloc aligned dynamic memory.
 
void osal_kfree (void *addr)
 Free dynamic memory.
 
void * osal_vmalloc (unsigned long size)
 alloc virtually contiguous memory.
 
void * osal_vzalloc (unsigned long size)
 alloc virtually contiguous memory.
 
void osal_vfree (void *addr)
 release memory allocd by vmalloc().
 
int osal_pool_mem_init (void *pool, unsigned int size)
 Initialize dynamic memory.
 
void * osal_pool_mem_alloc (void *pool, unsigned int size)
 alloc dynamic memory.
 
void * osal_pool_mem_alloc_align (void *pool, unsigned int size, unsigned int boundary)
 alloc aligned memory.
 
void osal_pool_mem_free (void *pool, const void *addr)
 Free dynamic memory.
 
int osal_pool_mem_deinit (void *pool)
 Deinitialize dynamic memory.
 
osal_blockmem_status osal_blockmem_get_status (unsigned long phyaddr, unsigned int size)
 Get the block mem status.
 
void * osal_ioremap (unsigned long phys_addr, unsigned long size)
 Map bus memory into CPU space.
 
void * osal_ioremap_nocache (unsigned long phys_addr, unsigned long size)
 Map bus memory into CPU space.
 
void * osal_ioremap_cached (unsigned long phys_addr, unsigned long size)
 Map bus memory into CPU space.
 
void osal_iounmap (void *addr, unsigned long size)
 Free a IO remapping.
 
void * osal_ioremap_wc (unsigned long phys_addr, unsigned long size)
 map memory into CPU space write combined.
 
void * osal_phys_to_virt (unsigned long addr)
 Change physical addresses to virtual addresses.
 
unsigned long osal_virt_to_phys (const void *virt_addr)
 Change virtual addresses to physical addresses.
 
void * osal_blockmem_vmap (unsigned long phys_addr, unsigned long size)
 Maps size from phys_addr into contiguous kernel virtual space.
 
void osal_blockmem_vunmap (const void *virt_addr)
 Free the virtually contiguous memory area.
 
void osal_blockmem_free (unsigned long phys_addr, unsigned long size)
 Free the reserved memory which has been defined in product.
 
unsigned long osal_copy_from_user (void *to, const void *from, unsigned long n)
 copy_from_user.
 
unsigned long osal_copy_to_user (void *to, const void *from, unsigned long n)
 copy_to_user.
 
int osal_access_ok (int type, const void *addr, unsigned long size)
 Check whether the user space memory block is available.
 

详细描述

函数说明

◆ osal_access_ok()

int osal_access_ok ( int  type,
const void *  addr,
unsigned long  size 
)

Check whether the user space memory block is available.

参数
type[in] Access type. 0:read, 1:write.
addr[in] A pointer variable to user space that points to the beginning of a memory block to be checked.
size[in] Size of the memory block to be checked.
返回值
trueuser space memory block is available.
falseuser space memory block is unavailable.
Support System:
linux liteos.

◆ osal_blockmem_free()

void osal_blockmem_free ( unsigned long  phys_addr,
unsigned long  size 
)

Free the reserved memory which has been defined in product.

Description:
Free the reserved memory which has been defined in product.
参数
phys_addrphysical address
sizeSize of the address to be manipulated
Support System:
linux.

◆ osal_blockmem_get_status()

osal_blockmem_status osal_blockmem_get_status ( unsigned long  phyaddr,
unsigned int  size 
)

Get the block mem status.

Description:
Get the block mem status.
参数
phyaddrphysical address
sizeSize of the address to be manipulated
返回值
OSAL_BLOCKMEM_VALIDThe block mem is valid.
OSAL_BLOCKMEM_INVALID_PHYADDRThe block mem is invalid.
OSAL_BLOCKMEM_INVALID_SIZEThe block mem is invalid.
Support System:
linux.

◆ osal_blockmem_vmap()

void * osal_blockmem_vmap ( unsigned long  phys_addr,
unsigned long  size 
)

Maps size from phys_addr into contiguous kernel virtual space.

参数
phys_addrphysical address
sizeSize of the address to be manipulated
注意
this function only support VM_MAP with PAGE_KERNEL flag.
Support System:
linux.

◆ osal_blockmem_vunmap()

void osal_blockmem_vunmap ( const void *  virt_addr)

Free the virtually contiguous memory area.

Description:
Free the virtually contiguous memory area starting at virt_addr which was created from the phys_addr passed to osal_vunmap().
参数
virt_addrvirtual address
注意
Must not be called in interrupt context.
Support System:
linux.

◆ osal_copy_from_user()

unsigned long osal_copy_from_user ( void *  to,
const void *  from,
unsigned long  n 
)

copy_from_user.

参数
to[out] The kernel address to which the data is copied.
from[in] The user space address of the data to be copied.
n[in] Length of data to be copied (unit: bytes).
返回
0 is returned on success; otherwise, the number of bytes that are not copied is returned.
Support System:
linux liteos freertos.

◆ osal_copy_to_user()

unsigned long osal_copy_to_user ( void *  to,
const void *  from,
unsigned long  n 
)

copy_to_user.

参数
to[out] The user space address to which the data is copied.
from[in] The kernel address of the data to be copied.
n[in] Length of data to be copied (unit: bytes).
返回
0 is returned on success; otherwise, the number of bytes that are not copied is returned.
Support System:
linux liteos freertos.

◆ osal_ioremap()

void * osal_ioremap ( unsigned long  phys_addr,
unsigned long  size 
)

Map bus memory into CPU space.

Description:
This API is used to map the device whose memory type is device memory and does not use the cache.
参数
phys_addr[in] bus address of the memory
size[in] size of the resource to map
返回
Returns the virtual address mapped to
Support System:
linux liteos.

◆ osal_ioremap_cached()

void * osal_ioremap_cached ( unsigned long  phys_addr,
unsigned long  size 
)

Map bus memory into CPU space.

Description:
This API is used to map the device whose memory type is normal memory and use the cache. This speeds up memory access and improves system performance.
参数
phys_addr[in] bus address of the memory
size[in] size of the resource to map
返回
Returns the virtual address mapped to
Support System:
linux liteos.

◆ osal_ioremap_nocache()

void * osal_ioremap_nocache ( unsigned long  phys_addr,
unsigned long  size 
)

Map bus memory into CPU space.

Description:
Map bus memory into CPU space.The functions of osal_ioremap_nocache are the same as those of osal_ioremap. and reserved symbols for backward compatibility with drivers that use the osal_ioremap_nocache interface.
参数
phys_addr[in] bus address of the memory
size[in] size of the resource to map
注意
Must be freed with iounmap.
返回
Returns the virtual address mapped to
Support System:
linux liteos freertos.

◆ osal_ioremap_wc()

void * osal_ioremap_wc ( unsigned long  phys_addr,
unsigned long  size 
)

map memory into CPU space write combined.

Description:
map memory into CPU space write combined.
参数
phys_addr[in] bus address of the memory
size[in] size of the resource to map
注意
Must be freed with iounmap.
返回
Returns the virtual address mapped to
Support System:
linux liteos.

◆ osal_iounmap()

void osal_iounmap ( void *  addr,
unsigned long  size 
)

Free a IO remapping.

参数
addr[in] virtual address from ioremap_*.
size[in] size of the resource to map
注意
Caller must ensure there is only one unmapping for the same pointer.
Support System:
linux liteos freertos.

◆ osal_kfree()

void osal_kfree ( void *  addr)

Free dynamic memory.

Description:
This API is used to free specified dynamic memory that has been allocd and update module mem used.
参数
addr[in] Starting address of the memory block to be freed.
Support System:
linux liteos freertos.

◆ osal_kmalloc()

void * osal_kmalloc ( unsigned long  size,
unsigned int  osal_gfp_flag 
)

Alloc dynamic memory.

Description:
This API is used to alloc a memory block of which the size is specified.
参数
size[in] How many bytes of memory are required.
osal_gfp_flag[in] The type of memory to alloc. This parameter is not used in liteos and freertos. In linux, it must include one of the following access modes: OSAL_GFP_ATOMIC, OSAL_GFP_DMA, OSAL_GFP_KERNEL. OSAL_GFP_ZERO can be bitwise-or'd in flags, Then, the memory is set to zero.
Support System:
linux liteos freertos.

◆ osal_kmalloc_align()

void * osal_kmalloc_align ( unsigned int  size,
unsigned int  osal_gfp_flag,
unsigned int  boundary 
)

alloc aligned dynamic memory.

Description:
This API is used to alloc memory blocks of specified size and of which the starting addresses are aligned on a specified boundary.
注意
The alignment parameter value must be a power of 2 with the minimum value being 4.
参数
size[in] Size of the memory block to be allocd (unit: byte).
osal_gfp_flag[in] The type of memory to alloc. This parameter is not used in liteos and freertos. In linux, it must include one of the following access modes: OSAL_GFP_ATOMIC, OSAL_GFP_DMA, OSAL_GFP_KERNEL. OSAL_GFP_ZERO can be bitwise-or'd in flags, Then, the memory is set to zero.
boundary[in] Boundary on which the memory is aligned. (unit: byte).
Support System:
liteos, freertos.

◆ osal_kzalloc()

void * osal_kzalloc ( unsigned long  size,
unsigned int  osal_gfp_flag 
)

Alloc dynamic memory.

Description:
This API is used to alloc a memory block of which the size is specified, and set the momory block to 0.
参数
size[in] How many bytes of memory are required.
osal_gfp_flag[in] The type of memory to alloc. This parameter is not used in liteos and freertos. In linux, it must include one of the following access modes: OSAL_GFP_ATOMIC, OSAL_GFP_DMA, OSAL_GFP_KERNEL. OSAL_GFP_ZERO can be bitwise-or'd in flags, Then, the memory is set to zero.
Support System:
linux liteos freertos.

◆ osal_kzalloc_align()

void * osal_kzalloc_align ( unsigned int  size,
unsigned int  osal_gfp_flag,
unsigned int  boundary 
)

alloc aligned dynamic memory.

Description:
This API is used to alloc memory blocks of specified size and of which the starting addresses are aligned on a specified boundary. The momory block will set to 0.
注意
The alignment parameter value must be a power of 2 with the minimum value being 4.
参数
size[in] Size of the memory block to be allocd (unit: byte).
osal_gfp_flag[in] The type of memory to alloc. This parameter is not used in liteos and freertos. In linux, it must include one of the following access modes: OSAL_GFP_ATOMIC, OSAL_GFP_DMA, OSAL_GFP_KERNEL. OSAL_GFP_ZERO can be bitwise-or'd in flags, Then, the memory is set to zero.
boundary[in] Boundary on which the memory is aligned. (unit: byte).
Support System:
liteos, freertos.

◆ osal_phys_to_virt()

void * osal_phys_to_virt ( unsigned long  addr)

Change physical addresses to virtual addresses.

参数
addrphysical address
返回
Returns the virtual address mapped to
Support System:
linux liteos freertos.

◆ osal_pool_mem_alloc()

void * osal_pool_mem_alloc ( void *  pool,
unsigned int  size 
)

alloc dynamic memory.

Description:
This API is used to alloc a memory block of which the size is specified and update module mem used.
注意
The input pool parameter must be initialized via func osal_pool_mem_init. The size of the input parameter size can not be greater than the memory pool size that specified at the second input parameter of osal_pool_mem_init. The size of the input parameter size must be four byte-aligned. This function is defined only when LOSCFG_MEM_MUL_MODULE is defined in liteos. This function is defined only when XLTCFG_SUPPORT_MEMMNG is defined in freertos.
参数
pool[in] Pointer to the memory pool that contains the memory block to be allocd.
size[in] Size of the memory block to be allocd (unit: byte).
返回值
NULLThe memory fails to be allocd.
VOID*The memory is successfully allocd, and the API returns the pointer to the allocd memory block.
Support System:
liteos, seliteos, freertos.

◆ osal_pool_mem_alloc_align()

void * osal_pool_mem_alloc_align ( void *  pool,
unsigned int  size,
unsigned int  boundary 
)

alloc aligned memory.

Description:
This API is used to alloc memory blocks of specified size and of which the starting addresses are aligned on a specified boundary and update module mem used.
注意
The input pool parameter must be initialized via func osal_pool_mem_init. The size of the input parameter size can not be greater than the memory pool size that specified at the second input parameter of osal_pool_mem_init. The alignment parameter value must be a power of 2 with the minimum value being 4. This function is defined only when LOSCFG_MEM_MUL_MODULE is defined in liteos. This function is defined only when XLTCFG_SUPPORT_MEMMNG is defined in freertos.
参数
pool[in] Pointer to the memory pool that contains the memory block to be allocd.
size[in] Size of the memory block to be allocd (unit: byte).
boundary[in] Boundary on which the memory is aligned. (unit: byte).
Support System:
liteos, seliteos, freertos.

◆ osal_pool_mem_deinit()

int osal_pool_mem_deinit ( void *  pool)

Deinitialize dynamic memory.

Description:
This API is used to deinitialize the dynamic memory of a doubly linked list.
注意
This function is defined only when LOSCFG_MEM_MUL_POOL is defined in liteos. This function is defined only when XLTCFG_SUPPORT_MEMMNG and XLTCFG_MEM_MUL_POOL are defined in freertos.
参数
pool[in] Starting address of memory.
返回值
OSAL_FAILUREThe dynamic memory fails to be deinitialized.
OSAL_SUCCESSThe dynamic memory is successfully deinitialized.
Support System:
liteos, seliteos, freertos.

◆ osal_pool_mem_free()

void osal_pool_mem_free ( void *  pool,
const void *  addr 
)

Free dynamic memory.

Description:
This API is used to free specified dynamic memory that has been allocd.
注意
The input pool parameter must be initialized via func osal_pool_mem_init. The input addr parameter must be allocd by osal_pool_mem_alloc or osal_pool_mem_alloc_align. This function is defined only when LOSCFG_MEM_MUL_MODULE is defined in liteos. This function is defined only when XLTCFG_SUPPORT_MEMMNG is defined in freertos.
参数
pool[in] Pointer to the memory pool that contains the dynamic memory block to be freed.
addr[in] Starting address of the memory block to be freed.
Support System:
liteos, seliteos, freertos.

◆ osal_pool_mem_init()

int osal_pool_mem_init ( void *  pool,
unsigned int  size 
)

Initialize dynamic memory.

Description:
This API is used to initialize the dynamic memory of a doubly linked list.
注意
The size parameter value should match the following two conditions:
1) Be less than or equal to the Memory pool size;
2) Be greater than the size of min_pool_size of each system.
Call this API when dynamic memory needs to be initialized during the startup of LiteOS. The parameter input must be 4 or 8 byte-aligned. The init area [pool, pool + size] should not conflict with other pools. This function is defined only when LOSCFG_MEM_MUL_MODULE is defined in liteos. This function is defined only when XLTCFG_SUPPORT_MEMMNG is defined in freertos.
参数
pool[in] Starting address of memory.
size[in] Memory size.
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
liteos, seliteos, freertos.

◆ osal_vfree()

void osal_vfree ( void *  addr)

release memory allocd by vmalloc().

Description:
This API is used to release memory allocd by osal_vmalloc().
参数
addr[in] Starting address of the memory block to be freed.
Support System:
linux liteos freertos.

◆ osal_virt_to_phys()

unsigned long osal_virt_to_phys ( const void *  virt_addr)

Change virtual addresses to physical addresses.

Support System:
linux liteos.

◆ osal_vmalloc()

void * osal_vmalloc ( unsigned long  size)

alloc virtually contiguous memory.

Description:
This API is used to alloc memory space with consecutive virtual addresses.
参数
size[in] How many bytes of memory are required.
返回
Returns the pointer to the virtual memory.
Support System:
linux liteos freertos.

◆ osal_vzalloc()

void * osal_vzalloc ( unsigned long  size)

alloc virtually contiguous memory.

Description:
This API is used to alloc memory space with consecutive virtual addresses. The momory space will set to 0.
参数
size[in] How many bytes of memory are required.
返回
Returns the pointer to the virtual memory.
Support System:
linux liteos freertos.