Commit graph

162 commits

Author SHA1 Message Date
Sean Cross
58d7c3b17a 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>
2014-11-28 17:33:36 +08:00
Sean Cross
2e3dfee040 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>
2014-11-28 17:33:20 +08:00
Sean Cross
a7ff5acb5d 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>
2014-11-28 17:30:33 +08:00
Sean Cross
f5434fe897 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>
2014-11-28 17:28:42 +08:00
Sean Cross
b8a7aedbd7 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>
2014-11-28 17:10:00 +08:00
Sean Cross
fe826f6e1d 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>
2014-11-28 13:13:38 +08:00
Sean Cross
f8991202c6 cmd: Use strtoul instead of _strtoul
The non-underscore one comes from vsprintf.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-11-28 13:12:53 +08:00
Sean Cross
698b123bd0 bionic: Remove strtoul
We now use the one exposed in vsprintf.  This removes code duplication.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-11-28 13:12:07 +08:00
Sean Cross
07d1a09254 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>
2014-11-26 16:18:41 +08:00
Sean Cross
0ca1a5d757 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>
2014-11-25 17:09:33 +08:00
Sean Cross
6360f6d40e cmd-sleep: Take advantage of _msleep and _usleep
These are available globally now.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-11-25 17:08:59 +08:00
Sean Cross
b5829b9694 bionic: Add _msleep and _usleep commands
Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-11-25 17:08:48 +08:00
Sean Cross
d93e92acda cmd-load: Add load command 2014-09-19 16:14:01 +08:00
Sean Cross
107f38c699 include: Add missing fernvale-usb.h
We now use our own USB drivers.
2014-09-19 16:11:54 +08:00
Sean Cross
7e6500a28e main: Add firmware load/jump 2014-09-19 16:10:34 +08:00
bunnie
8f13d99dd4 LCD turns on and draws.
Some basic progress on the LCD, such that the interface can
turn-on and draw.

The implementation uses a slow sequential-write method to update
the display; the vestiges of an auto-copy system are also in
place but not yet debugged.

The system seems to support two methods for issuing commands and
data to the LCD. One is a simple write-to-commit method. The
other is a more sophisticated command list that's set up, and
then dispatched. The write-to-commit kind of works now, although
it's left to be seen if we aren't running too far ahead of
commands or missing some wait states.

To get the demo to work, run the following commands in fernly:

bl 5  (turns on backlight)
lcd su   (sets up GPIOs and timing)
lcd init (initializes the LCD-side controller)
lcd tp1  (blasts a small test pattern to the top of display)

You'll note that the VCOM setting looks to be off (alternate
light/dark lines).

Next steps include:

1) verify that commands are being issued correctly to the LCD
(no missing commands due to writes happening faster than
the interface can keep up)

2) cross-check with LCD datasheet for the initialization
of the controller -- there are some undocumented commands
I left out in this implementation, maybe they need to go in
there; I also left out the gamma table.

3) get the autocopy method to work. I think, from what I can
tell, the autocopy will take a region of interest from memory,
composite it with up to four other regions with alpha blending,
and then auto-copy this to the LCD. You can insert commands
into the auto-copy stream as necessary, but I believe this,
combined with the TE (tearing effect) sync bit, will allow
you to just write to a region of memory as a frame buffer
and have it show up on the display without any CPU intervention.

Could be wrong tho....
2014-09-17 02:44:34 +08:00
bunnie
0893cc4584 add clock gating header file to fernvale 2014-09-16 18:52:33 +08:00
bunnie
d21c18d1f0 initial take at LCD API
Nothing is correct at the moment, but basic commands are integrated
into the shell, which will simplifying merging later on for files
that are shared-edit.
2014-09-15 10:15:25 +00:00
bunnie
09600c82c9 add backlight control command to fernly
The command "bl" will set the backlight to a value from between 0
to a #define constant max brightness level.
2014-09-15 14:59:53 +08:00
bunnie
49c2130545 add LED control function
Command-line to turn LEDs on the board on or off.

Also, modified .gitignore to be emacs-friendly.
2014-09-15 04:57:19 +00:00
Sean Cross
5f181600c9 spi: Add Fernvale SPI header 2014-09-12 16:48:58 +08:00
Sean Cross
43a1517aec spi: Get basic SPI commands working 2014-09-12 16:46:11 +08:00
Sean Cross
8d0e780508 include: Add GPIO header file
This adds a header file to describe Fernvale's unique GPIO scheme.
2014-09-12 16:45:38 +08:00
Sean Cross
4658e533c1 scriptic: Add more complete script debugging
This adds the ability to print out each command as it's executed.

This is a compile-time option.
2014-09-11 17:28:51 +08:00
Sean Cross
50dc503837 scriptic: Support searching by name
Rather than hardcoding scriptic scripts, we can look through all
known script names.
2014-09-11 16:44:42 +08:00
Sean Cross
72f92b7fd2 cmd: Split commands into their own files
Commands shouldn't all live in main.c.  Move everything except
"help" into its own command file.
2014-09-11 14:18:51 +08:00
Sean Cross
555af9447c fernvale: Fully get PSRAM working
This uses scriptic to run scripts that do bringup of various systems.
2014-09-11 13:16:06 +08:00
Sean Cross
40c1a9941f usb-loader: Remove unneeded code
We remove more code from usb-loader, to make it fit in weird places.
2014-09-11 13:15:37 +08:00
Sean Cross
c41333448f main: Fix "(null)" when unknown command is tried
It used to print out "Unknown command: (null)".  Fix it so that it
prints out the actual command instead.
2014-09-11 13:15:37 +08:00
Sean Cross
c2c331160c main: Add msleep command
Using a delay loop, it's more or less working right.
2014-09-11 13:15:37 +08:00
Sean Cross
1c3ef737bf fernly: Fix printf("%d") > 99999
This adds lots of divison code, which fixes, among other things,
calling printf() with %d greater than 99999.
2014-09-11 13:15:37 +08:00
Sean Cross
05532408dc main: Disable battery watchdog
This allows us to run without a battery.  Otherwise, it would reboot
after about five seconds.
2014-09-09 15:04:36 +08:00
Sean Cross
4a2c43cde7 main: Don't enable interrupts
We don't yet have interrupts, so don't enable them.
2014-09-09 15:04:36 +08:00
Sean Cross
3f0bf86658 vectors: Get rid of irq C function
We don't have interrupts yet.
2014-09-09 15:04:35 +08:00
Sean Cross
cea2d6f9b5 fernvale.ld: Load at address 0x70000000
We're hacking on PSRAM now, so load to iram.
2014-09-09 15:04:35 +08:00
Sean Cross
ec4ac95cc4 start: Don't relocate to address 0
fernly runs in IRAM now, before PSRAM has been set up.
2014-09-09 15:04:35 +08:00
Sean Cross
d5024b490a usb-loader: Get basic USB loader working well
This is good enough to load fernly over USB.
2014-09-09 15:04:35 +08:00
Sean Cross
6a4fe44cd5 serial: Enable USB serial mode 2014-09-09 14:02:17 +08:00
Sean Cross
52c7aa83b8 vsprintf: Fix string printing
It would previously only print out the first character.
2014-09-09 13:59:43 +08:00
Sean Cross
f82c53bfdc bionic: Fix strnlen to work with length of -1
This is used to mean INT_MAX.
2014-09-09 13:59:18 +08:00
Sean Cross
a066600558 main: Add peek and poke commands 2014-09-09 11:14:06 +08:00
Sean Cross
48710a3b69 usb-loader: Add a loader that supports the ROM 2014-09-09 11:13:24 +08:00
Sean Cross
02a62aba4e Makefile: Build fernvale loader host and target files
THe Fernly loader consists of a binary run on the target, to load
data into RAM, and on the host, to feed data to the target.  This
gets the build system to compile both halves.
2014-09-01 16:45:46 +08:00
Sean Cross
f1bd07c69d loader: Get basic loader working well
The loader binary is now very reliable.
2014-09-01 16:44:54 +08:00
Sean Cross
f1c1e5ba27 fernly-loader: Set serial port speed after opening
When Novena first boots, its serial port is running at an unknown
speed.  Fernvale runs at 115200.  Set the serial port speed once
the serial port is opened.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-09-01 16:44:03 +08:00
Sean Cross
dd6616b677 fernly: Add two-stage bootloader and get basics working
The romulator only emulates 64k of SPI ROM.  That's not enough for anything
interesting.

Add a second-stage bootloader to send data to Fernvale over serial.  This
will allow us to work around needing code relocations, and allow for much
larger binaries.
2014-08-27 15:24:43 +08:00
Sean Cross
7eaaa0cc14 irq: Work on getting IRQs working 2014-08-27 12:32:06 +08:00
Sean Cross
8f18cfd58b fernvale: Get IRQs to at least do something
IRQs now do something.  They still don't work, though.
2014-08-26 17:09:42 +08:00
Sean Cross
624dbb2f2e include: Add printf.h 2014-08-19 16:08:39 +08:00
Sean Cross
6f04d659aa main: Add back in command line mode
It's useful to have.
2014-08-19 15:55:02 +08:00