EM-ODP  3.7.0
Event Machine on ODP
event_machine_hw_specific.c File Reference
#include "em_include.h"
Include dependency graph for event_machine_hw_specific.c:

Go to the source code of this file.

Functions

void em_core_mask_zero (em_core_mask_t *mask)
 
void em_core_mask_set (int core, em_core_mask_t *mask)
 
void em_core_mask_clr (int core, em_core_mask_t *mask)
 
int em_core_mask_isset (int core, const em_core_mask_t *mask)
 
int em_core_mask_iszero (const em_core_mask_t *mask)
 
int em_core_mask_equal (const em_core_mask_t *mask1, const em_core_mask_t *mask2)
 
void em_core_mask_set_count (int count, em_core_mask_t *mask)
 
void em_core_mask_copy (em_core_mask_t *dst, const em_core_mask_t *src)
 
int em_core_mask_count (const em_core_mask_t *mask)
 
void em_core_mask_set_bits (const uint64_t bits[], int len, em_core_mask_t *mask)
 
int em_core_mask_get_bits (uint64_t bits[], int len, const em_core_mask_t *mask)
 
int em_core_mask_set_str (const char *mask_str, em_core_mask_t *mask)
 
void em_core_mask_tostr (char *mask_str, int len, const em_core_mask_t *mask)
 
int em_core_mask_idx (int n, const em_core_mask_t *mask)
 
void em_core_mask_and (em_core_mask_t *dst, const em_core_mask_t *src1, const em_core_mask_t *src2)
 
void em_core_mask_or (em_core_mask_t *dst, const em_core_mask_t *src1, const em_core_mask_t *src2)
 
void em_core_mask_xor (em_core_mask_t *dst, const em_core_mask_t *src1, const em_core_mask_t *src2)
 

Detailed Description

Event Machine HW specific functions and other additions.

Definition in file event_machine_hw_specific.c.

Function Documentation

◆ em_core_mask_and()

void em_core_mask_and ( em_core_mask_t dst,
const em_core_mask_t src1,
const em_core_mask_t src2 
)

Bitwise AND operation on two masks, store the result in 'dst'

dst = src1 & src2

Parameters
[out]dstDestination core mask, result is stored here
src1Source mask #1
src2Source mask #2

Definition at line 181 of file event_machine_hw_specific.c.

◆ em_core_mask_clr()

void em_core_mask_clr ( int  core,
em_core_mask_t mask 
)

Clear a bit in the mask.

Parameters
coreCore id
[out]maskCore mask

Definition at line 53 of file event_machine_hw_specific.c.

◆ em_core_mask_copy()

void em_core_mask_copy ( em_core_mask_t dst,
const em_core_mask_t src 
)

Copy core mask

Parameters
[out]dstDestination core mask
srcSource core mask

Definition at line 82 of file event_machine_hw_specific.c.

◆ em_core_mask_count()

int em_core_mask_count ( const em_core_mask_t mask)

Count the number of bits set in the mask.

Parameters
maskCore mask
Returns
Number of bits set

Definition at line 87 of file event_machine_hw_specific.c.

◆ em_core_mask_equal()

int em_core_mask_equal ( const em_core_mask_t mask1,
const em_core_mask_t mask2 
)

Test if two masks are equal

Parameters
mask1First core mask
mask2Second core mask
Returns
Non-zero if the two masks are equal

Definition at line 71 of file event_machine_hw_specific.c.

◆ em_core_mask_get_bits()

int em_core_mask_get_bits ( uint64_t  bits[],
int  len,
const em_core_mask_t mask 
)

Get core mask, stored in a uint64_t array for the user

core 0: bits[0] = 0x1 (len = 1) core 1: bits[0] = 0x2 (len = 1) ... core 64: bits[0] = 0x0, bits[1] = 0x1 (len = 2) core 65: bits[0] = 0x0, bits[1] = 0x2 (len = 2) ... cores 0-127: bits[0]=0xffffffffffffffff, bits[1]=0xffffffffffffffff (len=2) ...

Parameters
[out]bitsArray of uint64_t:s that the core mask will be stored in.
lenNumber of array elements in bits[].
maskCore mask to get bits from.
Returns
The number of uint64_t:s written into bits[].

Definition at line 115 of file event_machine_hw_specific.c.

◆ em_core_mask_idx()

int em_core_mask_idx ( int  n,
const em_core_mask_t mask 
)

Return the index (position) of the Nth set bit in the core mask

Parameters
nNth set bit, note n=1 means first set bit, n=[1...MaxCores]
maskCore mask
Returns
Index of the Nth set bit, <0 on error or if no such bit.

Definition at line 164 of file event_machine_hw_specific.c.

◆ em_core_mask_isset()

int em_core_mask_isset ( int  core,
const em_core_mask_t mask 
)

Test if a bit is set in the mask.

Parameters
coreCore id
maskCore mask
Returns
Non-zero if core id is set in the mask

Definition at line 58 of file event_machine_hw_specific.c.

◆ em_core_mask_iszero()

int em_core_mask_iszero ( const em_core_mask_t mask)

Test if the mask is all zero.

Parameters
maskCore mask
Returns
Non-zero if the mask is all zero

Definition at line 63 of file event_machine_hw_specific.c.

◆ em_core_mask_or()

void em_core_mask_or ( em_core_mask_t dst,
const em_core_mask_t src1,
const em_core_mask_t src2 
)

Bitwise OR operation on two masks, store the result in 'dst'

dst = src1 | src2

Parameters
[out]dstDestination core mask, result is stored here
src1Source mask #1
src2Source mask #2

Definition at line 188 of file event_machine_hw_specific.c.

◆ em_core_mask_set()

void em_core_mask_set ( int  core,
em_core_mask_t mask 
)

Set a bit in the mask.

Parameters
coreCore id
[out]maskCore mask

Definition at line 48 of file event_machine_hw_specific.c.

◆ em_core_mask_set_bits()

void em_core_mask_set_bits ( const uint64_t  bits[],
int  len,
em_core_mask_t mask 
)

Set specified bits from 'bits[]' in core mask.

core 0: bits[0] = 0x1 (len = 1) core 1: bits[0] = 0x2 (len = 1) ... core 64: bits[0] = 0x0, bits[1] = 0x1 (len = 2) core 65: bits[0] = 0x0, bits[1] = 0x2 (len = 2) ... cores 0-127: bits[0]=0xffffffffffffffff, bits[1]=0xffffffffffffffff (len=2) ...

Parameters
bitsArray of uint64_t:s with the bits to set in the core mask
lenNumber of array elements in bits[].
[out]maskCore mask to set.
Note
bits ar 'or'ed into mask, so any previously set bits will remain set.

Definition at line 92 of file event_machine_hw_specific.c.

◆ em_core_mask_set_count()

void em_core_mask_set_count ( int  count,
em_core_mask_t mask 
)

Set a range (0...count-1) of bits in the mask.

Parameters
countNumber of bits to set
[out]maskCore mask

Definition at line 76 of file event_machine_hw_specific.c.

◆ em_core_mask_set_str()

int em_core_mask_set_str ( const char *  mask_str,
em_core_mask_t mask 
)

Set bits in a mask according to a given string.

Parameters
mask_strString containing '0xcoremask' to set
[out]maskCore mask to set
Returns
Zero (0) on success, non-zero on error.
Note
bits ar 'or'ed into mask, so any previously set bits will remain set.

Definition at line 146 of file event_machine_hw_specific.c.

◆ em_core_mask_tostr()

void em_core_mask_tostr ( char *  mask_str,
int  len,
const em_core_mask_t mask 
)

Get core mask in string format

Parameters
[out]mask_strString into which the core mask will be printed
lenLength of 'mask_str'
maskCore mask to convert to string format

Definition at line 156 of file event_machine_hw_specific.c.

◆ em_core_mask_xor()

void em_core_mask_xor ( em_core_mask_t dst,
const em_core_mask_t src1,
const em_core_mask_t src2 
)

Bitwise XOR operation on two masks, store the result in 'dst'

dst = src1 ^ src2

Parameters
[out]dstDestination core mask, result is stored here
src1Source mask #1
src2Source mask #2

Definition at line 195 of file event_machine_hw_specific.c.

◆ em_core_mask_zero()

void em_core_mask_zero ( em_core_mask_t mask)

Zero the whole mask.

Parameters
[out]maskCore mask to zero (clear)

Definition at line 43 of file event_machine_hw_specific.c.