bionic: Add _msleep and _usleep commands

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-sleep: Take advantage of _msleep and _usleep

These are available globally now.

Signed-off-by: Sean Cross <xobs@kosagi.com>
main: Remove warning when building without AUTOMATED

The get_hex() function is only used when in AUTOMATED mode.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-lcd: Reformat code before doing "auto" work

Before we work on trying to get the LCD to be self-refreshing, reformat
the code to use our macros and indentation style.

Signed-off-by: Sean Cross <xobs@kosagi.com>
bionic: Remove strtoul

We now use the one exposed in vsprintf.  This removes code duplication.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd: Use strtoul instead of _strtoul

The non-underscore one comes from vsprintf.

Signed-off-by: Sean Cross <xobs@kosagi.com>
emi: Remove infinite loop waiting on calibration

We used to while(1) wait for EMI to calibrate, but sometimes EMI never
returns from calibration.  Break if it hasn't finished after 256 tries.

Signed-off-by: Sean Cross <xobs@kosagi.com>
lcd: Add basic LCD library

This supports setting up the LCD, and then starting a transfer.

Interrupts are required to have self-refresh working.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-lcd: Refactor lcd command, get PIO/DMA working

This major refactor of the "lcd" command gets two different PIO test
commands working (tpp1 and tpp2), along with a test command for dma
(tpd) that, when called multiple times, will step through a framebuffer
pattern and blast it out to the screen.

Signed-off-by: Sean Cross <xobs@kosagi.com>
lcd: improve DMA support

Rather than completely rewriting everything on each runthrough, we
now only refill the command buffer before toggling the RUN bit.

This will improve performance by eliminating excessive register writes.

Signed-off-by: Sean Cross <xobs@kosagi.com>
magic: Force the use of gcc for scriptic

Scriptic uses some directives that aren't available in clang, so assemble
scripts using gcc.

Signed-off-by: Sean Cross <xobs@kosagi.com>
vsprintf: expose strtoul function

This function is a wrapper around simple_strtoul, and allows us to expose
it, replacing the one in bionic.c.

Signed-off-by: Sean Cross <xobs@kosagi.com>
lcd: get rid of lcd_setup()

Combine init and setup into one function, and call it lcd_init().

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-lcd: Remove "lcd setup" command

This function no longer exists.

Signed-off-by: Sean Cross <xobs@kosagi.com>
main: Initialize LCD on boot

Now that we have LCD working, we can initialize the LCD when the board boots.

Signed-off-by: Sean Cross <xobs@kosagi.com>