Merge remote-tracking branch 'flipperdevices/hedgetr/stack15' into dev

This commit is contained in:
MX
2023-04-23 00:46:39 +03:00
3 changed files with 21 additions and 9 deletions

View File

@@ -199,8 +199,8 @@ Function,-,LL_EXTI_StructInit,void,LL_EXTI_InitTypeDef*
Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef* Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef*
Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*" Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*"
Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef* Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef*
Function,-,LL_I2C_DeInit,ErrorStatus,const I2C_TypeDef* Function,-,LL_I2C_DeInit,ErrorStatus,I2C_TypeDef*
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, const LL_I2C_InitTypeDef*" Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, LL_I2C_InitTypeDef*"
Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef* Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef*
Function,-,LL_Init1msTick,void,uint32_t Function,-,LL_Init1msTick,void,uint32_t
Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef* Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef*
1 entry status name type params
199 Function - LL_GPIO_DeInit ErrorStatus GPIO_TypeDef*
200 Function + LL_GPIO_Init ErrorStatus GPIO_TypeDef*, LL_GPIO_InitTypeDef*
201 Function - LL_GPIO_StructInit void LL_GPIO_InitTypeDef*
202 Function - LL_I2C_DeInit ErrorStatus const I2C_TypeDef* I2C_TypeDef*
203 Function + LL_I2C_Init ErrorStatus I2C_TypeDef*, const LL_I2C_InitTypeDef* I2C_TypeDef*, LL_I2C_InitTypeDef*
204 Function - LL_I2C_StructInit void LL_I2C_InitTypeDef*
205 Function - LL_Init1msTick void uint32_t
206 Function + LL_LPTIM_DeInit ErrorStatus LPTIM_TypeDef*

View File

@@ -27,6 +27,16 @@
#define FURI_HAL_FLASH_OPT_KEY2 0x4C5D6E7F #define FURI_HAL_FLASH_OPT_KEY2 0x4C5D6E7F
#define FURI_HAL_FLASH_OB_TOTAL_WORDS (0x80 / (sizeof(uint32_t) * 2)) #define FURI_HAL_FLASH_OB_TOTAL_WORDS (0x80 / (sizeof(uint32_t) * 2))
/* lib/STM32CubeWB/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_RfWithFlash/Core/Src/flash_driver.c
* ProcessSingleFlashOperation, quote:
> In most BLE application, the flash should not be blocked by the CPU2 longer than FLASH_TIMEOUT_VALUE (1000ms)
> However, it could be that for some marginal application, this time is longer.
> ... there is no other way than waiting the operation to be completed.
> If for any reason this test is never passed, this means there is a failure in the system and there is no other
> way to recover than applying a device reset.
*/
#define FURI_HAL_FLASH_C2_LOCK_TIMEOUT_MS 3000u /* 3 seconds */
#define IS_ADDR_ALIGNED_64BITS(__VALUE__) (((__VALUE__)&0x7U) == (0x00UL)) #define IS_ADDR_ALIGNED_64BITS(__VALUE__) (((__VALUE__)&0x7U) == (0x00UL))
#define IS_FLASH_PROGRAM_ADDRESS(__VALUE__) \ #define IS_FLASH_PROGRAM_ADDRESS(__VALUE__) \
(((__VALUE__) >= FLASH_BASE) && ((__VALUE__) <= (FLASH_BASE + FLASH_SIZE - 8UL)) && \ (((__VALUE__) >= FLASH_BASE) && ((__VALUE__) <= (FLASH_BASE + FLASH_SIZE - 8UL)) && \
@@ -132,9 +142,11 @@ static void furi_hal_flash_begin_with_core2(bool erase_flag) {
for(volatile uint32_t i = 0; i < 35; i++) for(volatile uint32_t i = 0; i < 35; i++)
; ;
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(FURI_HAL_FLASH_C2_LOCK_TIMEOUT_MS * 1000);
while(true) { while(true) {
/* Wait till flash controller become usable */ /* Wait till flash controller become usable */
while(LL_FLASH_IsActiveFlag_OperationSuspended()) { while(LL_FLASH_IsActiveFlag_OperationSuspended()) {
furi_check(!furi_hal_cortex_timer_is_expired(timer));
furi_thread_yield(); furi_thread_yield();
}; };
@@ -144,6 +156,7 @@ static void furi_hal_flash_begin_with_core2(bool erase_flag) {
/* Actually we already have mutex for it, but specification is specification */ /* Actually we already have mutex for it, but specification is specification */
if(LL_HSEM_IsSemaphoreLocked(HSEM, CFG_HW_BLOCK_FLASH_REQ_BY_CPU1_SEMID)) { if(LL_HSEM_IsSemaphoreLocked(HSEM, CFG_HW_BLOCK_FLASH_REQ_BY_CPU1_SEMID)) {
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
furi_check(!furi_hal_cortex_timer_is_expired(timer));
furi_thread_yield(); furi_thread_yield();
continue; continue;
} }
@@ -151,6 +164,7 @@ static void furi_hal_flash_begin_with_core2(bool erase_flag) {
/* Take sempahopre and prevent core2 from anything funky */ /* Take sempahopre and prevent core2 from anything funky */
if(LL_HSEM_1StepLock(HSEM, CFG_HW_BLOCK_FLASH_REQ_BY_CPU2_SEMID) != 0) { if(LL_HSEM_1StepLock(HSEM, CFG_HW_BLOCK_FLASH_REQ_BY_CPU2_SEMID) != 0) {
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
furi_check(!furi_hal_cortex_timer_is_expired(timer));
furi_thread_yield(); furi_thread_yield();
continue; continue;
} }
@@ -237,7 +251,6 @@ bool furi_hal_flash_wait_last_operation(uint32_t timeout) {
Even if the FLASH operation fails, the BUSY flag will be reset and an error Even if the FLASH operation fails, the BUSY flag will be reset and an error
flag will be set */ flag will be set */
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(timeout * 1000); FuriHalCortexTimer timer = furi_hal_cortex_timer_get(timeout * 1000);
while(READ_BIT(FLASH->SR, FLASH_SR_BSY)) { while(READ_BIT(FLASH->SR, FLASH_SR_BSY)) {
if(furi_hal_cortex_timer_is_expired(timer)) { if(furi_hal_cortex_timer_is_expired(timer)) {
return false; return false;
@@ -263,7 +276,6 @@ bool furi_hal_flash_wait_last_operation(uint32_t timeout) {
/* Wait for control register to be written */ /* Wait for control register to be written */
timer = furi_hal_cortex_timer_get(timeout * 1000); timer = furi_hal_cortex_timer_get(timeout * 1000);
while(READ_BIT(FLASH->SR, FLASH_SR_CFGBSY)) { while(READ_BIT(FLASH->SR, FLASH_SR_CFGBSY)) {
if(furi_hal_cortex_timer_is_expired(timer)) { if(furi_hal_cortex_timer_is_expired(timer)) {
return false; return false;

View File

@@ -52,12 +52,12 @@ void platformSetIrqCallback(PlatformIrqCallback callback) {
furi_thread_mark_as_service(rfal_platform.thread); furi_thread_mark_as_service(rfal_platform.thread);
furi_thread_set_priority(rfal_platform.thread, FuriThreadPriorityIsr); furi_thread_set_priority(rfal_platform.thread, FuriThreadPriorityIsr);
furi_thread_start(rfal_platform.thread); furi_thread_start(rfal_platform.thread);
furi_hal_gpio_add_int_callback(&gpio_nfc_irq_rfid_pull, nfc_isr, NULL);
// Disable interrupt callback as the pin is shared between 2 apps
// It is enabled in rfalLowPowerModeStop()
furi_hal_gpio_disable_int_callback(&gpio_nfc_irq_rfid_pull);
} }
furi_hal_gpio_add_int_callback(&gpio_nfc_irq_rfid_pull, nfc_isr, NULL);
// Disable interrupt callback as the pin is shared between 2 apps
// It is enabled in rfalLowPowerModeStop()
furi_hal_gpio_disable_int_callback(&gpio_nfc_irq_rfid_pull);
} }
bool platformSpiTxRx(const uint8_t* txBuf, uint8_t* rxBuf, uint16_t len) { bool platformSpiTxRx(const uint8_t* txBuf, uint8_t* rxBuf, uint16_t len) {