146 #define TN_FMEM_BUF_DEF(name, item_type, size) \
149 * (TN_MAKE_ALIG_SIZE(sizeof(item_type)) / sizeof(TN_UWord)) \
224 unsigned int block_size,
struct TN_ListItem wait_queue
list of tasks waiting for free memory block
Circular doubly linked list, for internal kernel usage.
enum TN_RCode tn_fmem_release(struct TN_FMem *fmem, void *p_data)
Release memory block back to the pool.
TN_RCode
Result code returned by kernel services.
TN_ObjId
Magic number for object validity verification.
unsigned long TN_TickCnt
Type for system tick count, it is used by the kernel to represent absolute tick count value as well a...
Definitions used through the whole kernel.
int free_blocks_cnt
free blocks count
enum TN_ObjId id_fmp
id for object validity verification.
int blocks_cnt
capacity (total blocks count)
Fixed memory blocks pool.
void * free_list
Pointer to the first free memory block.
int tn_fmem_free_blocks_cnt_get(struct TN_FMem *fmem)
Returns number of free blocks in the memory pool.
enum TN_RCode tn_fmem_iget_polling(struct TN_FMem *fmem, void **p_data)
The same as tn_fmem_get() with zero timeout, but for using in the ISR.
enum TN_RCode tn_fmem_get(struct TN_FMem *fmem, void **p_data, TN_TickCnt timeout)
Get memory block from the pool.
enum TN_RCode tn_fmem_get_polling(struct TN_FMem *fmem, void **p_data)
The same as tn_fmem_get() with zero timeout.
void * start_addr
memory pool start address; note that it should be a multiple of sizeof(TN_UWord). ...
enum TN_RCode tn_fmem_create(struct TN_FMem *fmem, void *start_addr, unsigned int block_size, int blocks_cnt)
Construct fixed memory blocks pool.
enum TN_RCode tn_fmem_irelease(struct TN_FMem *fmem, void *p_data)
The same as tn_fmem_get(), but for using in the ISR.
void * data_elem
if task tries to receive data from memory pool, and there's no more free blocks in the pool...
unsigned int block_size
block size (in bytes); note that it should be a multiple of sizeof(TN_UWord}), use a macro TN_MAKE_AL...
enum TN_RCode tn_fmem_delete(struct TN_FMem *fmem)
Destruct fixed memory blocks pool.
FMem-specific fields related to waiting task, to be included in struct TN_Task.
Circular doubly linked list item, for internal kernel usage.
int tn_fmem_used_blocks_cnt_get(struct TN_FMem *fmem)
Returns number of used (non-free) blocks in the memory pool.