RTEMS CAN/CAN FD Stack
Loading...
Searching...
No Matches
Macros
can-helpers.h File Reference

This header file is part of CAN/CAN FD bus common support. It implements functions and defines used to simplify controller's operations. More...

#include <rtems.h>
#include <stdatomic.h>
Include dependency graph for can-helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RTEMS_CAN_USER_MAGIC   0x05402033
 This define provides user magic value. It is used to check whether rtems_can_user structure was correctly initialized.
 
#define BIT(nr)   ( 1UL << ( nr ) )
 
#define GENMASK(h, l)    ( ( ( ~0UL ) << ( l ) ) & ( ~0UL >> ( sizeof( long ) * 8 - 1 - ( h ) ) ) )
 
#define __bf_shf(x)   ( __builtin_ffsll( x ) - 1 )
 
#define FIELD_PREP(_mask, _val)    ( { ( (typeof( _mask )) ( _val ) << __bf_shf( _mask ) ) & ( _mask ); } )
 
#define FIELD_GET(_mask, _reg)    ( { (typeof( _mask )) ( ( ( _reg ) & ( _mask ) ) >> __bf_shf( _mask ) ); } )
 

Detailed Description

This header file is part of CAN/CAN FD bus common support. It implements functions and defines used to simplify controller's operations.

Implementation is based on original LinCAN - Linux CAN bus driver Part of OrtCAN project https://ortcan.sourceforge.net/