clock.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * This file is part of FH8620 BSP for RT-Thread distribution.
  3. *
  4. * Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
  5. * All rights reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. *
  21. * Visit http://www.fullhan.com to get contact with Fullhan.
  22. *
  23. * Change Logs:
  24. * Date Author Notes
  25. */
  26. #ifndef TIMER_H_
  27. #define TIMER_H_
  28. #include <rtdef.h>
  29. void rt_hw_clock_init(void);
  30. void rt_hw_get_clock(void);
  31. void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn);
  32. void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv);
  33. struct fh_clk;
  34. /*
  35. void fh_pmu_open(void);
  36. void fh_pmu_close(void);
  37. */
  38. #define DIFF_SDC_REFCLK_0 (0)
  39. #define DIFF_SDC_REFCLK_90 (1)
  40. #define DIFF_SDC_REFCLK_180 (2)
  41. #define DIFF_SDC_REFCLK_270 (3)
  42. #define SDC_CLK_PARA_ERROR (0xffff0000)
  43. #define SDC_CLK_PARA_OK (0)
  44. void clk_gate(struct fh_clk *p_clk);
  45. void clk_ungate(struct fh_clk *p_clk);
  46. struct fh_clk *clk_get(const char *name);
  47. rt_uint32_t clk_get_rate(struct fh_clk *p_clk);
  48. void clk_set_rate(struct fh_clk *p_clk,rt_uint32_t rate_value);
  49. rt_uint32_t sdc_get_phase(struct fh_clk *p_clk);
  50. rt_uint32_t sdc_set_phase(struct fh_clk *p_clk,rt_uint32_t phase);
  51. #endif