实现MAXQ2000微控制器的JTAG加载主机

[09-13 17:04:13]   来源:http://www.88dzw.com  控制技术   阅读:8661

文章摘要:下面是执行这一操作的例程shiftIR3。;==;=;= shiftIR3;= clock0, clock1, shift;=;= Shifts a 3-bit value into the IR register.;=;= Inputs : A[0] - Low three bits contain value to shift into IR;= Outputs : None;= Destroys : AP, APC, A[0], PSW, LC[0];=shiftIR3: move APC, #80h ; Acc => A[0],

实现MAXQ2000微控制器的JTAG加载主机,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com

下面是执行这一操作的例程shiftIR3。

;==============================================================================
;=
;=  shiftIR3
;=     clock0, clock1, shift
;=
;=  Shifts a 3-bit value into the IR register.
;=
;=  Inputs   : A[0] - Low three bits contain value to shift into IR
;=  Outputs  : None
;=  Destroys : AP, APC, A[0], PSW, LC[0]
;=

shiftIR3:
   move    APC, #80h         ; Acc => A[0], turn off auto inc/dec
   call    clock1            ; (Select DR Scan)
   call    clock1            ; (Select IR Scan)
   call    clock0            ; (Capture IR - loads 001b to shift register)
   call    clock0            ; (Shift IR)
   move    TMS, #0           ; Drive TMS low                            
   move    C, TDO            ; xxxxx210   c = s
   rrc                       ; sxxxxx21   c = 0
   call    shift             ; Shift in IR bit 0
   rrc                       ; ssxxxxx2   c = 1
   call    shift             ; Shift in IR bit 1
   rrc                       ; sssxxxxx   c = 2
   move    TMS, #1           ; Drive TMS high for last bit
   call    shift             ; Shift in IR bit 2 (Exit1 IR)
   call    clock1            ; (Update IR)
   call    clock0            ; (Run Test Idle)
   ret

写入TAP数据寄存器

数值移入或者移出TAP控制器DR的操作与装入/卸载IR的方式相似。通常,只有当IR被设置为两个数值之一时才能进行这一操作:100b (使TAP控制器进入系统编程模式)或者010b (使TAP控制器进入调试模式)。

激活系统编程模式后,装入和卸载DR寄存器的操作如下。
  • DR寄存器移入和移出宽度为3比特。所有三个比特都代表有效数据。
  • 当到达Update-DR状态时,送入DR寄存器的数值被复制到从机微控制器的内部系统编程寄存器中。这三个比特的用法如下。
    • 从机微控制器可访问第0位(读/写),它作为寄存器位ICDF.1 (SPE),也被称为系统编程使能位。复位后,程序ROM检查该位,确定应进入启动加载程序模式(SPE = 1)还是正常程序执行模式(SPE = 0)。
    • 从机微控制器可访问第1位和第2位(读/写),它作为寄存器位ICDF.2-3 (PSS0-PSS1),也被称为编程源选择位。对于能够为启动加载程序提供多个接口的微控制器,例如MAXQ2000,这些位用于当SPE = 1时应选择哪一启动加载程序接口。当SPE = 0 (正常程序执行模式)时,这些位的设置不起作用。
  • DR寄存器传送出去的数值是系统编程寄存器以前的数值(当进入Capture-DR状态后,锁存到移位寄存器中)。
激活系统编程模式后,装入和卸载DR寄存器的操作如下。
  • DR寄存器移入和移出宽度为10比特。对于移出数据,所有10个比特都代表有效数据(8个数据位和2个状态位)。对于移入数据,只使用了8个数据位;没有使用两个状态位。
  • 然后,将移入DR寄存器的高8位卸载,作为启动加载程序命令的一部分,被启动加载程序(从程序ROM中运行)读取。
  • 移出DR寄存器的10个比特含有8位由启动加载程序装入的数值(作为命令输出的一部分),以及由TAP控制器设置的两个状态信息位。
;==============================================================================
;=
;=  shiftDR3
;=
;=  Shifts a 3-bit value into the DR register.  This operation should only be
;=  performed when IR =100b (System Programming Mode).
;=
;=  Inputs   : A[0] - Low 3 bits contain value to shift into SPB (PSS1:PSS0:SPE)
;=  Outputs  : None
;=  Destroys : AP, APC, A[0], PSW, LC[0]

shiftDR3:
   move    APC, #80h         ; Acc => A[0], turn off auto inc/dec
   call    clock1            ; (Select DR Scan)
   call    clock0            ; (Capture DR)
   call    clock0            ; (Shift DR)
   move    TMS, #0           ; Drive TMS low                            
   move    C, TDO            ; xxxxx210   c = s
   rrc                       ; sxxxxx21   c = 0
   call    shift             ; Shift in DR bit 0
   rrc                       ; ssxxxxx2   c = 1
   call    shift             ; Shift in DR bit 1
   rrc                       ; sssxxxxx   c = 2
   move    TMS, #1           ; Drive TMS high for last bit
   call    shift             ; Shift in DR bit 2 (Exit1 DR)
   call    clock1            ; (Update DR)
   call    clock0            ; (Run Test Idle)
   ret


;==============================================================================
;=
;=  shiftDR
;=     clock0, clock1, shift
;=
;=  Shifts a 10-bit value into and out of the DR register.  This operation 
;=  should only be performed when IR = 010b (Debug/Loader Mode).
;=
;=  Inputs   : A[0]  - Byte value (input) to shift into DR
;=  Outputs  : A[0]  - Byte value (output) shifted out of DR
;=             A[1]  - Low two bits are status bits 1:0 shifted out of DR
;=             A[15] - Byte value shifted in, cached for use by shiftDR_next
;=  Destroys : AP, APC, PSW, LC[0]

shiftDR:
   move    APC, #80h         ; Acc => A[0], turn off auto inc/dec
   move    A[15], A[0]       ; Cache input byte value for use by shiftDR_next
   sla2                      ; Add two empty bits (for status)
   call    clock1            ; (Select DR Scan)
   call    clock0            ; (Capture DR)
   call    clock0            ; (Shift DR)
   
   move    TMS, #0           ; Drive TMS low                            
   move    C, TDO            ; xxxxxxxx76543210   c = s
   rrc                       
   call    shift             ; Shift in DR bit 0
   rrc                        
   call    shift             ; Shift in DR bit 1
   rrc                       
   call    shift             ; Shift in DR bit 2
   rrc                       
   call    shift             ; Shift in DR bit 3
   rrc                       
   call    shift             ; Shift in DR bit 4
   rrc                       
   call    shift             ; Shift in DR bit 5
   rrc                       
   call    shift             ; Shift in DR bit 6
   rrc                       
   call    shift             ; Shift in DR bit 7
   rrc                       
   call    shift             ; Shift in DR bit 8
   rrc                       
   move    TMS, #1           ; Drive TMS high for last bit
   call    shift             ; Shift in DR bit 9 (Exit1 DR)
   call    clock1            ; (Update DR)
   call    clock0            ; (Run Test Idle)

   push    Acc               ; sddd dddd 10xx xxxx
   sra4                      ; ssss sddd dddd 10xx
   sra2                      ; ssss sssd dddd dd10
   and     #0003h            ; ---- ---- ---- --10
   move    A[1], Acc         ; Return status bits only in A[1]
   pop     Acc
   and     #0FF00h           
   xch                       ; Return data bits only in A[0]
   ret

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]  下一页


Tag:控制技术计算机控制技术,工厂电气控制技术控制技术

《实现MAXQ2000微控制器的JTAG加载主机》相关文章