From 0817f26bb06cdf2a3db57b71b9d045bfe25d456e Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Sat, 25 Feb 2012 17:56:03 +0000 Subject: [PATCH] regbits: Moved the struct declaration Moved the data type to sim_avr_types.h, so it doesn't need the full avr_t type to be used. Signed-off-by: Michel Pollet --- simavr/sim/sim_avr_types.h | 12 ++++++++++++ simavr/sim/sim_regbit.h | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/simavr/sim/sim_avr_types.h b/simavr/sim/sim_avr_types.h index b8e0902..638d68f 100644 --- a/simavr/sim/sim_avr_types.h +++ b/simavr/sim/sim_avr_types.h @@ -29,6 +29,18 @@ 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 diff --git a/simavr/sim/sim_regbit.h b/simavr/sim/sim_regbit.h index 9f2987a..4852b56 100644 --- a/simavr/sim/sim_regbit.h +++ b/simavr/sim/sim_regbit.h @@ -30,17 +30,6 @@ extern "C" { #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 -- 2.39.5