📄 stm8s_uart2.ls
字号:
973 01f0 260b jrne L363
974 ; 235 UART2->CR2 &= (u8)(~itpos);
976 01f2 7b02 ld a,(OFST+0,sp)
977 01f4 43 cpl a
978 01f5 c45245 and a,21061
979 01f8 c75245 ld 21061,a
981 01fb 201a jra L553
982 01fd L363:
983 ; 237 else if (uartreg == 0x03)
985 01fd 7b01 ld a,(OFST-1,sp)
986 01ff a103 cp a,#3
987 0201 260b jrne L763
988 ; 239 UART2->CR4 &= (u8)(~itpos);
990 0203 7b02 ld a,(OFST+0,sp)
991 0205 43 cpl a
992 0206 c45247 and a,21063
993 0209 c75247 ld 21063,a
995 020c 2009 jra L553
996 020e L763:
997 ; 243 UART2->CR6 &= (u8)(~itpos);
999 020e 7b02 ld a,(OFST+0,sp)
1000 0210 43 cpl a
1001 0211 c45249 and a,21065
1002 0214 c75249 ld 21065,a
1003 0217 L553:
1004 ; 246 }
1007 0217 5b04 addw sp,#4
1008 0219 81 ret
1065 ; 256 void UART2_IrDAConfig(UART2_IrDAMode_TypeDef UART2_IrDAMode)
1065 ; 257 {
1066 switch .text
1067 021a _UART2_IrDAConfig:
1071 ; 258 assert_param(IS_UART2_IRDAMODE_OK(UART2_IrDAMode));
1073 ; 260 if (UART2_IrDAMode != UART2_IRDAMODE_NORMAL)
1075 021a 4d tnz a
1076 021b 2706 jreq L124
1077 ; 262 UART2->CR5 |= UART2_CR5_IRLP;
1079 021d 72145248 bset 21064,#2
1081 0221 2004 jra L324
1082 0223 L124:
1083 ; 266 UART2->CR5 &= ((u8)~UART2_CR5_IRLP);
1085 0223 72155248 bres 21064,#2
1086 0227 L324:
1087 ; 268 }
1090 0227 81 ret
1125 ; 279 void UART2_IrDACmd(FunctionalState NewState)
1125 ; 280 {
1126 switch .text
1127 0228 _UART2_IrDACmd:
1131 ; 283 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
1133 ; 285 if (NewState != DISABLE)
1135 0228 4d tnz a
1136 0229 2706 jreq L344
1137 ; 288 UART2->CR5 |= UART2_CR5_IREN;
1139 022b 72125248 bset 21064,#1
1141 022f 2004 jra L544
1142 0231 L344:
1143 ; 293 UART2->CR5 &= ((u8)~UART2_CR5_IREN);
1145 0231 72135248 bres 21064,#1
1146 0235 L544:
1147 ; 295 }
1150 0235 81 ret
1209 ; 305 void UART2_LINBreakDetectionConfig(UART2_LINBreakDetectionLength_TypeDef UART2_LINBreakDetectionLength)
1209 ; 306 {
1210 switch .text
1211 0236 _UART2_LINBreakDetectionConfig:
1215 ; 307 assert_param(IS_UART2_LINBREAKDETECTIONLENGTH_OK(UART2_LINBreakDetectionLength));
1217 ; 309 if (UART2_LINBreakDetectionLength != UART2_LINBREAKDETECTIONLENGTH_10BITS)
1219 0236 4d tnz a
1220 0237 2706 jreq L574
1221 ; 311 UART2->CR4 |= UART2_CR4_LBDL;
1223 0239 721a5247 bset 21063,#5
1225 023d 2004 jra L774
1226 023f L574:
1227 ; 315 UART2->CR4 &= ((u8)~UART2_CR4_LBDL);
1229 023f 721b5247 bres 21063,#5
1230 0243 L774:
1231 ; 317 }
1234 0243 81 ret
1355 ; 331 void UART2_LINConfig(UART2_LinMode_TypeDef UART2_Mode, UART2_LinAutosync_TypeDef UART2_Autosync, UART2_LinDivUp_TypeDef UART2_DivUp)
1355 ; 332 {
1356 switch .text
1357 0244 _UART2_LINConfig:
1359 0244 89 pushw x
1360 00000000 OFST: set 0
1363 ; 333 assert_param(IS_UART2_SLAVE_OK(UART2_Mode));
1365 ; 335 assert_param(IS_UART2_AUTOSYNC_OK(UART2_Autosync));
1367 ; 337 assert_param(IS_UART2_DIVUP_OK(UART2_DivUp));
1369 ; 339 if (UART2_Mode != UART2_LIN_MODE_MASTER)
1371 0245 9e ld a,xh
1372 0246 4d tnz a
1373 0247 2706 jreq L755
1374 ; 341 UART2->CR6 |= UART2_CR6_LSLV;
1376 0249 721a5249 bset 21065,#5
1378 024d 2004 jra L165
1379 024f L755:
1380 ; 345 UART2->CR6 &= ((u8)~UART2_CR6_LSLV);
1382 024f 721b5249 bres 21065,#5
1383 0253 L165:
1384 ; 348 if (UART2_Autosync != UART2_LIN_AUTOSYNC_DISABLE)
1386 0253 0d02 tnz (OFST+2,sp)
1387 0255 2706 jreq L365
1388 ; 350 UART2->CR6 |= UART2_CR6_LASE ;
1390 0257 72185249 bset 21065,#4
1392 025b 2004 jra L565
1393 025d L365:
1394 ; 354 UART2->CR6 &= ((u8)~ UART2_CR6_LASE );
1396 025d 72195249 bres 21065,#4
1397 0261 L565:
1398 ; 357 if (UART2_DivUp != UART2_LIN_DIVUP_LBRR1)
1400 0261 0d05 tnz (OFST+5,sp)
1401 0263 2706 jreq L765
1402 ; 359 UART2->CR6 |= UART2_CR6_LDUM;
1404 0265 721e5249 bset 21065,#7
1406 0269 2004 jra L175
1407 026b L765:
1408 ; 363 UART2->CR6 &= ((u8)~ UART2_CR6_LDUM);
1410 026b 721f5249 bres 21065,#7
1411 026f L175:
1412 ; 366 }
1415 026f 85 popw x
1416 0270 81 ret
1451 ; 378 void UART2_LINCmd(FunctionalState NewState)
1451 ; 379 {
1452 switch .text
1453 0271 _UART2_LINCmd:
1457 ; 380 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
1459 ; 382 if (NewState != DISABLE)
1461 0271 4d tnz a
1462 0272 2706 jreq L116
1463 ; 385 UART2->CR3 |= UART2_CR3_LINEN;
1465 0274 721c5246 bset 21062,#6
1467 0278 2004 jra L316
1468 027a L116:
1469 ; 390 UART2->CR3 &= ((u8)~UART2_CR3_LINEN);
1471 027a 721d5246 bres 21062,#6
1472 027e L316:
1473 ; 392 }
1476 027e 81 ret
1511 ; 402 void UART2_SmartCardCmd(FunctionalState NewState)
1511 ; 403 {
1512 switch .text
1513 027f _UART2_SmartCardCmd:
1517 ; 404 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
1519 ; 406 if (NewState != DISABLE)
1521 027f 4d tnz a
1522 0280 2706 jreq L336
1523 ; 409 UART2->CR5 |= UART2_CR5_SCEN;
1525 0282 721a5248 bset 21064,#5
1527 0286 2004 jra L536
1528 0288 L336:
1529 ; 414 UART2->CR5 &= ((u8)(~UART2_CR5_SCEN));
1531 0288 721b5248 bres 21064,#5
1532 028c L536:
1533 ; 416 }
1536 028c 81 ret
1572 ; 427 void UART2_SmartCardNACKCmd(FunctionalState NewState)
1572 ; 428 {
1573 switch .text
1574 028d _UART2_SmartCardNACKCmd:
1578 ; 429 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
1580 ; 431 if (NewState != DISABLE)
1582 028d 4d tnz a
1583 028e 2706 jreq L556
1584 ; 434 UART2->CR5 |= UART2_CR5_NACK;
1586 0290 72185248 bset 21064,#4
1588 0294 2004 jra L756
1589 0296 L556:
1590 ; 439 UART2->CR5 &= ((u8)~(UART2_CR5_NACK));
1592 0296 72195248 bres 21064,#4
1593 029a L756:
1594 ; 441 }
1597 029a 81 ret
1654 ; 450 void UART2_WakeUpConfig(UART2_WakeUp_TypeDef UART2_WakeUp)
1654 ; 451 {
1655 switch .text
1656 029b _UART2_WakeUpConfig:
1660 ; 452 assert_param(IS_UART2_WAKEUP_OK(UART2_WakeUp));
1662 ; 454 UART2->CR1 &= ((u8)~UART2_CR1_WAKE);
1664 029b 72175244 bres 21060,#3
1665 ; 455 UART2->CR1 |= (u8)UART2_WakeUp;
1667 029f ca5244 or a,21060
1668 02a2 c75244 ld 21060,a
1669 ; 456 }
1672 02a5 81 ret
1708 ; 468 void UART2_ReceiverWakeUpCmd(FunctionalState NewState)
1708 ; 469 {
1709 switch .text
1710 02a6 _UART2_ReceiverWakeUpCmd:
1714 ; 470 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
1716 ; 472 if (NewState != DISABLE)
1718 02a6 4d tnz a
1719 02a7 2706 jreq L527
1720 ; 475 UART2->CR2 |= UART2_CR2_RWU;
1722 02a9 72125245 bset 21061,#1
1724 02ad 2004 jra L727
1725 02af L527:
1726 ; 480 UART2->CR2 &= ((u8)~UART2_CR2_RWU);
1728 02af 72135245 bres 21061,#1
1729 02b3 L727:
1730 ; 482 }
1733 02b3 81 ret
1756 ; 493 u8 UART2_ReceiveData8(void)
1756 ; 494 {
1757 switch .text
1758 02b4 _UART2_ReceiveData8:
1762 ; 495 return ((u8)UART2->DR);
1764 02b4 c65241 ld a,21057
1767 02b7 81 ret
1790 ; 506 u16 UART2_ReceiveData9(void)
1790 ; 507 {
1791 switch .text
1792 02b8 _UART2_ReceiveData9:
1794 02b8 89 pushw x
1795 00000002 OFST: set 2
1798 ; 508 return (u16)((((u16)UART2->DR) | ((u16)(((u16)((u16)UART2->CR1 & (u16)UART2_CR1_R8)) << 1))) & ((u16)0x01FF));
1800 02b9 c65244 ld a,21060
1801 02bc 5f clrw x
1802 02bd a480 and a,#128
1803 02bf 5f clrw x
1804 02c0 02 rlwa x,a
1805 02c1 58 sllw x
1806 02c2 1f01 ldw (OFST-1,sp),x
1807 02c4 c65241 ld a,21057
1808 02c7 5f clrw x
1809 02c8 97 ld xl,a
1810 02c9 01 rrwa x,a
1811 02ca 1a02 or a,(OFST+0,sp)
1812 02cc 01 rrwa x,a
1813 02cd 1a01 or a,(OFST-1,sp)
1814 02cf 01 rrwa x,a
1815 02d0 01 rrwa x,a
1816 02d1 a4ff and a,#255
1817 02d3 01 rrwa x,a
1818 02d4 a401 and a,#1
1819 02d6 01 rrwa x,a
1822 02d7 5b02 addw sp,#2
1823 02d9 81 ret
1857 ; 522 void UART2_SendData8(u8 Data)
1857 ; 523 {
1858 switch .text
1859 02da _UART2_SendData8:
1861 02da 88 push a
1862 00000000 OFST: set 0
1865 02db L177:
1866 ; 525 while(!(UART2->SR&UART2_SR_TXE));
1868 02db c65240 ld a,21056
1869 02de a580 bcp a,#128
1870 02e0 27f9 jreq L177
1871 ; 526 UART2->DR = Data;
1873 02e2 7b01 ld a,(OFST+1,sp)
1874 02e4 c75241 ld 21057,a
1875 ; 527 }
1878 02e7 84 pop a
1879 02e8 81 ret
1913 ; 538 void UART2_SendData9(u16 Data)
1913 ; 539 {
1914 switch .text
1915 02e9 _UART2_SendData9:
1917 02e9 89 pushw x
1918 00000000 OFST: set 0
1921 ; 540 UART2->CR1 &= ((u8)~UART2_CR1_T8); /* Clear the transmit data bit 8 */
1923 02ea 721d5244 bres 21060,#6
1924 ; 541 UART2->CR1 |= (u8)(((u8)(Data >> 2)) & UART2_CR1_T8); /* Write the transmit data bit [8] */
1926 02ee 54 srlw x
1927 02ef 54 srlw x
1928 02f0 9f ld a,xl
1929 02f1 a440 and a,#64
1930 02f3 ca5244 or a,21060
1931 02f6 c75244 ld 21060,a
1932 ; 542 UART2->DR = (u8)(Data); /* Write the transmit data bit [0:7] */
1934 02f9 7b02 ld a,(OFST+2,sp)
1935 02fb c75241 ld 21057,a
1936 ; 544 }
1939 02fe 85 popw x
1940 02ff 81 ret
1963 ; 551 void UART2_SendBreak(void)
1963 ; 552 {
1964 switch .text
1965 0300 _UART2_SendBreak:
1969 ; 553 UART2->CR2 |= UART2_CR2_SBK;
1971 0300 72105245 bset 21061,#0
1972 ; 554 }
1975 0304 81 ret
2009 ; 563 void UART2_SetAddress(u8 UART2_Address)
2009 ; 564 {
2010 switch .text
2011 0305 _UART2_SetAddress:
2013 0305 88 push a
2014 00000000 OFST: set 0
2017 ; 566 assert_param(IS_UART2_ADDRESS_OK(UART2_Address));
2019 ; 569 UART2->CR4 &= ((u8)~UART2_CR4_ADD);
2021 0306 c65247 ld a,21063
2022 0309 a4f0 and a,#240
2023 030b c75247 ld 21063,a
2024 ; 571 UART2->CR4 |= UART2_Address;
2026 030e c65247 ld a,21063
2027 0311 1a01 or a,(OFST+1,sp)
2028 0313 c75247 ld 21063,a
2029 ; 572 }
2032 0316 84 pop a
2033 0317 81 ret
2067 ; 583 void UART2_SetGuardTime(u8 UART2_GuardTime)
2067 ; 584 {
2068 switch .text
2069 0318 _UART2_SetGuardTime:
2073 ; 586 UART2->GTR = UART2_GuardTime;
2075 0318 c7524a ld 21066,a
2076 ; 587 }
2079 031b 81 ret
2113 ; 613 void UART2_SetPrescaler(u8 UART2_Prescaler)
2113 ; 614 {
2114 switch .text
2115 031c _UART2_SetPrescaler:
2119 ; 616 UART2->PSCR = UART2_Prescaler;
2121 031c c7524b ld 21067,a
2122 ; 617 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -