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

📄 usb_to_serial.lst

📁 usb serial converter
💻 LST
📖 第 1 页 / 共 5 页
字号:
                ;****************************************************************
                ; RAM ALLOCATION
                ;****************************************************************
                
                ; NOTE: Variables need to be grouped into a cohesive block and
                ; this constant needs to be set to the size of the variable
                ; block. This block of data is cleared when a Reset Serial
                ; operation occurs.
                
0010=           SIZEOF_VARIABLE_BLOCK:  equ     10h             ;
                
                ;PSP_BEGIN:         equ     00h
                ;PSP_END:           equ     0Fh
0010=           VARS_BEGIN:         equ     10h
                ;DSP_END:           equ     A5h
00B8=           DSP_BEGIN:          equ     (TOP_OF_RAM + 1)
                
                ;****************************************************************
                ; GLOBAL CONSTANTS
                ;****************************************************************
                
0000=           FALSE:              equ     00h                 ;
FFFFFFFF=           TRUE:               equ     ~FALSE              ;
                
                ;****************************************************************
                ; VARIABLES
                ;****************************************************************
                
                ;----------------------------------------------------------------
                ; USB_TO_SERIAL VARIABLES
                ;----------------------------------------------------------------
                
0010=           RX_TX_VARS:         equ     VARS_BEGIN          ; 
                
0010=           control_report:     equ     (RX_TX_VARS + 0)    ; this hold the 5 bytes of config data
                
0015=           setup_serial:       equ     (RX_TX_VARS + 5)    ; flag that indicates if a feature report has come in
0016=           load_ep1:           equ     (RX_TX_VARS + 6)    ;
0017=           tx_pending:         equ     (RX_TX_VARS + 7)    ; flag to indicate a TX transfer is pending
                
0018=           serial_configured:  equ     (RX_TX_VARS + 8)    ; set when we get configured
0019=           bit_rate:           equ     (RX_TX_VARS + 9)    ; set by host, this is the rate of transfers
001A=           data_bit_count:     equ     (RX_TX_VARS + 10)   ;
001B=           parity_on:          equ     (RX_TX_VARS + 11)   ;
001C=           parity_type:        equ     (RX_TX_VARS + 12)   ; set by host, this is the parity type we are using 
001D=           stop_bit_count:     equ     (RX_TX_VARS + 13)   ;
                
001E=           parity:             equ     (RX_TX_VARS + 14)   ; the parity being generated or checked
001F=           loop_counter:       equ     (RX_TX_VARS + 15)   ; used for bit rate control 
                
0020=           p1_shadow:          equ     (RX_TX_VARS + 16)   ;
0021=           temp:               equ     (RX_TX_VARS + 17)   ; 
0022=           temp2:              equ     (RX_TX_VARS + 18)   ; 
                
0022=           RX_TX_VARS_END:     equ     temp2               ;
                
                ;----------------------------------------------------------------
                ; Variables for RX 
                ;----------------------------------------------------------------
                
0023=           RX_VARS:            equ     (RX_TX_VARS_END + 1) ;
                
0023=           rts_shadow:         equ     (RX_VARS + 0)       ;
0024=           error_location:     equ     (RX_VARS + 1)       ;
0025=           rx_buffer_in:       equ     (RX_VARS + 2)       ;
0026=           rx_buffer_out:      equ     (RX_VARS + 3)       ;
0027=           rx_buffer:          equ     (RX_VARS + 4)       ;
                
0047=           RX_VARS_END:        equ     (rx_buffer + SIZEOF_RX_BUFFER) ;
                
                ;----------------------------------------------------------------
                ; Variables for TX
                ;----------------------------------------------------------------
                
0048=           TX_VARS:            equ     (RX_VARS_END + 1)   ;
                
0048=           tx_byte_count:      equ     (TX_VARS + 0)       ; number of bytes in the OUT packet
0049=           tx_byte_counter:    equ     (TX_VARS + 1)       ; # of bytes that have been transmitted
004A=           tx_data:            equ     (TX_VARS + 2)       ; current data being transmitted
                
004A=           TX_VARS_END:        equ     tx_data
                
                ;----------------------------------------------------------------
                ; Variables for EP0 and enumeration 
                ;----------------------------------------------------------------
                
004B=           EP0_VARS:           equ     (TX_VARS_END + 1)   ; EP0 variables will be based here
                
004B=           ep0_mode_shadow:    equ     (EP0_VARS + 0)      ; the ep0 mode register shadow
004C=           ep0_next_mode:      equ     (EP0_VARS + 1)      ; holds the mode that ep0 will go to next
004D=           ep0_data_toggle:    equ     (EP0_VARS + 2)      ; keeps track of the toggle bit
004E=           configuration:      equ     (EP0_VARS + 3)      ; holds the current status of configuration 
004F=           device_status:      equ     (EP0_VARS + 4)      ; holds the current status of remote_wakeup (2 bytes)
0051=           zero_register:      equ     (EP0_VARS + 6)      ; two bytes of 0
0053=           ep1_status:         equ     (EP0_VARS + 8)      ; holds the current status of ep1_stall (2 bytes)
0055=           ep2_status:         equ     (EP0_VARS + 10)     ; holds the current status of ep2_stall (2 bytes)
0057=           protocol:           equ     (EP0_VARS + 12)     ; holds the current status of protocol
0058=           ram_or_rom:         equ     (EP0_VARS + 13)     ; flag to pick whether we should get data from ram or rom
0059=           data_count:         equ     (EP0_VARS + 14)     ; the total number of bytes being sent
005A=           data_start:         equ     (EP0_VARS + 15)     ; location of data to be sent
005B=           load_loop_counter:  equ     (EP0_VARS + 16)     ; counts the load loops
005C=           control_read_counter: equ   (EP0_VARS + 17)     ; for get descriptor command
005D=           suspend_count:      equ     (EP0_VARS + 18)     ;  
005E=           idle:               equ     (EP0_VARS + 19)     ;  
                
005E=           EP0_VARS_END:       equ     idle                ;
                
                ;----------------------------------------------------------------
                ; Aliased Variables
                ;----------------------------------------------------------------
                
0022=           byte_counter:       equ     temp2               ;
                
                ; Definitions for SETUP packets
                
00B8=           request_type:       equ     (ep0_fifo + 0)      ;
00B9=           request:            equ     (ep0_fifo + 1)      ;
00BA=           value:              equ     (ep0_fifo + 2)      ;
00BB=           value_hi:           equ     (ep0_fifo + 3)      ;
00BC=           index:              equ     (ep0_fifo + 4)      ;
00BD=           index_hi:           equ     (ep0_fifo + 5)      ;
00BE=           length:             equ     (ep0_fifo + 6)      ;
00BF=           length_hi:          equ     (ep0_fifo + 7)      ;
                
                ;****************************************************************
                ; CONTROL REPORT 
                ;****************************************************************
                ; The control report is a five-byte report that includes 
                ; configuration settings. These settings include baud rate, reset,
                ; even/odd parity, parity enable, number of stop bits and data
                ; length.
                ;****************************************************************
                
0005=           SIZEOF_CONTROL_REPORT: equ  5               ;
                
                ; Definitions for Control Report
                
0010=           baud_rate_byte_0:   equ     (control_report + 0) ;
0011=           baud_rate_byte_1:   equ     (control_report + 1) ;
0012=           baud_rate_byte_2:   equ     (control_report + 2) ;
0013=           baud_rate_byte_3:   equ     (control_report + 3) ;
0014=           config:             equ     (control_report + 4) ;
                
                ;----------------------------------------------------------------
                ; config FIELDS
                ;----------------------------------------------------------------
                
0080=           RESET:              equ     80h                 ; 1: Reset
0020=           PARITY_TYPE:        equ     20h                 ; 1: Even, 0: Odd
0010=           PARITY_ON:          equ     10h                 ; 1: Enable parity, 0: Disable parity
0008=           STOP_BITS:          equ     08h                 ; 1: Two stop bits, 0: One stop bit
0003=           BIT_COUNT:          equ     03h                 ; Data length - 5
                
                ;****************************************************************
                ; OUTPUT REPORT
                ;****************************************************************
                
                ; Definitions for Output Report
                
00E0=           output_report:      equ     ep2_fifo            ;
                
00E0=           output_control:     equ     (output_report + 0) ;
                
                IF ((SIZEOF_OUTPUT_REPORT - 1) & ~7)
                
001F=           OUTPUT_COUNT:       equ     1Fh                 ;
00E1=           output_count:       equ     (output_report + 1) ;
00E2=           output_data:        equ     (output_report + 2) ;
                
                ELSE
                ENDIF
                
0002=           SIZEOF_OUTPUT_HEADER: equ   (output_data - output_report) ;
                
                ;----------------------------------------------------------------
                ; OUTPUT REPORT BYTE 0 FIELDS
                ;----------------------------------------------------------------
                
0020=           OUTPUT_DTR:         equ     20h                 ; 
0010=           OUTPUT_RTS:         equ     10h                 ; 
0008=           OUTPUT_RESET:       equ     08h                 ; 
                
                ;****************************************************************
                ; INPUT REPORT
                ;****************************************************************
                
                ; Definitions for Input Report
                
00C0=           input_report:       equ     ep1_fifo            ;
                
00C0=           input_status:       equ     (input_report + 0)  ;
                
                IF ((SIZEOF_INPUT_REPORT - 1) & ~7)
                
001F=           INPUT_COUNT:        equ     1Fh                 ;
00C1=           input_count:        equ     (input_report + 1)  ;
00C2=           input_data:         equ     (input_report + 2)  ;
                
                ELSE
                ENDIF
                
0002=           SIZEOF_INPUT_HEADER: equ    (input_data - input_report) ;
                
                ;----------------------------------------------------------------
                ; INPUT REPORT BYTE 0 FIELDS
                ;----------------------------------------------------------------
                
0080=           INPUT_RI:           equ     80h                 ; 
0040=           INPUT_CD:           equ     40h                 ; 
0020=           INPUT_DSR:          equ     20h                 ; 
0010=           INPUT_CTS:          equ     10h                 ; 
0008=           INPUT_ERROR:        equ     08h                 ; 
                
                ;****************************************************************
                ; INPUT AND OUTPUT PORT DEFINITIONS
                ;****************************************************************
                ; The use of "input" and "output" here refers to electrical
                ; signals that are input to and output from the processor. There
                ; is no relationship between the reference of input/output here
                ; and the reference to input/output reports to/from the host.
                ;****************************************************************
                
                ;----------------------------------------------------------------
                ; PORT 0 PIN ALLOCATION
                ;----------------------------------------------------------------
                
0000=           INPUT_PORT:         equ     P0_DATA             ;
                
0080=           RXD:                equ     80h                 ;
0010=           RI:                 equ     10h                 ;
0008=           CD:                 equ     08h                 ;
0004=           DSR:                equ     04h                 ;
0002=           CTS:                equ     02h                 ;
                
                ;----------------------------------------------------------------
                ; PORT 1 PIN ALLOCATION
                ;----------------------------------------------------------------
                
0001=           OUTPUT_PORT:        equ     P1_DATA             ;
0020=           output_port_shadow: equ     p1_shadow           ;
                
0004=           DTR:                equ     04h                 ;
0002=           RTS:                equ     02h                 ;
0001=           TXD:                equ     01h                 ;
                
0007=           OUTPUT_PORT_MASK:   equ     (DTR | RTS | TXD)   ;

⌨️ 快捷键说明

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