mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-04-19 09:26:54 +02:00
83 lines
1.8 KiB
C
83 lines
1.8 KiB
C
//---
|
|
// gint:clock - Clock signals, overclock, and standby modes
|
|
//---
|
|
|
|
#ifndef GINT_CLOCK
|
|
#define GINT_CLOCK
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <gint/defs/types.h>
|
|
/* This header used to expose the sleep() function; include <gint/cpu.h> to
|
|
ensure this is still the case */
|
|
#include <gint/cpu.h>
|
|
|
|
//---
|
|
// Clock signals
|
|
//---
|
|
|
|
/* clock_frequency_t
|
|
A dump of the Clock Pulse Generator's (CPG) configuration. Use the MPU
|
|
detection functions from <gint/mpu.h> to use the correct fields. */
|
|
typedef struct
|
|
{
|
|
union {
|
|
int PLL1;
|
|
int FLL;
|
|
};
|
|
union {
|
|
int PLL2;
|
|
int PLL;
|
|
};
|
|
|
|
int Bphi_div;
|
|
int Iphi_div;
|
|
int Pphi_div;
|
|
|
|
union {
|
|
int CKIO_f;
|
|
int RTCCLK_f;
|
|
};
|
|
|
|
int Bphi_f;
|
|
int Iphi_f;
|
|
int Pphi_f;
|
|
|
|
} clock_frequency_t;
|
|
|
|
/* clock_freq() - get the frequency of the main clocks
|
|
This function returns the address of a static object which is used by the
|
|
module; this address never changes. */
|
|
const clock_frequency_t *clock_freq(void);
|
|
|
|
//---
|
|
// Overclock
|
|
//---
|
|
|
|
/* TODO: All overclock */
|
|
|
|
//---
|
|
// Sleep functions
|
|
//---
|
|
|
|
/* sleep_us(): Sleep for a fixed duration in microseconds
|
|
Stops the processor until the specified delay in microseconds has elapsed.
|
|
(The processor will still wake up occasionally to handle interrupts.) This
|
|
function selects a timer with timer_setup() called with TIMER_ANY. */
|
|
void sleep_us(uint64_t delay_us);
|
|
|
|
/* sleep_us_spin(): Actively sleep for a fixed duration in microseconds
|
|
Like sleep_us(), but uses timer_spinwait() and does not rely on interrupts
|
|
being enabled. Useful in timer code running without interrupts. */
|
|
void sleep_us_spin(uint64_t delay_us);
|
|
|
|
/* sleep_ms(): Sleep for a fixed duration in milliseconds */
|
|
#define sleep_ms(delay_ms) sleep_us((delay_ms) * 1000ull)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* GINT_CLOCK */
|