typedef uint64_t avr_cycle_count_t;
typedef uint16_t avr_io_addr_t;
+/*
+ * this 'structure' is a packed representation of an IO register 'bit'
+ * (or consecutive bits). This allows a way to set/get/clear them.
+ * gcc is happy passing these as register value, so you don't need to
+ * use a pointer when passing them along to functions.
+ *
+ * 9 bits ought to be enough, as it's the maximum I've seen (atmega2560)
+ */
+typedef struct avr_regbit_t {
+ uint32_t reg : 9, bit : 3, mask : 8;
+} avr_regbit_t;
+
// printf() conversion specifier for avr_cycle_count_t
#define PRI_avr_cycle_count PRIu64
#define ARRAY_SIZE(_aa) (sizeof(_aa) / sizeof((_aa)[0]))
-/*
- * this 'structure' is a packed representation of an IO register 'bit'
- * (or consecutive bits). This allows a way to set/get/clear them.
- * gcc is happy passing these as register value, so you don't need to
- * use a pointer when passing them along to functions.
- *
- * 9 bits ought to be enough, as it's the maximum I've seen (atmega2560)
- */
-typedef struct avr_regbit_t {
- unsigned long reg : 9, bit : 3, mask : 8;
-} avr_regbit_t;
/*
* These accessors are inlined and are used to perform the operations on