sam4l_hal.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. This file is part of the ChipWhisperer Example Targets
  3. Copyright (C) 2017 NewAE Technology Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef SAM4L_HAL_H_
  16. #define SAM4L_HAL_H_
  17. #include "sam.h"
  18. //Generic Platform
  19. #include "uart.h"
  20. #include "sam4l_aes.h"
  21. //Pin PA06 choosen (mostly at random) to be GPIO4
  22. //This can be overridden elsewhere
  23. #define trigger_setup() {GPIO->GPIO_PORT[0].GPIO_ODERS = GPIO_PA06; GPIO->GPIO_PORT[0].GPIO_STERC = GPIO_PA06;}
  24. #define trigger_high() {GPIO->GPIO_PORT[0].GPIO_OVRS = GPIO_PA06;}
  25. #define trigger_low() {GPIO->GPIO_PORT[0].GPIO_OVRC = GPIO_PA06;}
  26. void periclk_usart0_init(void);
  27. void periclk_aesa_init(void);
  28. #define init_uart uart0_init
  29. #define putch uart0_putch
  30. #define getch uart0_getch
  31. void HW_AES128_Init(void);
  32. void HW_AES128_LoadKey(uint8_t* key);
  33. void HW_AES128_Enc(uint8_t* pt);
  34. void HW_AES128_Enc_pretrigger(uint8_t* pt);
  35. void HW_AES128_Enc_posttrigger(uint8_t* pt);
  36. void HW_AES128_Dec(uint8_t *ct);
  37. #endif //SAM4L_HAL_H_