135 #define TN_FMEM_BUF_DEF(name, item_type, size) \
138 * (TN_MAKE_ALIG_SIZE(sizeof(item_type)) / sizeof(TN_UWord)) \
213 unsigned int block_size,
struct TN_ListItem wait_queue
list of tasks waiting for free memory block
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_Timeout
The value representing maximum number of system ticks to wait.
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
ptr to free block list
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_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.
enum TN_RCode tn_fmem_get(struct TN_FMem *fmem, void **p_data, TN_Timeout timeout)
Get memory block from the pool.