312MHz: 29.91s, 273.88MB/s
408MHz: 23.15s, 353.86MB/s
The performance increase is linear, so clearly the bottleneck here is the ram itself.
Being memory copy (read+write), the bandwidth would be 2x those numbers: 548 and 707MB/s
void FUN_80006654(void)
{
uint uVar1;
uint uVar2;
ushort *puVar3;
uint uVar4;
uint uVar5;
ushort *unaff_r4;
ushort *puVar6;
int unaff_r5;
int iVar7;
ushort uVar8;
uint uVar9;
puVar6 = DAT_800067a0; //0x801AC04A sample buffer
uVar8 = *(ushort *)(DAT_80006798 + 0xec); //0x801FA24C channel 1 average
uVar1 = (uint)uVar8; //again average
uVar5 = 0;
if (*(char *)(DAT_8000679c + 3) == '\x06') //0x8019D5A0 channel 1 volt per div
{
uVar2 = 0x23; //Some minimum value???
}
else
{
uVar2 = 0x14; //Less when signal not doubled
}
uVar4 = DAT_800067a4; //0x000009C4 2500 number of samples
if (*(byte *)(DAT_8000679c + 10) < 0x19) //Time base less then 25 (50mS/div - 500nS/div)
{
uVar4 = DAT_800067a8; //000005DC 1500 number of samples
}
//Skip when signal is high enough
if (uVar2 <= *(ushort *)(DAT_80006798 + 0xe8)) //signal peak peak
{
return;
}
//Channel screen offset
// avg + minimum signal needed less then screen offset or screen offset plus minimum signal needed less then avg
//Check if the center of the signal is outside the minimal signal band around the center line
if ((uVar1 + uVar2 < (uint)*(ushort *)(DAT_8000679c + 6)) || (*(ushort *)(DAT_8000679c + 6) + uVar2 < uVar1))
{
//some dc component detection with small signal on it
//Double compensation less then peakpeak
if (uVar2 >> 1 < (uint)*(ushort *)(DAT_80006798 + 0xe8)) //This is nonsense. Only if signal peak peak is less then uVar2 it can get here!!
{
return;
}
if (uVar4 == 0) //What the bullshit here. Is set to a fixed value in the above code!!!!
{
return;
}
//With full compiler optimisation it probably does not make a difference if the loop does only one sample at a time
//Plus with the number of samples set above (1500 or 2500) it will always be even number
puVar3 = DAT_800067a0 + -1; //Point to 1 sample before buffer
if ((uVar4 & 1) != 0) //Odd number of samples to do
{
*DAT_800067a0 = uVar8; //fill the buffer with avg value??
puVar3 = puVar6; //sample buffer
}
uVar4 = uVar4 >> 1; //Half the count
if (uVar4 == 0) //How can it be zero when you set it to 2500 or 1500!!!!!!!!!
{
return;
}
do //Fill the buffer with average value
{
puVar3[1] = uVar8;
uVar4 = uVar4 - 1;
puVar3 = puVar3 + 2;
*puVar3 = uVar8;
} while (uVar4 != 0);
return;
}
iVar7 = DAT_8000679c; //Settings base 0x8019D5A0
if (uVar4 == 0) //Again how can it be zero!!!!
{
puVar6 = unaff_r4; //Some stack stuff restore for return. Ghidra nonsense
iVar7 = unaff_r5;
}
uVar2 = 0; //Init
if (uVar4 == 0) //And again how can it be zero!!!!!!
{
return;
}
do
{
uVar9 = (uint)puVar6[uVar2]; //Sample buffer indexed, so get sample
if (uVar1 <= uVar9 && uVar9 != uVar1) //if average less or equal and it is not equal, so sample above average line or not
{
//above average line
if (uVar5 < 0x15) //starts on zero so first samples are on offset
{
LAB_80006738:
uVar8 = *(ushort *)(iVar7 + 6); //avg var is channel offset
}
else
{
uVar5 = 0; //Reset counter
uVar8 = *(short *)(iVar7 + 6) + 1; //avg var is offset + 1
}
}
else
{
//below average line
if (uVar1 <= uVar9) //Can only be equal since the other if takes the average less then samples
{
uVar8 = *(ushort *)(iVar7 + 6); //avg var is channel offset
uVar5 = uVar5 + 1 & 0xfffeffff;
}
else
{
if ((uVar5 < 0x15) || (uVar5 = 0, *(short *)(iVar7 + 6) == 0)) //The offset can't be zero since it is limitited between 7 and 395 but as safe guard checked on zero before subtract
goto LAB_80006738;
uVar8 = *(short *)(iVar7 + 6) - 1;
}
}
puVar6[uVar2] = uVar8; //overwrite the sample
uVar2 = uVar2 + 1 & 0xfffeffff;
if (uVar4 <= uVar2) //do all the samples
{
return;
}
} while( true );
}
if ((uint)((ulonglong)(uint)*(byte *)(iVar3 + 0xb) * (ulonglong)DAT_8001af94 >> 0x21) * -3 + (uint)*(byte *)(iVar3 + 0xb) == 0)
if (((((ulonglong)backup * (ulonglong)0xAAAAAAAB) >> 0x21) * -3) + backup) == 0)
if((backup % 3) == 0)
Damn, that's almost ofuscated code!
Here's johnny
int FUN_800337c4(char **param_1,uchar *param_2,uint param_3)
{
if (param_1 == (char **)0x0)
{
return 9;
}
typedef enum
{
FR_INVALID_OBJECT, //(9) The file/directory object is invalid
} FRESULT;
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode)
{
if (!fp)
return FR_INVALID_OBJECT;
uint FUN_80033b18(int param_1,int param_2,uint param_3,int *param_4)
{
*param_4 = 0;
uVar1 = FUN_800390e8(param_1,aiStack44);
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br)
{
*br = 0; //Clear read byte counter
res = validate(&fp->obj, &fs); //Check validity of the file object
Think I found the source code used for the file system used in the scope.
The "no no" is probably optimized because the compiler saw that there was a valid pointer when calling the function.
FatFS is widely used in the embedded world, no surprises here
uVar7 = (uint)data->data & 0xffffffe0;
while (uVar7 <= ((uint)(data->data + data->blocks * data->blocksize) & 0xffffffe0))
{
coproc_moveto_Invalidate_Data_Cache_by_MVA(uVar7);
coproc_moveto_Invalidate_Instruction_Cache_by_MVA(uVar7);
uVar7 = uVar7 + 0x20;
}
LAB_800370b8
800370b8 3e 0f 07 ee mcr p15,0x0,r0,cr7,cr14,0x1
800370bc 35 0f 07 ee mcr p15,0x0,r0,cr7,cr5,0x1
800370c0 20 00 80 e2 add r0,r0,#0x20
800370c4 01 00 50 e1 cmp r0,r1
800370c8 fa ff ff 9a bls LAB_800370b8
Anyone?
Anyone?
Sorry, can't help. Remember sometimes it's not the app programmers, but the guys that implemented the compiler...
They invalidate both the data and the instruction cache for 32 byte blocks. A pointer to where the data resides is send to the co-processor. This pointer is incremented with 32 after every iteration of the loop.
Anyone?