stm32_port.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright 2020-2023 Espressif Systems (Shanghai) CO LTD
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #pragma once
  16. #include <stdint.h>
  17. #include "esp_loader_io.h"
  18. #if defined STM32C0
  19. #include "stm32c0xx_hal.h"
  20. #elif defined STM32F0
  21. #include "stm32f0xx_hal.h"
  22. #elif defined STM32F1
  23. #include "stm32f1xx_hal.h"
  24. #elif defined STM32F2
  25. #include "stm32f2xx_hal.h"
  26. #elif defined STM32F3
  27. #include "stm32f3xx_hal.h"
  28. #elif defined STM32F4
  29. #include "stm32f4xx_hal.h"
  30. #elif defined STM32F7
  31. #include "stm32f7xx_hal.h"
  32. #elif defined STM32G0
  33. #include "stm32g0xx_hal.h"
  34. #elif defined STM32G4
  35. #include "stm32g4xx_hal.h"
  36. #elif defined STM32H5
  37. #include "stm32h5xx_hal.h"
  38. #elif defined STM32H7
  39. #include "stm32h7xx_hal.h"
  40. #endif
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. typedef struct {
  45. UART_HandleTypeDef *huart;
  46. GPIO_TypeDef *port_io0;
  47. uint16_t pin_num_io0;
  48. GPIO_TypeDef *port_rst;
  49. uint16_t pin_num_rst;
  50. } loader_stm32_config_t;
  51. void loader_port_stm32_init(loader_stm32_config_t *config);
  52. #ifdef __cplusplus
  53. }
  54. #endif