utils.h 584 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #ifndef _UTILS_H
  3. #define _UTILS_H
  4. #include "stm32g0xx.h"
  5. /* Type defs */
  6. typedef union {
  7. uint64_t u64;
  8. int64_t i64;
  9. uint32_t u32[2];
  10. int32_t i32[2];
  11. } nt64_t;
  12. typedef enum {
  13. Flash_Ok = 0,
  14. Flash_Error = 1,
  15. Flash_PG_End = 2,
  16. Flash_PG_Clear = 3
  17. } flash_result_t;
  18. /* Defines */
  19. #define FLASH_PAGE_START 0x0800F800
  20. #define FLASH_PAGE_END 0x0800FFF8
  21. #define FLASH_PAGE_NMB 31
  22. #define FLASH_PAGE_NUM 1
  23. /* Functions prototypes */
  24. flash_result_t Flash_Write(uint64_t * data);
  25. flash_result_t Flash_Read(uint64_t * data);
  26. #endif /* _UTILS_H */