📄 stm8s_i2c.ls
字号:
1757 021b 0f01 clr (OFST+0,sp)
1758 ; 672 assert_param(IS_I2C_FLAG_OK(Flag));
1760 ; 675 switch ((u16)Flag & (u16)0xF000)
1762 021d 01 rrwa x,a
1763 021e 9f ld a,xl
1764 021f a4f0 and a,#240
1765 0221 97 ld xl,a
1766 0222 4f clr a
1767 0223 02 rlwa x,a
1769 ; 723 default:
1769 ; 724 break;
1770 0224 1d1000 subw x,#4096
1771 0227 270c jreq L136
1772 0229 1d1000 subw x,#4096
1773 022c 270c jreq L336
1774 022e 1d1000 subw x,#4096
1775 0231 2714 jreq L536
1776 0233 201b jra L147
1777 0235 L136:
1778 ; 679 case 0x1000:
1778 ; 680 /* Check the status of the specified I2C flag */
1778 ; 681 if ((I2C->SR1 & (u8)Flag) != 0)
1780 0235 c65217 ld a,21015
1781 ; 684 bitstatus = SET;
1783 0238 2003 jp LC005
1784 ; 689 bitstatus = RESET;
1785 023a L336:
1786 ; 694 case 0x2000:
1786 ; 695 /* Check the status of the specified I2C flag */
1786 ; 696 if ((I2C->SR2 & (u8)Flag) != 0)
1788 023a c65218 ld a,21016
1789 023d LC005:
1790 023d 1503 bcp a,(OFST+2,sp)
1791 023f 270d jreq L357
1792 ; 699 bitstatus = SET;
1794 0241 LC004:
1797 0241 a601 ld a,#1
1798 0243 6b01 ld (OFST+0,sp),a
1800 0245 2009 jra L147
1801 ; 704 bitstatus = RESET;
1802 0247 L536:
1803 ; 709 case 0x3000:
1803 ; 710 /* Check the status of the specified I2C flag */
1803 ; 711 if ((I2C->SR3 & (u8)Flag) != 0)
1805 0247 c65219 ld a,21017
1806 024a 1503 bcp a,(OFST+2,sp)
1807 ; 714 bitstatus = SET;
1809 024c 26f3 jrne LC004
1810 024e L357:
1811 ; 719 bitstatus = RESET;
1815 024e 0f01 clr (OFST+0,sp)
1816 ; 723 default:
1816 ; 724 break;
1818 0250 L147:
1819 ; 729 return bitstatus;
1821 0250 7b01 ld a,(OFST+0,sp)
1824 0252 5b03 addw sp,#3
1825 0254 81 ret
1887 ; 748 void I2C_ClearFlag(I2C_Flag_TypeDef Flag)
1887 ; 749 {
1888 switch .text
1889 0255 _I2C_ClearFlag:
1891 0255 89 pushw x
1892 0256 5204 subw sp,#4
1893 00000004 OFST: set 4
1896 ; 750 u8 tmp1 = 0;
1898 ; 751 u8 tmp2 = 0;
1900 ; 752 u16 tmp3 = 0;
1902 ; 755 assert_param(IS_I2C_CLEAR_FLAG_OK(Flag));
1904 ; 758 tmp3 = ((u16)Flag & (u16)0x0F00);
1906 0258 01 rrwa x,a
1907 0259 9f ld a,xl
1908 025a a40f and a,#15
1909 025c 97 ld xl,a
1910 025d 4f clr a
1911 025e 02 rlwa x,a
1912 025f 1f03 ldw (OFST-1,sp),x
1913 ; 761 if(tmp3 == 0x0100)
1915 0261 a30100 cpw x,#256
1916 0264 2608 jrne L1101
1917 ; 764 I2C->SR2 = (u8)(~(u8)Flag);
1919 0266 7b06 ld a,(OFST+2,sp)
1920 0268 43 cpl a
1921 0269 c75218 ld 21016,a
1923 026c 2022 jra L3101
1924 026e L1101:
1925 ; 767 else if(tmp3 == 0x0200)
1927 026e a30200 cpw x,#512
1928 0271 260a jrne L5101
1929 ; 770 tmp1 = I2C->SR1;
1931 0273 c65217 ld a,21015
1932 ; 772 I2C->CR2 = I2C->CR2;
1934 0276 5552115211 mov 21009,21009
1936 027b 2013 jra L3101
1937 027d L5101:
1938 ; 775 else if(tmp3 == 0x0300)
1940 027d a30300 cpw x,#768
1941 0280 2608 jrne L1201
1942 ; 779 tmp1 = I2C->SR1;
1944 0282 c65217 ld a,21015
1945 ; 781 tmp2 = I2C->SR3;
1947 0285 c65219 ld a,21017
1949 0288 2006 jra L3101
1950 028a L1201:
1951 ; 788 tmp1 = I2C->SR1;
1953 028a c65217 ld a,21015
1954 ; 790 tmp2 = I2C->DR;
1956 028d c65216 ld a,21014
1957 0290 L3101:
1958 ; 792 }
1961 0290 5b06 addw sp,#6
1962 0292 81 ret
2110 ; 811 ITStatus I2C_GetITStatus(I2C_ITPendingBit_TypeDef ITPendingBit)
2110 ; 812 {
2111 switch .text
2112 0293 _I2C_GetITStatus:
2114 0293 89 pushw x
2115 0294 88 push a
2116 00000001 OFST: set 1
2119 ; 813 ITStatus itstatus = RESET;
2121 ; 816 assert_param(IS_I2C_ITPENDINGBIT_OK(ITPendingBit));
2123 ; 819 if (((u16)ITPendingBit & 0xF000) == 0x1000) /* Returns whether the status register to check is SR1 */
2125 0295 01 rrwa x,a
2126 0296 9f ld a,xl
2127 0297 a4f0 and a,#240
2128 0299 97 ld xl,a
2129 029a 4f clr a
2130 029b 02 rlwa x,a
2131 029c a31000 cpw x,#4096
2132 029f 2609 jrne L3011
2133 ; 822 if ((I2C->SR1 & (u8)ITPendingBit) != 0)
2135 02a1 c65217 ld a,21015
2136 02a4 1503 bcp a,(OFST+2,sp)
2137 02a6 270d jreq L3111
2138 ; 825 itstatus = SET;
2140 02a8 2007 jp LC007
2141 ; 830 itstatus = RESET;
2142 02aa L3011:
2143 ; 836 if ((I2C->SR2 & (u8)ITPendingBit) != 0)
2145 02aa c65218 ld a,21016
2146 02ad 1503 bcp a,(OFST+2,sp)
2147 02af 2704 jreq L3111
2148 ; 839 itstatus = SET;
2150 02b1 LC007:
2152 02b1 a601 ld a,#1
2154 02b3 2001 jra L1111
2155 02b5 L3111:
2156 ; 844 itstatus = RESET;
2159 02b5 4f clr a
2160 02b6 L1111:
2161 ; 849 return itstatus;
2165 02b6 5b03 addw sp,#3
2166 02b8 81 ret
2229 ; 868 void I2C_ClearITPendingBit(I2C_ITPendingBit_TypeDef ITPendingBit)
2229 ; 869 {
2230 switch .text
2231 02b9 _I2C_ClearITPendingBit:
2233 02b9 89 pushw x
2234 02ba 5204 subw sp,#4
2235 00000004 OFST: set 4
2238 ; 870 u8 tmp1 = 0;
2240 ; 871 u8 tmp2 = 0;
2242 ; 872 u16 tmp3 = 0;
2244 ; 875 assert_param(IS_I2C_ITPENDINGBIT_OK(ITPendingBit));
2246 ; 878 tmp3 = ((u16)ITPendingBit & (u16)0x0F00);
2248 02bc 01 rrwa x,a
2249 02bd 9f ld a,xl
2250 02be a40f and a,#15
2251 02c0 97 ld xl,a
2252 02c1 4f clr a
2253 02c2 02 rlwa x,a
2254 02c3 1f03 ldw (OFST-1,sp),x
2255 ; 881 if(tmp3 == 0x0100)
2257 02c5 a30100 cpw x,#256
2258 02c8 2608 jrne L1511
2259 ; 884 I2C->SR2 = (u8)(~(u8)ITPendingBit);
2261 02ca 7b06 ld a,(OFST+2,sp)
2262 02cc 43 cpl a
2263 02cd c75218 ld 21016,a
2265 02d0 2022 jra L3511
2266 02d2 L1511:
2267 ; 887 else if(tmp3 == 0x0200)
2269 02d2 a30200 cpw x,#512
2270 02d5 260a jrne L5511
2271 ; 890 tmp1 = I2C->SR1;
2273 02d7 c65217 ld a,21015
2274 ; 892 I2C->CR2 = I2C->CR2;
2276 02da 5552115211 mov 21009,21009
2278 02df 2013 jra L3511
2279 02e1 L5511:
2280 ; 895 else if(tmp3 == 0x0300)
2282 02e1 a30300 cpw x,#768
2283 02e4 2608 jrne L1611
2284 ; 899 tmp1 = I2C->SR1;
2286 02e6 c65217 ld a,21015
2287 ; 901 tmp2 = I2C->SR3;
2289 02e9 c65219 ld a,21017
2291 02ec 2006 jra L3511
2292 02ee L1611:
2293 ; 908 tmp1 = I2C->SR1;
2295 02ee c65217 ld a,21015
2296 ; 910 tmp2 = I2C->DR;
2298 02f1 c65216 ld a,21014
2299 02f4 L3511:
2300 ; 912 }
2303 02f4 5b06 addw sp,#6
2304 02f6 81 ret
2317 xdef _I2C_ClearITPendingBit
2318 xdef _I2C_GetITStatus
2319 xdef _I2C_ClearFlag
2320 xdef _I2C_GetFlagStatus
2321 xdef _I2C_SendData
2322 xdef _I2C_Send7bitAddress
2323 xdef _I2C_ReceiveData
2324 xdef _I2C_CheckEvent
2325 xdef _I2C_ITConfig
2326 xdef _I2C_FastModeDutyCycleConfig
2327 xdef _I2C_AcknowledgeConfig
2328 xdef _I2C_StretchClockCmd
2329 xdef _I2C_SoftwareResetCmd
2330 xdef _I2C_GenerateSTOP
2331 xdef _I2C_GenerateSTART
2332 xdef _I2C_GeneralCallCmd
2333 xdef _I2C_Cmd
2334 xdef _I2C_Init
2335 xdef _I2C_DeInit
2336 xref.b c_lreg
2337 xref.b c_x
2356 xref c_sdivx
2357 xref c_ludv
2358 xref c_rtol
2359 xref c_smul
2360 xref c_lmul
2361 xref c_lcmp
2362 xref c_ltor
2363 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -