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

📄 stm8s_flash.ls

📁 STM8s
💻 LS
📖 第 1 页 / 共 3 页
字号:
 734  00ff e701          	ld	(1,x),a
 735                     ; 245     FLASH_WaitForLastOperation(FLASH_MEMTYPE_DATA);
 738  0101 a601          	ld	a,#1
 739  0103 cd01b4        	call	_FLASH_WaitForLastOperation
 741                     ; 248     FLASH->CR2 &= (u8)(~FLASH_CR2_OPT);
 743  0106 721f505b      	bres	20571,#7
 744                     ; 249     FLASH->NCR2 |= FLASH_NCR2_NOPT;
 746  010a 721e505c      	bset	20572,#7
 747                     ; 250 }
 750  010e 81            	ret
 813                     ; 256 u16 FLASH_ReadOptionByte(u16 Address)
 813                     ; 257 {
 814                     	switch	.text
 815  010f               _FLASH_ReadOptionByte:
 817  010f 5204          	subw	sp,#4
 818       00000004      OFST:	set	4
 821                     ; 258     u8 value_optbyte, value_optbyte_complement = 0;
 823                     ; 259     u16 res_value = 0;
 825                     ; 262     assert_param(IS_OPTION_BYTE_ADDRESS_OK(Address));
 827                     ; 265     value_optbyte = *((NEAR u8*)Address); /* Read option byte */
 829  0111 f6            	ld	a,(x)
 830  0112 6b01          	ld	(OFST-3,sp),a
 831                     ; 266     value_optbyte_complement = *(((NEAR u8*)Address) + 1); /* Read option byte complement*/
 833  0114 e601          	ld	a,(1,x)
 834  0116 6b02          	ld	(OFST-2,sp),a
 835                     ; 268     if (value_optbyte == (u8)(~value_optbyte_complement))
 837  0118 7b02          	ld	a,(OFST-2,sp)
 838  011a 43            	cpl	a
 839  011b 1101          	cp	a,(OFST-3,sp)
 840  011d 2617          	jrne	L723
 841                     ; 270         res_value = (u16)((u16)value_optbyte << 8);
 843  011f 7b01          	ld	a,(OFST-3,sp)
 844  0121 5f            	clrw	x
 845  0122 97            	ld	xl,a
 846  0123 4f            	clr	a
 847  0124 02            	rlwa	x,a
 848  0125 1f03          	ldw	(OFST-1,sp),x
 849                     ; 271         res_value = res_value | (u16)value_optbyte_complement;
 851  0127 7b02          	ld	a,(OFST-2,sp)
 852  0129 5f            	clrw	x
 853  012a 97            	ld	xl,a
 854  012b 01            	rrwa	x,a
 855  012c 1a04          	or	a,(OFST+0,sp)
 856  012e 01            	rrwa	x,a
 857  012f 1a03          	or	a,(OFST-1,sp)
 858  0131 01            	rrwa	x,a
 859  0132 1f03          	ldw	(OFST-1,sp),x
 861  0134 2005          	jra	L133
 862  0136               L723:
 863                     ; 275         res_value = FLASH_OPTIONBYTE_ERROR;
 865  0136 ae5555        	ldw	x,#21845
 866  0139 1f03          	ldw	(OFST-1,sp),x
 867  013b               L133:
 868                     ; 278     return(res_value);
 870  013b 1e03          	ldw	x,(OFST-1,sp)
 873  013d 5b04          	addw	sp,#4
 874  013f 81            	ret
 948                     ; 287 void FLASH_SetLowPowerMode(FLASH_LPMode_TypeDef LPMode)
 948                     ; 288 {
 949                     	switch	.text
 950  0140               _FLASH_SetLowPowerMode:
 952  0140 88            	push	a
 953       00000000      OFST:	set	0
 956                     ; 290     assert_param(IS_FLASH_LOW_POWER_MODE_OK(LPMode));
 958                     ; 292     FLASH->CR1 &= (u8)(~(FLASH_CR1_HALT | FLASH_CR1_AHALT)); /* Clears the two bits */
 960  0141 c6505a        	ld	a,20570
 961  0144 a4f3          	and	a,#243
 962  0146 c7505a        	ld	20570,a
 963                     ; 293     FLASH->CR1 |= (u8)LPMode; /* Sets the new mode */
 965  0149 c6505a        	ld	a,20570
 966  014c 1a01          	or	a,(OFST+1,sp)
 967  014e c7505a        	ld	20570,a
 968                     ; 294 }
 971  0151 84            	pop	a
 972  0152 81            	ret
1030                     ; 302 void FLASH_SetProgrammingTime(FLASH_ProgramTime_TypeDef ProgTime)
1030                     ; 303 {
1031                     	switch	.text
1032  0153               _FLASH_SetProgrammingTime:
1036                     ; 305     assert_param(IS_FLASH_PROGRAM_TIME_OK(ProgTime));
1038                     ; 307     FLASH->CR1 &= (u8)(~FLASH_CR1_FIX);
1040  0153 7211505a      	bres	20570,#0
1041                     ; 308     FLASH->CR1 |= (u8)ProgTime;
1043  0157 ca505a        	or	a,20570
1044  015a c7505a        	ld	20570,a
1045                     ; 309 }
1048  015d 81            	ret
1073                     ; 317 FLASH_LPMode_TypeDef FLASH_GetLowPowerMode(void)
1073                     ; 318 {
1074                     	switch	.text
1075  015e               _FLASH_GetLowPowerMode:
1079                     ; 319     return((FLASH_LPMode_TypeDef)(FLASH->CR1 & (FLASH_CR1_HALT | FLASH_CR1_AHALT)));
1081  015e c6505a        	ld	a,20570
1082  0161 a40c          	and	a,#12
1085  0163 81            	ret
1110                     ; 328 FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime(void)
1110                     ; 329 {
1111                     	switch	.text
1112  0164               _FLASH_GetProgrammingTime:
1116                     ; 330     return((FLASH_ProgramTime_TypeDef)(FLASH->CR1 & FLASH_CR1_FIX));
1118  0164 c6505a        	ld	a,20570
1119  0167 a401          	and	a,#1
1122  0169 81            	ret
1156                     ; 339 u32 FLASH_GetBootSize(void)
1156                     ; 340 {
1157                     	switch	.text
1158  016a               _FLASH_GetBootSize:
1160  016a 5204          	subw	sp,#4
1161       00000004      OFST:	set	4
1164                     ; 341     u32 temp = 0;
1166                     ; 344     temp = (u32)((u32)FLASH->FPR * (u32)512);
1168  016c c6505d        	ld	a,20573
1169  016f 5f            	clrw	x
1170  0170 97            	ld	xl,a
1171  0171 90ae0200      	ldw	y,#512
1172  0175 cd0000        	call	c_umul
1174  0178 96            	ldw	x,sp
1175  0179 1c0001        	addw	x,#OFST-3
1176  017c cd0000        	call	c_rtol
1178                     ; 347     if (FLASH->FPR == 0xFF)
1180  017f c6505d        	ld	a,20573
1181  0182 a1ff          	cp	a,#255
1182  0184 2611          	jrne	L154
1183                     ; 349         temp += 512;
1185  0186 ae0200        	ldw	x,#512
1186  0189 bf02          	ldw	c_lreg+2,x
1187  018b ae0000        	ldw	x,#0
1188  018e bf00          	ldw	c_lreg,x
1189  0190 96            	ldw	x,sp
1190  0191 1c0001        	addw	x,#OFST-3
1191  0194 cd0000        	call	c_lgadd
1193  0197               L154:
1194                     ; 353     return(temp);
1196  0197 96            	ldw	x,sp
1197  0198 1c0001        	addw	x,#OFST-3
1198  019b cd0000        	call	c_ltor
1202  019e 5b04          	addw	sp,#4
1203  01a0 81            	ret
1312                     ; 365 FlagStatus FLASH_GetFlagStatus(FLASH_Flag_TypeDef FLASH_FLAG)
1312                     ; 366 {
1313                     	switch	.text
1314  01a1               _FLASH_GetFlagStatus:
1316  01a1 88            	push	a
1317       00000001      OFST:	set	1
1320                     ; 367     FlagStatus status = RESET;
1322                     ; 369     assert_param(IS_FLASH_FLAGS_OK(FLASH_FLAG));
1324                     ; 372     if ((FLASH->IAPSR & (u8)FLASH_FLAG) != (u8)RESET)
1326  01a2 c4505f        	and	a,20575
1327  01a5 2706          	jreq	L325
1328                     ; 374         status = SET; /* FLASH_FLAG is set */
1330  01a7 a601          	ld	a,#1
1331  01a9 6b01          	ld	(OFST+0,sp),a
1333  01ab 2002          	jra	L525
1334  01ad               L325:
1335                     ; 378         status = RESET; /* FLASH_FLAG is reset*/
1337  01ad 0f01          	clr	(OFST+0,sp)
1338  01af               L525:
1339                     ; 382     return status;
1341  01af 7b01          	ld	a,(OFST+0,sp)
1344  01b1 5b01          	addw	sp,#1
1345  01b3 81            	ret
1438                     ; 393 FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef MemType)
1438                     ; 394 {
1439                     	switch	.text
1440  01b4               _FLASH_WaitForLastOperation:
1442  01b4 5203          	subw	sp,#3
1443       00000003      OFST:	set	3
1446                     ; 395     u8 flagstatus = 0x00;
1448  01b6 0f03          	clr	(OFST+0,sp)
1449                     ; 396     u16 timeout = OPERATION_TIMEOUT;
1451  01b8 ae1000        	ldw	x,#4096
1452  01bb 1f01          	ldw	(OFST-2,sp),x
1453                     ; 399     if (MemType == FLASH_MEMTYPE_PROG)
1455  01bd 4d            	tnz	a
1456  01be 2628          	jrne	L706
1458  01c0 200e          	jra	L575
1459  01c2               L375:
1460                     ; 403             flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_EOP |
1460                     ; 404                                               FLASH_IAPSR_WR_PG_DIS));
1462  01c2 c6505f        	ld	a,20575
1463  01c5 a405          	and	a,#5
1464  01c7 6b03          	ld	(OFST+0,sp),a
1465                     ; 405             timeout--;
1467  01c9 1e01          	ldw	x,(OFST-2,sp)
1468  01cb 1d0001        	subw	x,#1
1469  01ce 1f01          	ldw	(OFST-2,sp),x
1470  01d0               L575:
1471                     ; 401         while ((flagstatus == 0x00) && (timeout != 0x00))
1473  01d0 0d03          	tnz	(OFST+0,sp)
1474  01d2 261c          	jrne	L306
1476  01d4 1e01          	ldw	x,(OFST-2,sp)
1477  01d6 26ea          	jrne	L375
1478  01d8 2016          	jra	L306
1479  01da               L506:
1480                     ; 412             flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_HVOFF |
1480                     ; 413                                               FLASH_IAPSR_WR_PG_DIS));
1482  01da c6505f        	ld	a,20575
1483  01dd a441          	and	a,#65
1484  01df 6b03          	ld	(OFST+0,sp),a
1485                     ; 414             timeout--;
1487  01e1 1e01          	ldw	x,(OFST-2,sp)
1488  01e3 1d0001        	subw	x,#1
1489  01e6 1f01          	ldw	(OFST-2,sp),x
1490  01e8               L706:
1491                     ; 410         while ((flagstatus == 0x00) && (timeout != 0x00))
1493  01e8 0d03          	tnz	(OFST+0,sp)
1494  01ea 2604          	jrne	L306
1496  01ec 1e01          	ldw	x,(OFST-2,sp)
1497  01ee 26ea          	jrne	L506
1498  01f0               L306:
1499                     ; 425     if (timeout == 0x00 )
1501  01f0 1e01          	ldw	x,(OFST-2,sp)
1502  01f2 2604          	jrne	L516
1503                     ; 427         flagstatus = FLASH_STATUS_TIMEOUT;
1505  01f4 a602          	ld	a,#2
1506  01f6 6b03          	ld	(OFST+0,sp),a
1507  01f8               L516:
1508                     ; 430     return((FLASH_Status_TypeDef)flagstatus);
1510  01f8 7b03          	ld	a,(OFST+0,sp)
1513  01fa 5b03          	addw	sp,#3
1514  01fc 81            	ret

⌨️ 快捷键说明

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