[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] [PATCH] Firebee software poweroff
I’m always confused which of my mail addresses is active on MiNT list, so my apologies if this shows up multiple.
Am 15.12.2013 um 22:28 schrieb Jo Even Skarstein <joska@online.no>:
> On Sun, 2013-12-15 at 21:53 +0100, Vincent Rivière wrote:
>
>> I have slightly improved Jo Even's patch.
>
> Thank you for fixing my crude hack. Basically I just stole a couple of
> lines of code and some #define's from BaS. But I'm wondering about the
> TXRDY register. I left that test out on purpose simply because in BaS
> this test always returns true. So I simplified it, but maybe I should
> have fixed BaS instead... (BaS-gcc, BaS.c, lines 64-69).
This is clearly a mistake. I have fixed that in BaS. Thanks for the hint!
Not sure if your shutdown code is entirely correct/complete, however. Of course, it shuts down the machine, so the primary goal is reached.
While there was only the power button to shut down the machine before, we now have a second way to do that.
Pressing the power button generates an exception that gets handled in BaS (handler_psc3 in exceptions.S). That handler reads out RTC data from the FPGA and saves it back into the PIC. This piece of code is now missing from the shutdown code.
Not sure about all the implications of this (I guess at least if you changed the time from TOS, it will now reset to where it was before after a soft shutdown and new boot).
The missing „timesave“ code should probably be implemented into the shutdown code as well or - even better - let BaS do that (although not tried myself, that could probably be easily done by triggering a PSC3 soft interrupt in the Firebee’s interrupt controller).
MCF_INTC_INTFRCH |= MCF_INTC_INTFRCH_INTFRC32 should do it.