v850e_utils.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * include/asm-v850/v850e_utils.h -- Utility functions associated with
  3. * V850E CPUs
  4. *
  5. * Copyright (C) 2001,03 NEC Electronics Corporation
  6. * Copyright (C) 2001,03 Miles Bader <miles@gnu.org>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. *
  12. * Written by Miles Bader <miles@gnu.org>
  13. */
  14. #ifndef __V850_V850E_UTILS_H__
  15. #define __V850_V850E_UTILS_H__
  16. /* Calculate counter clock-divider and count values to attain the
  17. desired frequency RATE from the base frequency BASE_FREQ. The
  18. counter is expected to have a clock-divider, which can divide the
  19. system cpu clock by a power of two value from MIN_DIVLOG2 to
  20. MAX_DIV_LOG2, and a word-size of COUNTER_SIZE bits (the counter
  21. counts up and resets whenever it's equal to the compare register,
  22. generating an interrupt or whatever when it does so). The returned
  23. values are: *DIVLOG2 -- log2 of the desired clock divider and *COUNT
  24. -- the counter compare value to use. Returns true if it was possible
  25. to find a reasonable value, otherwise false (and the other return
  26. values will be set to be as good as possible). */
  27. extern int calc_counter_params (unsigned long base_freq,
  28. unsigned long rate,
  29. unsigned min_divlog2, unsigned max_divlog2,
  30. unsigned counter_size,
  31. unsigned *divlog2, unsigned *count);
  32. #endif /* __V850_V850E_UTILS_H__ */