RTEMS CAN/CAN FD Stack
Loading...
Searching...
No Matches
Macros | Enumerations
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 CAN_DEFAULT_FIFO_SIZE   64
 
#define RTEMS_CAN_USER_MAGIC   0x05402033
 This define provides user magic value. It is used to check whether 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)
 
#define FIELD_GET(_mask, _reg)
 

Enumerations

enum  can_state {
  CAN_STATE_ERROR_ACTIVE = 0 , CAN_STATE_ERROR_WARNING , CAN_STATE_ERROR_PASSIVE , CAN_STATE_BUS_OFF ,
  CAN_STATE_STOPPED , CAN_STATE_SLEEPING , CAN_STATE_MAX
}
 

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.

Macro Definition Documentation

◆ FIELD_GET

#define FIELD_GET (   _mask,
  _reg 
)
Value:
({ \
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
})

◆ FIELD_PREP

#define FIELD_PREP (   _mask,
  _val 
)
Value:
({ \
((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
})