SimAVR
AVR Simulator
Register Bit

These accessors are inlined and are used to perform the operations on avr_regbit_t definitions. More...

Macros

#define ARRAY_SIZE(_aa)   (sizeof(_aa) / sizeof((_aa)[0]))
 
#define AVR_IO_REGBIT(_io, _bit)   { . reg = (_io), .bit = (_bit), .mask = 1 }
 
#define AVR_IO_REGBITS(_io, _bit, _mask)   { . reg = (_io), .bit = (_bit), .mask = (_mask) }
 

Functions

static uint8_t avr_regbit_set (avr_t *avr, avr_regbit_t rb)
 Set/get/clear io register bits in one operation. More...
 
static uint8_t avr_regbit_setto (avr_t *avr, avr_regbit_t rb, uint8_t v)
 
static uint8_t avr_regbit_setto_raw (avr_t *avr, avr_regbit_t rb, uint8_t v)
 Set the 'raw' bits, if 'v' is the unshifted value of the bits. More...
 
static uint8_t avr_regbit_get (avr_t *avr, avr_regbit_t rb)
 
static uint8_t avr_regbit_from_value (avr_t *avr, avr_regbit_t rb, uint8_t value)
 Using regbit from value eliminates some of the set to test then clear register operations. More...
 
static uint8_t avr_regbit_get_raw (avr_t *avr, avr_regbit_t rb)
 Return the bit(s) 'in position' instead of zero based. More...
 
static uint8_t avr_regbit_clear (avr_t *avr, avr_regbit_t rb)
 
static uint8_t avr_regbit_get_array (avr_t *avr, avr_regbit_t *rb, int count)
 This reads the bits for an array of avr_regbit_t, make up a "byte" with them. More...
 
static void avr_regbit_set_array_from_value (avr_t *avr, avr_regbit_t *rb, uint8_t count, uint8_t value)
 Does the reverse of avr_regbit_get_array. More...
 

Detailed Description

These accessors are inlined and are used to perform the operations on avr_regbit_t definitions.

This is the "official" way to access bits into registers The small footprint costs brings much better versatility for functions/bits that are not always defined in the same place on real AVR cores

Macro Definition Documentation

#define ARRAY_SIZE (   _aa)    (sizeof(_aa) / sizeof((_aa)[0]))
#define AVR_IO_REGBIT (   _io,
  _bit 
)    { . reg = (_io), .bit = (_bit), .mask = 1 }
#define AVR_IO_REGBITS (   _io,
  _bit,
  _mask 
)    { . reg = (_io), .bit = (_bit), .mask = (_mask) }

Function Documentation

static uint8_t avr_regbit_clear ( avr_t avr,
avr_regbit_t  rb 
)
inlinestatic

Here is the call graph for this function:

Here is the caller graph for this function:

static uint8_t avr_regbit_from_value ( avr_t avr,
avr_regbit_t  rb,
uint8_t  value 
)
inlinestatic

Using regbit from value eliminates some of the set to test then clear register operations.

makes cheking register bits before setting easier.

Here is the caller graph for this function:

static uint8_t avr_regbit_get ( avr_t avr,
avr_regbit_t  rb 
)
inlinestatic

Here is the caller graph for this function:

static uint8_t avr_regbit_get_array ( avr_t avr,
avr_regbit_t rb,
int  count 
)
inlinestatic

This reads the bits for an array of avr_regbit_t, make up a "byte" with them.

This allows reading bits like CS0, CS1, CS2 etc even if they are not in the same physical IO register.

Here is the caller graph for this function:

static uint8_t avr_regbit_get_raw ( avr_t avr,
avr_regbit_t  rb 
)
inlinestatic

Return the bit(s) 'in position' instead of zero based.

Here is the caller graph for this function:

static uint8_t avr_regbit_set ( avr_t avr,
avr_regbit_t  rb 
)
inlinestatic

Set/get/clear io register bits in one operation.

Here is the call graph for this function:

Here is the caller graph for this function:

static void avr_regbit_set_array_from_value ( avr_t avr,
avr_regbit_t rb,
uint8_t  count,
uint8_t  value 
)
inlinestatic

Does the reverse of avr_regbit_get_array.

Here is the call graph for this function:

Here is the caller graph for this function:

static uint8_t avr_regbit_setto ( avr_t avr,
avr_regbit_t  rb,
uint8_t  v 
)
inlinestatic

Here is the call graph for this function:

Here is the caller graph for this function:

static uint8_t avr_regbit_setto_raw ( avr_t avr,
avr_regbit_t  rb,
uint8_t  v 
)
inlinestatic

Set the 'raw' bits, if 'v' is the unshifted value of the bits.

Here is the call graph for this function:

Here is the caller graph for this function: