📄 icedrvr.htm
字号:
<title>The SerialICE Driver</title> <h1 align=center>The SerialICE Driver</h1><!--INDEX "SerialICE Driver" --><!--INDEX "Vector Table" -->The SerialICE Driver is downloaded from the host to the SerialICE Controller.Once the driver has been downloaded, the SerialICE Monitor is able to use itto communicate with the SerialICE Kernel that is resident on the Target.<p>For more information of how to select and download an SerialICE Driver pleaserefer to the section on <a href="igetstrt1a.htm">Getting Started withSerialICE-1A</a>. <p></dl><h2>SerialICE Monitor - SerialICE Kernel Communication</h2><dl><dd>Two tables are used to provide linkage between the SerialICE Monitor and theSerialICE Kernel. The driver's table is located at 0x80020000 is used whenthe SerialICE Monitor needs to call one of the functions in the driver. Thesefunctions are listed below:<p><table border cellpadding=6 width=80%><tr><th>Offset</th><th>Function</th><th>Description</th></tr><tr><td>0</td><td valign=top>Entry Point</td><td>The entry point of the driver</td></tr><tr><td>8</td><td valign=top>DVRIF_VERS</td><td>The version number of the driver</td></tr><tr><td>12</td><td valign=top>_cputype</td><td>The address of an INT that contains the type of the CPU eg. 4001</td></tr><tr><td>16</td><td valign=top>_drivername</td><td>The address of a string that contains the driver name</td></tr><tr><td>20</td><td valign=top>read_target(int type,Ulong addr,int size)</td><td>The address of a function that reads a value from the target</td></tr><tr><td>24</td><td valign=top>write_target(int type,Ulong addr,Ulong value,int size)</td><td>The address of a function that writes a value to the target</td></tr><tr><td>28</td><td valign=top>run_target(int mode,int flags,int count)</td><td>The address of a function that starts target execution</td></tr><tr><td>32</td><td valign=top>setbp_target(int n,int type,Ulong addr)</td><td>The address of a function that sets a breakpoint in the target</td></tr><tr><td>36</td><td valign=top>clrbp_target(int n)</td><td>The address of a function that clears a breakpoint in the target</td></tr><tr><td>40</td><td valign=top>flush_target(int type)</td><td>The address of a function that flushes the caches in the target</td></tr><tr><td>44</td><td valign=top>0</td><td>Not used</td></tr><tr><td>48</td><td valign=top>is_writeable_target(Ulong addr)</td><td>The address of a function that returns TRUE if the specified address is writeable</td></tr></table><p>The second table is located at 0xbfc00200 and is used when the driver needsto call functions within the SerialICE Monitor. The functions in this table areshown below:<p><table border cellpadding=6 width=80%><tr><th>Offset</th><th>Function</th><th>Description</th></tr><tr><td>0</td><td valign=top>read(int fd, char *buf, int size)</td><td>Read specified number of bytes into buf. Returns number ofbytes read.</td></tr><tr><td valign=top>4</td><td valign=top>write(int fd, char *buf, int size)</td><td>Write specified number of bytes from buf. Returns number ofbytes written.</td></tr><tr><td>8</td><td>int open(char *name [,int mode])</td><td>Open a device. Returns file descriptor.</td></tr><tr><td>12</td><td>close(int fd)</td><td>Close a file descriptor.</td></tr><tr><td>16</td><td>ioctl(int fd, int request, arg)</td><td>Perform I/O control operation.</td></tr><tr><td>20</td><td>printf(char *fmtstr, arg...)</td><td>Print formatted to stdout.</td></tr><tr><td>24</td><td valign=top>addRegRec(RegRec *reg)</td><td>The address of a function that adds a register to the current list</td></tr><tr><td>28</td><td valign=top>void *malloc(int size)</td><td>The address of a function that allocates a block of memory</td></tr><tr><td>32</td><td valign=top>cpuInit</td><td>The address of a function that ...</td></tr><tr><td>36</td><td valign=top>char*getenv(char *name)</td><td>The address of a function that returns a pointer to the definitionof the specified environment variable</td></tr><tr><td>40</td><td>0</td><td>Not used</td></tr><tr><td>44</td><td>0</td><td>Not used</td></tr><tr><td>48</td><td valign=top>stop(int type)</td><td>The address of a function that returns control to the Monitor</td></tr><tr><td>52</td><td valign=top>int getBpid()</td><td>The address of a function that returns the id of the currentbreakpoint (if any)</td></tr><tr><td>56</td><td valign=top>is_xvwmode() </td><td>The address of a function that returns TRUE if xvwmode is set</td></tr><tr><td>60</td><td valign=top>gdbstop(int type)</td><td>The address of a function that returns control to the gdb commandmode</td></tr><tr><td>64</td><td valign=top>setTrcbp(Ulong addr,int tover)</td><td>The address of a function that sets a trace breakpoint</td></tr><tr><td>68</td><td valign=top>addCmdRec(CmdRec *cmd)</td><td>The address of a function that adds a new command to the currentcommand list</td></tr><tr><td>72</td><td valign=top>Ulong disasm(char *buf,Ulong addr,Ulong instr)</td><td>The address of a function that disassembles an instruction</td></tr><tr><td>76</td><td valign=top>get_rsa(Ulong *dst,char *src)</td><td>The address of a function that performs expression evaluation</td></tr><tr><td>80</td><td valign=top>is_gdbmode (read)</td><td>The address of a function that returns TRUE if gdbmode is set</td></tr><tr><td>84</td><td valign=top>addEnvRec(EnvRec *var)</td><td>The address of a function that adds a new environment variable to the current list</td></tr></table><p>Once the driver has been loaded, IMON calls the routine whose addressis located at offset 4 (_start) in the table. The routine _start firstclears the bss section and then calls dvrInit(). <p><pre> _start() { clrbss(); dvrInit(); }</pre>dvrInit adds the list of registers and commands that are specific tothis processor. Offsets 8 and 12 contain the address of an intthat contains the processor number (eg. 4001), and the address of astring that describes the driver (eg. "Driver for LR4001")respectively.<p>The driver is divided into a four files:<p><ol> <li>Startup code (<a href="../lib/crt3.s">lib/crt3.s</a>) <li>Common code (<a href="../bsps/iceif.c">bsps/iceif.c</a>) <li>Base processor code (<a href="../bsps/400x.c">bsps/400x.c</a>, <a href="../bsps/401x.c">bsps/401x.c</a>) <li>Processor-specific code (eg. <a href="../bsps/d4001.c">bsps/d4001.c</a>, <a href="../bsps/d4003.c">bsps/d4003.c</a>, <a href="../bsps/d4101.c">bsps/d4101.c</a>, <a href="../bsps/d4011.c">bsps/d4011.c</a> etc.)</ol><p>Most modifications needed to support a new ASIC can be made by making changesto the Processor-specific code module (eg. bsps/d4001.c).<p></dl><p><hr><b>Navigation:</b> <a href="index.htm">Document Home</a> | <a href="doctoc.htm">Document Contents</a> | <a href="docindex.htm">Document Index</a> <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -