code:devstart - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
5087
5088 /* Device start routine for disks
5089 * and other devices that have the register
5090 * layout of the older DEC controllers (RF, RK, RP, TM)
5091 */
5092 #define IENABLE 0100
5093 #define WCOM 02
5094 #define RCOM 04
5095 #define GO 01
5096 devstart(bp, devloc, devblk, hbcom)
5097 struct buf *bp;
5098 int *devloc;
5099 {
5100 register int *dp;
5101 register struct buf *rbp;
5102 register int com;
5103
- com为待传给寄存器RKCS的局部变量
5104 dp = devloc;
5105 rbp = bp;
- RKDA地址赋给dp
- 则 dp-1 为RKBA地址, dp-2 为RKWC地址, dp-3 为RKCS地址,详见RK磁盘 寄存器
5106 *dp = devblk; /* block address */
5107 *--dp = rbp->b_addr; /* buffer address */
5108 *--dp = rbp->b_wcount; /* word count */
5109 com = (hbcom<<8) | IENABLE | GO |
5110 ((rbp->b_xmem & 03) << 4);
5111 if (rbp->b_flags&B_READ)
- com置IENABLE,GO标志
- 将第4,5两位置为rbp->xmem的高2位,rbp->xmem的意义参见struct buf
5112 com =| RCOM;
5113 else
- 如果为读,置RCOM标志
5114 com =| WCOM;
5115 *--dp = com;
- 如果为写,置WCOM标志
5116 }
- 将com赋值给RKCS
5117 /* ------------------------- */