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

📄 smc_dtc_download2562k_end.hex

📁 HID-Ukey底层源码实现(st72651芯片) windows上层驱动
💻 HEX
📖 第 1 页 / 共 2 页
字号:
 // *****************************************************************
 // * NOTICE: The information contained in this file is proprietary *
 // * to SGS-THOMSON Microelectronics and is being made available   *
 // * to ST customers under strict non-disclosure agreements.       *
 // * Use or disclosure of this information is permissible only     *
 // * under the terms of the existing non-disclosure agreement.     *
 // *****************************************************************

 // Written by Christophe BRICOUT
 // Created by MPmanCompiler.exe (v3.0) Sun Mar 30 01:44:04 2003


 //============================================================================
 //
 //			SMC DOWNLOAD Plugin
 //
 //============================================================================
 ////
 ////	For Download:
 ////  0xE6: Number of address bytes// 3 or 4
 ////  0xE5-0xE2: CA0-7, PA0-7, PA8-15, [PA16-23]
 ////  0xE0: Page counter. Number of pages to be download
 ////  0xF0-0xFF: For the redundant area
 ////
 ////	For Erase one block
 ////  0xE6: Number of address bytes// 2 or 3
 ////  0xE5-0xE3: PA0-7, PA8-15, [PA16-23]
 ////
 //============================================================================
  
 //-------------			<<<<<< Entry point for download from buffer0
 0xb1,   //   0 LD	LSB 1
 // :Init_Download
 //-------------
 0xa0,   //   1 LD	MSB 0
 0x87,   //   2 LD	ADR_BUFFER11
 0xa8,   //   3 LD	MSB 8
 0xb,   //   4 CP	ALWAYS
 // JP :Init_Registers
 0x48,   //   5 JP  8
 //-------------			<<<<<< Entry point for download from buffer1
 0xb3,   //   6 LD	LSB 3
 0xb,   //   7 CP	ALWAYS
 // JP :Init_Download
 0x67,   //   8 JP  -7
  
 //-------------			<<<<<< Entry point for block erase
 0xa0,   //   9 LD	MSB 0
 0xb0,   //   a LD	LSB 0
 0x87,   //   b LD	ADR_BUFFER11
 0xa6,   //   c LD	MSB 6
  
 // :Init_Registers
 //--------------
 0xb0,   //   d LD	LSB 0
 0x8b,   //   e LD	CMP11
  
 //      LD	MSB 1		// data_flash port = output,removed for 256mb
 0xb9,   //   f LD	LSB 9		// DATA_FLASH Port driven by FCI  
 0x8d,   //  10 LD	CTRL_FCI	// PARALLEL Port driven by FCI
  
 0xa0,   //  11 LD	MSB 0
 0xbf,   //  12 LD	LSB 15
 0x91,   //  13 LD	DDR_PARALLEL	// PA3-0 as output, PA7-4 as input
 0x92,   //  14 LD	OR_PARALLEL	// PA3=/RD, PA2=ALE, PA1=/WE, PA0=CLE
  
 0xaf,   //  15 LD	MSB 15
 0x83,   //  16 LD	MASK
 0x31,   //  17 XOR
  
 0x85,   //  18 LD	ADR_BUFFER01	// clear the high byte of ADR0
 0x86,   //  19 LD	ADR_BUFFER10	// clear the low byte of ADR1
 0x89,   //  1a LD	CMP01
 0x9f,   //  1b LD	BUFFER_MNGT	// Clear segment pointer for calculate PARITY
  
 0xb1,   //  1c LD	LSB 1
 0x81,   //  1d LD	X		// X = 1
 0x88,   //  1e LD	CMP00		// Set CMP0=0x0001 for timeout control on busy
  
 0xba,   //  1f LD	LSB 10
 0x90,   //  20 LD	DR_PARALLEL	// RD = 1// ALE = 0// WE = 1// CLE = 0
  
 //============================================================================
 //// The buffer flag is in ADR_BUFFER11
 //// 0x01: write to buf0
 //// 0x03: write to buf1
 //// 0x00: erase operation
 //============================================================================
 //commented for 256mb
 0xc7,   //  21 LD	A ADR_BUFFER11
 0x28,   //  22 BCLR1			// Skip send "Sequential Read" CMD on Erasing
 0xb0,   //  23 LD	LSB 0		// A=0// This is "Sequential Read" command
 // JP :Loop_Write_Pages
 0x59,   //  24 JP  25
 //end of 256mb
  
 //============================================================================
 ////// Output the sequential read command (0x00)
 //      LD	DATA_FLASH	// Send "Sequential Read" command,for 256mb
  
 ////// Preset the "Reserved Field", "Data Status Field" & "Block Status Byte"
 0xaf,   //  25 LD	MSB 15
 0x84,   //  26 LD	ADR_BUFFER00	// ADR0 points to spare area
 0xba,   //  27 LD	LSB 10
 0x82,   //  28 LD	Y		// Used to count 6 time of ADR0 pointer
 0xc3,   //  29 LD	A MASK
 // :Preset_0xFF
 //-----------
 0x9b,   //  2a LD	DATA_BUFFER0
 0x27,   //  2b ADDER16	ADR_BUFFER0
 0x3d,   //  2c INCY
 // JR :Preset_0xFF
 0x63,   //  2d JP  -3
  
 0xaf,   //  2e LD	MSB 15
 0xbc,   //  2f LD	LSB 12
 0x82,   //  30 LD	Y		// Y points to low byte of Address Field-2
  
 ////// Calculate the parity bit of the address fields
 ////// Since ST7 is too slow to do this job, let DTC do it!!
 0xdb,   //  31 LD	A DATA_BUFFER0
 0x27,   //  32 ADDER16	ADR_BUFFER0
 0x1,   //  33 SEC
 0x31,   //  34 XOR
 0xdb,   //  35 LD	A DATA_BUFFER0
 0x31,   //  36 XOR
 0xa,   //  37 CP	CARRY
 //      JP :Set_Parity_Done //for 256mb
 // JP :Loop_Write_Pages
 0x45,   //  38 JP  5
 0x31,   //  39 XOR
 0x38,   //  3a BSET1			// Set the parity bit
 0x9b,   //  3b LD	DATA_BUFFER0	// Update parity bit of Address-Field 1
 0x80,   //  3c LD	<Y>		// Update parity bit of Address-Field 2
 // :Set_Parity_Done
 //---------------
 //commented for 256mb
 //      LD	LSB 11
 //      LD	DR_PARALLEL	// WE = 1, CLE = 1
 //      LD	LSB 9
 //     LD	DR_PARALLEL	// WE = 0, CLE = 1
 //      NOP
  
 // :Loop_Write_Pages
 //----------------
 0xbb,   //  3d LD	LSB 11
 0x90,   //  3e LD	DR_PARALLEL	// WE = 1, CLE = 1, ALE = 0, RD = 1
 ////    LD	LSB 10
 ////    LD	DR_PARALLEL	// WE = 1, CLE = 0, ALE = 0, RD = 1
 //// Keep CLE as high to output "Data Input" or "Block Erase" command
 //============================================================================
  
 0xa1,   //  3f LD	MSB 1		// data_flash port = output
 0xb9,   //  40 LD	LSB 9		// DATA_FLASH Port driven by FCI  
 0x8d,   //  41 LD	CTRL_FCI	// PARALLEL Port driven by FCI
  
 0xcb,   //  42 LD	A CMP11		// Load "Data Input" or "Block Erase" cmd
 0x8c,   //  43 LD	DATA_FLASH	// Send the first command. It is 0x80 or 0x60
 0xb9,   //  44 LD	LSB 9
 0x90,   //  45 LD	DR_PARALLEL	// WE = 0, CLE = 1
 0xbb,   //  46 LD	LSB 11
 0x90,   //  47 LD	DR_PARALLEL	// WE = 1, CLE = 1
  
 //============================================================================
 //// Finish output a command, set CLE low.
 //// Going to output the address, set ALE high
 0xbe,   //  48 LD	LSB 14
 0x90,   //  49 LD	DR_PARALLEL	// WE = 1, CLE = 0, ALE = 1, RD = 1
  
 //      LD A CMP01
 //      LD ADR_BUFFER01
  
 0xae,   //  4a LD	MSB 14
 0xb6,   //  4b LD	LSB 6
 0x84,   //  4c LD	ADR_BUFFER00	// ADR0 = 0x00E6// points to "Num of address"
  
 0xdb,   //  4d LD	A DATA_BUFFER0
 0x82,   //  4e LD	Y		// Load number of addres bytes
 0x26,   //  4f SUB16	ADR_BUFFER0
  
 0x3c,   //  50 DECY
  
 //// Send one byte less if this is an erase operation
 0xc7,   //  51 LD	A ADR_BUFFER11
 //      BCLR1   //changed for 256mb
 0x38,   //  52 BSET1
 // JP :Send_Address_Bytes
 0x43,   //  53 JP  3
 0x3c,   //  54 DECY //added for 256mb
 0x3c,   //  55 DECY
  
 // :Send_Address_Bytes
 //------------------
 0xdb,   //  56 LD	A DATA_BUFFER0
 0x26,   //  57 SUB16	ADR_BUFFER0
 0x8c,   //  58 LD	DATA_FLASH	// Send the address byte
 0xbc,   //  59 LD	LSB 12
 0x90,   //  5a LD	DR_PARALLEL	// WE = 0, ALE = 1
 0xbe,   //  5b LD	LSB 14
 0x90,   //  5c LD	DR_PARALLEL	// WE = 1, ALE = 1
 // :Next_Address_Byte
 //-----------------          
 0x3c,   //  5d DECY
 // JP :Send_Address_Bytes
 0x68,   //  5e JP  -8
  
 0xba,   //  5f LD	LSB 10
 0x90,   //  60 LD	DR_PARALLEL	// WE = 1, CLE = 0, ALE = 0, RD = 1
  
 //============================================================================
  
 //:write_next_col
 //--------------
 0xc7,   //  61 LD	A ADR_BUFFER11	// Load the operation flag
 0x28,   //  62 BCLR1			// It is 0001 or 0011 or 0000
 0xac,   //  63 LD	MSB 12
 0xb6,   //  64 LD	LSB 6 //commented for debug
 //     LD LSB 13
 0x60,   //  65 BRANCH :Send_Erase_CMD
  
 //============================================================================
 //      INCY			// Now Y=0
 // :write_next_col
 //----------------
 //       LD A CMP01   //for 256mb
 //       LD Y
  
 //--------------			// Reset the ECC machine first
 0xa3,   //  66 LD	MSB 3		// Reset ECC machine, DATA_FLASH port = output
 0xb9,   //  67 LD	LSB 9		// DATA_FLASH Port driven by FCI  
 0x8d,   //  68 LD	CTRL_FCI	// PARALLEL Port driven by FCI
  
 0xc9,   //  69 LD A CMP01
 0x82,   //  6a LD Y
  
 0xaf,   //  6b LD	MSB 15
 0xbd,   //  6c LD	LSB 13
 0x84,   //  6d LD	ADR_BUFFER00	// Load pointer of ECC1 (0x00FD)
  
 //============================================================================
 //// Wait on one of the buffer full
 //commented for debug
 0xc7,   //  6e LD	A ADR_BUFFER11
 0x39,   //  6f BSET2
 // JP :Wait_Buffer1_Full
 0x45,   //  70 JP  5
 //debug end
 // :Wait_Buffer0_Full
 //-----------------
 0xdf,   //  71 LD	A BUFFER_MNGT
 0x2a,   //  72 BCLR3
 // JP :Wait_Buffer0_Full
 0x62,   //  73 JP  -2
 // JP :Write_256_Bytes
 0x44,   //  74 JP  4
 //debug
 //-------      
 // :Wait_Buffer1_Full
 //-----------------
 0xdf,   //  75 LD	A BUFFER_MNGT
 0x2b,   //  76 BCLR4
 // JP :Wait_Buffer1_Full
 0x62,   //  77 JP  -2
 //debug end
 //============================================================================
 // :Write_256_Bytes
 //---------------
 0xdc,   //  78 LD	A DATA_BUFFER1
 0x8c,   //  79 LD	DATA_FLASH
 0x9d,   //  7a LD	ECC_CRC
 0xdd,   //  7b LD	A ECC_CRC	// AUTO UPDATE OF Line PARITY 1
 0xdd,   //  7c LD	A ECC_CRC	// AUTO UPDATE OF Line PARITY 2
 0xdd,   //  7d LD	A ECC_CRC	// AUTO UPDATE OF column PARITY
  
 0xb8,   //  7e LD	LSB 8
 0x90,   //  7f LD	DR_PARALLEL	// WE = 0
 0xba,   //  80 LD	LSB 10
 0x90,   //  81 LD	DR_PARALLEL	// WE = 1
  
 0x2f,   //  82 ADDER16	ADR_BUFFER1
 0x3d,   //  83 INCY
 // JP :Write_256_Bytes
 0x6c,   //  84 JP  -12

⌨️ 快捷键说明

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