?? progctrl.psm
字號:
;KCPSM3 Program - UART programming of StrataFLASH memory on the Spartan-3E Starter Kit.
;
;Ken Chapman - Xilinx Ltd
;
;Version v1.00 - 28th March 2006
;
;This program uses a 115200 baud UART connection with XON/XOFF flow control
;to allow a standard MCS file for the configuration of a Spartan-3E device to
;be programmed into the Intel StrataFLASH device on the board.
;
;
;
;
;**************************************************************************************
; Port definitions
;**************************************************************************************
;
;
CONSTANT status_port, 00 ;UART and filter status input
CONSTANT tx_data_present, 01 ; Transmitter data present - bit0
CONSTANT tx_half_full, 02 ; FIFO half full - bit1
CONSTANT tx_full, 04 ; full - bit2
CONSTANT rx_data_present, 08 ; data present - bit3
CONSTANT rx_half_full, 10 ; Receiver half full - bit4
CONSTANT rx_full, 20 ; FIFO full - bit5
CONSTANT spare1, 40 ; spare '0' - bit6
CONSTANT SF_STS, 80 ; StrataFLASH STS - bit7
;
CONSTANT UART_read_port, 01 ;UART Rx data input
;
CONSTANT UART_write_port, 04 ;UART Tx data output
;
;
CONSTANT SF_data_in_port, 02 ;Read data from StrataFLASH device
;
CONSTANT SF_data_out_port, 10 ;Data to write into StrataFLASH device
;
CONSTANT SF_addr_hi_port, 80 ;StrataFLASH address[23:16]
CONSTANT SF_addr_mi_port, 40 ;StrataFLASH address[15:8]
CONSTANT SF_addr_lo_port, 20 ;StrataFLASH address[7:0]
;
CONSTANT SF_control_port, 08 ;StrataFLASH control
CONSTANT SF_read, 01 ; active High read - bit0
CONSTANT SF_ce, 02 ; active Low device enable - bit1
CONSTANT SF_we, 04 ; active Low write - bit2
;
;
;
;**************************************************************************************
; Special Register usage
;**************************************************************************************
;
NAMEREG sF, UART_data ;used to pass data to and from the UART
;
;
;**************************************************************************************
; Useful data constants
;**************************************************************************************
;
;Constant to define a software delay of 1us. This must be adjusted to reflect the
;clock applied to KCPSM3. Every instruction executes in 2 clock cycles making the
;calculation highly predictable. The '6' in the following equation even allows for
;'CALL delay_1us' instruction in the initiating code.
;
; delay_1us_constant = (clock_rate - 6)/4 Where 'clock_rate' is in MHz
;
;Example: For a 50MHz clock the constant value is (10-6)/4 = 11 (0B Hex).
;For clock rates below 10MHz the value of 1 must be used and the operation will
;become lower than intended.
;
CONSTANT delay_1us_constant, 0B
;
;
;
;ASCII table
;
CONSTANT character_a, 61
CONSTANT character_b, 62
CONSTANT character_c, 63
CONSTANT character_d, 64
CONSTANT character_e, 65
CONSTANT character_f, 66
CONSTANT character_g, 67
CONSTANT character_h, 68
CONSTANT character_i, 69
CONSTANT character_j, 6A
CONSTANT character_k, 6B
CONSTANT character_l, 6C
CONSTANT character_m, 6D
CONSTANT character_n, 6E
CONSTANT character_o, 6F
CONSTANT character_p, 70
CONSTANT character_q, 71
CONSTANT character_r, 72
CONSTANT character_s, 73
CONSTANT character_t, 74
CONSTANT character_u, 75
CONSTANT character_v, 76
CONSTANT character_w, 77
CONSTANT character_x, 78
CONSTANT character_y, 79
CONSTANT character_z, 7A
CONSTANT character_A, 41
CONSTANT character_B, 42
CONSTANT character_C, 43
CONSTANT character_D, 44
CONSTANT character_E, 45
CONSTANT character_F, 46
CONSTANT character_G, 47
CONSTANT character_H, 48
CONSTANT character_I, 49
CONSTANT character_J, 4A
CONSTANT character_K, 4B
CONSTANT character_L, 4C
CONSTANT character_M, 4D
CONSTANT character_N, 4E
CONSTANT character_O, 4F
CONSTANT character_P, 50
CONSTANT character_Q, 51
CONSTANT character_R, 52
CONSTANT character_S, 53
CONSTANT character_T, 54
CONSTANT character_U, 55
CONSTANT character_V, 56
CONSTANT character_W, 57
CONSTANT character_X, 58
CONSTANT character_Y, 59
CONSTANT character_Z, 5A
CONSTANT character_0, 30
CONSTANT character_1, 31
CONSTANT character_2, 32
CONSTANT character_3, 33
CONSTANT character_4, 34
CONSTANT character_5, 35
CONSTANT character_6, 36
CONSTANT character_7, 37
CONSTANT character_8, 38
CONSTANT character_9, 39
CONSTANT character_colon, 3A
CONSTANT character_fullstop, 2E
CONSTANT character_semi_colon, 3B
CONSTANT character_minus, 2D
CONSTANT character_plus, 2B
CONSTANT character_comma, 2C
CONSTANT character_less_than, 3C ;'<'
CONSTANT character_greater_than, 3E ;'>'
CONSTANT character_open, 28 ;'('
CONSTANT character_close, 29 ;')'
CONSTANT character_divide, 2F ;'/'
CONSTANT character_equals, 3D
CONSTANT character_space, 20
CONSTANT character_CR, 0D ;carriage return
CONSTANT character_LF, 0A ;line feed
CONSTANT character_question, 3F ;'?'
CONSTANT character_dollar, 24
CONSTANT character_exclaim, 21 ;'!'
CONSTANT character_BS, 08 ;Back Space command character
CONSTANT character_XON, 11 ;Flow control ON
CONSTANT character_XOFF, 13 ;Flow control OFF
;
;
;**************************************************************************************
; Scratch Pad Memory Locations
;**************************************************************************************
;
CONSTANT ISR_preserve_s0, 00 ;preserve register during ISR
;
;
;
;Store up to one line of an MCS file as bytes
;A typical data line consists of:-
;: Start character which is not stored
;10 Number of data bytes included (16 in this case)
;aaaa Lower 16-bits of the storage address
;00 Record type (data in this case)
;dddd... Data bytes (typically 16 which is the maximum)
;cc Checksum
;CR/LF Line will end in carriage return and/or line feed which is not stored.
;
;So a total of 21 bytes could be stored before processing.
;This is located at the end of scratch pad memory.
;
CONSTANT line_start, 2B ;21 bytes until end of memory
CONSTANT data_start, 2F ;Start of data field if present
;
;
;**************************************************************************************
; Initialise the system and welcome message
;**************************************************************************************
;
cold_start: CALL SF_init ;initialise StrataFLASH controls
CALL delay_1s ;delay because UART is fast and JTAG startup sequence can be slow
ENABLE INTERRUPT ;Interrupt is used for XON/XOFF flow control
welcome_start: CALL send_CR
CALL send_welcome ;start up message and version number
;
;
;**************************************************************************************
; Main menu and command selection
;**************************************************************************************
;
;
warm_start: CALL send_Menu ;Menu and command selection
CALL send_CR
;
prompt: CALL send_CR
CALL send_CR
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -