R_SREG = 32+0x3f,
// maximum number of IO registers, on normal AVRs
- MAX_IOs = 256, // Bigger AVRs need more than 256-32 (mega1280)
+ MAX_IOs = 279, // Bigger AVRs need more than 256-32 (mega1280)
};
#define AVR_DATA_TO_IO(v) ((v) - 32)
// not only to "cycles that runs" but also "cycles that might have run"
// like, sleeping.
avr_cycle_count_t cycle; // current cycle
+
+ /**
+ * Sleep requests are accumulated in sleep_usec until the minimum sleep value
+ * is reached, at which point sleep_usec is cleared and the sleep request
+ * is passed on to the operating system.
+ */
+ uint32_t sleep_usec;
// called at init time
void (*init)(struct avr_t * avr);
// called at init time (for special purposes like using a memory mapped file as flash see: simduino)
void (*special_init)(struct avr_t * avr);
- // called at termination time ( to clean special initalizations)
+ // called at termination time ( to clean special initializations)
void (*special_deinit)(struct avr_t * avr);
// called at reset time
void (*reset)(struct avr_t * avr);
// Mirror of the SREG register, to facilitate the access to bits
// in the opcode decoder.
- // This array is re-synthetized back/forth when SREG changes
+ // This array is re-synthesized back/forth when SREG changes
uint8_t sreg[8];
uint8_t i_shadow; // used to detect edges on I flag
int
avr_init(
avr_t * avr);
+// Used by the cores, allocated a mutable avr_t from the const global
+avr_t *
+avr_core_allocate(
+ const avr_t * core,
+ uint32_t coreLen);
+
// resets the AVR, and the IO modules
void
avr_reset(
avr_flashaddr_t address);
/*
- * these are accessors for avr->data but allows watchpoints to be set for gdb
+ * These are accessors for avr->data but allows watchpoints to be set for gdb
* IO modules use that to set values to registers, and the AVR core decoder uses
* that to register "public" read by instructions.
*/
/*
- * These are callbacks for the two 'main' bahaviour in simavr
+ * These are callbacks for the two 'main' behaviour in simavr
*/
void avr_callback_sleep_gdb(avr_t * avr, avr_cycle_count_t howLong);
void avr_callback_run_gdb(avr_t * avr);