Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Allocates memory from specified segment for a "hardware buffer" (a buffer that can be accessed via a DMA engine). The returned buffer will be padded in function of memory segment's properties.

...

lib_mem.h/lib_mem.c

Prototype

Code Block
languagecpp
void  *Mem_SegAllocHW (const  CPU_CHAR    *p_name,
                              MEM_SEG     *p_seg,
                              CPU_SIZE_T   size,
                              CPU_SIZE_T   align,
                              CPU_SIZE_T  *p_bytes_reqd,
                              LIB_ERR     *p_err)


Arguments

p_name

Pointer to allocated object name. Used for allocations tracking. May be DEF_NULL.

...

  1. The buffer returned by this function will be padded according to the padding_align argument passed at creation of this memory segment. This is particularly useful with systems that use cache memory and DMA engine to copy buffers as it guarantees that nothing else will be allocated on the same cache line (as long as the padding_align argument is set to the length of a cache line).
  2. For a an usage example of this function, refer to Memory Segments page.