mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-06-18 16:55:31 -04:00
exclusiveデモ修正。
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@298 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
parent
72fd0dd832
commit
6cf0322c98
@ -27,6 +27,9 @@ void BromMain( void )
|
||||
while ( 1 )
|
||||
{
|
||||
u8 cpuID = i_osGetCpuID();
|
||||
u8 locked;
|
||||
u8 *exBuf = (u8 *)HW_MAIN_MEM + HW_MAIN_MEM_SIZE/2;
|
||||
u8 *ownerBuf = exBuf + 1;
|
||||
|
||||
osSleep(1000 - 100 * cpuID);
|
||||
if ( osTryLockByte(1, (OSLockByte *)HW_CARD_LOCK_BUF, NULL) == OS_LOCK_SUCCESS )
|
||||
@ -40,15 +43,29 @@ void BromMain( void )
|
||||
osTPrintf( "[Core%d] SpinLock is failed.\n", cpuID );
|
||||
}
|
||||
#ifndef SDK_MG20EMU
|
||||
if ( miStoreExclusiveByte(cpuID, (u8 *)HW_MAIN_MEM_EX) == MI_STREX_SUCCESS )
|
||||
locked = miLoadExclusiveByte( exBuf );
|
||||
if ( locked )
|
||||
{
|
||||
osTPrintf( "[Core%d] StrExclusive is succeed.\n", cpuID );
|
||||
osTPrintf( "[Core%d] LdrExclusive is locked with %x.\n", cpuID, locked );
|
||||
}
|
||||
else
|
||||
{
|
||||
osTPrintf( "[Core%d] StrExclusive is failed.\n", cpuID );
|
||||
osSleep(500 - 100 * cpuID);
|
||||
if ( miStoreExclusiveByte(cpuID + 1, exBuf) == MI_STREX_SUCCESS )
|
||||
{
|
||||
*ownerBuf = cpuID + 1;
|
||||
osTPrintf( "[Core%d] StrExclusive is succeed. %x -> %x.\n", cpuID, locked, *exBuf );
|
||||
*ownerBuf = 0;
|
||||
// clear exclusive flag
|
||||
miLoadExclusiveByte( exBuf );
|
||||
osSleep(500 - 100 * cpuID);
|
||||
miStoreExclusiveByte( 0, exBuf );
|
||||
}
|
||||
else
|
||||
{
|
||||
osTPrintf( "[Core%d] StrExclusive is failed. %x -> %x.\n", cpuID, locked, *exBuf );
|
||||
}
|
||||
}
|
||||
osTPrintf( "[Core%d] LoadExclusive value is %x.\n", cpuID, miLoadExclusiveByte( (u8 *)HW_MAIN_MEM_EX ) );
|
||||
#endif // SDK_MG20EMU
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user