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

📄 stm8s_flash.ls

📁 STM8s
💻 LS
📖 第 1 页 / 共 3 页
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.9.2 - 29 Jun 2010
   3                     ; Generator V4.3.5 - 02 Jul 2010
  75                     ; 47 void FLASH_Unlock(FLASH_MemType_TypeDef MemType)
  75                     ; 48 {
  77                     	switch	.text
  78  0000               _FLASH_Unlock:
  82                     ; 50     assert_param(IS_MEMORY_TYPE_OK(MemType));
  84                     ; 53     if (MemType == FLASH_MEMTYPE_PROG)
  86  0000 4d            	tnz	a
  87  0001 260a          	jrne	L73
  88                     ; 55         FLASH->PUKR = FLASH_RASS_KEY1;
  90  0003 35565062      	mov	20578,#86
  91                     ; 56         FLASH->PUKR = FLASH_RASS_KEY2;
  93  0007 35ae5062      	mov	20578,#174
  95  000b 2008          	jra	L14
  96  000d               L73:
  97                     ; 62         FLASH->DUKR = FLASH_RASS_KEY2; /* Warning: keys are reversed on data memory !!! */
  99  000d 35ae5064      	mov	20580,#174
 100                     ; 63         FLASH->DUKR = FLASH_RASS_KEY1;
 102  0011 35565064      	mov	20580,#86
 103  0015               L14:
 104                     ; 65 }
 107  0015 81            	ret
 142                     ; 73 void FLASH_Lock(FLASH_MemType_TypeDef MemType)
 142                     ; 74 {
 143                     	switch	.text
 144  0016               _FLASH_Lock:
 148                     ; 76     assert_param(IS_MEMORY_TYPE_OK(MemType));
 150                     ; 79     if (MemType == FLASH_MEMTYPE_PROG)
 152  0016 4d            	tnz	a
 153  0017 2606          	jrne	L16
 154                     ; 81         FLASH->IAPSR = (u8)(~FLASH_IAPSR_PUL);
 156  0019 35fd505f      	mov	20575,#253
 158  001d 2004          	jra	L36
 159  001f               L16:
 160                     ; 87         FLASH->IAPSR = (u8)(~FLASH_IAPSR_DUL);
 162  001f 35f7505f      	mov	20575,#247
 163  0023               L36:
 164                     ; 89 }
 167  0023 81            	ret
 201                     ; 97 void FLASH_DeInit(void)
 201                     ; 98 {
 202                     	switch	.text
 203  0024               _FLASH_DeInit:
 205  0024 88            	push	a
 206       00000001      OFST:	set	1
 209                     ; 99     u8 temp = 0;
 211                     ; 100     FLASH->CR1 = FLASH_CR1_RESET_VALUE;
 213  0025 725f505a      	clr	20570
 214                     ; 101     FLASH->CR2 = FLASH_CR2_RESET_VALUE;
 216  0029 725f505b      	clr	20571
 217                     ; 102     FLASH->NCR2 = FLASH_NCR2_RESET_VALUE;
 219  002d 35ff505c      	mov	20572,#255
 220                     ; 103     FLASH->IAPSR &= (u8)(~FLASH_IAPSR_DUL);
 222  0031 7217505f      	bres	20575,#3
 223                     ; 104     FLASH->IAPSR &= (u8)(~FLASH_IAPSR_PUL);
 225  0035 7213505f      	bres	20575,#1
 226                     ; 105     temp = FLASH->IAPSR; /* Reading of this register causes the clearing of status flags */
 228  0039 c6505f        	ld	a,20575
 229                     ; 106 }
 232  003c 84            	pop	a
 233  003d 81            	ret
 288                     ; 113 void FLASH_ITConfig(FunctionalState NewState)
 288                     ; 114 {
 289                     	switch	.text
 290  003e               _FLASH_ITConfig:
 294                     ; 115     if (NewState != DISABLE)
 296  003e 4d            	tnz	a
 297  003f 2706          	jreq	L131
 298                     ; 117         FLASH->CR1 |= FLASH_CR1_IE; /* Enables the interrupt sources */
 300  0041 7212505a      	bset	20570,#1
 302  0045 2004          	jra	L331
 303  0047               L131:
 304                     ; 121         FLASH->CR1 &= (u8)(~FLASH_CR1_IE); /* Disables the interrupt sources */
 306  0047 7213505a      	bres	20570,#1
 307  004b               L331:
 308                     ; 123 }
 311  004b 81            	ret
 345                     ; 134 void FLASH_EraseByte(u32 Address)
 345                     ; 135 {
 346                     	switch	.text
 347  004c               _FLASH_EraseByte:
 349       00000000      OFST:	set	0
 352                     ; 137     assert_param(IS_FLASH_ADDRESS_OK(Address));
 354                     ; 138     *((PointerAttr u8*) Address) = FLASH_CLEAR_BYTE; /* Erase byte */
 356  004c 7b04          	ld	a,(OFST+4,sp)
 357  004e b700          	ld	c_x,a
 358  0050 1e05          	ldw	x,(OFST+5,sp)
 359  0052 bf01          	ldw	c_x+1,x
 360  0054 4f            	clr	a
 361  0055 92bd0000      	ldf	[c_x.e],a
 362                     ; 140 }
 366  0059 81            	ret
 409                     ; 152 void FLASH_ProgramByte(u32 Address, u8 Data)
 409                     ; 153 {
 410                     	switch	.text
 411  005a               _FLASH_ProgramByte:
 413       00000000      OFST:	set	0
 416                     ; 155     assert_param(IS_FLASH_ADDRESS_OK(Address));
 418                     ; 156     *((PointerAttr u8*) Address) = Data;
 420  005a 7b07          	ld	a,(OFST+7,sp)
 421  005c 88            	push	a
 422  005d 7b05          	ld	a,(OFST+5,sp)
 423  005f b700          	ld	c_x,a
 424  0061 1e06          	ldw	x,(OFST+6,sp)
 425  0063 84            	pop	a
 426  0064 bf01          	ldw	c_x+1,x
 427  0066 92bd0000      	ldf	[c_x.e],a
 428                     ; 157 }
 431  006a 81            	ret
 465                     ; 167 u8 FLASH_ReadByte(u32 Address)
 465                     ; 168 {
 466                     	switch	.text
 467  006b               _FLASH_ReadByte:
 469       00000000      OFST:	set	0
 472                     ; 170     assert_param(IS_FLASH_ADDRESS_OK(Address));
 474                     ; 171     return(*((PointerAttr u8*) Address)); /* Read byte */
 476  006b 7b04          	ld	a,(OFST+4,sp)
 477  006d b700          	ld	c_x,a
 478  006f 1e05          	ldw	x,(OFST+5,sp)
 479  0071 bf01          	ldw	c_x+1,x
 480  0073 92bc0000      	ldf	a,[c_x.e]
 483  0077 81            	ret
 526                     ; 184 void FLASH_ProgramWord(u32 Address, u32 Data)
 526                     ; 185 {
 527                     	switch	.text
 528  0078               _FLASH_ProgramWord:
 530       00000000      OFST:	set	0
 533                     ; 187     assert_param(IS_FLASH_ADDRESS_OK(Address));
 535                     ; 190     FLASH->CR2 |= FLASH_CR2_WPRG;
 537  0078 721c505b      	bset	20571,#6
 538                     ; 191     FLASH->NCR2 &= (u8)(~FLASH_NCR2_NWPRG);
 540  007c 721d505c      	bres	20572,#6
 541                     ; 193     *((PointerAttr u8*)Address)       = *((u8*)(&Data)); /* Write one byte - from lowest address*/
 543  0080 7b07          	ld	a,(OFST+7,sp)
 544  0082 88            	push	a
 545  0083 7b05          	ld	a,(OFST+5,sp)
 546  0085 b700          	ld	c_x,a
 547  0087 1e06          	ldw	x,(OFST+6,sp)
 548  0089 84            	pop	a
 549  008a bf01          	ldw	c_x+1,x
 550  008c 92bd0000      	ldf	[c_x.e],a
 551                     ; 194     *(((PointerAttr u8*)Address) + 1) = *((u8*)(&Data)+1); /* Write one byte*/
 553  0090 7b08          	ld	a,(OFST+8,sp)
 554  0092 88            	push	a
 555  0093 7b05          	ld	a,(OFST+5,sp)
 556  0095 b700          	ld	c_x,a
 557  0097 1e06          	ldw	x,(OFST+6,sp)
 558  0099 84            	pop	a
 559  009a 90ae0001      	ldw	y,#1
 560  009e bf01          	ldw	c_x+1,x
 561  00a0 93            	ldw	x,y
 562  00a1 92a70000      	ldf	([c_x.e],x),a
 563                     ; 195     *(((PointerAttr u8*)Address) + 2) = *((u8*)(&Data)+2); /* Write one byte*/
 565  00a5 7b09          	ld	a,(OFST+9,sp)
 566  00a7 88            	push	a
 567  00a8 7b05          	ld	a,(OFST+5,sp)
 568  00aa b700          	ld	c_x,a
 569  00ac 1e06          	ldw	x,(OFST+6,sp)
 570  00ae 84            	pop	a
 571  00af 90ae0002      	ldw	y,#2
 572  00b3 bf01          	ldw	c_x+1,x
 573  00b5 93            	ldw	x,y
 574  00b6 92a70000      	ldf	([c_x.e],x),a
 575                     ; 196     *(((PointerAttr u8*)Address) + 3) = *((u8*)(&Data)+3); /* Write one byte - from higher address*/
 577  00ba 7b0a          	ld	a,(OFST+10,sp)
 578  00bc 88            	push	a
 579  00bd 7b05          	ld	a,(OFST+5,sp)
 580  00bf b700          	ld	c_x,a
 581  00c1 1e06          	ldw	x,(OFST+6,sp)
 582  00c3 84            	pop	a
 583  00c4 90ae0003      	ldw	y,#3
 584  00c8 bf01          	ldw	c_x+1,x
 585  00ca 93            	ldw	x,y
 586  00cb 92a70000      	ldf	([c_x.e],x),a
 587                     ; 197 }
 590  00cf 81            	ret
 635                     ; 206 void FLASH_ProgramOptionByte(u16 Address, u8 Data)
 635                     ; 207 {
 636                     	switch	.text
 637  00d0               _FLASH_ProgramOptionByte:
 639  00d0 89            	pushw	x
 640       00000000      OFST:	set	0
 643                     ; 209     assert_param(IS_OPTION_BYTE_ADDRESS_OK(Address));
 645                     ; 212     FLASH->CR2 |= FLASH_CR2_OPT;
 647  00d1 721e505b      	bset	20571,#7
 648                     ; 213     FLASH->NCR2 &= (u8)(~FLASH_NCR2_NOPT);
 650  00d5 721f505c      	bres	20572,#7
 651                     ; 216     *((NEAR u8*)Address) = Data;
 653  00d9 7b05          	ld	a,(OFST+5,sp)
 654  00db 1e01          	ldw	x,(OFST+1,sp)
 655  00dd f7            	ld	(x),a
 656                     ; 217     *((NEAR u8*)(Address + 1)) = (u8)(~Data);
 658  00de 7b05          	ld	a,(OFST+5,sp)
 659  00e0 43            	cpl	a
 660  00e1 1e01          	ldw	x,(OFST+1,sp)
 661  00e3 e701          	ld	(1,x),a
 662                     ; 219     FLASH_WaitForLastOperation(FLASH_MEMTYPE_DATA);
 664  00e5 a601          	ld	a,#1
 665  00e7 cd01b4        	call	_FLASH_WaitForLastOperation
 667                     ; 222     FLASH->CR2 &= (u8)(~FLASH_CR2_OPT);
 669  00ea 721f505b      	bres	20571,#7
 670                     ; 223     FLASH->NCR2 |= FLASH_NCR2_NOPT;
 672  00ee 721e505c      	bset	20572,#7
 673                     ; 224 }
 676  00f2 85            	popw	x
 677  00f3 81            	ret
 713                     ; 232 void FLASH_EraseOptionByte(u16 Address)
 713                     ; 233 {
 714                     	switch	.text
 715  00f4               _FLASH_EraseOptionByte:
 719                     ; 235     assert_param(IS_OPTION_BYTE_ADDRESS_OK(Address));
 721                     ; 238     FLASH->CR2 |= FLASH_CR2_OPT;
 723  00f4 721e505b      	bset	20571,#7
 724                     ; 239     FLASH->NCR2 &= (u8)(~FLASH_NCR2_NOPT);
 726  00f8 721f505c      	bres	20572,#7
 727                     ; 242     *((NEAR u8*)Address) = FLASH_CLEAR_BYTE;
 729  00fc 7f            	clr	(x)
 730                     ; 243     *((NEAR u8*)(Address + 1 )) = FLASH_SET_BYTE;
 733  00fd a6ff          	ld	a,#255

⌨️ 快捷键说明

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