| Author |
Message |
|
|
Page 1 of 1
|
| EMJB |
Posted: Mon May 14, 2012 4:05 pm |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
Am having problems with the above:
(1) Case SYSVAR_TvType with a value of anything but zero causes a crash
(2) Case SYSVAR_ScartType with a value of 1 does not change from Standard to External, but a value of 0 does change from External to Standard SCART type.
Anyone got any bright ideas what I might be doing wrong?
EMJB |
|
|
| Back to top |
|
| R2-D2 |
Posted: Thu May 17, 2012 5:54 pm |
|
|
|
Frequent contributor
Joined: 18 Dec 2006
Posts: 12149
|
EMJB wrote: (2) Case SYSVAR_ScartType with a value of 1 does not change from Standard to External, but a value of 0 does change from External to Standard SCART type.
All this one does is set/unset the relevant bit in the "etc" structure, so it's really hard to see how it wouldn't work. TF5810 or TF5800?
There's a fairly general issue concerning the TAP API and reentrancy, so might that be a possibility with the SYSVAR_TvType crash? One thing to try is to run with no TAPs then launch your TAP (so it's the only one running). |
_________________ Troubleshooting -- User Manual -- Dark Side of the Matrix: Firmwares and Patches |
|
| Back to top |
|
| EMJB |
Posted: Thu May 17, 2012 6:32 pm |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
R2-D2 wrote: EMJB wrote: (2) Case SYSVAR_ScartType with a value of 1 does not change from Standard to External, but a value of 0 does change from External to Standard SCART type.
All this one does is set/unset the relevant bit in the "etc" structure, so it's really hard to see how it wouldn't work. TF5810 or TF5800? ). TF5800. Since posting, I have found that manipulating the relevant EEPROM bit generates the right toppy menu indication and the right GetSystemVar response, but I think you need to reboot for the hardware state to actually change. If you manipulate the EEPROM bit and then call TAP_SetSystemVar(SYSVAR_ScartType,1) it behaves as if you had called TAP_SetSystemVar(SYSVAR_ScartType,0)!
R2-D2 wrote: There's a fairly general issue concerning the TAP API and reentrancy, so might that be a possibility with the SYSVAR_TvType crash? One thing to try is to run with no TAPs then launch your TAP (so it's the only one running). Will give it a try
Thanks,
EMJB |
|
|
| Back to top |
|
| EMJB |
Posted: Fri May 18, 2012 10:09 am |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
R2-D2 wrote: There's a fairly general issue concerning the TAP API and reentrancy, so might that be a possibility with the SYSVAR_TvType crash? One thing to try is to run with no TAPs then launch your TAP (so it's the only one running).
Running without any other TAPs doesn't help.
EMJB |
|
|
| Back to top |
|
| FireBird |
Posted: Fri May 18, 2012 11:08 am |
|
|
|
Frequent contributor
Joined: 05 May 2005
Posts: 348
Location: Vienna/Austria
|
To check if it is a reentrance problem, please try the following code:
Code: dword TAP_EventHandler(word event, dword param1, dword param2)
{
static bool DoNotReenter = FALSE;
if(DoNotReenter) return param1;
DoNotReenter = TRUE;
//your code
...
DoNotReenter = FALSE;
return param1;
}
If there are any returns within your code, you need to reset DoNotReenter to false before, or your TAP will be "dead" afterwards. |
|
|
| Back to top |
|
| EMJB |
Posted: Fri May 18, 2012 3:40 pm |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
@FireBird
Already have code in to detect & report if my code is re-entrant along the lines of your suggestion, so that does not appear to be the problem with the TV type causing crashes. In any case, why should it re-enter only when the type is non-zero?
EMJB |
|
|
| Back to top |
|
| R2-D2 |
Posted: Fri May 18, 2012 9:27 pm |
|
|
|
Frequent contributor
Joined: 18 Dec 2006
Posts: 12149
|
EMJB wrote: In any case, why should it re-enter only when the type is non-zero?
Because zero (Multi) might not actually cause a change to anything significant? The other changes require resets that might cause TAPs to be sent idle events (although I haven't actually checked).
I was going to ask if we've ever seen this before, but I see [url=http://forum.toppy.org.uk/forum/viewtopic.php?p=137671]you have[/ur]! Can you remember how you coped before? |
_________________ Troubleshooting -- User Manual -- Dark Side of the Matrix: Firmwares and Patches |
|
| Back to top |
|
| EMJB |
Posted: Sat May 19, 2012 6:33 am |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
R2-D2 wrote: I was going to ask if we've ever seen this before, but I see [url=http://forum.toppy.org.uk/forum/viewtopic.php?p=137671]you have[/ur]! Can you remember how you coped before?
Oops - I forgot that I raised it before - I just gave up trying to set TV Type.
EMJB |
|
|
| Back to top |
|
| R2-D2 |
Posted: Sat May 19, 2012 8:39 pm |
|
|
|
Frequent contributor
Joined: 18 Dec 2006
Posts: 12149
|
|
| Back to top |
|
| EMJB |
Posted: Sun May 20, 2012 12:22 pm |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
R2-D2 wrote: Do you have some CrashTrace analyses of a few crashes?
Generated with simple test program with no idle handler to re-enter and changes initiated with 0/1/2 keys and my usual selection of TAPs running:
Code:
$sp=805000b8
$at=00000001 $v0=00000000 $v1=8fb50044 $a0=10000401
$a1=8226adb8 $a2=00001047 $a3=81d033e8 $t0=00000000
$t1=00000000 $t2=00000000 $t3=8042f178 $t4=80402844
$t5=00000002 $t6=3000030c $t7=3000020c $t8=00000001
$t9=8017a364 $s0=82268690 $s1=00010001 $s2=8226ae78
$s3=0000e300 $s4=00000000 $s5=8017a384 $s6=00010001
$s7=8226ae78 $s8=80500250 $ra=822687dc $t0=00000044
$t1=00000000 $gp=8fb50044 $k1=82268824
<<< Unexpected Exception >>>
CAUSE = 00008408
EPC = 82268824
*EPC = 8c420000
SR = 10000403
badVAddr = 00000000
task = 0
_runCount=1
˙astTask(0) = 0
Code:
$sp=805000b8
$at=00000001 $v0=27bdffe0 $v1=82ce27f0 $a0=80500164
$a1=8227add0 $a2=00001047 $a3=81d033e8 $t0=00000000
$t1=00000000 $t2=00000000 $t3=8042f178 $t4=80402800
$t5=00000002 $t6=3000030c $t7=3000020c $t8=00000001
$t9=27bdffe0 $s0=82278690 $s1=00010002 $s2=8227ae78
$s3=0000e300 $s4=00000000 $s5=8017a384 $s6=00010002
$s7=8227ae78 $s8=80500250 $ra=82278838 $t0=00000044
$t1=00000000 $gp=82ce27f0 $k1=27bdffe0
<<< Unexpected Exception >>>
CAUSE = 00008408
EPC = 27bdffe0
Invalid EPC Address
SR = 10000403
badVAddr = 27bdffe0
task = 0
_runCount=1
lastTask(0) = 0
Code:
$sp=805000b8
$at=00000001 $v0=00000000 $v1=8fb50044 $a0=10000401
$a1=8226adb8 $a2=00001047 $a3=81d033e8 $t0=00000000
$t1=00000000 $t2=00000000 $t3=8042f178 $t4=80402800
$t5=00000002 $t6=3000030c $t7=3000020c $t8=00000001
$t9=8017a364 $s0=82268690 $s1=00010001 $s2=8226ae78
$s3=0000e300 $s4=00000000 $s5=8017a384 $s6=00010001
$s7=8226ae78 $s8=80500250 $ra=822687dc $t0=00000044
$t1=00000000 $gp=8fb50044 $k1=82268824
<<< Unexpected Exception >>>
CAUSE = 00008408
EPC = 82268824
*EPC = 8c420000
SR = 10000403
badVAddr = 00000000
task = 0
_runCount=1
lastTask(0) = 0
and this one with no other TAPs running:Code:
$sp=805000b8
$at=00000001 $v0=00000000 $v1=8fb50044 $a0=10000401
$a1=8226adb8 $a2=00001047 $a3=81d033e8 $t0=00000000
$t1=00000000 $t2=00000000 $t3=8042f178 $t4=80402844
$t5=00000002 $t6=3000030c $t7=3000020c $t8=00000001
$t9=8017a364 $s0=82268690 $s1=00010001 $s2=8226ae78
$s3=0000e300 $s4=00000000 $s5=8017a384 $s6=00010001
$s7=8226ae78 $s8=80500250 $ra=822687dc $t0=00000044
$t1=00000000 $gp=8fb50044 $k1=82268824
<<< Unexpected Exception >>>
CAUSE = 00008408
EPC = 82268824
*EPC = 8c420000
SR = 10000403
badVAddr = 00000000
task = 0
_runCount=1
lastTask(0) = 0
Hope these help to discover the cause
EMJB |
|
|
| Back to top |
|
| R2-D2 |
Posted: Sun May 20, 2012 7:21 pm |
|
|
|
Frequent contributor
Joined: 18 Dec 2006
Posts: 12149
|
|
| Back to top |
|
| EMJB |
Posted: Mon May 21, 2012 8:58 am |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
R2-D2 wrote: Sorry, I should have been clearer: can you get some output from CrashTrace?
PM sent with requested info.
EMJB |
|
|
| Back to top |
|
| EMJB |
Posted: Mon May 28, 2012 5:11 pm |
|
|
|
Frequent contributor
Joined: 08 Jul 2005
Posts: 3268
Location: Maldon Essex
|
Thanks to R2-D2, I now have a solution to both these problems.
The cause of crashing is as follows: the change of video to PAL or NTSC ends up sending EVT_VIDEO_CONV to every TAP. Due to the stupid way Topfield have done things, that long-predicted issue with the single global TAP index raises its head, since the loop to send these events just
overwrites the index.
The SCART setting problem is caused by the Topfield code completely ignoring the "value" parameter.
The fixed code is as follows:Code:
#include ... FirebirdLib.h
int Fixed_TAP_SetSystemVar(int varId, int value)
{
if (varId == SYSVAR_TvType)
{
register dword gp_r asm ("gp"); volatile dword gp = gp_r;
int res;
dword *tapIndexPtr;
dword myIndex;
InitTAPex();
tapIndexPtr = (dword*) TAP_IndexAddress; //0x8017a584;
myIndex = *(dword*) tapIndexPtr;
res = TAP_SetSystemVar(varId, value);
gp_r = gp;
*tapIndexPtr = myIndex;
return res;
}
ef ((varId == SYSVAR_ScartType) && (value != 0))
{
EEPROMSTRUCT *EprStr;
dword fwResetVideo = FindInstructionSequence(
"8f99a13c 9339000b 0019ce40 0c022166 00192782 8f9ea13c 93cf000b 93d9000d 000f7fc0 0019cf40 000f27c2 0c02217f 00192f82",
"ffe00000 fc00ffff ffe000ff fc000000 ffe0ffff ffff0000 ffe0ffff ffffffff ffe000ff ffffffff ffe0ffff fc000000 ffffffff",
0x80080000, 0x80150000, 0, TRUE);
EprStr = (EEPROMSTRUCT*)GetEEPROMAddress();
if (EprStr != NULL)
{
EprStr->ScartType = 1;
CallFirmware(fwResetVideo,0,0,0,0);
return(1);
}
else
return(TAP_GetSystemVar(SYSVAR_ScartType));
}
else
return(TAP_SetSystemVar(varId, value));
}
which seems to work OK for me.
Thanks again, R2-D2.
EMJB |
|
|
| Back to top |
|
|
|
|