The following shall concentrate on the goals of the functions within the files. No emphasis will be put on function that are either not to be changed or were simply imported.
This function includes callbacks from the breakpoint windows.
Called when a breakpoint has been toggled and does the necessary operations.
Called when a breakpoint has been set and does the necessary operations.
Called when a breakpoint has been selected from the list and does the necessary operations.
Refreshes the state of the window.
Invoked when a value has been entered in a breakpoint window.
This file deals with pixmaps and the existance of files that hold them. It is not very relevant to KMD, but here is a brief description.
This is an internally used function to check if a pixmap file exists.
This is an internally used function to create pixmaps.
Use this function to set the directory containing installed pixmaps.
This is an internally used function to create pixmaps.
Finds a widget given its name.
Creates the breakpoints window.
Creates the simple breakpoints window.
This file includes the callback functions to events occuring. The user of the system triggers GTK events which invoke the appropriate functions as defined in view.c. All these functions exist within callback.c as follows:
Loads the file that was put within the appropriate box in GTK and does all the operations necessary to extract the data from it and set the board. This function will, by convention, open an ELF file.
Loads a binary file as if it were an ELF file. This function is called when the user chooses to open an incompatible file as a binary.
Compiles a .s file as specified within the appropriate box in GTK.
When the user browses through the files within a file dialogue, this function is invoked upon OK button being pressed.
downloads a file into the FPGA when the "download" button in FPGA features is pressed.
This will update the state of state of the box where a file is chosen in the FPGA feature tab.
When the "Start" button is pressed, i.e. it is wished to start execution, this function is called and the necessary communication with the board id carried out.
When the "Stop" button is pressed, this function is called and the necessary communication with the board id carried out.
When the "Continue" button is pressed, this function is called and the necessary communication with the board id carried out e.g BR_CONTINUE is sent to the board.
When the "Walk" button is pressed, this function is called and the necessary communication with the board id carried out.
Called when "SWI", "BL" or "ABORT" are pressed.
Called when "FIQ" or "IRQ" are pressed.
Called when the "Refresh" toggle button is pressed. It may or may not invoke any operation, but currently doesn't since the state of the toggle button being changed is all that is necessary.
When the "Ping" button is pressed this function is called to ping the board, check what it is currently doing and refresh everything. It ensures that everything is up-to-date, for instance, when communication has been lost.
If the "Reset" button has been pressed the board will be asked to reset, some flags will be updated, global refresh will be called and the state of the application, in general, will be initiated.
Refreshes all the memory entries and register banks.
refreshes all memory entries.
Called when the value within the entry box has been changed. It will do the obvious update of the current value.
Within a memory frame/section it is possible to switch between different representation of the memory values. This function is called when such switch is taking place i.e. when a new option has been picked from the selection menu. It chooses the columns to display within the column list.
Called when the line width and granularity are changed and updates the values.
Called when the number of rows the be displayed is changed. It updated the value which indicates the size of the list to be displayed and then refreshes the memory section.
When the user chooses whether to have the ASCII value of the memory entry diaplyed or not, this function is called and sets the new visibility of the column.
When the user chooses whether to have the dis-assembly the memory entry diaplyed or not, this function is called and sets the new visibility of the column.
When the user inputs a memory address in order to jump to that specific location in memory, this fuction is called and steps to the beginning of that address so that the user gets a convenient view of that location after the memory refresh takes place.
Called when a user has typed in a new value for some memory address and sets that value wherever appropriate just before committing a global refresh.
This allows us to change the contents of a memory in some address in accordance with some ASCII value that the user inputs.
This would do the actual assembly. When the user types in an instruction, some imported code will convert that into machine code and set the given memory access to hold the given instruction (in binary, of course).
This function describes the behaviour of the scroll bar. When the user manipulates the scroll bar in the memory section, values will be passed to this fuction in order to achieve the required behaviour.
This function does the necessary memory location update when the user lets the scroll bar go. This completed the functionality of the scroll bar above.
When a certain line(row) within the memory column list has been chosen this function is called.
When a row in the memory column list has been pressed and it is possible to determine which memory address was referred to, this function copies the column values into the above entries amongst other things.
A hex value has been entered, requesting an update of some register value. The appropriate register is set to the new value entered and the register banks display is being updated.
A selection has been made within the register bank column list. The row is highlighted and the appropriate register and its value are copied into the entries above.
This is not really a callback function. It is called from the callback function which deals with the case when the user chooses to perform a "Walk" operation. It takes as an argument the number of steps to walk and if the board is not already running, it will perform the walk as expected.
Updates the console window.
wrapper function to go from timer interrupts. It refreshes the display and does some more work every once in a while. It will normally refresh the display and be of use only when "refresh" is pressed.
This function updates the memory values while the program is running by setting the "Refresh" button to be active and calling for memory refresh.
This function updates the register values while the program is running by setting the "Refresh" button to be active and calling for register banks refresh.
Responsible for updating the console window and called when setting up the application.
This function is called when the current flags are being changed by the user. This function updates the CPSR value as it is derived from the flags and sets the CPSR to the new value.
This function is called when the saved flags are being changed by the user. This function updates the SPSR value as it is derived from the flags and sets the SPSR to the new value.
This function is called when the current mode that is derived from the 4 most significant bits in the CSPR is changed and sets the CPSR to the new value which will reflect the mode chosen.
This function is called when the saved mode that is derived from the 4 most significant bits in the SPSR is changed and sets the SPSR to the new value which will reflect the mode chosen.
Called when the user quits the application.
called by the GTK timer to poll the devices on the board and see if there is something to be sent.
Deals with an events of key presses when they occur in order to possibly send bytes to back-end terminal.
Supplies Assembly and disassembly functions. The ones used in KMD are listed.
Returns disassembly of a hexadecinal value.
Returns a list of possible assemblies.
Frees up the list of strings returned, let us say, when we get a disassembly and we have finished dealing with it..
Does the conversion between an array of unsigned characters and a GList.
Allows us to retrieve the contents of list one by one.
This is an imported file that contains methods that parse a dot file like our .komodo file. It include various methods to step within the file structure and, of course open and close it. Note that only functions used in KMD are listed.
Parses the given file. `inAList' should be FALSE if we are not expecting a ')' at the end of a list of items.
Opens the given file.
Opens a string rather than a file.
Closes the given file that was handles by the parser.
Finds a list of symbols in a parsed file.
Finds a symbol in a parsed file and returns a boolean.
Finds a symbol in a parsed file and returns the position number of the symbol.
Finds a symbol in a parsed file and returns its contents.
Allows us to step within a symbol list.
Get the next number within the list by advancing.
Get the next string within the list by advancing.
The main procedure to execute instructions when the application is in emulation mode.
Sends an array of characters where char_number is the number of characters.
Gets an array of characters where char_number is the number of characters.
sends 32 bit int to the board.
gets 32 bit int from the board.
sends 16 bit int to the board.
gets 16 bit int from board.
send just one char to the board (length is set to 1).
get just one char from board (length is set to 1).
This module is used by emulcore and, therefore, does not need a detailed explanation.
Gets the user's input to manipulate the flash.
Prints the flash table.
converts an unsigned character array to an integer.
The interface between the GUI and the board is specified here. Also, the main function that sets the application up, sets the board up and gives control to GTK is located here.
This function identifies the board using the board_cpu_reference_number from the board. It will set the global variable board_cpu_name to hold the name of the cpu found. It will also set up some other variables as soon as the cpu has been identified, e.g. register banks. This function is a client of the wotRu? function.
Pings the boards. If start is positive, this will indicate that this is the first time the board is interrogated and the board version will be recorded. Upon success 1 is returned, 0 otherwise.
Same as above, but simpler and faster. If unsuccessful, it will call the above.
Same as above, but simpler and faster. If unsuccessful, it will call the above. Notice the hierarchy.
Checks for the current state of the board by communicating with it. It sets the current label on the screen to indicate what the board is doing.
This routine is called at the start to retrieve information about the board. It returns 0 if there has been a failure, 1 otherwise.
Updates the values of registers in a register bank indicated by regbanknumber. The structure that holds all the register values will be updated and 1 will be returned if everything has been successful, 0 otherwise.
Sets a register on the board to a new value. regbanknumber is the number of the register bank, registernumber is the number of the register (typically 0..17) and value is a pointer to the bit array which is the value to be put in the register specified. The returned value is there to indicate success when it equals 1.
Gets the values of a given memory address. The input count indicates the number of bytes dealt with, address is an address pointer and dest is a pointer to the destination where the value should be put. A returned value of 1 indicated success.
Sets a value of a memory location. Similar to the above, but address is the memory address to be set and sourc is the value to set that memory address to. All the above is in bit array (where unsigned character array , or pointer rather, is used).
The main function which is invoked when running the application. This function is worthy of taking a good look at:
This function inputs an array of arguments and deals with them one by one.
Having processed the command line arguments, this subroutine does some further initialisation.
Not relevant to KMD.
This file includes various functions, which do some general purpose operations that are of practical use to the application, mainly conversions and data processing routines.
Takes an unsigned char which is the binary representation of a value and, given the size, it returns a string which is the representation of this binary in hexadecimal. This function assumes big endian.
As above, but little endian.
Given a binary representation of a value within a bit array, this function will return an ASCII string where unwanted ASCII values are replaced by a dot.
Given a bit array as the one above, together with an integer offset and the size of that bit array, the returned value will be the big array which is the sum of the second and third argument.
Same as above, only that rather than returning a value of the new value, the second argument is being overwritten and the result of the addition is now at the location of the second argument.
The inputs value1 and value2 are both bit arrays and are added together to return their sum given their length/bit width in count.
Subtracts value2 from value1 and returns the result as an integer.
As above, with the argument to subtract being of type long and the result being of type long.
Converts a given bit array into an integer given the length of that bit array in count.
Does the opposite of what the above does. Given an integer and the length which we are interested in for the result, this function will return a bit array corresponding to that integer.
This function copies a bit array. Given a pointer to pass, it will copy the content of pass, given its size, into the location supplied by ret. It is important that memory allocation of size count is taken care of for the destination ret before this function is called.
A hexadecimal string to bit array conversion which takes care of register names too. The string is given in pass and the result is returned via ret. pass can be either a string which is a memory address in hexadecimal representation or a register name. The function returns 1 upon success.
This function converts a string which is a hexadecimal representation of some value (or memory address) into a bit array which can be passed down the wire. Count is the size of the value given and returned in nibbles and the integer returned is 0 upon failure and 1 upon success. Note that the destination ret will require memory allocation and that the values we are really interested in are pass which is a pointer to the input and ret which is a pointer to the output.
finds a string in an array of strings and returns the position where the string was found. It is useful when trying to find a memory address. arrcount is the array size.
Same as above only that rather than an array of strings we have a symbol table which makes it handy when dealing with registers.
Finds a value in the register bank and returns the register string. Useful when trying to find out if a memory value is equal to some value of a register and attaching the register name to that memory address. This function takes as arguments the value as a bit array with its length and returns the register name.
for a given hexadecimal character it returns the least significant bit, that is, for a char 0-9,A-F it returns the 1 bit.
for a given hexadecimal character it returns the second bit (assuming big endian), that is, for a char 0-9,A-F it returns the 2 bit.
for a given hexadecimal character it returns the third bit (assuming big endian), that is, for a char 0-9,A-F it returns the 4 bit.
for a given hexadecimal character it returns the most significant bit, that is, for a char 0-9,A-F it returns the 8 bit.
Given 4 sequential bits, this function will return the hexadecimal character which stands for those 4 bits, e.g. for (1,1,0,1) it will return 'D'. This is useful when trying to gather up flag states and make up the 4 most significant bits of the CPSR and SPSR.
Called when crashing to close serial_FD if we use the serial port.
This is a routine that is invoked when something has crashed and exits safely if an error occured during setup. It makes sure serial_FD is closed.
This is a very technical routine that sets up the serial port. waittime is a waiting time which is variable within these port settings.
sends a character array to the board. sends char_number number of characters given by data_ptr.
gets a character array from the board. sends char_number number of characters given by data_ptr.
sends 32 bit int to the board.
gets 32 bit int from board.
sends 16 bit int to the board.
gets 16 bit int from board.
gets 1 char from board.
sends 1 char to the board.
This is the main component which is responsible for the presentation. It is the wrapper of the functionality of the system as a whole, allowing interaction with the user and managing the interconnection between many parts of the system. GTK+ is used to build up all items and the required callback functions are all to be found in callbacks.c.
Disassemble an instruction given the memory address , its value and the length.
This function will refresh the display of the memory values which are currently visible to the user.
This function will refresh the display of the register banks. It has various steps to ensure that the values are all up-to-date. It inputs the number of register bank to be refreshed.
This function creates the main window which contains all the frames, buttons, menus, etc. that follow. Size, title and other properties are chosen just before the file and control bars are added. Also, the items within the display list will be added later to this window.
This function is called in order to create the file bar in the main window, or rather the file section - the one to deal with loading and compiling files, as well as the "features" and "about" button.
This will create a new window which displays the current features available after consulting the board.
In the above function, XILINX_FPGA is sometimes available (in current labs this should always be the case) and, when detected, upon clicking the appropriate button in the features window, this function will be called and create a new container.
Creates a box containing the console window to be manipulated in features.
Creates the splash window that appears at the beginning of a run.
This will create a new window with information and credits when the buttons labeled "about" is presses in the control bar.
This function will be called when the program starts and it will create the basic control panel of the application. It comprises buttons to control the current execution status, some fields to pass arguments to those buttons and some extra buttons which will open new windows e.g. breakpoints.
This function will be called when the button "create new window" which is a part of the following view_create_memory_clist (void) is pressed. A new window aligned to the left of the screen will be opened and it will have a large convenient presentation of the memory.
Creates a memory window which comprises the memory addresses and their values, dis-assembly and ASCII value. Also, we have some buttons and entry fields created.
This function will typically be called twice to create the two frames in which the properties derived from the CPSR and SPSR are displayed and are allowed to be changed, hence updating the values of the above registers. Each window will comprise of a label with the current state, the flags which will be represented by toggled buttons and a selection menu which will allow the current mode to be changed.
creates a register bank window. It takes as an argument the register bank e.g. IRQ and returns a frame that presents the contents of that register bank.
Creates a console window. It requires no arguments and returns a widget which is the scrolled console window (that is the one called from features).
the following subroutine goes to the already retrieved window display list and parses it accordingly.
R within the parsing list stands for register,
M for memory list,
C for console,
F for flag window,
! for vertical line,
~ for horizontal line.
appropriate functions that create to appropriate widget are then called and the current display list can be found in the entry window_list in the file ./.komodo