2 #include "lfds700_ringbuffer_internal.h"
8 /****************************************************************************/
9 void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs,
10 struct lfds700_ringbuffer_element *re_array_inc_dummy,
11 lfds700_pal_uint_t number_elements,
12 struct lfds700_misc_prng_state *ps,
18 LFDS700_PAL_ASSERT( rs != NULL );
19 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->fs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
20 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->qs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
21 LFDS700_PAL_ASSERT( re_array_inc_dummy != NULL );
22 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
23 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
24 LFDS700_PAL_ASSERT( number_elements >= 2 );
25 LFDS700_PAL_ASSERT( ps != NULL );
26 // TRD : user_state can be NULL
28 rs->user_state = user_state;
30 re_array_inc_dummy[0].qe_use = &re_array_inc_dummy[0].qe;
32 lfds700_freelist_init_valid_on_current_logical_core( &rs->fs, rs );
33 lfds700_queue_init_valid_on_current_logical_core( &rs->qs, &re_array_inc_dummy[0].qe, ps, rs );
35 for( loop = 1 ; loop < number_elements ; loop++ )
37 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
38 LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
40 re_array_inc_dummy[loop].qe_use = &re_array_inc_dummy[loop].qe;
41 LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re_array_inc_dummy[loop].fe, &re_array_inc_dummy[loop] );
42 lfds700_freelist_push( &rs->fs, &re_array_inc_dummy[loop].fe, ps );
45 LFDS700_MISC_BARRIER_STORE;
47 lfds700_misc_force_store();