?? stm32f10x_flash.txt
字號:
FLASH_ReadOutProtection PROC
;;;532 FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState)
;;;533 {
0002d4 b530 PUSH {r4,r5,lr}
0002d6 4605 MOV r5,r0
;;;534 FLASH_Status status = FLASH_COMPLETE;
;;;535
;;;536 /* Check the parameters */
;;;537 assert(IS_FUNCTIONAL_STATE(NewState));
;;;538
;;;539 status = FLASH_WaitForLastOperation(EraseTimeout);
0002d8 f640f640 MOV r0,#0xfff
0002dc f7fff7ff BL FLASH_WaitForLastOperation
;;;540
;;;541 if(status == FLASH_COMPLETE)
0002e0 2804 CMP r0,#4
0002e2 d12f BNE |L1.836|
;;;542 {
;;;543 /* Authorizes the small information block programming */
;;;544 FLASH->OPTKEYR = FLASH_KEY1;
0002e4 4c43 LDR r4,|L1.1012|
0002e6 4844 LDR r0,|L1.1016|
0002e8 60a0 STR r0,[r4,#8]
;;;545 FLASH->OPTKEYR = FLASH_KEY2;
0002ea 4844 LDR r0,|L1.1020|
0002ec 60a0 STR r0,[r4,#8]
;;;546
;;;547 FLASH->CR |= CR_OPTER_Set;
0002ee 6920 LDR r0,[r4,#0x10]
0002f0 f040f040 ORR r0,r0,#0x20
0002f4 6120 STR r0,[r4,#0x10]
;;;548 FLASH->CR |= CR_STRT_Set;
0002f6 6920 LDR r0,[r4,#0x10]
0002f8 f040f040 ORR r0,r0,#0x40
0002fc 6120 STR r0,[r4,#0x10]
;;;549
;;;550 /* Wait for last operation to be completed */
;;;551 status = FLASH_WaitForLastOperation(EraseTimeout);
0002fe f640f640 MOV r0,#0xfff
000302 f7fff7ff BL FLASH_WaitForLastOperation
;;;552
;;;553 if(status == FLASH_COMPLETE)
000306 f641f641 MOV r1,#0x1fdf
00030a 2804 CMP r0,#4
00030c d11b BNE |L1.838|
;;;554 {
;;;555 /* if the erase operation is completed, disable the OPTER Bit */
;;;556 FLASH->CR &= CR_OPTER_Reset;
00030e 6920 LDR r0,[r4,#0x10]
000310 4008 ANDS r0,r0,r1
000312 6120 STR r0,[r4,#0x10]
;;;557
;;;558 /* Enable the Option Bytes Programming operation */
;;;559 FLASH->CR |= CR_OPTPG_Set;
000314 6920 LDR r0,[r4,#0x10]
000316 f040f040 ORR r0,r0,#0x10
00031a 6120 STR r0,[r4,#0x10]
;;;560
;;;561 if(NewState != DISABLE)
00031c 4839 LDR r0,|L1.1028|
00031e b11d CBZ r5,|L1.808|
;;;562 {
;;;563 OB->RDP = 0x00;
000320 2100 MOVS r1,#0
000322 f8a0f8a0 STRH r1,[r0,#0x800]
000326 e002 B |L1.814|
|L1.808|
;;;564 }
;;;565 else
;;;566 {
;;;567 OB->RDP = RDP_Key;
000328 21a5 MOVS r1,#0xa5
00032a f8a0f8a0 STRH r1,[r0,#0x800]
|L1.814|
;;;568 }
;;;569
;;;570 /* Wait for last operation to be completed */
;;;571 status = FLASH_WaitForLastOperation(EraseTimeout);
00032e f640f640 MOV r0,#0xfff
000332 f7fff7ff BL FLASH_WaitForLastOperation
;;;572
;;;573 if(status != FLASH_BUSY)
000336 2801 CMP r0,#1
000338 d004 BEQ |L1.836|
;;;574 {
;;;575 /* if the program operation is completed, disable the OPTPG Bit */
;;;576 FLASH->CR &= CR_OPTPG_Reset;
00033a 6921 LDR r1,[r4,#0x10]
00033c f641f641 MOV r2,#0x1fef
000340 4011 ANDS r1,r1,r2
000342 6121 STR r1,[r4,#0x10]
|L1.836|
;;;577 }
;;;578 }
;;;579 else
;;;580 {
;;;581 if(status != FLASH_BUSY)
;;;582 {
;;;583 /* Disable the OPTER Bit */
;;;584 FLASH->CR &= CR_OPTER_Reset;
;;;585 }
;;;586 }
;;;587 }
;;;588 /* Return the protection operation Status */
;;;589 return status;
;;;590 }
000344 bd30 POP {r4,r5,pc}
|L1.838|
000346 2801 CMP r0,#1
000348 d0fc BEQ |L1.836|
00034a 6922 LDR r2,[r4,#0x10]
00034c 4011 ANDS r1,r1,r2
00034e 6121 STR r1,[r4,#0x10]
000350 bd30 POP {r4,r5,pc}
;;;591
ENDP
FLASH_UserOptionByteConfig PROC
;;;613 FLASH_Status FLASH_UserOptionByteConfig(u16 OB_IWDG, u16 OB_STOP, u16 OB_STDBY)
;;;614 {
000352 b5f0 PUSH {r4-r7,lr}
000354 4605 MOV r5,r0
000356 460e MOV r6,r1
000358 4617 MOV r7,r2
;;;615 FLASH_Status status = FLASH_COMPLETE;
;;;616
;;;617 /* Check the parameters */
;;;618 assert(IS_OB_IWDG_SOURCE(OB_IWDG));
;;;619 assert(IS_OB_STOP_SOURCE(OB_STOP));
;;;620 assert(IS_OB_STDBY_SOURCE(OB_STDBY));
;;;621
;;;622 /* Authorize the small information block programming */
;;;623 FLASH->OPTKEYR = FLASH_KEY1;
00035a 4c26 LDR r4,|L1.1012|
00035c 4826 LDR r0,|L1.1016|
00035e 60a0 STR r0,[r4,#8]
;;;624 FLASH->OPTKEYR = FLASH_KEY2;
000360 4826 LDR r0,|L1.1020|
000362 60a0 STR r0,[r4,#8]
;;;625
;;;626 /* Wait for last operation to be completed */
;;;627 status = FLASH_WaitForLastOperation(ProgramTimeout);
000364 200f MOVS r0,#0xf
000366 f7fff7ff BL FLASH_WaitForLastOperation
;;;628
;;;629 if(status == FLASH_COMPLETE)
00036a 2804 CMP r0,#4
00036c d114 BNE |L1.920|
;;;630 {
;;;631 /* Enable the Option Bytes Programming operation */
;;;632 FLASH->CR |= CR_OPTPG_Set;
00036e 6920 LDR r0,[r4,#0x10]
000370 f040f040 ORR r0,r0,#0x10
000374 6120 STR r0,[r4,#0x10]
;;;633
;;;634 OB->USER = ( OB_IWDG | OB_STOP |OB_STDBY) | (u16)0xF8;
000376 ea45ea45 ORR r0,r5,r6
00037a 4338 ORRS r0,r0,r7
00037c 4922 LDR r1,|L1.1032|
00037e f040f040 ORR r0,r0,#0xf8
000382 8008 STRH r0,[r1,#0]
;;;635
;;;636 /* Wait for last operation to be completed */
;;;637 status = FLASH_WaitForLastOperation(ProgramTimeout);
000384 200f MOVS r0,#0xf
000386 f7fff7ff BL FLASH_WaitForLastOperation
;;;638
;;;639 if(status != FLASH_BUSY)
00038a 2801 CMP r0,#1
00038c d004 BEQ |L1.920|
;;;640 {
;;;641 /* if the program operation is completed, disable the OPTPG Bit */
;;;642 FLASH->CR &= CR_OPTPG_Reset;
00038e 6921 LDR r1,[r4,#0x10]
000390 f641f641 MOV r2,#0x1fef
000394 4011 ANDS r1,r1,r2
000396 6121 STR r1,[r4,#0x10]
|L1.920|
;;;643 }
;;;644 }
;;;645 /* Return the Option Byte program Status */
;;;646 return status;
;;;647 }
000398 bdf0 POP {r4-r7,pc}
;;;648
ENDP
FLASH_GetUserOptionByte PROC
;;;659 /* Return the User Option Byte */
;;;660 return (u32)(FLASH->OBR >> 2);
00039a 4816 LDR r0,|L1.1012|
00039c 69c0 LDR r0,[r0,#0x1c]
00039e 0880 LSRS r0,r0,#2
;;;661 }
0003a0 4770 BX lr
;;;662
ENDP
FLASH_GetWriteProtectionOptionByte PROC
;;;672 /* Return the Falsh write protection Register value */
;;;673 return (u32)(FLASH->WRPR);
0003a2 4814 LDR r0,|L1.1012|
0003a4 6a00 LDR r0,[r0,#0x20]
;;;674 }
0003a6 4770 BX lr
;;;675
ENDP
FLASH_GetReadOutProtectionStatus PROC
;;;685 {
;;;686 FlagStatus readoutstatus = RESET;
0003a8 2000 MOVS r0,#0
;;;687
;;;688 if ((FLASH->OBR & RDPRT_Mask) != (u32)RESET)
0003aa 4912 LDR r1,|L1.1012|
0003ac 69c9 LDR r1,[r1,#0x1c]
0003ae f011f011 TST r1,#2
0003b2 d000 BEQ |L1.950|
;;;689 {
;;;690 readoutstatus = SET;
0003b4 2001 MOVS r0,#1
|L1.950|
;;;691 }
;;;692 else
;;;693 {
;;;694 readoutstatus = RESET;
;;;695 }
;;;696 return readoutstatus;
;;;697 }
0003b6 4770 BX lr
;;;698
ENDP
FLASH_GetPrefetchBufferStatus PROC
;;;707 {
;;;708 FlagStatus bitstatus = RESET;
0003b8 2000 MOVS r0,#0
;;;709
;;;710 if ((FLASH->ACR & ACR_PRFTBS_Mask) != (u32)RESET)
0003ba 490e LDR r1,|L1.1012|
0003bc 6809 LDR r1,[r1,#0]
0003be f011f011 TST r1,#0x20
0003c2 d000 BEQ |L1.966|
;;;711 {
;;;712 bitstatus = SET;
0003c4 2001 MOVS r0,#1
|L1.966|
;;;713 }
;;;714 else
;;;715 {
;;;716 bitstatus = RESET;
;;;717 }
;;;718 /* Return the new state of FLASH Prefetch Buffer Status (SET or RESET) */
;;;719 return bitstatus;
;;;720 }
0003c6 4770 BX lr
;;;721
ENDP
FLASH_ITConfig PROC
;;;738
;;;739 if(NewState != DISABLE)
0003c8 4a0a LDR r2,|L1.1012|
0003ca b119 CBZ r1,|L1.980|
;;;740 {
;;;741 /* Enable the interrupt sources */
;;;742 FLASH->CR |= FLASH_IT;
0003cc 6911 LDR r1,[r2,#0x10]
0003ce 4308 ORRS r0,r0,r1
0003d0 6110 STR r0,[r2,#0x10]
;;;743 }
;;;744 else
;;;745 {
;;;746 /* Disable the interrupt sources */
;;;747 FLASH->CR &= ~(u32)FLASH_IT;
;;;748 }
;;;749 }
0003d2 4770 BX lr
|L1.980|
0003d4 6911 LDR r1,[r2,#0x10]
0003d6 ea21ea21 BIC r0,r1,r0
0003da 6110 STR r0,[r2,#0x10]
0003dc 4770 BX lr
;;;750
ENDP
FLASH_GetFlagStatus PROC
;;;764 FlagStatus FLASH_GetFlagStatus(u16 FLASH_FLAG)
;;;765 {
0003de 4601 MOV r1,r0
;;;766 FlagStatus bitstatus = RESET;
0003e0 2000 MOVS r0,#0
;;;767
;;;768 /* Check the parameters */
;;;769 assert(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
;;;770
;;;771 if(FLASH_FLAG == FLASH_FLAG_OPTERR)
0003e2 4a04 LDR r2,|L1.1012|
0003e4 2901 CMP r1,#1
0003e6 d111 BNE |L1.1036|
;;;772 {
;;;773 if((FLASH->OBR & FLASH_FLAG_OPTERR) != (u32)RESET)
0003e8 69d1 LDR r1,[r2,#0x1c]
0003ea f011f011 TST r1,#1
0003ee d000 BEQ |L1.1010|
;;;774 {
;;;775 bitstatus = SET;
0003f0 2001 MOVS r0,#1
|L1.1010|
0003f2 4770 BX lr
|L1.1012|
0003f4 40022000 DCD 0x40022000
|L1.1016|
0003f8 45670123 DCD 0x45670123
|L1.1020|
0003fc cdef89ab DCD 0xcdef89ab
|L1.1024|
000400 1ffff800 DCD 0x1ffff800
|L1.1028|
000404 1ffff000 DCD 0x1ffff000
|L1.1032|
000408 1ffff802 DCD 0x1ffff802
|L1.1036|
;;;776 }
;;;777 else
;;;778 {
;;;779 bitstatus = RESET;
;;;780 }
;;;781 }
;;;782 else
;;;783 {
;;;784 if((FLASH->SR & FLASH_FLAG) != (u32)RESET)
00040c 68d2 LDR r2,[r2,#0xc]
00040e 420a TST r2,r1
000410 d0ef BEQ |L1.1010|
;;;785 {
;;;786 bitstatus = SET;
000412 2001 MOVS r0,#1
000414 e7ed B |L1.1010|
;;;787 }
;;;788 else
;;;789 {
;;;790 bitstatus = RESET;
;;;791 }
;;;792 }
;;;793 /* Return the new state of FLASH_FLAG (SET or RESET) */
;;;794 return bitstatus;
;;;795 }
;;;796
ENDP
FLASH_ClearFlag PROC
;;;814 /* Clear the flags */
;;;815 FLASH->SR = FLASH_FLAG;
000416 4901 LDR r1,|L1.1052|
000418 60c8 STR r0,[r1,#0xc]
;;;816 }
00041a 4770 BX lr
;;;817
ENDP
|L1.1052|
00041c 40022000 DCD 0x40022000
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -