AM64x MCU+ SDK  10.00.00
ub_esarray.h File Reference

Introduction

Allocated memory array which is expanded or shrinked automatically.

How it expands and shrinks is defined by 'ub_esarray_init' call. The first allocation happens at the call of 'ub_esarray_init'. 'ub_esarray_close' must be called at the end to free all the allocated area.

To use as a fifo, push data by 'ub_esarray_add_ele', and pop data by 'ub_esarray_pop_ele'. The contents of data element is copied each time.

To use as a lifo(stack), push data by 'ub_esarray_add_ele', and pop data by 'ub_esarray_pop_last_ele'. The contents of data element is copied each time.

To avoid copying data, data pointer and data index can be used. But such use can't be thread safe. To be thread safe, data must be locked by calling 'ub_esarray_data_lock' during the time of using the pointers or the index numbers, and must be unlocked by calling 'ub_esarray_data_unlock' after that.

Go to the source code of this file.

Typedefs

typedef struct ub_esarray_cstd ub_esarray_cstd_t
 the data handle of ub_esarray object, the inside of it is private More...
 
typedef void ub_esarray_element_t
 data type of the element More...
 

Functions

ub_esarray_cstd_tub_esarray_init (int esunit, int elesize, int maxeles)
 initialize ub_esarray object. More...
 
void ub_esarray_close (ub_esarray_cstd_t *eah)
 close ub_esarray More...
 
int ub_esarray_add_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed)
 add one element More...
 
int ub_esarray_pop_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed)
 pop in fifo mode(get from index=0, and delete index=0) More...
 
int ub_esarray_pop_last_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed)
 pop in stack mode(get from the last index, and delete it) More...
 
int ub_esarray_del_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed)
 delete one element *ed More...
 
int ub_esarray_data_lock (ub_esarray_cstd_t *eah)
 lock data to preserve checked out data by ub_esarray_get_newele or ub_esarray_get_ele More...
 
int ub_esarray_data_unlock (ub_esarray_cstd_t *eah)
 unlock data to return to the default status More...
 
int ub_esarray_ele_nums (ub_esarray_cstd_t *eah)
 returns the number of elements More...
 
ub_esarray_element_tub_esarray_get_newele (ub_esarray_cstd_t *eah)
 get a new element from the ub_esarray_array More...
 
ub_esarray_element_tub_esarray_get_ele (ub_esarray_cstd_t *eah, int index)
 get the indexed element from the ub_esarray_array More...
 
int ub_esarray_del_pointer (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed)
 delete one element with element pointer More...
 
int ub_esarray_del_index (ub_esarray_cstd_t *eah, int index)
 delete one element with index More...