📄 stm8s_flash.ls
字号:
1223 0225 L154:
1224 ; 541 res_value = FLASH_OPTIONBYTE_ERROR;
1226 0225 ae5555 ldw x,#21845
1227 0228 L354:
1228 ; 544 return(res_value);
1232 0228 5b04 addw sp,#4
1233 022a 81 ret
1307 ; 561 void FLASH_SetLowPowerMode(FLASH_LPMode_TypeDef LPMode)
1307 ; 562 {
1308 switch .text
1309 022b _FLASH_SetLowPowerMode:
1311 022b 88 push a
1312 00000000 OFST: set 0
1315 ; 564 assert_param(IS_FLASH_LOW_POWER_MODE_OK(LPMode));
1317 ; 566 FLASH->CR1 &= (u8)(~(FLASH_CR1_HALT | FLASH_CR1_AHALT)); /* Clears the two bits */
1319 022c c6505a ld a,20570
1320 022f a4f3 and a,#243
1321 0231 c7505a ld 20570,a
1322 ; 567 FLASH->CR1 |= (u8)LPMode; /* Sets the new mode */
1324 0234 c6505a ld a,20570
1325 0237 1a01 or a,(OFST+1,sp)
1326 0239 c7505a ld 20570,a
1327 ; 568 }
1330 023c 84 pop a
1331 023d 81 ret
1389 ; 584 void FLASH_SetProgrammingTime(FLASH_ProgramTime_TypeDef ProgTime)
1389 ; 585 {
1390 switch .text
1391 023e _FLASH_SetProgrammingTime:
1395 ; 587 assert_param(IS_FLASH_PROGRAM_TIME_OK(ProgTime));
1397 ; 589 FLASH->CR1 &= (u8)(~FLASH_CR1_FIX);
1399 023e 7211505a bres 20570,#0
1400 ; 590 FLASH->CR1 |= (u8)ProgTime;
1402 0242 ca505a or a,20570
1403 0245 c7505a ld 20570,a
1404 ; 591 }
1407 0248 81 ret
1432 ; 608 FLASH_LPMode_TypeDef FLASH_GetLowPowerMode(void)
1432 ; 609 {
1433 switch .text
1434 0249 _FLASH_GetLowPowerMode:
1438 ; 610 return((FLASH_LPMode_TypeDef)(FLASH->CR1 & (FLASH_CR1_HALT | FLASH_CR1_AHALT)));
1440 0249 c6505a ld a,20570
1441 024c a40c and a,#12
1444 024e 81 ret
1469 ; 628 FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime(void)
1469 ; 629 {
1470 switch .text
1471 024f _FLASH_GetProgrammingTime:
1475 ; 630 return((FLASH_ProgramTime_TypeDef)(FLASH->CR1 & FLASH_CR1_FIX));
1477 024f c6505a ld a,20570
1478 0252 a401 and a,#1
1481 0254 81 ret
1515 ; 648 u32 FLASH_GetBootSize(void)
1515 ; 649 {
1516 switch .text
1517 0255 _FLASH_GetBootSize:
1519 0255 5204 subw sp,#4
1520 00000004 OFST: set 4
1523 ; 650 u32 temp = 0;
1525 0257 5f clrw x
1526 0258 1f03 ldw (OFST-1,sp),x
1527 025a 1f01 ldw (OFST-3,sp),x
1528 ; 653 temp = (u32)((u32)FLASH->FPR * (u32)512);
1530 025c c6505d ld a,20573
1531 025f 97 ld xl,a
1532 0260 90ae0200 ldw y,#512
1533 0264 cd0000 call c_umul
1535 0267 96 ldw x,sp
1536 0268 5c incw x
1537 0269 cd0000 call c_rtol
1539 ; 656 if (FLASH->FPR == 0xFF)
1541 026c c6505d ld a,20573
1542 026f 4c inc a
1543 0270 260d jrne L375
1544 ; 658 temp += 512;
1546 0272 ae0200 ldw x,#512
1547 0275 bf02 ldw c_lreg+2,x
1548 0277 5f clrw x
1549 0278 bf00 ldw c_lreg,x
1550 027a 96 ldw x,sp
1551 027b 5c incw x
1552 027c cd0000 call c_lgadd
1554 027f L375:
1555 ; 662 return(temp);
1557 027f 96 ldw x,sp
1558 0280 5c incw x
1559 0281 cd0000 call c_ltor
1563 0284 5b04 addw sp,#4
1564 0286 81 ret
1673 ; 682 FlagStatus FLASH_GetFlagStatus(FLASH_Flag_TypeDef FLASH_FLAG)
1673 ; 683 {
1674 switch .text
1675 0287 _FLASH_GetFlagStatus:
1677 0287 88 push a
1678 00000001 OFST: set 1
1681 ; 684 FlagStatus status = RESET;
1683 0288 0f01 clr (OFST+0,sp)
1684 ; 686 assert_param(IS_FLASH_FLAGS_OK(FLASH_FLAG));
1686 ; 689 if ((FLASH->IAPSR & (u8)FLASH_FLAG) != (u8)RESET)
1688 028a c4505f and a,20575
1689 028d 2702 jreq L546
1690 ; 691 status = SET; /* FLASH_FLAG is set */
1692 028f a601 ld a,#1
1694 0291 L546:
1695 ; 695 status = RESET; /* FLASH_FLAG is reset*/
1697 ; 699 return status;
1701 0291 5b01 addw sp,#1
1702 0293 81 ret
1787 ; 717 FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef MemType)
1787 ; 718 {
1788 switch .text
1789 0294 _FLASH_WaitForLastOperation:
1791 0294 5205 subw sp,#5
1792 00000005 OFST: set 5
1795 ; 719 u32 timeout = 2000;
1797 0296 ae07d0 ldw x,#2000
1798 0299 1f03 ldw (OFST-2,sp),x
1799 029b 5f clrw x
1800 029c 1f01 ldw (OFST-4,sp),x
1801 ; 720 u8 flagstatus = 0x00;
1803 029e 0f05 clr (OFST+0,sp)
1804 ; 722 if (MemType == FLASH_MEMTYPE_PROG)
1806 02a0 4d tnz a
1807 02a1 262b jrne L727
1809 02a3 200e jra L517
1810 02a5 L317:
1811 ; 726 flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_EOP |
1811 ; 727 FLASH_IAPSR_WR_PG_DIS));
1813 02a5 c6505f ld a,20575
1814 02a8 a405 and a,#5
1815 02aa 6b05 ld (OFST+0,sp),a
1816 ; 728 timeout--;
1818 02ac 96 ldw x,sp
1819 02ad 5c incw x
1820 02ae a601 ld a,#1
1821 02b0 cd0000 call c_lgsbc
1823 02b3 L517:
1824 ; 724 while ((flagstatus == 0x00) && (timeout != 0x00))
1826 02b3 7b05 ld a,(OFST+0,sp)
1827 02b5 2622 jrne L327
1829 02b7 96 ldw x,sp
1830 02b8 5c incw x
1831 02b9 cd0000 call c_lzmp
1833 02bc 26e7 jrne L317
1834 02be 2019 jra L327
1835 02c0 L527:
1836 ; 735 flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_HVOFF |
1836 ; 736 FLASH_IAPSR_WR_PG_DIS));
1838 02c0 c6505f ld a,20575
1839 02c3 a441 and a,#65
1840 02c5 6b05 ld (OFST+0,sp),a
1841 ; 737 timeout--;
1843 02c7 96 ldw x,sp
1844 02c8 5c incw x
1845 02c9 a601 ld a,#1
1846 02cb cd0000 call c_lgsbc
1848 02ce L727:
1849 ; 733 while ((flagstatus == 0x00) && (timeout != 0x00))
1851 02ce 7b05 ld a,(OFST+0,sp)
1852 02d0 2607 jrne L327
1854 02d2 96 ldw x,sp
1855 02d3 5c incw x
1856 02d4 cd0000 call c_lzmp
1858 02d7 26e7 jrne L527
1859 02d9 L327:
1860 ; 740 if (timeout == 0x00 )
1862 02d9 96 ldw x,sp
1863 02da 5c incw x
1864 02db cd0000 call c_lzmp
1866 02de 2604 jrne L537
1867 ; 742 flagstatus = FLASH_STATUS_TIMEOUT;
1869 02e0 a602 ld a,#2
1870 02e2 6b05 ld (OFST+0,sp),a
1871 02e4 L537:
1872 ; 745 return((FLASH_Status_TypeDef)flagstatus);
1874 02e4 7b05 ld a,(OFST+0,sp)
1877 02e6 5b05 addw sp,#5
1878 02e8 81 ret
1891 xdef _FLASH_WaitForLastOperation
1892 xdef _FLASH_GetFlagStatus
1893 xdef _FLASH_GetBootSize
1894 xdef _FLASH_GetProgrammingTime
1895 xdef _FLASH_GetLowPowerMode
1896 xdef _FLASH_SetProgrammingTime
1897 xdef _FLASH_SetLowPowerMode
1898 xdef _FLASH_ReadOptionByte
1899 xdef _FLASH_ReadByte
1900 xdef _FLASH_ProgramWord
1901 xdef _FLASH_ProgramOptionByte
1902 xdef _FLASH_ProgramByte
1903 xdef _FLASH_ProgramBlock
1904 xdef _FLASH_EraseOptionByte
1905 xdef _FLASH_EraseByte
1906 xdef _FLASH_EraseBlock
1907 xdef _FLASH_ITConfig
1908 xdef _FLASH_DeInit
1909 xdef _FLASH_Lock
1910 xdef _FLASH_Unlock
1911 xref.b c_lreg
1912 xref.b c_x
1913 xref.b c_y
1932 xref c_lzmp
1933 xref c_lgsbc
1934 xref c_rtol
1935 xref c_umul
1936 xref c_ladc
1937 xref c_ltor
1938 xref c_lgadd
1939 xref c_cmulx
1940 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -