xtensa_init.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2019 Cadence Design Systems, Inc.
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
  7. */
  8. /*
  9. * Copyright (c) 2015-2019 Cadence Design Systems, Inc.
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining
  12. * a copy of this software and associated documentation files (the
  13. * "Software"), to deal in the Software without restriction, including
  14. * without limitation the rights to use, copy, modify, merge, publish,
  15. * distribute, sublicense, and/or sell copies of the Software, and to
  16. * permit persons to whom the Software is furnished to do so, subject to
  17. * the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be included
  20. * in all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  25. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  26. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  27. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  28. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. */
  30. /*
  31. * XTENSA INITIALIZATION ROUTINES CODED IN C
  32. *
  33. * This file contains miscellaneous Xtensa RTOS-generic initialization functions
  34. * that are implemented in C.
  35. */
  36. #ifdef XT_BOARD
  37. #include "xtensa/xtbsp.h"
  38. #endif
  39. #include "xtensa_rtos.h"
  40. #include "sdkconfig.h"
  41. #include "esp_private/esp_clk.h"
  42. #ifdef XT_RTOS_TIMER_INT
  43. unsigned _xt_tick_divisor = 0; /* cached number of cycles per tick */
  44. void _xt_tick_divisor_init(void)
  45. {
  46. _xt_tick_divisor = esp_clk_cpu_freq() / XT_TICK_PER_SEC;
  47. }
  48. /* Deprecated, to be removed */
  49. int xt_clock_freq(void)
  50. {
  51. return esp_clk_cpu_freq();
  52. }
  53. #endif /* XT_RTOS_TIMER_INT */