Since putc() doesn't automatically print '\r' when '\n' is printed,
we must manually do this conversion ourselves.
Signed-off-by: Sean Cross <xobs@kosagi.com>
In order to improve reliability, add a binary mode for interacting
with the SPI chip. This lets us hook up flashrom.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Due to a typo, USB receive was unreliable. This patch corrects a typo
that was causing USB receive to fail on certain devices.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The default USB-CDC driver that ships with OS X does not recognize the
Fernvale platform.
Link to a repo maintianed by Jacob Rosenthal that works around the problem.
Signed-off-by: Sean Cross <xobs@kosagi.com>
To make cross-compilation easy, refer users to the setup_codesourcery
repo that is maintained by Robert Foss.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Use the macros STDIN_FILENO and STDOUT_FILENO to refer to the file
handles for stdin and stdout. This prevents us from using the wrong handle
to write or read, which was a problem with the older code.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The memset() prototype from glibc includes __THROW and __nonnull as
decorators, which are nonstandard. Remove these for additional
compatibility with gcc.
Additionally, remove linux/types.h and linux/string.h, and replace them
with sys/types.h and sys/string.h.
The "make test" target allows for more convenient testing of new code. It
uses novena-usb-hub to power-toggle the USB port on Novena, then upload the
new build of fernly.
Signed-off-by: thesourcerer8 <pg@futureware.at>
gcc will automatically use these functions for certain operations. Don't
punt and use printf(), instead call serial_putc and serial_puts.
Signed-off-by: Sean Cross <xobs@kosagi.com>
It was nice, but it isn't as good at cross-compiling yet. Plus, by sticking
with gcc, we have one compiler throughout the entire system.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The serial is in an unknown state at the start, so print the
register list after init.
This will cause some registers to get clobbered. If we really need
to know the state of the registers early on, we should copy them
to RAM before our init code runs.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The USB device was triggering bugs in the Linux USB stack. Possibly
a queueing issue, I'm not sure. The end result was corruption in audio
playback, probably due to DMA timing issues.
Signed-off-by: Sean Cross <xobs@kosagi.com>
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>
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>
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>
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>
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>