📄 stm32f10x_i2c.txt
字号:
; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\Obj\stm32f10x_i2c.o --depend=.\Obj\stm32f10x_i2c.d --device=DARMSTM --apcs=interwork -O3 -I..\..\include -I..\..\..\FWLib\library\inc -I..\..\..\USBLib\library\inc -I..\..\Config -I..\..\GUI\Core -I..\..\GUI\Font -I..\..\GUI\ConvertColor -I..\..\GUI\AntiAlias -I..\..\GUI\ConvertMono -I..\..\GUI\JPEG -I..\..\GUI\MemDev -I..\..\GUI\MultiLayer -I..\..\GUI\Widget -I..\..\GUI\WM -IC:\Keil\ARM\INC\ST\STM32F10x ..\..\..\FWLib\library\src\stm32f10x_i2c.c]
THUMB
AREA ||i.I2C_ARPCmd||, CODE, READONLY, ALIGN=1
I2C_ARPCmd PROC
;;;814 *******************************************************************************/
;;;815 void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
000000 2900 CMP r1,#0
;;;816 {
;;;817 /* Check the parameters */
;;;818 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;819 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;820
;;;821 if (NewState != DISABLE)
;;;822 {
;;;823 /* Enable the selected I2C ARP */
;;;824 I2Cx->CR1 |= CR1_ENARP_Set;
000002 8801 LDRH r1,[r0,#0]
000004 d002 BEQ |L1.12|
000006 f0410110 ORR r1,r1,#0x10
00000a e001 B |L1.16|
|L1.12|
;;;825 }
;;;826 else
;;;827 {
;;;828 /* Disable the selected I2C ARP */
;;;829 I2Cx->CR1 &= CR1_ENARP_Reset;
00000c f0210110 BIC r1,r1,#0x10
|L1.16|
000010 8001 STRH r1,[r0,#0] ;824
;;;830 }
;;;831 }
000012 4770 BX lr
;;;832
ENDP
AREA ||i.I2C_AcknowledgeConfig||, CODE, READONLY, ALIGN=1
I2C_AcknowledgeConfig PROC
;;;422 *******************************************************************************/
;;;423 void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState)
000000 2900 CMP r1,#0
;;;424 {
;;;425 /* Check the parameters */
;;;426 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;427 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;428
;;;429 if (NewState != DISABLE)
;;;430 {
;;;431 /* Enable the acknowledgement */
;;;432 I2Cx->CR1 |= CR1_ACK_Set;
000002 8801 LDRH r1,[r0,#0]
000004 d002 BEQ |L2.12|
000006 f4416180 ORR r1,r1,#0x400
00000a e001 B |L2.16|
|L2.12|
;;;433 }
;;;434 else
;;;435 {
;;;436 /* Disable the acknowledgement */
;;;437 I2Cx->CR1 &= CR1_ACK_Reset;
00000c f4216180 BIC r1,r1,#0x400
|L2.16|
000010 8001 STRH r1,[r0,#0] ;432
;;;438 }
;;;439 }
000012 4770 BX lr
;;;440
ENDP
AREA ||i.I2C_CalculatePEC||, CODE, READONLY, ALIGN=1
I2C_CalculatePEC PROC
;;;771 *******************************************************************************/
;;;772 void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState)
000000 2900 CMP r1,#0
;;;773 {
;;;774 /* Check the parameters */
;;;775 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;776 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;777
;;;778 if (NewState != DISABLE)
;;;779 {
;;;780 /* Enable the selected I2C PEC calculation */
;;;781 I2Cx->CR1 |= CR1_ENPEC_Set;
000002 8801 LDRH r1,[r0,#0]
000004 d002 BEQ |L3.12|
000006 f0410120 ORR r1,r1,#0x20
00000a e001 B |L3.16|
|L3.12|
;;;782 }
;;;783 else
;;;784 {
;;;785 /* Disable the selected I2C PEC calculation */
;;;786 I2Cx->CR1 &= CR1_ENPEC_Reset;
00000c f0210120 BIC r1,r1,#0x20
|L3.16|
000010 8001 STRH r1,[r0,#0] ;781
;;;787 }
;;;788 }
000012 4770 BX lr
;;;789
ENDP
AREA ||i.I2C_CheckEvent||, CODE, READONLY, ALIGN=1
I2C_CheckEvent PROC
;;;937 *******************************************************************************/
;;;938 ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, u32 I2C_EVENT)
000000 4602 MOV r2,r0
;;;939 {
;;;940 u32 lastevent = 0;
;;;941 u32 flag1 = 0, flag2 = 0;
;;;942 ErrorStatus status = ERROR;
;;;943
;;;944 /* Check the parameters */
;;;945 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;946 assert_param(IS_I2C_EVENT(I2C_EVENT));
;;;947
;;;948 /* Read the I2Cx status register */
;;;949 flag1 = I2Cx->SR1;
000002 8a93 LDRH r3,[r2,#0x14]
000004 2000 MOVS r0,#0 ;942
;;;950 flag2 = I2Cx->SR2;
000006 8b12 LDRH r2,[r2,#0x18]
;;;951 flag2 = flag2 << 16;
;;;952
;;;953 /* Get the last event value from I2C status register */
;;;954 lastevent = (flag1 | flag2) & FLAG_Mask;
000008 ea434302 ORR r3,r3,r2,LSL #16
00000c f023427f BIC r2,r3,#0xff000000
;;;955
;;;956 /* Check whether the last event is equal to I2C_EVENT */
;;;957 if (lastevent == I2C_EVENT )
000010 428a CMP r2,r1
000012 d100 BNE |L4.22|
;;;958 {
;;;959 /* SUCCESS: last event is equal to I2C_EVENT */
;;;960 status = SUCCESS;
000014 2001 MOVS r0,#1
|L4.22|
;;;961 }
;;;962 else
;;;963 {
;;;964 /* ERROR: last event is different from I2C_EVENT */
;;;965 status = ERROR;
;;;966 }
;;;967
;;;968 /* Return status */
;;;969 return status;
;;;970 }
000016 4770 BX lr
;;;971
ENDP
AREA ||i.I2C_ClearFlag||, CODE, READONLY, ALIGN=1
I2C_ClearFlag PROC
;;;1060 *******************************************************************************/
;;;1061 void I2C_ClearFlag(I2C_TypeDef* I2Cx, u32 I2C_FLAG)
000000 f021427f BIC r2,r1,#0xff000000
;;;1062 {
;;;1063 u32 flagpos = 0;
;;;1064 u32 flagindex = 0;
;;;1065
;;;1066 /* Check the parameters */
;;;1067 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;1068 assert_param(IS_I2C_CLEAR_FLAG(I2C_FLAG));
;;;1069
;;;1070 /* Get the I2C flag position */
;;;1071 flagpos = I2C_FLAG & FLAG_Mask;
;;;1072
;;;1073 /* Get the I2C flag index */
;;;1074 flagindex = I2C_FLAG >> 28;
000004 0f09 LSRS r1,r1,#28
;;;1075
;;;1076 /* Clear the flag by writing 0 */
;;;1077 if (flagindex == 1)
000006 2901 CMP r1,#1
000008 d102 BNE |L5.16|
;;;1078 {
;;;1079 /* Clear the selected I2C flag */
;;;1080 I2Cx->SR1 = (u16)~flagpos;
00000a 43d1 MVNS r1,r2
00000c 8281 STRH r1,[r0,#0x14]
;;;1081 }
;;;1082 /* Flags that need a read of the SR1 register to be cleared */
;;;1083 else if (flagindex == 2)
;;;1084 {
;;;1085 /* Read the SR1 register */
;;;1086 (void)I2Cx->SR1;
;;;1087 }
;;;1088 /* Flags that need a read of SR1 and a write on CR1 registers to be cleared */
;;;1089 else if (flagindex == 6)
;;;1090 {
;;;1091 /* Read the SR1 register */
;;;1092 (void)I2Cx->SR1;
;;;1093
;;;1094 /* Write on the CR1 register */
;;;1095 I2Cx->CR1 |= CR1_PE_Set;
;;;1096 }
;;;1097 /* Flags that need a read of SR1 and SR2 registers to be cleared */
;;;1098 else /*flagindex == 0xA*/
;;;1099 {
;;;1100 /* Read the SR1 register */
;;;1101 (void)I2Cx->SR1;
;;;1102
;;;1103 /* Read the SR2 register */
;;;1104 (void)I2Cx->SR2;
;;;1105 }
;;;1106 }
00000e 4770 BX lr
|L5.16|
000010 2902 CMP r1,#2 ;1083
000012 d101 BNE |L5.24|
000014 8a80 LDRH r0,[r0,#0x14] ;1086
000016 4770 BX lr
|L5.24|
000018 2906 CMP r1,#6 ;1089
00001a 8a81 LDRH r1,[r0,#0x14] ;1092
00001c d104 BNE |L5.40|
00001e 8801 LDRH r1,[r0,#0] ;1095
000020 f0410101 ORR r1,r1,#1 ;1095
000024 8001 STRH r1,[r0,#0] ;1095
000026 4770 BX lr
|L5.40|
000028 8b00 LDRH r0,[r0,#0x18] ;1104
00002a 4770 BX lr
;;;1107
ENDP
AREA ||i.I2C_ClearITPendingBit||, CODE, READONLY, ALIGN=1
I2C_ClearITPendingBit PROC
;;;1189 *******************************************************************************/
;;;1190 void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, u32 I2C_IT)
000000 f021427f BIC r2,r1,#0xff000000
;;;1191 {
;;;1192 u32 flagpos = 0;
;;;1193 u32 flagindex = 0;
;;;1194
;;;1195 /* Check the parameters */
;;;1196 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;1197 assert_param(IS_I2C_CLEAR_IT(I2C_IT));
;;;1198
;;;1199 /* Get the I2C flag position */
;;;1200 flagpos = I2C_IT & FLAG_Mask;
;;;1201
;;;1202 /* Get the I2C flag index */
;;;1203 flagindex = I2C_IT >> 28;
000004 0f09 LSRS r1,r1,#28
;;;1204
;;;1205 /* Clear the flag by writing 0 */
;;;1206 if (flagindex == 1)
000006 2901 CMP r1,#1
000008 d102 BNE |L6.16|
;;;1207 {
;;;1208 /* Clear the selected I2C flag */
;;;1209 I2Cx->SR1 = (u16)~flagpos;
00000a 43d1 MVNS r1,r2
00000c 8281 STRH r1,[r0,#0x14]
;;;1210 }
;;;1211 /* Flags that need a read of the SR1 register to be cleared */
;;;1212 else if (flagindex == 2)
;;;1213 {
;;;1214 /* Read the SR1 register */
;;;1215 (void)I2Cx->SR1;
;;;1216 }
;;;1217 /* Flags that need a read of SR1 and a write on CR1 registers to be cleared */
;;;1218 else if (flagindex == 6)
;;;1219 {
;;;1220 /* Read the SR1 register */
;;;1221 (void)I2Cx->SR1;
;;;1222
;;;1223 /* Write on the CR1 register */
;;;1224 I2Cx->CR1 |= CR1_PE_Set;
;;;1225 }
;;;1226 /* Flags that need a read of SR1 and SR2 registers to be cleared */
;;;1227 else /*flagindex == 0xA*/
;;;1228 {
;;;1229 /* Read the SR1 register */
;;;1230 (void)I2Cx->SR1;
;;;1231
;;;1232 /* Read the SR2 register */
;;;1233 (void)I2Cx->SR2;
;;;1234 }
;;;1235 }
00000e 4770 BX lr
|L6.16|
000010 2902 CMP r1,#2 ;1212
000012 d101 BNE |L6.24|
000014 8a80 LDRH r0,[r0,#0x14] ;1215
000016 4770 BX lr
|L6.24|
000018 2906 CMP r1,#6 ;1218
00001a 8a81 LDRH r1,[r0,#0x14] ;1221
00001c d104 BNE |L6.40|
00001e 8801 LDRH r1,[r0,#0] ;1224
000020 f0410101 ORR r1,r1,#1 ;1224
000024 8001 STRH r1,[r0,#0] ;1224
000026 4770 BX lr
|L6.40|
000028 8b00 LDRH r0,[r0,#0x18] ;1233
00002a 4770 BX lr
;;;1236
ENDP
AREA ||i.I2C_Cmd||, CODE, READONLY, ALIGN=1
I2C_Cmd PROC
;;;287 *******************************************************************************/
;;;288 void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
000000 2900 CMP r1,#0
;;;289 {
;;;290 /* Check the parameters */
;;;291 assert_param(IS_I2C_ALL_PERIPH(I2Cx));
;;;292 assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;293
;;;294 if (NewState != DISABLE)
;;;295 {
;;;296 /* Enable the selected I2C peripheral */
;;;297 I2Cx->CR1 |= CR1_PE_Set;
000002 8801 LDRH r1,[r0,#0]
000004 d002 BEQ |L7.12|
000006 f0410101 ORR r1,r1,#1
00000a e001 B |L7.16|
|L7.12|
;;;298 }
;;;299 else
;;;300 {
;;;301 /* Disable the selected I2C peripheral */
;;;302 I2Cx->CR1 &= CR1_PE_Reset;
00000c f0210101 BIC r1,r1,#1
|L7.16|
000010 8001 STRH r1,[r0,#0] ;297
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -