⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paddreg.htm

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 HTM
字号:
		<title>PMON - Adding Registers</title>		<h1 align=center>Adding Registers</h1><!--INDEX "Adding registers to PMON" -->Adding registers to PMON is very simple. You might want to do this inorder to make PMON able to display and modify the registers ofperipheral devices that you have on your own board. For example, if youhave a real-time clock chip that contains 4 registers. You can addthese registers to PMON so that you can display and set them from thePMON command line.<p>The register information is entered into a table that is locatedin the appropriate file in the lib directory. For example, if yourprocessor uses the 4001 core, you should add the registers to thearray c4001_reglist located in the file lib/c4001.c. A fragment of this table is shown below..<p><pre>        {mXc0,mips_cause_def,"C0_CAUSE","CAUSE",13,(F_CP0|F_MIPS)},        {mXmem,0,"M_TIC0","TIC0",M_TMR4001+O_TIC0},        {mXmem,Tmr4003Stat,"M_TSTAT","TSTAT",M_TMR4001+O_TSTAT},</pre>Reading from left to right, the field definitions are as follows...<ol><li>The first field contains the address of a function that can be used to set and get thecurrent value of the register. The prototype for a register access function is...<pre>	unsigned long mXmem(int mode, int reg, unsigned long value)</pre>	where:	<ul>	<li>mode is either zero for read, or 1 for write.	<li>reg is the value from the 5th field of the reglist[] structure.	<li>value (for write operations) contains the value to be		written.	<li>For reads, the return value is the value read from the		register.	</ul><p>The first example shows the definition for a register that is accessed viacoprocessor 0. The remaining examples are for memory-mapped registers.<p><li>The second field contains either zero, or the address of an arrayof structures that describe the bit fields within the register. Forexample,<pre>char *excodes[] = {	"Int","MOD","TLBL","TLBS","AdEL","AdES","IBE","DBE",	"Sys","Bp","RI","CpU","Ovf","Resv","Resv","Resv",0};	RegSpec mips_cause_def[] = {	{1,31,"BD",2,0,1},	{2,28,"CE",10,0,1},	{6,10,"IP",2,0,1},	{2,8,"SW",2,0,0},	{4,2,"EXCODE",0,excodes,1},	{0}};</pre>	Where:<p>	<ul>	<li>The first field of the structure definition contains the 		width of the register field in bits. For example, in the		example above, the BD field is one bit wide, while the		IP field is 6 bits wide.<p>	<li>The second field of the structure definition contains the 		least significant bit number of the field. For example, 		in the example above, the BD field is in bit 31, 		while the IP field starts at bit 10.<p>	<li>The third field of the structure definition contains the 		name of the register field.<p>	<li>The fourth field of the structure definition contains 	the numerical base that PMON	should use when displaying the value of the register field. Possible	values are 2, 8, 10, and 16. If this	value is zero, it indicates that the next field if the structure	contains a pointer to an array.<p>	<li>The fifth field of the structure definition contains either zero,	or a pointer to an array that specifies the strings that	should be displayed for each possible value of the register field.	In this example the values of the EXCODE field are	specified by the array excodes[].<p>	<li>The sixth field of the structure definition contains a 	flag that is used to indicate	that this register field is read-only. In the example above,	only the SW field is not read-only.	</ul><p>In the first example, the CAUSE and TSTAT registers use this feature to specify the bit fields in the register.<p><li>The third field contains the long name of the register.<p><li>The fourth field contains the short (or alternate) name of the register.<p><li>The fifth field contains additional information that is passed to theregister access function.<p><li>The sixth field (if present) contains flags that specify additionalinformation about the entry. For example,<p><table><tr><td>F_RO	</td><td>The register is read-only.</td></tr><tr><td>R_WO	</td><td>The register is write-only.</td></tr></table><p></ol>Once the table has been modified, you need to rebuild PMON and <ahref="mkroms.htm">make</a> new <a href="romdef.htm">ROMs</a>.<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 + -