Go to the source code of this file.
AvrCore handling methods | |
AvrCore * | avr_core_new (char *dev_name) |
void | avr_core_destroy (void *core) |
void | avr_core_get_sizes (AvrCore *core, int *flash, int *sram, int *sram_start, int *eeprom) |
void | avr_core_attach_vdev (AvrCore *core, uint16_t addr, char *name, VDevice *vdev, int flags, uint8_t reset_value, uint8_t rd_mask, uint8_t wr_mask) |
VDevice * | avr_core_get_vdev_by_name (AvrCore *core, char *name) |
VDevice * | avr_core_get_vdev_by_addr (AvrCore *core, int addr) |
void | avr_core_set_state (AvrCore *core, StateType state) |
int | avr_core_get_state (AvrCore *core) |
void | avr_core_set_sleep_mode (AvrCore *core, int sleep_mode) |
int | avr_core_get_sleep_mode (AvrCore *core) |
Status Register Access Methods | |
int | avr_core_sreg_get_bit (AvrCore *core, int b) |
void | avr_core_sreg_set_bit (AvrCore *core, int b, int v) |
RAMPZ access methods | |
uint8_t | avr_core_rampz_get (AvrCore *core) |
void | avr_core_rampz_set (AvrCore *core, uint8_t v) |
Direct I/O Register Access Methods | |
IO Registers are mapped in memory directly after the 32 (0x20) general registers. | |
void | avr_core_io_display_names (AvrCore *core) |
uint8_t | avr_core_io_read (AvrCore *core, int reg) |
void | avr_core_io_write (AvrCore *core, int reg, uint8_t val) |
Stack Methods | |
uint32_t | avr_core_stack_pop (AvrCore *core, int bytes) |
void | avr_core_stack_push (AvrCore *core, int bytes, uint32_t val) |
Program Counter Methods | |
int32_t | avr_core_PC_size (AvrCore *core) |
void | avr_core_PC_incr (AvrCore *core, int val) |
Methods for accessing CK and instruction Clocks | |
uint64_t | avr_core_CK_get (AvrCore *core) |
void | avr_core_CK_incr (AvrCore *core) |
int | avr_core_inst_CKS_get (AvrCore *core) |
void | avr_core_inst_CKS_set (AvrCore *core, int val) |
Interrupt Access Methods. | |
IntVect * | avr_core_irq_get_pending (AvrCore *core) |
void | avr_core_irq_raise (AvrCore *core, int irq) |
void | avr_core_irq_clear (AvrCore *core, IntVect *irq) |
void | avr_core_irq_clear_all (AvrCore *core) |
Break point access methods. | |
void | avr_core_insert_breakpoint (AvrCore *core, int pc) |
void | avr_core_remove_breakpoint (AvrCore *core, int pc) |
void | avr_core_disable_breakpoints (AvrCore *core) |
void | avr_core_enable_breakpoints (AvrCore *core) |
Program control methods | |
int | avr_core_step (AvrCore *core) |
void | avr_core_run (AvrCore *core) |
void | avr_core_reset (AvrCore *core) |
Callback Handling Methods | |
void | avr_core_add_ext_rd_wr (AvrCore *core, int addr, PortFP_ExtRd ext_rd, PortFP_ExtWr ext_wr) |
void | avr_core_clk_cb_add (AvrCore *core, CallBack *cb) |
void | avr_core_async_cb_add (AvrCore *core, CallBack *cb) |
void | avr_core_clk_cb_exec (AvrCore *core) |
void | avr_core_async_cb_exec (AvrCore *core) |
Defines | |
#define | BREAK_OPCODE 0x9598 |
Functions | |
void | avr_core_dump_core (AvrCore *core, FILE *f_core) |
int | avr_core_load_program (AvrCore *core, char *file, int format) |
int | avr_core_load_eeprom (AvrCore *core, char *file, int format) |
Variables | |
int | global_debug_inst_output = 0 |
Definition in file avrcore.c.
|
Allocate a new AvrCore object.
Definition at line 355 of file avrcore.c. References avr_core_destroy(), avr_new, class_overload_destroy(), and dev_supp_lookup_device(). |
|
Destructor for the AvrCore class. Not to be called directly, except by a derived class. Called via class_unref. Definition at line 500 of file avrcore.c. References class_destroy(), class_unref(), and dlist_delete_all(). Referenced by avr_core_new(). |
|
Query the sizes of the 3 memory spaces: flash, sram, and eeprom.
Definition at line 523 of file avrcore.c. References flash_get_size(). |
|
Attach a virtual device into the Memory.
|
|
Returns the
|
|
Returns the
|
|
Sets the device's state (running, stopped, breakpoint, sleep).
|
|
Returns the device's state (running, stopped, breakpoint, sleep).
Referenced by avr_core_step(). |
|
Sets the device to a sleep state.
|
|
Return the device's sleepmode.
|
|
Get the value of bit
|
|
Set the value of bit
|
|
Get the value of the rampz register.
|
|
Set the value of the rampz register.
|
|
Displays all registers.
Definition at line 684 of file avrcore.c. References display_io_reg_name(), and mem_io_fetch(). |
|
Reads the value of a register.
|
|
Writes the value of a register. See avr_core_io_read() for a discussion of reg.
|
|
Pop 1-4 bytes off of the stack. See stack_pop() for more details. |
|
Push 1-4 bytes onto the stack. See stack_push() for more details. |
|
Returns the size of the Program Counter in bytes. Most devices have a 16-bit PC (2 bytes), but some larger ones (e.g. mega256), have a 22-bit PC (3 bytes). |
|
Increment the Program Counter by val. val can be either positive or negative. If the result of the incrememt is outside the valid range for PC, it is adjusted to fall in the valid range. This allows addresses to wrap around the end of the insn space. |
|
Get the current clock counter.
Referenced by avr_core_run(). |
|
Increment the clock counter.
Referenced by avr_core_step(). |
|
Get the number of clock cycles remaining for the currently executing instruction.
|
|
Set the number of clock cycles for the instruction being executed.
Referenced by avr_core_reset(). |
|
Gets the first pending irq.
|
|
Raises an irq by adding it's data to the irq_pending list.
Definition at line 805 of file avrcore.c. References avr_message. |
|
Calls the interrupt's callback to clear the flag.
|
|
Removes all irqs from the irq_pending list.
Referenced by avr_core_reset(). |
|
Inserts a break point.
Definition at line 835 of file avrcore.c. References flash_read(), and flash_write(). |
|
Removes a break point.
Definition at line 849 of file avrcore.c. References flash_write(). |
|
Disable breakpoints. Disables all breakpoints that where set using avr_core_insert_breakpoint(). The breakpoints are not removed from the breakpoint list. |
|
Enable breakpoints. Enables all breakpoints that where previous disabled. |
|
Process a single program instruction, all side effects and peripheral stimulii. Executes instructions, calls callbacks, and checks for interrupts. Definition at line 1044 of file avrcore.c. References avr_core_async_cb_exec(), avr_core_CK_incr(), avr_core_clk_cb_exec(), and avr_core_get_state(). Referenced by avr_core_run(). |
|
Start the processing of instructions by the simulator. The simulated device will run until one of the following occurs:
Definition at line 1101 of file avrcore.c. References avr_core_CK_get(), avr_core_reset(), avr_core_step(), avr_message, get_program_time(), signal_has_occurred(), signal_watch_start(), and signal_watch_stop(). |
|
Sets the simulated CPU back to its initial state. Zeroes out PC, IRQ's, clock, and memory. Definition at line 1155 of file avrcore.c. References avr_core_inst_CKS_set(), avr_core_irq_clear_all(), display_clock(), and mem_reset(). Referenced by avr_core_run(). |
|
For adding external read and write callback functions. rd and wr should come in pairs, but it is safe to add empty function via passing a NULL pointer for either function.
Definition at line 1195 of file avrcore.c. References avr_warning, mem_get_vdevice_by_addr(), and port_add_ext_rd_wr(). |
|
Add a new clock callback to list.
|
|
Add a new asynchronous callback to list.
|
|
Run all the callbacks in the list. If a callback returns non-zero (true), then it is done with it's job and wishes to be removed from the list. The time argument has dual meaning. If the callback list is for the clock callbacks, time is the value of the CK clock counter. If the callback list is for the asynchronous callback, time is the number of milliseconds from some unknown, arbitrary time on the host system. Referenced by avr_core_step(). |
|
Run all the asynchronous callbacks.
Referenced by avr_core_step(). |
|
Dump the contents of the entire CPU core.
Definition at line 1245 of file avrcore.c. References flash_dump_core(), and mem_dump_core(). |
|
Load a program from an input file.
Definition at line 1258 of file avrcore.c. References flash_load_from_file(). |
|
Load a program from an input file.
Definition at line 1265 of file avrcore.c. References mem_get_vdevice_by_name(). |
|
Flag for enabling output of instruction debug messages.
|