main.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * This Source Code Form is subject to the terms of the MIT License.
  3. * If a copy of the MIT License was not distributed with this file,
  4. * you can obtain one at https://opensource.org/licenses/MIT
  5. */
  6. #ifndef INC_MAIN_H
  7. #define INC_MAIN_H
  8. #include <stdint.h>
  9. #include "system.h"
  10. #ifndef NULL
  11. #define NULL ((void*) 0)
  12. #endif
  13. #define likely(x) __builtin_expect((x),1)
  14. #define unlikely(x) __builtin_expect((x),0)
  15. #define GPIO_LED_BLUE (GPIOD)
  16. #define GPIO_LED_GREEN (GPIOD)
  17. #define GPIO_BUTTON (GPIOA)
  18. #define MAX_READ_ATTEMPTS (100u)
  19. /* all times in milliseconds */
  20. /* minimum wait time between reset deassert and attack */
  21. #define DELAY_JITTER_MS_MIN (20u)
  22. /* increment per failed attack */
  23. #define DELAY_JITTER_MS_INCREMENT (1u)
  24. /* maximum wait time between reset deassert and attack */
  25. #define DELAY_JITTER_MS_MAX (50u)
  26. /* flash readout statistics */
  27. typedef struct {
  28. uint32_t numAttempts;
  29. uint32_t numSuccess;
  30. uint32_t numFailure;
  31. } extractionStatistics_t;
  32. void printExtractionStatistics( void );
  33. #endif