// this is a static constructor for each of the AVR devices
typedef struct avr_kind_t {
const char * names[4]; // name aliases
- avr_t * (*make)();
+ avr_t * (*make)(void);
} avr_kind_t;
// a symbol loaded from the .elf file
static inline uint8_t avr_regbit_set(avr_t * avr, avr_regbit_t rb)
{
uint8_t a = rb.reg;
+ uint8_t m;
+
if (!a)
return 0;
- uint8_t m = rb.mask << rb.bit;
+ m = rb.mask << rb.bit;
avr_core_watch_write(avr, a, avr->data[a] | m);
return (avr->data[a] >> rb.bit) & rb.mask;
}
static inline uint8_t avr_regbit_setto(avr_t * avr, avr_regbit_t rb, uint8_t v)
{
uint8_t a = rb.reg;
+ uint8_t m;
+
if (!a)
return 0;
- uint8_t m = rb.mask << rb.bit;
+ m = rb.mask << rb.bit;
avr_core_watch_write(avr, a, (avr->data[a] & ~(m)) | ((v << rb.bit) & m));
return (avr->data[a] >> rb.bit) & rb.mask;
}
static inline uint8_t avr_regbit_setto_raw(avr_t * avr, avr_regbit_t rb, uint8_t v)
{
uint8_t a = rb.reg;
+ uint8_t m;
+
if (!a)
return 0;
- uint8_t m = rb.mask << rb.bit;
+ m = rb.mask << rb.bit;
avr_core_watch_write(avr, a, (avr->data[a] & ~(m)) | ((v) & m));
return (avr->data[a]) & (rb.mask << rb.bit);
}
static inline uint8_t avr_regbit_get_array(avr_t * avr, avr_regbit_t *rb, int count)
{
uint8_t res = 0;
+ int i;
- for (int i = 0; i < count; i++, rb++) if (rb->reg) {
+ for (i = 0; i < count; i++, rb++) if (rb->reg) {
uint8_t a = (rb->reg);
res |= ((avr->data[a] >> rb->bit) & rb->mask) << i;
}