Next Previous Contents

5. Documentation of .h files

The following will leave out all the prototypes of the functions.

Note the following exceptional definitions:


#define _(String) (String) 
#define uchar unsigned char

5.1 breakcalls.h


int breakpoint_mask; 
int breakpoint_line[2][4];

5.2 breaksupport.h

No data structures.

5.3 breakview.h

No data structures.

5.4 callbacks.h


#define REFRESH_PERIOD 100 /* the interval between each refresh on the screen
i.e. how often the values on board are inspected */ 
#define POLLING_PERIOD 300
#define MAX_LENGTH 16 /* maximum length of message returned from the board */
/* the following are booleans describing the state of the flags in: */
/* 1) CPSR */
int nflag_current_boolean;
int zflag_current_boolean;
int cflag_current_boolean;
int vflag_current_boolean;
/* 2) SPSR */
int nflag_saved_boolean; 
int zflag_saved_boolean;
int cflag_saved_boolean;
int vflag_saved_boolean;
int compile_communication[2]; 
FILE *view_console_port;

5.5 chump.h

The only data structure that is used in KMD (in interface.h, in fact) is:


typedef struct DefinitionStackName{ 
struct DefinitionStackName* next; 
char* string; 
GList* rules; 
} DefinitionStack;

5.6 dotparse.h

This is irrelevant because it is not used directly in KMD.

5.7 emulcore.h


typedef enum { /*Board instructions unsigned char*/ 
BR_NOP = 0x0, 
BR_PING = 0x1, 
BR_WOT_R_U = 0x2,
BR_RESET = 0x4, 
BR_FR_GET = 0x10, 
BR_FR_SET = 0x10, 
BR_FR_FILE = 0x14,
BR_FR_SEND = 0x15, 
BR_WOT_U_DO= 0x20, 
BR_STOP = 0x21,
BR_PAUSE = 0x22, 
BR_CONTINUE= 0x23,
BR_RTF_SET = 0x24, 
BR_RTF_GET = 0x25, 
BR_BP_WRITE= 0x30, 
BR_BP_READ = 0x31, 
BR_BP_SET = 0x32, 
BR_BP_GET = 0x33, 
BR_WP_WRITE= 0x34, 
BR_WP_READ = 0x35, 
BR_WP_SET = 0x36,
BR_WP_GET = 0x37,
BR_START = 0x80 
} BR_Instruction;
typedef struct {
char cond;
char size; 
int addra;
int addrb;
int dataa[2]; 
int datab[2]; 
} BreakElement;
BreakElement breakpoints[32]; 
BreakElement watchpoints[32];
int emul_bp_flag[2];
int emul_wp_flag[2];
uchar registers[REGSIZE];
uchar memory[RAMSIZE]; 
uchar status; 
int paused;
unsigned int steps_togo; 
unsigned int steps_reset; 
char runflags;
uchar rtf;

5.8 emulmips.h

This module is used by emulcore and, therefore, does not need a detailed explanation.

5.9 flash.h

#define TABLE 0x00004000

#define MAGIC_NUMBER 0

#define FLAGS 4

#define RAM_START 8

#define RAM_LENGTH 12

#define ROM_START 16

#define ROM_LENGTH 20

#define START_OFFSET 24

#define CPSR 28

#define SPARTAN_START 32

#define SPARTAN_LENGTH 36

#define VIRTEX_START 40

#define VIRTEX_LENGTH 44

#define LCD_LINE1 48

#define LCD_LINE2 64

#define USER_TEXT 80

typedef enum {

SERIAL,

EMULATOR,

FAKE

} target_type;

target_type board_type;

5.10 interface.h


/* the following defines possible instructions that can be sent to the board as 1 byte each */ 
typedef enum { /*Board instructions unsigned char*/ 
BR_NOP = 0x0,
BR_PING = 0x1, 
BR_WOT_R_U = 0x2, 
BR_RESET = 0x4,
BR_COMM_W = 0x6,
BR_COMM_R = 0x7, 
BR_FR_GET = 0x10, 
BR_FR_SET = 0x11, 
BR_FR_WRITE= 0x12, 
BR_FR_READ = 0x13, 
BR_FR_FILE = 0x14, 
BR_FR_SEND = 0x15, 
BR_WOT_U_DO= 0x20, 
BR_STOP = 0x21, 
BR_PAUSE = 0x22,
BR_CONTINUE= 0x23, 
BR_RTF_SET = 0x24, 
BR_RTF_GET = 0x25,
BR_BP_WRITE= 0x30, 
BR_BP_READ = 0x31,
BR_BP_SET = 0x32,
BR_BP_GET = 0x33, 
BR_GET_REG = 0x5a,
BR_GET_MEM = 0x48, 
BR_SET_REG = 0x52,
BR_SET_MEM = 0x40,
BR_START = 0x80 
} BR_Instruction;
typedef struct {/* Regbank struct*/ 
char *name; /* Name to display in window*/ 
int offset; /* offset in registers (in bits if flags)*/ 
unsigned char width; /* width in bytes (0 means 1bit flags)*/
unsigned char number; /* count of registers*/
char **names; /* array of strings for names*/ 
unsigned char *values; /* array of values (regvalue = values + regnumber * width*/
int pointer; /* does this regbank store memory pointers */
} reg_bank; /* flags use 1 char each*/
typedef struct { /* special_reg struct*/
char *name; /* Name of register*/
unsigned char *value; /* offset of value*/
GdkColor colour; 
char** pixmap_data; 
GdkPixmap* pixmap; 
GdkBitmap* bitmap;
int active; /* if activated or not */ 
} special_reg; /* flags use 1 char each*/
typedef enum { /* this describes a type of a feature and will be used as member in feature */
XILINX_FPGA, 
CONSOLE, 
} feature_type;
typedef struct { /* holds data of a xilinx fpga feature */ 
char* filestring;
} xilinx_fpga_data;
typedef struct { /* holds data about a console */
GtkWidget *text; 
} console_data;
typedef struct { /* Feature struct */ 
unsigned char reference_number; 
int sub_reference_number;
char* name; /* it's name as recognised from .komodo file */
feature_type type; /* see above - enumeration with different supported features */
union { /* the data within that feature */ 
xilinx_fpga_data xilinx_fpga;
console_data console; 
} data; 
unsigned char dev_number; /* number to communicate by - serial number assigned depending on the order
the board sent it */
} feature;
typedef struct { /* Memory Segments */ 
unsigned char* start; /* chararr pointer to address of length board_memory_ptr_width*/ 
unsigned char* length; /* chararr of length board_memory_ptr_width*/
} memory_segment;
typedef struct {
long value;
char *name;
int flags; 
} symbol;
typedef enum {
SERIAL, 
EMULATOR,
FAKE
} target_type;
uchar board_nulreg[16];
char* rcfile; /* the name of the file to be opened - .komodo*/
char* emulator_prog; /* the name of the program to emulate KMD */
int use_internal; /* boolean */
int VERBOSE; /* boolean - be loud and informative or not */
symbol *symbol_table; /* build a symbol table that is made up of symbols */
int symbol_count; /* number of sybols in symbol table */ 
GtkStyle* fixed_style;
GdkFont* fixed_font;
int board_there; /* boolean indicating if the board is connected or not */
target_type board_type;/* indicates what board or virtual board we work with now */
int board_version; /* retains the version of the board */
int board_wordaline; 
int board_memory_ptr_width;
unsigned char board_cpu_reference_number;
int board_cpu_sub_reference_number;
char *board_cpu_name;
int board_num_regbanks;
int board_main_regbank; 
int special_register_count; /* special registers are CPSR et al */
special_reg special_registers[2]; /* we allocate place for 2 special registers */
uchar board_startcommand; 
reg_bank *board_reg_banks; /* the list of register banks */
int board_regbanks_gran; /* granularity of the register banks */
int board_num_features; /* number of features found as reported from the board */
feature *board_features; /* a list of those features */
int board_num_mem_segments;
memory_segment *board_mem_segments;
DefinitionStack *board_asm_tables;
int board_emulation_communication_from[2];
int board_emulation_communication_to[2];

5.11 jimulator.h

There is currently no such file.

5.12 misc.h

This file includes only prototypes.

5.13 serial.h

Many of the variables here are to deal with lower level protocols.


/* the following will define some of the properties to be considered */
#ifdef LINUX
#define PORTNAME "/dev/ttyS0"
#define PORTSPEED B115200 
#endif
#ifdef SUNOS 
#define PORTNAME "/dev/ttya" 
#define PORTSPEED B115200 
#endif
#ifndef SUNOS 
#ifndef LINUX
#define PORTNAME "/dev/ttyS0" 
#define PORTSPEED B115200 
#endif 
#endif
#ifdef SERIAL_PORT 
#define PORTNAME SERIAL_PORT 
#endif
#ifdef SERIAL_SPEED 
#define PORTNAME BSERIAL_SPEED 
#endif
int serial_FD; 
int read_pipe; 
int write_pipe;
struct termios serial_originalportsettings; 
char* portname; 
GList* serial_list_2_board; 
GList* serial_list_2_computer;

5.14 view.h


#define CONSOLE_UPPER_BOUND 20
typedef struct mem_window_name{ 
GtkWidget* clist_ptr;
GtkWidget* address_entry;
GtkWidget* hex_entry; 
GtkWidget* ascii_entry;
GtkWidget* dis_entry;
GtkWidget* scroll; 
unsigned char* address; 
unsigned char* regoffset;
int count; int width; int gran;
GList* isa; 
} mem_window;
typedef struct mem_window_list_name{
mem_window* mem_data_ptr; 
struct mem_window_list_name* next;
} mem_window_list;
typedef struct reg_window_name{ 
GtkWidget* clist_ptr; 
GtkWidget* address_entry; 
GtkWidget* hex_entry;
int regbank_no; 
int wait; 
gint timer; 
} reg_window;
typedef struct reg_window_list_name{
reg_window* reg_data_ptr; 
struct reg_window_list_name* next; 
} reg_window_list;
typedef struct dat_window_name{
GtkWidget* clist_ptr;
GtkWidget* address_entry;
GtkWidget* hex_entry;
GtkWidget* ascii_entry;
GtkWidget* dis_entry;
GtkWidget* scroll; 
unsigned char* address;
unsigned char* regoffset;
int count;
int width;
int gran; } dat_window;
typedef struct dat_window_list_name{ 
mem_window* dat_data_ptr;
struct dat_window_list_name* next; 
} dat_window_list;
char* view_dis(uchar*, uchar*,int, GList*);
gpointer view_console; /* a pointer to the text in the string console */
gpointer view_comms;
char* view_window_display_list;/* a variable to hold the display list string that was derived 
from .komodo */
mem_window_list* view_memwindowlist; /* a group of memory windows/containers that 
we have */ 
reg_window_list* view_regwindowlist; /* as above, for register banks */ 
dat_window_list* view_datwindowlist; /* a list of memory windows/containers data e.g. 
number of lines */
GtkWidget* view_splashwindow; /* global referring to the splash window created */
GtkWidget* view_mainwindow; /* refers to our main GTK window */
GtkWidget* view_maincontainer; /* refers to the actual container within the window */
GtkWidget* view_progressbar; /* the progress bar widget which is used to make other local 
progress bar global by assignment */
GtkWidget* view_enqlabel; /* the labels that reports the current state of the board e.g. stopped */
GtkWidget* view_steplabel; /* the labels that reports the current step number */
GtkWidget* view_current_reg_bank; /* will be the label reporting the current mode in the CPSR */
GtkWidget* view_saved_reg_bank; /* will be the label reporting the current mode in the SPSR */
GtkWidget* view_breakwindow[2][4]; GtkWidget* view_fileerror; /* a widget for error messages, 
will be assigned to a new gtk dialogue at times */ 
GtkWidget* view_refreshbutton; /* the widget of the toggle button refresh */ 
GtkWidget* view_binary_load_address; /* the address of a binary being loaded */
int view_step_number; /* defines the initial number of steps to be taken when step is pressed */ 
int view_step_freq; /*defines the initial value in the second box next to muti-step */
/* definitions of colours and pixmaps */ 
GdkColor view_greycolour; /* defines the grey colour used in the application */
/* the pixmaps used: */
GdkPixmap* view_chump_pixmap;
GdkBitmap* view_chump_bitmap;
GdkPixmap* view_tick_pixmap; 
GdkBitmap* view_tick_bitmap;
GdkPixmap* view_mulogo_pixmap;
GdkBitmap* view_mulogo_bitmap;
GdkPixmap* view_komodologo_pixmap; 
GdkBitmap* view_komodologo_bitmap; 
GdkPixmap* view_komodotitle_pixmap; 
GdkBitmap* view_komodotitle_bitmap; 
GdkPixmap* view_komodoicon_pixmap;
GdkBitmap* view_komodoicon_bitmap; 
/* the following are toggle-button widgets to be used for flags */
/* for flags in CPSR */ 
GtkWidget *nflag_current;
GtkWidget *zflag_current; 
GtkWidget *cflag_current;
GtkWidget *vflag_current;
/* for flags in SPSR */
GtkWidget *nflag_saved; 
GtkWidget *zflag_saved; 
GtkWidget *cflag_saved; 
GtkWidget *vflag_saved;
GtkTooltips* view_tooltips; /* one to hold the tooltips of all items in turn */
GtkWidget *console_entry; /* the entry within the console/terminal is now global */
gint view_global_refresh_timer; /* boolean to indicate if the display needs to be refreshed */
GtkWidget *text_in_console[CONSOLE_UPPER_BOUND]; /* caters for up to CONSOLE_UPPER_BOUND features where the highest serial number for a console is 20 */


Next Previous Contents