pal_os_timer.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * \copyright
  3. * Copyright (c) 2018, Infineon Technologies AG
  4. * All rights reserved.
  5. *
  6. * This software is provided with terms and conditions as specified in OPTIGA(TM) Trust X Evaluation Kit License Agreement.
  7. * \endcopyright
  8. *
  9. * \author Infineon AG
  10. *
  11. * \file
  12. *
  13. * \brief This file implements the platform abstraction layer APIs for timer.
  14. *
  15. * \addtogroup grPAL
  16. * @{
  17. */
  18. /**********************************************************************************************************************
  19. * HEADER FILES
  20. *********************************************************************************************************************/
  21. #include "pal_os_timer.h"
  22. #include "nrf_delay.h"
  23. #include "nrf_rtc.h"
  24. #include "nrf_drv_rtc.h"
  25. /**********************************************************************************************************************
  26. * MACROS
  27. *********************************************************************************************************************/
  28. /// @cond hidden
  29. /*********************************************************************************************************************
  30. * LOCAL DATA
  31. *********************************************************************************************************************/
  32. // Defined in pal_os_event.c
  33. extern volatile uint32_t g_tick_count;
  34. /**********************************************************************************************************************
  35. * LOCAL ROUTINES
  36. *********************************************************************************************************************/
  37. /// @endcond
  38. /**********************************************************************************************************************
  39. * API IMPLEMENTATION
  40. *********************************************************************************************************************/
  41. /**
  42. * Get the current time in milliseconds<br>
  43. *
  44. *
  45. * \retval uint32_t time in milliseconds
  46. */
  47. uint32_t pal_os_timer_get_time_in_milliseconds(void)
  48. {
  49. return (g_tick_count);
  50. }
  51. /**
  52. * Function to wait or delay until the given milliseconds time
  53. *
  54. * \param[in] milliseconds Delay value in milliseconds
  55. *
  56. */
  57. void pal_os_timer_delay_in_milliseconds(uint16_t milliseconds)
  58. {
  59. nrf_delay_ms(milliseconds);
  60. }
  61. /**
  62. * @}
  63. */