int main(void) { /*HW semaphore Clock enable*/ __HAL_RCC_HSEM_CLK_ENABLE(); /* Activate HSEM notification for Cortex-M4*/ HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); /* Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to perform system initialization (system clock config, external memory configuration.. ) */ HAL_PWREx_ClearPendingEvent(); HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN); /* Clear HSEM flag */ __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); /* STM32H7xx HAL library initialization: - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Infinite loop */ while (1) { } } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif /** * @} */ /** * @} */
时间: 2024-02-17 22:16:37 浏览: 173
Semaphore.rar_Linux/Unix编程_Unix_Linux_
这段代码是关于断言的一段代码。断言是一种调试技术,可以在程序中加入一些检查,用来检测程序运行时的错误。当程序执行到断言语句时,如果断言条件为假,则程序会停止运行并报告错误。在这段代码中,使用了宏定义USE_FULL_ASSERT来启用断言功能。当程序中出现参数错误时,assert_failed函数会被调用,报告发生错误的文件名和行号。如果不启用断言功能,则这段代码不会被编译进程序中。
阅读全文