disable more irqs to fix am32 flash errors (#51)

* disable more irqs to fix am23 flash errors

* fix spell errors and comment
This commit is contained in:
EMSR 2023-04-26 21:33:55 +08:00 committed by GitHub
parent 31abe8ba96
commit 29081c5048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 9 deletions

View File

@ -164,11 +164,19 @@ static uint8_t BL_ReadBuf(uint8_t *pstring, uint8_t len)
* atomic_block(nvic_prio_max) * atomic_block(nvic_prio_max)
*/ */
#if defined(AT32F43x) #if defined(AT32F43x)
ATOMIC_BLOCK(NVIC_PRIO_MAX){ //disable exint
//disable exint ExIntReg=EXINT->inten;
ExIntReg=EXINT->inten; EXINT->inten=0;//DISABLE ALL EXINT
EXINT->inten=0;//DISABLE ALL EXINT //disable 5-15 EXINT
} NVIC_DisableIRQ(EXINT9_5_IRQn);
NVIC_DisableIRQ(EXINT15_10_IRQn);
//disable USB
NVIC_DisableIRQ(TMR20_OVF_IRQn);
NVIC_DisableIRQ(OTGFS1_IRQn);
//disable uart 1\2\3
NVIC_DisableIRQ(USART1_IRQn);
NVIC_DisableIRQ(USART2_IRQn);
NVIC_DisableIRQ(USART3_IRQn);
#endif #endif
do { do {
if (!suart_getc_(pstring)) goto timeout; if (!suart_getc_(pstring)) goto timeout;
@ -190,10 +198,17 @@ static uint8_t BL_ReadBuf(uint8_t *pstring, uint8_t len)
} }
timeout: timeout:
#if defined(AT32F43x) #if defined(AT32F43x)
ATOMIC_BLOCK(NVIC_PRIO_MAX){ //re-enable exint
//re-enable exint EXINT->inten=ExIntReg;
EXINT->inten=ExIntReg; NVIC_EnableIRQ(EXINT9_5_IRQn);
} NVIC_EnableIRQ(EXINT15_10_IRQn);
//re-enable USB
NVIC_EnableIRQ(TMR20_OVF_IRQn);//TODO:tmr20 should be removed after
NVIC_EnableIRQ(OTGFS1_IRQn);
//re-enable uart 1\2\3
NVIC_EnableIRQ(USART1_IRQn);
NVIC_EnableIRQ(USART2_IRQn);
NVIC_EnableIRQ(USART3_IRQn);
#endif #endif
return (LastACK == brSUCCESS); return (LastACK == brSUCCESS);
} }