furi-hal.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include <furi-hal.h>
  2. #include <comp.h>
  3. #include <rtc.h>
  4. #include <tim.h>
  5. #include <gpio.h>
  6. #include <stm32wbxx_ll_cortex.h>
  7. void furi_hal_init() {
  8. furi_hal_clock_init();
  9. furi_hal_console_init();
  10. furi_hal_interrupt_init();
  11. furi_hal_delay_init();
  12. MX_GPIO_Init();
  13. FURI_LOG_I("HAL", "GPIO OK");
  14. MX_RTC_Init();
  15. FURI_LOG_I("HAL", "RTC OK");
  16. furi_hal_bootloader_init();
  17. furi_hal_version_init();
  18. furi_hal_spi_init();
  19. MX_TIM1_Init();
  20. FURI_LOG_I("HAL", "TIM1 OK");
  21. MX_TIM2_Init();
  22. FURI_LOG_I("HAL", "TIM2 OK");
  23. MX_TIM16_Init();
  24. FURI_LOG_I("HAL", "TIM16 OK");
  25. MX_COMP1_Init();
  26. FURI_LOG_I("HAL", "COMP1 OK");
  27. furi_hal_crypto_init();
  28. // VCP + USB
  29. furi_hal_usb_init();
  30. furi_hal_usb_set_config(UsbModeVcpSingle);
  31. furi_hal_vcp_init();
  32. FURI_LOG_I("HAL", "USB OK");
  33. furi_hal_i2c_init();
  34. // High Level
  35. furi_hal_power_init();
  36. furi_hal_light_init();
  37. furi_hal_vibro_init();
  38. furi_hal_subghz_init();
  39. furi_hal_nfc_init();
  40. furi_hal_rfid_init();
  41. furi_hal_bt_init();
  42. furi_hal_compress_icon_init();
  43. // FreeRTOS glue
  44. furi_hal_os_init();
  45. // Partial null pointer dereference protection
  46. LL_MPU_Disable();
  47. LL_MPU_ConfigRegion(
  48. LL_MPU_REGION_NUMBER0, 0x00, 0x0,
  49. LL_MPU_REGION_SIZE_1MB
  50. | LL_MPU_REGION_PRIV_RO_URO
  51. | LL_MPU_ACCESS_BUFFERABLE
  52. | LL_MPU_ACCESS_CACHEABLE
  53. | LL_MPU_ACCESS_SHAREABLE
  54. | LL_MPU_TEX_LEVEL1
  55. | LL_MPU_INSTRUCTION_ACCESS_ENABLE
  56. );
  57. LL_MPU_Enable(LL_MPU_CTRL_PRIVILEGED_DEFAULT);
  58. }