1 /***** the library wide include file *****/
2 #include "lfds600_internal.h"
7 #define LFDS600_QUEUE_STATE_UNKNOWN -1
8 #define LFDS600_QUEUE_STATE_EMPTY 0
9 #define LFDS600_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE 1
10 #define LFDS600_QUEUE_STATE_ATTEMPT_DELFDS600_QUEUE 2
12 #define LFDS600_QUEUE_POINTER 0
13 #define LFDS600_QUEUE_COUNTER 1
14 #define LFDS600_QUEUE_PAC_SIZE 2
16 /***** structures *****/
17 #pragma pack( push, LFDS600_ALIGN_DOUBLE_POINTER )
19 struct lfds600_queue_state
21 struct lfds600_queue_element
22 *volatile enqueue[LFDS600_QUEUE_PAC_SIZE],
23 *volatile dequeue[LFDS600_QUEUE_PAC_SIZE];
28 struct lfds600_freelist_state
32 struct lfds600_queue_element
34 // TRD : next in a lfds600_queue requires volatile as it is target of CAS
35 struct lfds600_queue_element
36 *volatile next[LFDS600_QUEUE_PAC_SIZE];
38 struct lfds600_freelist_element
49 /***** private prototypes *****/
50 int lfds600_queue_internal_freelist_init_function( void **user_data, void *user_state );
51 void lfds600_queue_internal_freelist_delete_function( void *user_data, void *user_state );
53 void lfds600_queue_internal_new_element_from_freelist( struct lfds600_queue_state *qs, struct lfds600_queue_element *qe[LFDS600_QUEUE_PAC_SIZE], void *user_data );
54 void lfds600_queue_internal_guaranteed_new_element_from_freelist( struct lfds600_queue_state *qs, struct lfds600_queue_element * qe[LFDS600_QUEUE_PAC_SIZE], void *user_data );
55 void lfds600_queue_internal_init_element( struct lfds600_queue_state *qs, struct lfds600_queue_element *qe[LFDS600_QUEUE_PAC_SIZE], struct lfds600_freelist_element *fe, void *user_data );
57 void lfds600_queue_internal_queue( struct lfds600_queue_state *qs, struct lfds600_queue_element *qe[LFDS600_QUEUE_PAC_SIZE] );
59 void lfds600_queue_internal_validate( struct lfds600_queue_state *qs, struct lfds600_validation_info *vi, enum data_structure_validity *lfds600_queue_validity, enum data_structure_validity *lfds600_freelist_validity );