[NTLK] Einstein on Android
Matthias Melcher
mm at matthiasm.com
Mon Feb 6 07:32:19 EST 2017
> On Feb 5, 2017, at 8:31 PM, Matthias Melcher <mm at matthiasm.com> wrote:
>
>> The binary stubs in Drivers/TSerialChipVoyager.cp actually seem to be in place, but nothing in ExecuteSerialDriverNative is called. Instead we get the "missing resources" error when we try to open a serial port. So this may be a missing hardware register or whatever. Gosh, I am so mad at myself!
>
> So, after stepping through the code, the function InitializeCommHardware() is called very *very* early in the game. If I see this right, it is called before the REx had a chance to link in the drivers for our own serial emulation code. InitializeCommHardware() then calls the ROM code for creating the serial ports, which fuddles around with DMA and interrupt, eventually failing and returning an error code that states that this resource does not exist.
>
> It is not clear to me how and when the REx starts to patch the drivers into the system, and if that can be done before InitializeCommHardware() is called. Or maybe the current drivers are not installed at all?
OK, more disassembly reading. Eventually I'll just rewrite the ROM by reading the ARM code... (LOL!).
It seems that "TSerialChipVoyager" is not supported as an external driver in REx, but instead hardcoded in ROM. So adding this driver in a REx does nothing.
I am stepping through the original code and some modified code, but I am still getting unexpected results.
When registering the hardware COM ports, eventually, TSerialChipVoyager::InitByOption(TOption *) is called. Registering interrupts and DMA all works just fine. Registering the hardware with "PTheSerChipRegistry::Register(TSerialChip *, unsigned long)" works well until "TUConfigServer::RegisterULongName(unsigned long, char *, unsigned long, unsigned long)" is asked to register 'extr' and the other serial port names, which fails with "Already registered".
I don't understand why that would be! Can anyone help?
Registering an alternative TSerialChipVoyager driver is possible by patching a single word in ROM, but it is not very elegant... .
- Matthias
More information about the NewtonTalk
mailing list