HALFRED  0.4.0
hal_bp.h
Go to the documentation of this file.
1 
11 #ifndef HAL_BP_H_
12 #define HAL_BP_H_
13 
14 
15 #include "hal_core.h"
16 #include <stdint.h>
17 
18 
74 /*
75  * Internal configuration of the buffer pool module.
76  */
77 
78 /* The alignment of the memory area inside of the (partial) buffers. */
79 #define HAL_BP_MEM_ALIGN 4UL
80 
81 #define HAL_BP_MUTEX_DECLARE(name) void* name
82 #define HAL_BP_MUTEX_CREATE(name) name = NULL
83 #define HAL_BP_MUTEX_LOCK(name) CORE_EnterCritical()
84 #define HAL_BP_MUTEX_UNLOCK(name) CORE_ExitCritical()
85 
86 
87 struct BP_BufferPool_Tag;
88 typedef struct BP_BufferPool_Tag* BP_BufferPool;
89 
90 typedef struct BP_PartialBuf_Tag
91 {
92  uint32_t size;
93  void* data;
94  struct BP_PartialBuf_Tag* next;
95  BP_BufferPool pool;
97 
99 
100 
111 BP_BufferPool BP_Create(uint32_t no_buffers, uint32_t buffer_size);
112 
124 BP_PartialBuffer BP_GetBuffer(BP_BufferPool bp, uint32_t buf_len);
125 
134 
148 uint32_t BP_CopyToMem(BP_PartialBuffer src, void* dst, uint32_t src_offset, uint32_t data_len);
149 
163 uint32_t BP_CopyToBuf(BP_PartialBuffer dst, const void* src, uint32_t dst_offset, uint32_t data_len);
164 
172 void BP_InitStandaloneBuf(BP_PartialBuffer buf, void* mem_area, uint32_t mem_size);
173 
180 #endif /* HAL_BP_H_ */
void BP_ReleaseBuffer(BP_PartialBuffer buf)
void BP_InitStandaloneBuf(BP_PartialBuffer buf, void *mem_area, uint32_t mem_size)
Definition: hal_bp.h:90
uint32_t BP_CopyToBuf(BP_PartialBuffer dst, const void *src, uint32_t dst_offset, uint32_t data_len)
BP_BufferPool BP_Create(uint32_t no_buffers, uint32_t buffer_size)
CPU Core API.
uint32_t BP_CopyToMem(BP_PartialBuffer src, void *dst, uint32_t src_offset, uint32_t data_len)
BP_PartialBuffer BP_GetBuffer(BP_BufferPool bp, uint32_t buf_len)