mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
cpg: add spread spectrum control
Disables spread spectrum by default so that the frequency estimations of the CPG driver (notably used by the timer driver and libprof) are more accurate.
This commit is contained in:
parent
bf21246f13
commit
6c535bf7df
3 changed files with 39 additions and 11 deletions
7
TODO
7
TODO
|
@ -3,17 +3,11 @@ For the 2.1.0 release:
|
||||||
* project: remove the compat branch
|
* project: remove the compat branch
|
||||||
* project: remove the gray aliases
|
* project: remove the gray aliases
|
||||||
|
|
||||||
Issues:
|
|
||||||
* #10 support fx-CG 20
|
|
||||||
|
|
||||||
Extensions on existing code:
|
Extensions on existing code:
|
||||||
* tmu: make interrupt handlers more elegant
|
* tmu: make interrupt handlers more elegant
|
||||||
* bopti: try to display fullscreen images with TLB access + DMA on fxcg50
|
* bopti: try to display fullscreen images with TLB access + DMA on fxcg50
|
||||||
* topti: support unicode fonts
|
|
||||||
* dma: fx9860g support (need to switch it on and update the Makefile)
|
* dma: fx9860g support (need to switch it on and update the Makefile)
|
||||||
* core: try to leave add-in without reset in case of panic
|
* core: try to leave add-in without reset in case of panic
|
||||||
* hardware: fill in the HWMEM_FITTLB flag
|
|
||||||
* cpg: spread spectrum on fxcg50
|
|
||||||
* core: use cmp/str for memchr()
|
* core: use cmp/str for memchr()
|
||||||
* r61524: brightness control and clean the file
|
* r61524: brightness control and clean the file
|
||||||
* core: review forgotten globals and MPU addresses not in <gint/mpu/*.h>
|
* core: review forgotten globals and MPU addresses not in <gint/mpu/*.h>
|
||||||
|
@ -21,6 +15,7 @@ Extensions on existing code:
|
||||||
* core: run destructors when a task-switch results in leaving the app
|
* core: run destructors when a task-switch results in leaving the app
|
||||||
* core: invoke main menu instead of returning after main() ends
|
* core: invoke main menu instead of returning after main() ends
|
||||||
* core rtc: use qdiv10 to massively improve division performance
|
* core rtc: use qdiv10 to massively improve division performance
|
||||||
|
* topti: let the font specify letter and word spacing
|
||||||
|
|
||||||
Future directions.
|
Future directions.
|
||||||
* A complete file system abstraction
|
* A complete file system abstraction
|
||||||
|
|
|
@ -65,8 +65,13 @@ typedef volatile struct
|
||||||
uint32_t CKOFF :1; /* CKO Output Stop */
|
uint32_t CKOFF :1; /* CKO Output Stop */
|
||||||
uint32_t :1;
|
uint32_t :1;
|
||||||
);
|
);
|
||||||
/* TODO: CPG: Add the SSCGCR register */
|
|
||||||
pad(0x28);
|
pad(0x1c);
|
||||||
|
lword_union(SSCGCR,
|
||||||
|
uint32_t SSEN :1; /* Spread Spectrum Enable */
|
||||||
|
uint32_t :31;
|
||||||
|
);
|
||||||
|
pad(0x8);
|
||||||
|
|
||||||
lword_union(FLLFRQ,
|
lword_union(FLLFRQ,
|
||||||
uint32_t :16;
|
uint32_t :16;
|
||||||
|
|
|
@ -113,11 +113,17 @@ static void sh7305_probe(void)
|
||||||
#undef CPG
|
#undef CPG
|
||||||
|
|
||||||
//---
|
//---
|
||||||
// Other driver stuff
|
// Initialization, contexts and driver metadata
|
||||||
//---
|
//---
|
||||||
|
|
||||||
static void init(void)
|
static void init(void)
|
||||||
{
|
{
|
||||||
|
/* Disable spread spectrum in SSGSCR */
|
||||||
|
if(isSH4())
|
||||||
|
{
|
||||||
|
SH7305_CPG.SSCGCR.SSEN = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* This avoids warnings about sh7705_probe() being undefined when
|
/* This avoids warnings about sh7705_probe() being undefined when
|
||||||
building for fxcg50 */
|
building for fxcg50 */
|
||||||
#if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50))
|
#if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50))
|
||||||
|
@ -126,9 +132,31 @@ static void init(void)
|
||||||
sh7305_probe();
|
sh7305_probe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t SSCGCR;
|
||||||
|
} ctx_t;
|
||||||
|
|
||||||
|
static ctx_t sys_ctx, gint_ctx;
|
||||||
|
|
||||||
|
static void ctx_save(void *ctx)
|
||||||
|
{
|
||||||
|
ctx_t *c = ctx;
|
||||||
|
if(isSH4()) c->SSCGCR = SH7305_CPG.SSCGCR.lword;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ctx_restore(void *ctx)
|
||||||
|
{
|
||||||
|
ctx_t *c = ctx;
|
||||||
|
if(isSH4()) SH7305_CPG.SSCGCR.lword = c->SSCGCR;
|
||||||
|
}
|
||||||
|
|
||||||
gint_driver_t drv_cpg = {
|
gint_driver_t drv_cpg = {
|
||||||
.name = "CPG",
|
.name = "CPG",
|
||||||
.init = init,
|
.init = init,
|
||||||
|
.sys_ctx = &sys_ctx,
|
||||||
|
.gint_ctx = &gint_ctx,
|
||||||
|
.ctx_save = ctx_save,
|
||||||
|
.ctx_restore = ctx_restore,
|
||||||
};
|
};
|
||||||
|
|
||||||
GINT_DECLARE_DRIVER(1, drv_cpg);
|
GINT_DECLARE_DRIVER(1, drv_cpg);
|
||||||
|
|
Loading…
Reference in a new issue