# display.c File Reference

Interface for using display coprocesses. More...

Go to the source code of this file.

## Enumerations
enum | { MAX_BUF = 1024 }
## Functions
int | display_open (char *prog, int no_xterm, int flash_sz, int sram_sz, int sram_start, int eeprom_sz)
void | display_close (void)
void | display_send_msg (char *msg)
void | display_clock (int clock)
void | display_pc (int val)
void | display_reg (int reg, uint8_t val)
void | display_io_reg (int reg, uint8_t val)
void | display_io_reg_name (int reg, char *name)
void | display_flash (int addr, int len, uint16_t *vals)
void | display_sram (int addr, int len, uint8_t *vals)
void | display_eeprom (int addr, int len, uint8_t *vals)

## Detailed Description

Interface for using display coprocesses.

Simulavr has the ability to use a coprocess to display register and memory values in near real time.

Definition in file display.c.

## Function Documentation

int display_open | ( | char * | prog,
|  | int | no_xterm,
|  | int | flash_sz,
|  | int | sram_sz,
|  | int | sram_start,
|  | int | eeprom_sz |
| ) |  |  |

Open a display as a coprocess.

Parameters:

  | prog | The program to use as a display coprocess.
  | no_xterm | If non-zero, don't run the disply in an xterm.
  | flash_sz | The size of the flash memory space in bytes.
  | sram_sz | The size of the sram memory space in bytes.
  | sram_start | The addr of the first byte of sram (usually 0x60 or 0x100).
  | eeprom_sz | The size of the eeprom memory space in bytes.

Try to start up a helper program as a child process for displaying registers and memory. If the prog argument is NULL, don't start up a display.

Returns an open file descriptor of a pipe used to send data to the helper program.

Returns -1 if something failed.

Definition at line 85 of file display.c.

References avr_warning.

void display_close | ( | void |  | ) |

Close a display and send coprocess a quit message.

Definition at line 181 of file display.c.

References display_send_msg().

void display_send_msg | ( | char * | msg | ) |

Encode the message and send to display.

Parameters:

  | msg | The message string to be sent to the display process.

Encoding is the same as that used by the gdb remote protocol: '$...#CC' where '...' is msg, CC is checksum. There is no newline termination for encoded messages.

FIXME: TRoth: This should be a private function. It is only public so that dtest.c can be kept simple. dtest.c should be changed to avoid direct use of this function. [dtest.c has served it's purpose and will be retired soon.]

Definition at line 220 of file display.c.

References avr_error, avr_free(), avr_new0, and avr_warning.

Referenced by display_clock(), display_close(), display_eeprom(), display_flash(), display_io_reg(), display_io_reg_name(), display_pc(), display_reg(), and display_sram().

void display_clock | ( | int | clock | ) |

Update the time in the display.

Parameters:

  | clock | The new time in number of clocks.

Definition at line 255 of file display.c.

References display_send_msg().

Referenced by avr_core_reset().

void display_pc | ( | int | val | ) |

Update the Program Counter in the display.

Parameters:

  | val | The new value of the program counter.

Definition at line 269 of file display.c.

References display_send_msg().

void display_reg | ( | int | reg,
|  | uint8_t | val |
| ) |  |  |

Update a register in the display.

Parameters:

  | reg | The register number.
  | val | The new value of the register.

Definition at line 284 of file display.c.

References display_send_msg().

void display_io_reg | ( | int | reg,
|  | uint8_t | val |
| ) |  |  |

Update an IO register in the display.

Parameters:

  | reg | The IO register number.
  | val | The new value of the register.

Definition at line 299 of file display.c.

References display_send_msg().

Referenced by mem_write().

void display_io_reg_name | ( | int | reg,
|  | char * | name |
| ) |  |  |

Specify a name for an IO register.

Parameters:

  | reg | The IO register number.
  | name | The symbolic name of the register.

Names of IO registers may be different from device to device.

Definition at line 316 of file display.c.

References display_send_msg().

Referenced by avr_core_io_display_names().

void display_flash | ( | int | addr,
|  | int | len,
|  | uint16_t * | vals |
| ) |  |  |

Update a block of flash addresses in the display.

Parameters:

  | addr | Address of beginning of the block.
  | len | Length of the block (number of words).
  | vals | Pointer to an array of len words.

The display will update each addr of the block to the coresponding value in the vals array.

Each address in the flash references a single 16-bit wide word (or opcode or instruction). Therefore, flash addresses are aligned to 16-bit boundaries. It is simplest to consider the flash an array of 16-bit values indexed by the address.

Definition at line 340 of file display.c.

References avr_error, and display_send_msg().

Referenced by flash_write().

void display_sram | ( | int | addr,
|  | int | len,
|  | uint8_t * | vals |
| ) |  |  |

Update a block of sram addresses in the display.

Parameters:

  | addr | Address of beginning of the block.
  | len | Length of the block (number of bytes).
  | vals | Pointer to an array of len bytes.

The display will update each addr of the block to the coresponding value in the vals array.

Definition at line 372 of file display.c.

References avr_error, and display_send_msg().

void display_eeprom | ( | int | addr,
|  | int | len,
|  | uint8_t * | vals |
| ) |  |  |

Update a block of eeprom addresses in the display.

Parameters:

  | addr | Address of beginning of the block.
  | len | Length of the block (number of bytes).
  | vals | Pointer to an array of len bytes.

The display will update each addr of the block to the coresponding value in the vals array.

Definition at line 404 of file display.c.

References avr_error, and display_send_msg().

Automatically generated by Doxygen 1.5.5 on 7 Nov 2008.