📄 stm8s_flash.ls
字号:
1212 0263 1a04 or a,(OFST+0,sp)
1213 0265 01 rrwa x,a
1214 0266 1a03 or a,(OFST-1,sp)
1215 0268 01 rrwa x,a
1216 0269 1f03 ldw (OFST-1,sp),x
1218 026b 2005 jra L504
1219 026d L304:
1220 ; 541 res_value = FLASH_OPTIONBYTE_ERROR;
1222 026d ae5555 ldw x,#21845
1223 0270 1f03 ldw (OFST-1,sp),x
1224 0272 L504:
1225 ; 544 return(res_value);
1227 0272 1e03 ldw x,(OFST-1,sp)
1230 0274 5b04 addw sp,#4
1231 0276 81 ret
1305 ; 561 void FLASH_SetLowPowerMode(FLASH_LPMode_TypeDef LPMode)
1305 ; 562 {
1306 switch .text
1307 0277 _FLASH_SetLowPowerMode:
1309 0277 88 push a
1310 00000000 OFST: set 0
1313 ; 564 assert_param(IS_FLASH_LOW_POWER_MODE_OK(LPMode));
1315 ; 566 FLASH->CR1 &= (u8)(~(FLASH_CR1_HALT | FLASH_CR1_AHALT)); /* Clears the two bits */
1317 0278 c6505a ld a,20570
1318 027b a4f3 and a,#243
1319 027d c7505a ld 20570,a
1320 ; 567 FLASH->CR1 |= (u8)LPMode; /* Sets the new mode */
1322 0280 c6505a ld a,20570
1323 0283 1a01 or a,(OFST+1,sp)
1324 0285 c7505a ld 20570,a
1325 ; 568 }
1328 0288 84 pop a
1329 0289 81 ret
1387 ; 584 void FLASH_SetProgrammingTime(FLASH_ProgramTime_TypeDef ProgTime)
1387 ; 585 {
1388 switch .text
1389 028a _FLASH_SetProgrammingTime:
1393 ; 587 assert_param(IS_FLASH_PROGRAM_TIME_OK(ProgTime));
1395 ; 589 FLASH->CR1 &= (u8)(~FLASH_CR1_FIX);
1397 028a 7211505a bres 20570,#0
1398 ; 590 FLASH->CR1 |= (u8)ProgTime;
1400 028e ca505a or a,20570
1401 0291 c7505a ld 20570,a
1402 ; 591 }
1405 0294 81 ret
1430 ; 608 FLASH_LPMode_TypeDef FLASH_GetLowPowerMode(void)
1430 ; 609 {
1431 switch .text
1432 0295 _FLASH_GetLowPowerMode:
1436 ; 610 return((FLASH_LPMode_TypeDef)(FLASH->CR1 & (FLASH_CR1_HALT | FLASH_CR1_AHALT)));
1438 0295 c6505a ld a,20570
1439 0298 a40c and a,#12
1442 029a 81 ret
1467 ; 628 FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime(void)
1467 ; 629 {
1468 switch .text
1469 029b _FLASH_GetProgrammingTime:
1473 ; 630 return((FLASH_ProgramTime_TypeDef)(FLASH->CR1 & FLASH_CR1_FIX));
1475 029b c6505a ld a,20570
1476 029e a401 and a,#1
1479 02a0 81 ret
1511 ; 648 u32 FLASH_GetBootSize(void)
1511 ; 649 {
1512 switch .text
1513 02a1 _FLASH_GetBootSize:
1515 02a1 5204 subw sp,#4
1516 00000004 OFST: set 4
1519 ; 650 u32 temp = 0;
1521 ; 653 temp = (u32)((u32)FLASH->FPR * (u32)512);
1523 02a3 c6505d ld a,20573
1524 02a6 5f clrw x
1525 02a7 97 ld xl,a
1526 02a8 90ae0200 ldw y,#512
1527 02ac cd0000 call c_umul
1529 02af 96 ldw x,sp
1530 02b0 1c0001 addw x,#OFST-3
1531 02b3 cd0000 call c_rtol
1533 ; 656 if (FLASH->FPR == 0xFF)
1535 02b6 c6505d ld a,20573
1536 02b9 a1ff cp a,#255
1537 02bb 2611 jrne L325
1538 ; 658 temp += 512;
1540 02bd ae0200 ldw x,#512
1541 02c0 bf02 ldw c_lreg+2,x
1542 02c2 ae0000 ldw x,#0
1543 02c5 bf00 ldw c_lreg,x
1544 02c7 96 ldw x,sp
1545 02c8 1c0001 addw x,#OFST-3
1546 02cb cd0000 call c_lgadd
1548 02ce L325:
1549 ; 662 return(temp);
1551 02ce 96 ldw x,sp
1552 02cf 1c0001 addw x,#OFST-3
1553 02d2 cd0000 call c_ltor
1557 02d5 5b04 addw sp,#4
1558 02d7 81 ret
1667 ; 682 FlagStatus FLASH_GetFlagStatus(FLASH_Flag_TypeDef FLASH_FLAG)
1667 ; 683 {
1668 switch .text
1669 02d8 _FLASH_GetFlagStatus:
1671 02d8 88 push a
1672 00000001 OFST: set 1
1675 ; 684 FlagStatus status = RESET;
1677 ; 686 assert_param(IS_FLASH_FLAGS_OK(FLASH_FLAG));
1679 ; 689 if ((FLASH->IAPSR & (u8)FLASH_FLAG) != (u8)RESET)
1681 02d9 c4505f and a,20575
1682 02dc 2706 jreq L575
1683 ; 691 status = SET; /* FLASH_FLAG is set */
1685 02de a601 ld a,#1
1686 02e0 6b01 ld (OFST+0,sp),a
1688 02e2 2002 jra L775
1689 02e4 L575:
1690 ; 695 status = RESET; /* FLASH_FLAG is reset*/
1692 02e4 0f01 clr (OFST+0,sp)
1693 02e6 L775:
1694 ; 699 return status;
1696 02e6 7b01 ld a,(OFST+0,sp)
1699 02e8 5b01 addw sp,#1
1700 02ea 81 ret
1781 ; 717 FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef MemType)
1781 ; 718 {
1782 switch .text
1783 02eb _FLASH_WaitForLastOperation:
1785 02eb 5205 subw sp,#5
1786 00000005 OFST: set 5
1789 ; 719 u32 timeout = 2000;
1791 02ed ae07d0 ldw x,#2000
1792 02f0 1f03 ldw (OFST-2,sp),x
1793 02f2 ae0000 ldw x,#0
1794 02f5 1f01 ldw (OFST-4,sp),x
1795 ; 720 u8 flagstatus = 0x00;
1797 02f7 0f05 clr (OFST+0,sp)
1798 ; 722 if (MemType == FLASH_MEMTYPE_PROG)
1800 02f9 4d tnz a
1801 02fa 2631 jrne L356
1803 02fc 2010 jra L146
1804 02fe L736:
1805 ; 726 flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_EOP |
1805 ; 727 FLASH_IAPSR_WR_PG_DIS));
1807 02fe c6505f ld a,20575
1808 0301 a405 and a,#5
1809 0303 6b05 ld (OFST+0,sp),a
1810 ; 728 timeout--;
1812 0305 96 ldw x,sp
1813 0306 1c0001 addw x,#OFST-4
1814 0309 a601 ld a,#1
1815 030b cd0000 call c_lgsbc
1817 030e L146:
1818 ; 724 while ((flagstatus == 0x00) && (timeout != 0x00))
1820 030e 0d05 tnz (OFST+0,sp)
1821 0310 2628 jrne L746
1823 0312 96 ldw x,sp
1824 0313 1c0001 addw x,#OFST-4
1825 0316 cd0000 call c_lzmp
1827 0319 26e3 jrne L736
1828 031b 201d jra L746
1829 031d L156:
1830 ; 735 flagstatus = (u8)(FLASH->IAPSR & (FLASH_IAPSR_HVOFF |
1830 ; 736 FLASH_IAPSR_WR_PG_DIS));
1832 031d c6505f ld a,20575
1833 0320 a441 and a,#65
1834 0322 6b05 ld (OFST+0,sp),a
1835 ; 737 timeout--;
1837 0324 96 ldw x,sp
1838 0325 1c0001 addw x,#OFST-4
1839 0328 a601 ld a,#1
1840 032a cd0000 call c_lgsbc
1842 032d L356:
1843 ; 733 while ((flagstatus == 0x00) && (timeout != 0x00))
1845 032d 0d05 tnz (OFST+0,sp)
1846 032f 2609 jrne L746
1848 0331 96 ldw x,sp
1849 0332 1c0001 addw x,#OFST-4
1850 0335 cd0000 call c_lzmp
1852 0338 26e3 jrne L156
1853 033a L746:
1854 ; 740 if (timeout == 0x00 )
1856 033a 96 ldw x,sp
1857 033b 1c0001 addw x,#OFST-4
1858 033e cd0000 call c_lzmp
1860 0341 2604 jrne L166
1861 ; 742 flagstatus = FLASH_STATUS_TIMEOUT;
1863 0343 a602 ld a,#2
1864 0345 6b05 ld (OFST+0,sp),a
1865 0347 L166:
1866 ; 745 return((FLASH_Status_TypeDef)flagstatus);
1868 0347 7b05 ld a,(OFST+0,sp)
1871 0349 5b05 addw sp,#5
1872 034b 81 ret
1885 xdef _FLASH_WaitForLastOperation
1886 xdef _FLASH_GetFlagStatus
1887 xdef _FLASH_GetBootSize
1888 xdef _FLASH_GetProgrammingTime
1889 xdef _FLASH_GetLowPowerMode
1890 xdef _FLASH_SetProgrammingTime
1891 xdef _FLASH_SetLowPowerMode
1892 xdef _FLASH_ReadOptionByte
1893 xdef _FLASH_ReadByte
1894 xdef _FLASH_ProgramWord
1895 xdef _FLASH_ProgramOptionByte
1896 xdef _FLASH_ProgramByte
1897 xdef _FLASH_ProgramBlock
1898 xdef _FLASH_EraseOptionByte
1899 xdef _FLASH_EraseByte
1900 xdef _FLASH_EraseBlock
1901 xdef _FLASH_ITConfig
1902 xdef _FLASH_DeInit
1903 xdef _FLASH_Lock
1904 xdef _FLASH_Unlock
1905 xref.b c_lreg
1906 xref.b c_x
1907 xref.b c_y
1926 xref c_lzmp
1927 xref c_lgsbc
1928 xref c_rtol
1929 xref c_umul
1930 xref c_ladc
1931 xref c_ltor
1932 xref c_lgadd
1933 xref c_cmulx
1934 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -