mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
use less static RAM to improve SH3 support
This commit is contained in:
parent
b2f580a009
commit
ece65927f0
4 changed files with 24 additions and 16 deletions
|
@ -48,7 +48,7 @@ typedef volatile struct
|
||||||
);
|
);
|
||||||
pad(19);
|
pad(19);
|
||||||
|
|
||||||
} GPACKED(0x10) etmu_t;
|
} GPACKED(4) etmu_t;
|
||||||
|
|
||||||
//---
|
//---
|
||||||
// SH7705 Timer Unit. Refer to:
|
// SH7705 Timer Unit. Refer to:
|
||||||
|
|
|
@ -66,7 +66,7 @@ static struct info {
|
||||||
/* intc_priority(): Configure the level of interrupts */
|
/* intc_priority(): Configure the level of interrupts */
|
||||||
int intc_priority(int intname, int level)
|
int intc_priority(int intname, int level)
|
||||||
{
|
{
|
||||||
struct info *i = &info[intname];
|
struct info const *i = &info[intname];
|
||||||
int IPRn = i->IPR4, IPRbits = i->IPR4bits;
|
int IPRn = i->IPR4, IPRbits = i->IPR4bits;
|
||||||
|
|
||||||
if(isSH3() && i->IPR3bits != 0)
|
if(isSH3() && i->IPR3bits != 0)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// kprint() definitions
|
// kprint() definitions
|
||||||
//---
|
//---
|
||||||
|
|
||||||
#define KPRINT_BUFSIZE 256
|
#define KPRINT_BUFSIZE 64
|
||||||
#define KFORMAT_ARGS \
|
#define KFORMAT_ARGS \
|
||||||
GUNUSED int spec, GUNUSED struct kprint_options *opt, va_list *args
|
GUNUSED int spec, GUNUSED struct kprint_options *opt, va_list *args
|
||||||
|
|
||||||
|
|
|
@ -423,10 +423,16 @@ static void init(void)
|
||||||
// Context system for this driver
|
// Context system for this driver
|
||||||
//---
|
//---
|
||||||
|
|
||||||
|
struct stored_timer {
|
||||||
|
uint32_t TCOR;
|
||||||
|
uint32_t TCNT;
|
||||||
|
uint16_t TCR;
|
||||||
|
uint16_t TSTR;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
tmu_t std[3];
|
struct stored_timer t[9];
|
||||||
etmu_t extra[6];
|
|
||||||
uint8_t TSTR;
|
uint8_t TSTR;
|
||||||
} ctx_t;
|
} ctx_t;
|
||||||
|
|
||||||
|
@ -440,20 +446,21 @@ static void ctx_save(void *buf)
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
tmu_t *c = &ctx->std[i];
|
struct stored_timer *c = &ctx->t[i];
|
||||||
c->TCOR = TMU[i].TCOR;
|
c->TCOR = TMU[i].TCOR;
|
||||||
c->TCNT = TMU[i].TCNT;
|
c->TCNT = TMU[i].TCNT;
|
||||||
c->TCR.word = TMU[i].TCR.word;
|
c->TCR = TMU[i].TCR.word;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < timer_count() - 3; i++)
|
for(int i = 3; i < timer_count(); i++)
|
||||||
{
|
{
|
||||||
etmu_t *T = &ETMU[i], *c = &ctx->extra[i];
|
struct stored_timer *c = &ctx->t[i];
|
||||||
|
etmu_t *T = &ETMU[i-3];
|
||||||
|
|
||||||
/* Don't snapshot an interrupt state, because the timer state
|
/* Don't snapshot an interrupt state, because the timer state
|
||||||
is sometimes garbage protected by a masked interrupt. */
|
is sometimes garbage protected by a masked interrupt. */
|
||||||
c->TCOR = T->TCOR ? T->TCOR : 0xffffffff;
|
c->TCOR = T->TCOR ? T->TCOR : 0xffffffff;
|
||||||
c->TCNT = T->TCNT ? T->TCNT : c->TCOR;
|
c->TCNT = T->TCNT ? T->TCNT : c->TCOR;
|
||||||
c->TCR.byte = T->TCR.byte & 0xd;
|
c->TCR = T->TCR.byte & 0xd;
|
||||||
c->TSTR = T->TSTR;
|
c->TSTR = T->TSTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,14 +472,15 @@ static void ctx_restore(void *buf)
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
tmu_t *c = &ctx->std[i];
|
struct stored_timer *c = &ctx->t[i];
|
||||||
TMU[i].TCOR = c->TCOR;
|
TMU[i].TCOR = c->TCOR;
|
||||||
TMU[i].TCNT = c->TCNT;
|
TMU[i].TCNT = c->TCNT;
|
||||||
TMU[i].TCR.word = c->TCR.word;
|
TMU[i].TCR.word = c->TCR;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < timer_count() - 3; i++)
|
for(int i = 3; i < timer_count(); i++)
|
||||||
{
|
{
|
||||||
etmu_t *T = &ETMU[i], *c = &ctx->extra[i];
|
struct stored_timer *c = &ctx->t[i];
|
||||||
|
etmu_t *T = &ETMU[i-3];
|
||||||
|
|
||||||
do T->TCOR = c->TCOR;
|
do T->TCOR = c->TCOR;
|
||||||
while(T->TCOR != c->TCOR);
|
while(T->TCOR != c->TCOR);
|
||||||
|
@ -483,8 +491,8 @@ static void ctx_restore(void *buf)
|
||||||
do T->TCNT = c->TCNT;
|
do T->TCNT = c->TCNT;
|
||||||
while(T->TCNT != c->TCNT);
|
while(T->TCNT != c->TCNT);
|
||||||
|
|
||||||
do T->TCR.byte = c->TCR.byte;
|
do T->TCR.byte = c->TCR;
|
||||||
while(T->TCR.byte != c->TCR.byte);
|
while(T->TCR.byte != c->TCR);
|
||||||
}
|
}
|
||||||
|
|
||||||
*TSTR = ctx->TSTR;
|
*TSTR = ctx->TSTR;
|
||||||
|
|
Loading…
Reference in a new issue