CO_MATH
[COMMON]

Optimized math functions and other computations. More...

Collaboration diagram for CO_MATH:

Defines

#define CO_ALIGN4_HI(val)   (((val)+3)&~3)
 Align val on the multiple of 4 equal or nearest higher.
#define CO_ALIGNx_HI(val, x)   (((val)+((x)-1))&~((x)-1))
 Align val on the multiple of a given number equal or nearest higher.
#define CO_ALIGN4_LO(val)   ((val)&~3)
 Align val on the multiple of 4 equal or nearest lower.
#define CO_ALIGN2_HI(val)   (((val)+1)&~1)
 Align val on the multiple of 2 equal or nearest higher.
#define CO_ALIGN2_LO(val)   ((val)&~1)
 Align val on the multiple of 2 equal or nearest lower.

Functions

uint32_t co_crc32 (uint32_t addr, uint32_t len, uint32_t crc)
 Compute a CRC32 on the buffer passed as parameter.
__INLINE uint32_t co_clz (uint32_t val)
 Count leading zeros.
__INLINE void co_random_init (uint32_t seed)
 Function to initialize the random seed.
__INLINE uint8_t co_rand_byte (void)
 Function to get an 8 bit random number.
__INLINE uint16_t co_rand_hword (void)
 Function to get an 16 bit random number.
__INLINE uint32_t co_rand_word (void)
 Function to get an 32 bit random number.
__INLINE uint32_t co_min (uint32_t a, uint32_t b)
 Function to return the smallest of 2 unsigned 32 bits words.
__INLINE uint32_t co_max (uint32_t a, uint32_t b)
 Function to return the greatest of 2 unsigned 32 bits words.
__INLINE int co_abs (int val)
 Function to return the absolute value of a signed integer.

Variables

static const uint32_t crc_tab [256]
 CRC lookup table.

Detailed Description

Optimized math functions and other computations.


Define Documentation

#define CO_ALIGN2_HI ( val   )     (((val)+1)&~1)

Align val on the multiple of 2 equal or nearest higher.

Parameters:
[in] val Value to align.
Returns:
Value aligned.

Definition at line 78 of file co_math.h.

#define CO_ALIGN2_LO ( val   )     ((val)&~1)

Align val on the multiple of 2 equal or nearest lower.

Parameters:
[in] val Value to align.
Returns:
Value aligned.

Definition at line 88 of file co_math.h.

#define CO_ALIGN4_HI ( val   )     (((val)+3)&~3)

Align val on the multiple of 4 equal or nearest higher.

Parameters:
[in] val Value to align.
Returns:
Value aligned.

Definition at line 47 of file co_math.h.

Referenced by co_copy32(), txl_buffer_get_params(), and txl_mpdu_subframe_len().

#define CO_ALIGN4_LO ( val   )     ((val)&~3)

Align val on the multiple of 4 equal or nearest lower.

Parameters:
[in] val Value to align.
Returns:
Value aligned.

Definition at line 69 of file co_math.h.

Referenced by rxl_go_to_last_rbd(), and rxl_rxcntrl_frame().

#define CO_ALIGNx_HI ( val,
 )     (((val)+((x)-1))&~((x)-1))

Align val on the multiple of a given number equal or nearest higher.

x value should be a power of 2.

Parameters:
[in] val Value to align.
[in] x Multiple value.
Returns:
Value aligned.

Definition at line 60 of file co_math.h.


Function Documentation

__INLINE int co_abs ( int  val  ) 

Function to return the absolute value of a signed integer.

Parameters:
[in] val Value
Returns:
The absolute value of val.

Definition at line 236 of file co_math.h.

Referenced by chan_p2p_noa_resync_check().

__INLINE uint32_t co_clz ( uint32_t  val  ) 

Count leading zeros.

Parameters:
[in] val Value to count the number of leading zeros on.
Returns:
Number of leading zeros when value is written as 32 bits.

Definition at line 102 of file co_math.h.

Referenced by apm_start_req_handler(), rc_get_initial_rate_config(), and scanu_join_frame_handler().

uint32_t co_crc32 ( uint32_t  addr,
uint32_t  len,
uint32_t  crc 
)

Compute a CRC32 on the buffer passed as parameter.

The initial value of the computation is taken from crc parameter, allowing for incremental computation.

Parameters:
[in] addr Pointer to the buffer on which the CRC has to be computed
[in] len Length of the buffer
[in] crc The initial value of the CRC computation
Returns:
The CRC computed on the buffer.

Referenced by mm_compute_beacon_crc().

__INLINE uint32_t co_max ( uint32_t  a,
uint32_t  b 
)

Function to return the greatest of 2 unsigned 32 bits words.

Parameters:
[in] a First value
[in] b Second value
Returns:
The greatest value between a and b

Definition at line 224 of file co_math.h.

Referenced by rc_set_previous_mcs_index().

__INLINE uint32_t co_min ( uint32_t  a,
uint32_t  b 
)

Function to return the smallest of 2 unsigned 32 bits words.

Parameters:
[in] a First value
[in] b Second value
Returns:
The smallest value between a and b

Definition at line 211 of file co_math.h.

Referenced by bfr_check_next_nodes(), chan_start_p2pgo_noa(), dbg_vsnprintf_offset(), me_add_ie_supp_rates(), me_get_sta_bw(), me_pol_tbl_bw_upd(), me_rate_bitfield_vht_build(), me_set_sta_ht_vht_param(), me_sta_bw_nss_max_upd(), p2p_cli_noa_get_abs_time(), rc_set_max_amsdu_len(), rc_set_next_mcs_index(), rxu_mgt_ind_handler(), and txl_ampdu_constraints_get().

__INLINE uint8_t co_rand_byte ( void   ) 

Function to get an 8 bit random number.

Returns:
Random byte value.

Definition at line 176 of file co_math.h.

Referenced by bam_create_ba_agg().

__INLINE uint16_t co_rand_hword ( void   ) 

Function to get an 16 bit random number.

Returns:
Random half word value.

Definition at line 187 of file co_math.h.

Referenced by rc_new_random_rate(), and rc_set_trial_tx().

__INLINE uint32_t co_rand_word ( void   ) 

Function to get an 32 bit random number.

Returns:
Random word value.

Definition at line 198 of file co_math.h.

__INLINE void co_random_init ( uint32_t  seed  ) 

Function to initialize the random seed.

Parameters:
[in] seed The seed number to use to generate the random sequence.

Definition at line 165 of file co_math.h.


Generated on 14 Jan 2020 for Ceva-RW WLAN FullMAC SW documentation by  doxygen 1.6.1