For more information of how to select and download an SerialICE Driver please refer to the section on Getting Started with SerialICE-1A.
| Offset | Function | Description |
|---|---|---|
| 0 | Entry Point | The entry point of the driver |
| 8 | DVRIF_VERS | The version number of the driver |
| 12 | _cputype | The address of an INT that contains the type of the CPU eg. 4001 |
| 16 | _drivername | The address of a string that contains the driver name |
| 20 | read_target(int type,Ulong addr,int size) | The address of a function that reads a value from the target |
| 24 | write_target(int type,Ulong addr,Ulong value,int size) | The address of a function that writes a value to the target |
| 28 | run_target(int mode,int flags,int count) | The address of a function that starts target execution |
| 32 | setbp_target(int n,int type,Ulong addr) | The address of a function that sets a breakpoint in the target |
| 36 | clrbp_target(int n) | The address of a function that clears a breakpoint in the target |
| 40 | flush_target(int type) | The address of a function that flushes the caches in the target |
| 44 | 0 | Not used |
| 48 | is_writeable_target(Ulong addr) | The address of a function that returns TRUE if the specified address is writeable |
The second table is located at 0xbfc00200 and is used when the driver needs to call functions within the SerialICE Monitor. The functions in this table are shown below:
| Offset | Function | Description |
|---|---|---|
| 0 | read(int fd, char *buf, int size) | Read specified number of bytes into buf. Returns number of bytes read. |
| 4 | write(int fd, char *buf, int size) | Write specified number of bytes from buf. Returns number of bytes written. |
| 8 | int open(char *name [,int mode]) | Open a device. Returns file descriptor. |
| 12 | close(int fd) | Close a file descriptor. |
| 16 | ioctl(int fd, int request, arg) | Perform I/O control operation. |
| 20 | printf(char *fmtstr, arg...) | Print formatted to stdout. |
| 24 | addRegRec(RegRec *reg) | The address of a function that adds a register to the current list |
| 28 | void *malloc(int size) | The address of a function that allocates a block of memory |
| 32 | cpuInit | The address of a function that ... |
| 36 | char*getenv(char *name) | The address of a function that returns a pointer to the definition of the specified environment variable |
| 40 | 0 | Not used |
| 44 | 0 | Not used |
| 48 | stop(int type) | The address of a function that returns control to the Monitor |
| 52 | int getBpid() | The address of a function that returns the id of the current breakpoint (if any) |
| 56 | is_xvwmode() | The address of a function that returns TRUE if xvwmode is set |
| 60 | gdbstop(int type) | The address of a function that returns control to the gdb command mode |
| 64 | setTrcbp(Ulong addr,int tover) | The address of a function that sets a trace breakpoint |
| 68 | addCmdRec(CmdRec *cmd) | The address of a function that adds a new command to the current command list |
| 72 | Ulong disasm(char *buf,Ulong addr,Ulong instr) | The address of a function that disassembles an instruction |
| 76 | get_rsa(Ulong *dst,char *src) | The address of a function that performs expression evaluation |
| 80 | is_gdbmode (read) | The address of a function that returns TRUE if gdbmode is set |
| 84 | addEnvRec(EnvRec *var) | The address of a function that adds a new environment variable to the current list |
Once the driver has been loaded, IMON calls the routine whose address is located at offset 4 (_start) in the table. The routine _start first clears the bss section and then calls dvrInit().
_start()
{
clrbss();
dvrInit();
}
dvrInit adds the list of registers and commands that are specific to
this processor. Offsets 8 and 12 contain the address of an int
that contains the processor number (eg. 4001), and the address of a
string that describes the driver (eg. "Driver for LR4001")
respectively.The driver is divided into a four files:
Most modifications needed to support a new ASIC can be made by making changes to the Processor-specific code module (eg. bsps/d4001.c).