Alternative library and kernel for add-in development on fx-9860G and fx-CG50 under Linux.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.9KB

  1. //---
  2. // gint:clock - Clock signals, overclock, and standby modes
  3. //---
  4. #ifndef GINT_CLOCK
  5. #define GINT_CLOCK
  6. //---
  7. // Clock signals
  8. //---
  9. /* clock_frequency_t
  10. A dump of the Clock Pulse Generator's (CPG) configuration. Use the MPU
  11. detection functions from <gint/mpu.h> to use the correct fields. */
  12. typedef struct
  13. {
  14. union {
  15. int PLL1;
  16. int FLL;
  17. };
  18. union {
  19. int PLL2;
  20. int PLL;
  21. };
  22. int Bphi_div;
  23. int Iphi_div;
  24. int Pphi_div;
  25. union {
  26. int CKIO_f;
  27. int RTCCLK_f;
  28. };
  29. int Bphi_f;
  30. int Iphi_f;
  31. int Pphi_f;
  32. } clock_frequency_t;
  33. /* clock_freq() - get the frequency of the main clocks
  34. This function returns the address of a static object which is used by the
  35. module; this address never changes. */
  36. const clock_frequency_t *clock_freq(void);
  37. //---
  38. // Overclock
  39. //---
  40. /* TODO: All overclock */
  41. //---
  42. // Sleep functions
  43. //---
  44. /* sleep() - halt the processor until an event occurs
  45. The function stops the processor until an interrupt is accepted; the
  46. duration is not known in advance. This function should be used when the
  47. add-in is idle, for instance while waiting for keyboard input. */
  48. #define sleep() __asm__("sleep")
  49. /* sleep_us() - sleep for a definite duration in microseconds
  50. Stops the processor until [delay_us] microseconds have elapsed. Interrupts
  51. may occur during that time (especially timers firing), in which case the
  52. events will be treated as usual. The processor will resume sleeping after
  53. handling them.
  54. The user may choose the timer used to time out the sleep. Remember that only
  55. timers 0 to 2 have microsecond-level resolution; other timers count in units
  56. of about 30 us.
  57. @timer Which timer to use to time out the sleep
  58. @us_delay How long to sleep (in microseconds) */
  59. void sleep_us(int timer, int us_delay);
  60. /* sleep_ms() - sleep for a definite duration in milliseconds */
  61. #define sleep_ms(timer, ms_delay) sleep_us(timer, (ms_delay) * 1000)
  62. #endif /* GINT_CLOCK */