forked from len0rd/rockbox
rk27xx: slightly optimize commit_discard_dcache_range()
Change-Id: I13ce643d4ba26db5de9ffa083070d7f40b0e7b1f
This commit is contained in:
parent
e2be0e75ab
commit
29e51a1777
1 changed files with 5 additions and 6 deletions
|
@ -218,18 +218,17 @@ void commit_discard_dcache (void) __attribute__((alias("commit_discard_idcache")
|
||||||
|
|
||||||
void commit_discard_dcache_range (const void *base, unsigned int size)
|
void commit_discard_dcache_range (const void *base, unsigned int size)
|
||||||
{
|
{
|
||||||
int cnt = size + ((unsigned long)base & 0x1f);
|
/* 0x01 is opcode for cache line commit discard */
|
||||||
unsigned long opcode = ((unsigned long)base & 0xffffffe0) | 0x01;
|
uint32_t end_opcode = (uint32_t)((uintptr_t)base + size) | 0x01;
|
||||||
|
uint32_t opcode = (uint32_t)((uintptr_t)base & 0xffffffe0) | 0x01;
|
||||||
|
|
||||||
int old_irq = disable_irq_save();
|
int old_irq = disable_irq_save();
|
||||||
|
|
||||||
while (cnt > 0)
|
while (opcode <= end_opcode)
|
||||||
{
|
{
|
||||||
CACHEOP = opcode;
|
|
||||||
|
|
||||||
while (CACHEOP & 0x03);
|
while (CACHEOP & 0x03);
|
||||||
|
|
||||||
cnt -= 32;
|
CACHEOP = opcode;
|
||||||
opcode += 32;
|
opcode += 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue