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

📄 c200mnrt.asm

📁 TMSLF2407A TI DSK 标准原程序 内含:AC电机控制etc, 良师益友
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;*H*************************************************************************
; TI Proprietary Information - Internal Data
; Copyright (c) 1993-1999, Texas Instruments Incorporated
; All rights reserved
;***************************************************************************
;
; DESCRIPTION:
;
;     Truely awesome monitor program
;       for C25LP HLL Real-Time Debugger.
;
;     TI Proprietary Information - Internal Data.
;     Copyright (c) 1993-1997, Texas Instruments Incorporated.
;
;     This real-time monitor was developed by H.Roland Hoar.
;
; STATUS:
;
;     This monitor version is dated 24th of June 1997.
;     It is intended for use with HLL Debugger versions "1.19" or later.
;     The MON_RELEASE mnemonic has the hexadecimal value '1019'.
;
;     This document has page feed characters spaced for 66 lines per page.
;     Its page alignment is adjusted to ensure
;         attractive two-page-per-sheet printing.
;
;***************************************************************************
;
               .title "Monitor program for C25LP HLL Real-Time Debugger."
               .include "c200mnrt.i" ; Include conditional assembly options.
               .mmregs               ; Include standard register mnemonics.
               .length 66            ; Set the page length for the listing.
;
               .page 
;***************************************************************************
;
; EXTERNAL FUNCTIONS:
;
;      MON_SE_CNFG    SE device configuration routine.
;      MON_RT_CNFG    RT device configuration routine.
;      MON_EINTR      Interrupt vector table macro "mon_eintr_vecs".
;      MON_ETRAP      Interrupt vector table macro "mon_etrap_vecs".
;
; INTERNAL FUNCTIONS:
;
;      MON_TRAP_ENTRY Monitor emulation trap service routine.
;      MON_INTR_ENTRY Monitor emulation interrupt service routine.
;      MON_ENTRY      Entry routine shared by traps and interrupts.
;      MON_WAIT       Wait to read a debugger message.
;      MON_EVALUATE   Evaluate the type of debugger message.
;      SENDCMND, RECVCMND, DOAWRITE, SWCHOPRT, MAYBERUN:
;                     These functions, labelled "_ENTR" and "_EXIT",
;                     respond to the type and value of the message.
;                     They implement the core of monitor state machine.
;      MON_UNUSED     Process a debugger unused command.
;      MON_ADRSWR     Process a debugger write address command.
;      MON_PMRD       Process a debugger read program memory command.
;      MON_PMWR       Process a debugger write program memory command.
;      MON_DMRD       Process a debugger read data memory command.
;      MON_DMWR       Process a debugger write data memory command.
;      MON_IORD       Process a debugger read io memory command.
;      MON_IOWR       Process a debugger write io memory command.
;      MON_EXECUTE, MON_EXIT, MON_QUICKGO:
;                     Monitor exit routines to return to the application.
;
;***************************************************************************
;
               .page 
;***************************************************************************
; REALTIME MNEMONICS
;***************************************************************************

;---------------------------------------------------------------------------
; Define the PRM_CMND register masks and bits.
;---------------------------------------------------------------------------
CMNDMASK       .set   00007h ; Mask for command opcode field.
;
CMND_NONE      .set   00000h ; Address value read command opcode.
CMND_ADRS      .set   00001h ; Address value write command opcode.
CMND_PMRD      .set   00002h ; Program memory read command opcode.
CMND_PMWR      .set   00003h ; Program memory write command opcode.
CMND_DMRD      .set   00004h ; Data memory read command opcode.
CMND_DMWR      .set   00005h ; Data memory write command opcode.
CMND_IORD      .set   00006h ; IO memory read command opcode.
CMND_IOWR      .set   00007h ; IO memory write command opcode.
;
RORWMASK       .set   00001h ; Mask to distinguish read/write commands.
PORDMASK       .set   00004h ; Mask to distinguish program/data commands.
;
AINCMASK       .set   00008h ; Mask for address increment option.
;
STOPMASK       .set   00010h ; Mask for stop-mode flag.
SNGLMASK       .set   00020h ; Mask for single-step flag.
EVERMASK       .set   00040h ; Mask for forever-run flag.
;
MAPSMASK       .set   00080h ; Mask for map register usage option.
;
B_RORWMASK     .set      00h ; Bit number of the read/write command mask.
B_PORDMASK     .set      02h ; Bit number of the program/data command mask.
;
B_AINCMASK     .set      03h ; Bit number of the address increment option.
;
B_STOPMASK     .set      04h ; Bit number of the stop-mode flag.
B_SNGLMASK     .set      05h ; Bit number of the single-step flag.
B_EVERMASK     .set      06h ; Bit number of the forever-run flag.
;
B_MAPSMASK     .set      07h ; Bit number of the map register usage option.
;
               .page 
;---------------------------------------------------------------------------
; Define the MON_STATUS register masks and bits.
;---------------------------------------------------------------------------
ATN_OK         .set   00000h ; Value for no outstanding status.
ATN_RESET      .set   00001h ; Mask for reset status.
ATN_SWBP       .set   0000Ch ; Mask for software breakpoint status.
ATN_TRAP       .set   00080h ; Mask for trap error.
;
;---------------------------------------------------------------------------
; Define the ST0 register masks used for manipulating public bits.
;---------------------------------------------------------------------------
USR_INT_DSB    .set   00200h ; Mask for ST0 user interrupt mode bit.
;
;---------------------------------------------------------------------------
; Define the ST1 register masks used for manipulating hidden bits.
;---------------------------------------------------------------------------
SNG_STP_DSB    .set   00020h ; Mask for ST1 single step mode disable.
GLB_INT_ENB    .set   00080h ; Mask for ST1 global interrupt enable.
;
;---------------------------------------------------------------------------
; Define the MON_AR value to be used (choice of AR7-0 register)
;---------------------------------------------------------------------------
MON_AR         .set   MON_AR_VALUE & 00007h ;
;
;---------------------------------------------------------------------------
; Define the IFR register masks and bits.
;---------------------------------------------------------------------------
MON_EMUMSK     .set   00040h ; Mask for emulation interrupt.
;
B_EMUMSK       .set      06h ; Bit number of emulation interrupt.
;
;---------------------------------------------------------------------------
; Define the IMR register masks and bits.
;---------------------------------------------------------------------------
               .eval  0, MON_USER_INT
               .eval  (MON_USER_INT1 << 0) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT2 << 1) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT3 << 2) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT4 << 3) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT5 << 4) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT6 << 5) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT7 << 6) | MON_USER_INT, MON_USER_INT
               .eval  (MON_USER_INT8 << 7) | MON_USER_INT, MON_USER_INT
MON_INT_MSK    .set   MON_USER_INT
;
               .page 
;---------------------------------------------------------------------------
; Define the analysis and message passing control registers addresses.
;
; MSG_DATA is used to access data via the message passing register.
; MSG_CMND is used to access command via the message passing register.
; MSG_STAT is used to check message status.
; MSG_CNTL is used to configure analysis and message passing.
;---------------------------------------------------------------------------
MSG_DATA       .set     1Ch  ; Analysis data register.
MSG_CMND       .set     1Dh  ; Analysis command register.
MSG_STAT       .set     1Eh  ; Analysis status register.
MSG_CNTL       .set     1Fh  ; Analysis control register.
;
;---------------------------------------------------------------------------
; Define the MSG_STAT register masks and bits.
;---------------------------------------------------------------------------
STAT_XFER      .set     01h  ; Mask for good transfer.
STAT_RFUL      .set     02h  ; Mask for read buffer full.
STAT_CMND      .set     04h  ; Mask for command type message.
STAT_WFUL      .set     08h  ; Mask for write buffer full.
STAT_ANYBP     .set     10h  ; Mask for message/breakpoint.
STAT_STRP      .set     20h  ; Mask for strap mode.
STAT_FUNC      .set     40h  ; Mask for functional mode.
;
B_STATXFER     .set       0  ; Bit number of good transfer.
B_STATRFUL     .set       1  ; Bit number of read buffer full.
B_STATCMND     .set       2  ; Bit number of command type message.
B_STATWFUL     .set       3  ; Bit number of write buffer full.
B_STATANYBP    .set       4  ; Bit number of message/breakpoint.
B_STATSTRP     .set       5  ; Bit number of strap mode.
B_STATFUNC     .set       6  ; Bit number of functional mode.
;
               .page 
;---------------------------------------------------------------------------
; Define the MSG_CNTL register masks and bits.
;---------------------------------------------------------------------------
ANA_TRPON      .set    001h  ; Trap On.
                             ; When set, enables analysis.
ANA_UBP0       .set    002h  ; User Breakpoint Bit #0.
ANA_UBP1       .set    004h  ; User Breakpoint Bit #1.
                             ; 00 => reserved.
                             ; 01 => create load mechanism.
                             ; 10 => analysis in wait state,
                             ;       disallow write to message registers.
                             ; 11 => analysis in run state,
                             ;       allow write to message registers.
ANA_MSGFLG     .set    008h  ; Message Flag.
                             ; Used as simple flag from monitor to debugger.
ANA_SWITCH     .set    010h  ; Message Switch.
                             ; Toggling this bit high then low
                             ; generates an event to the JTM.
ANA_SPOFF      .set    020h  ; Suspend Off.
                             ; When set, allows access the message passing
                             ; registers when not in ETRAP routine.
ANA_TPOFF      .set    040h  ; Analysis NMI Off.
                             ; When set, disables the analysis NMI.
;
B_ANATRPON     .set       0  ; Bit number of trap on.
B_ANAUBP0      .set       1  ; Bit number of user breakpoint bit 0.
B_ANAUBP1      .set       2  ; Bit number of user breakpoint bit 1.
B_ANAMSGFLG    .set       3  ; Bit number of message flag.
B_ANASWITCH    .set       4  ; Bit number of message switch.
B_ANASPOFF     .set       5  ; Bit number of suspend off.
B_ANATPOFF     .set       6  ; Bit number of trap off.
;
;---------------------------------------------------------------------------
; Define the MSG_CNTL register values that are to be actually used.
;---------------------------------------------------------------------------
ANA_DEFAULT    .set ANA_TPOFF | ANA_SPOFF | ANA_UBP1 | ANA_UBP0 | ANA_TRPON
ANA_SWLO       .set ANA_DEFAULT | 000h ; ANA_SWITCH low.
ANA_SWHI       .set ANA_DEFAULT | 010h ; ANA_SWITCH high.
;
               .page 
;---------------------------------------------------------------------------
; Define the MON_OPTION1 mnemonic.
;---------------------------------------------------------------------------
               .eval  0, OPTION1
               .eval  (MON_INT_MSK  << 00h) | OPTION1, OPTION1 ; uses 8 bits
;
               .eval  (0            << 08h) | OPTION1, OPTION1 ; unused
               .eval  (0            << 09h) | OPTION1, OPTION1 ; unused
               .eval  (MON_VECTOR   << 0Ah) | OPTION1, OPTION1 ; uses 1 bit
               .eval  (MON_INT_ALTR << 0Bh) | OPTION1, OPTION1 ; uses 1 bit
;
               .eval  (MON_RGST << 0Ch) | OPTION1, OPTION1 ; uses 1 bit
               .eval  (MON_AR   << 0Dh) | OPTION1, OPTION1 ; uses 3 bits
               ;eval  (MON_AR   << 0Eh) | OPTION1, OPTION1 ; uses 3 bits
               ;eval  (MON_AR   << 0Fh) | OPTION1, OPTION1 ; uses 3 bits
MON_OPTION1    .set   OPTION1
;
;---------------------------------------------------------------------------
; Define the MON_OPTION2 mnemonic.
;---------------------------------------------------------------------------
               .eval  0, OPTION2
               .eval  MON_IO_MAP_USE    | OPTION2, OPTION2 ; uses 2 bits
               ;eval  MON_IO_MAP_USE    | OPTION2, OPTION2 ; uses 2 bits
               .eval  MON_AUTO_INC      | OPTION2, OPTION2 ; uses 2 bits
               ;eval  MON_AUTO_INC      | OPTION2, OPTION2 ; uses 2 bits
;
               .eval  MON_ERROR_CHECK   | OPTION2, OPTION2 ; uses 2 bits
               ;eval  MON_ERROR_CHECK   | OPTION2, OPTION2 ; uses 2 bits
               .eval  MON_RESET_MESG    | OPTION2, OPTION2 ; uses 2 bits
               ;eval  MON_RESET_MESG    | OPTION2, OPTION2 ; uses 2 bits
;
               .eval  MON_CORE          | OPTION2, OPTION2
               .eval  MON_FULL          | OPTION2, OPTION2
               .eval  MON_SE_CNFG_USE   | OPTION2, OPTION2
               .eval  MON_WAIT_USE      | OPTION2, OPTION2
;
               .eval  MON_WAIT_STOP     | OPTION2, OPTION2
               .eval  MON_WAIT_SNGL     | OPTION2, OPTION2
               .eval  MON_WAIT_EVER     | OPTION2, OPTION2
               .eval  (0        << 0Fh) | OPTION2, OPTION2 ; unused
MON_OPTION2    .set   OPTION2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -