summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte2010-03-07 12:14:11 +0100
committerHarald Welte2010-03-07 12:16:25 +0100
commitfab52c296cb77914fdb2edbdda8083edbca3bf1d (patch)
treec94c8a8d2d1962920a2d4742541d4de2b348aaf2
parentHandle EAGAIN. Print errors properly. (diff)
downloadosmocom-fab52c296cb77914fdb2edbdda8083edbca3bf1d.tar.gz
osmocom-fab52c296cb77914fdb2edbdda8083edbca3bf1d.tar.xz
osmocom-fab52c296cb77914fdb2edbdda8083edbca3bf1d.zip
Added Solomon SSD1783 display driver for Motorola C155
Signed-off-by: Steve Markgraf <steve@steve-m.de> Conflicts: src/target/firmware/Makefile
-rw-r--r--src/target/firmware/Makefile2
-rw-r--r--src/target/firmware/board/compal_e99/init.c128
-rw-r--r--src/target/firmware/calypso/uwire.c2
-rw-r--r--src/target/firmware/display/font_r8x8_horiz.c261
-rw-r--r--src/target/firmware/display/ssd1783.c215
-rw-r--r--src/target/firmware/include/display/ssd1783.h63
6 files changed, 669 insertions, 2 deletions
diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile
index d02d940..ec5637f 100644
--- a/src/target/firmware/Makefile
+++ b/src/target/firmware/Makefile
@@ -4,7 +4,7 @@ INCLUDES=-Iinclude/ -I../../../include
# Various objects that are currently linked into all applications
FLASH_OBJS=flash/cfi_flash.o
-DISPLAY_OBJS=display/font_r8x8.o display/st7558.o
+DISPLAY_OBJS=display/font_r8x8.o display/font_r8x8_horiz.o display/st7558.o display/ssd1783.o
ABB_OBJS=abb/twl3025.o
RF_OBJS=rf/trf6151.o
BOARD_C123_OBJS=board/common/rffe_compal_dualband.o board/compal_e88/init.o
diff --git a/src/target/firmware/board/compal_e99/init.c b/src/target/firmware/board/compal_e99/init.c
new file mode 100644
index 0000000..ce48e80
--- /dev/null
+++ b/src/target/firmware/board/compal_e99/init.c
@@ -0,0 +1,128 @@
+/* Initialization for the Compal E99 (Motorola C155) */
+
+/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2010 by Steve Markgraf <steve@steve-m.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+
+#include <debug.h>
+#include <memory.h>
+#include <board.h>
+#include <keypad.h>
+#include <console.h>
+#include <cfi_flash.h>
+
+#include <calypso/irq.h>
+#include <calypso/clock.h>
+#include <calypso/dma.h>
+#include <calypso/rtc.h>
+#include <calypso/timer.h>
+#include <calypso/uart.h>
+
+#include <comm/sercomm.h>
+
+#include <abb/twl3025.h>
+#include <rf/trf6151.h>
+#include <display/ssd1783.h>
+
+#define ARMIO_LATCH_OUT 0xfffe4802
+#define ARMIO_CNTL_REG 0xfffe4804
+#define ASIC_CONF_REG 0xfffef008
+
+static void board_io_init(void)
+{
+ uint16_t reg;
+
+ reg = readw(ASIC_CONF_REG);
+ /* LCD Set I/O(3) / SA0 to I/O(3) mode */
+ reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ;
+ /* don't set function pins to I2C Mode, C155 uses UWire */
+ /* TWL3025: Set SPI+RIF RX clock to rising edge */
+ reg |= (1 << 13) | (1 << 14);
+ writew(reg, ASIC_CONF_REG);
+
+ /* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */
+ /* FIXME: Put the display backlight control to backlight.c */
+ reg = readw(ARMIO_CNTL_REG);
+ reg &= ~( (1 << 3) | (1 << 1));
+ writew(reg, ARMIO_CNTL_REG);
+
+ /* LCD Set I/O(3) output low */
+ reg = readw(ARMIO_LATCH_OUT);
+ reg &= ~(1 << 3);
+ reg |= (1 << 1);
+ writew(reg, ARMIO_LATCH_OUT);
+}
+
+void board_init(void)
+{
+ /* FIXME: this needs to go to board_e99/init.c once we have it */
+ wdog_enable(0);
+
+ static cfi_flash_t flash;
+ // XXX: move after mapping initialization and use final address
+ flash_init(&flash, 0x00000000);
+
+ calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
+ calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1);
+ calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1);
+ calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1);
+ calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1);
+ calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1);
+ calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0);
+
+ /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */
+ calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2);
+
+ /* Configure the RHEA bridge with some sane default values */
+ calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0);
+
+ board_io_init();
+
+ /* Enable bootrom mapping to route exception vectors to RAM */
+ calypso_bootrom(1);
+ calypso_exceptions_install();
+
+ irq_init();
+
+ /* initialize MODEM UART to be used for sercomm*/
+ uart_init(SERCOMM_UART_NR);
+ uart_baudrate(SERCOMM_UART_NR, UART_115200);
+
+ /* initialize IRDA UART to be used for old-school console code.
+ * note: IRDA uart only accessible on C115 and C117 PCB */
+ uart_init(CONS_UART_NR);
+ uart_baudrate(CONS_UART_NR, UART_115200);
+
+ hwtimer_init();
+
+ dma_init();
+ rtc_init();
+
+ /* Initialize LCD driver (uses UWire) */
+ ssd1783_init();
+
+ keypad_init();
+
+ /* Initialize ABB driver (uses SPI) */
+ twl3025_init();
+}
diff --git a/src/target/firmware/calypso/uwire.c b/src/target/firmware/calypso/uwire.c
index 5320a5e..ebdd277 100644
--- a/src/target/firmware/calypso/uwire.c
+++ b/src/target/firmware/calypso/uwire.c
@@ -23,7 +23,7 @@
#include <stdint.h>
#include <stdio.h>
-#define DEBUG
+//#define DEBUG
#include <debug.h>
#include <memory.h>
diff --git a/src/target/firmware/display/font_r8x8_horiz.c b/src/target/firmware/display/font_r8x8_horiz.c
new file mode 100644
index 0000000..046d09b
--- /dev/null
+++ b/src/target/firmware/display/font_r8x8_horiz.c
@@ -0,0 +1,261 @@
+/* 8x8 font, right aligned, horizontal scanning */
+
+const unsigned char fontdata_r8x8_horiz[] ={
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,
+ 0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,
+ 0x6c,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,
+ 0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,
+ 0x1c,0x1c,0x1c,0x7f,0x7f,0x6b,0x08,0x1c,
+ 0x10,0x10,0x38,0x7c,0xfe,0x7c,0x10,0x38,
+ 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,
+ 0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,
+ 0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,
+ 0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,
+ 0x0f,0x07,0x0f,0x7d,0xcc,0xcc,0xcc,0x78,
+ 0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,
+ 0x3f,0x33,0x3f,0x30,0x30,0x70,0xf0,0xe0,
+ 0x7f,0x63,0x7f,0x63,0x63,0x67,0xe6,0xc0,
+ 0x18,0xdb,0x3c,0xe7,0xe7,0x3c,0xdb,0x18,
+ 0x80,0xe0,0xf8,0xfe,0xf8,0xe0,0x80,0x00,
+ 0x02,0x0e,0x3e,0xfe,0x3e,0x0e,0x02,0x00,
+ 0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,
+ 0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,
+ 0x7f,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x00,
+ 0x3e,0x63,0x38,0x6c,0x6c,0x38,0xcc,0x78,
+ 0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,
+ 0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,
+ 0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,
+ 0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,
+ 0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,
+ 0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,
+ 0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,
+ 0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,
+ 0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,
+ 0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00,
+ 0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,
+ 0x6c,0x6c,0xfe,0x6c,0xfe,0x6c,0x6c,0x00,
+ 0x18,0x3e,0x60,0x3c,0x06,0x7c,0x18,0x00,
+ 0x00,0x63,0x66,0x0c,0x18,0x33,0x63,0x00,
+ 0x1c,0x36,0x1c,0x3b,0x6e,0x66,0x3b,0x00,
+ 0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x0c,0x18,0x30,0x30,0x30,0x18,0x0c,0x00,
+ 0x30,0x18,0x0c,0x0c,0x0c,0x18,0x30,0x00,
+ 0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,
+ 0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30,
+ 0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,
+ 0x03,0x06,0x0c,0x18,0x30,0x60,0x40,0x00,
+ 0x3e,0x63,0x67,0x6f,0x7b,0x73,0x3e,0x00,
+ 0x18,0x38,0x58,0x18,0x18,0x18,0x7e,0x00,
+ 0x3c,0x66,0x06,0x1c,0x30,0x66,0x7e,0x00,
+ 0x3c,0x66,0x06,0x1c,0x06,0x66,0x3c,0x00,
+ 0x0e,0x1e,0x36,0x66,0x7f,0x06,0x0f,0x00,
+ 0x7e,0x60,0x7c,0x06,0x06,0x66,0x3c,0x00,
+ 0x1c,0x30,0x60,0x7c,0x66,0x66,0x3c,0x00,
+ 0x7e,0x66,0x06,0x0c,0x18,0x18,0x18,0x00,
+ 0x3c,0x66,0x66,0x3c,0x66,0x66,0x3c,0x00,
+ 0x3c,0x66,0x66,0x3e,0x06,0x0c,0x38,0x00,
+ 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00,
+ 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30,
+ 0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,
+ 0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,
+ 0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,
+ 0x3c,0x66,0x06,0x0c,0x18,0x00,0x18,0x00,
+ 0x3e,0x63,0x6f,0x69,0x6f,0x60,0x3e,0x00,
+ 0x18,0x3c,0x66,0x66,0x7e,0x66,0x66,0x00,
+ 0x7e,0x33,0x33,0x3e,0x33,0x33,0x7e,0x00,
+ 0x1e,0x33,0x60,0x60,0x60,0x33,0x1e,0x00,
+ 0x7c,0x36,0x33,0x33,0x33,0x36,0x7c,0x00,
+ 0x7f,0x31,0x34,0x3c,0x34,0x31,0x7f,0x00,
+ 0x7f,0x31,0x34,0x3c,0x34,0x30,0x78,0x00,
+ 0x1e,0x33,0x60,0x60,0x67,0x33,0x1f,0x00,
+ 0x66,0x66,0x66,0x7e,0x66,0x66,0x66,0x00,
+ 0x3c,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,
+ 0x0f,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,
+ 0x73,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,
+ 0x78,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,
+ 0x63,0x77,0x7f,0x7f,0x6b,0x63,0x63,0x00,
+ 0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x00,
+ 0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,
+ 0x7e,0x33,0x33,0x3e,0x30,0x30,0x78,0x00,
+ 0x3c,0x66,0x66,0x66,0x6e,0x3c,0x0e,0x00,
+ 0x7e,0x33,0x33,0x3e,0x36,0x33,0x73,0x00,
+ 0x3c,0x66,0x30,0x18,0x0c,0x66,0x3c,0x00,
+ 0x7e,0x5a,0x18,0x18,0x18,0x18,0x3c,0x00,
+ 0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x00,
+ 0x66,0x66,0x66,0x66,0x66,0x3c,0x18,0x00,
+ 0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,
+ 0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x00,
+ 0x66,0x66,0x66,0x3c,0x18,0x18,0x3c,0x00,
+ 0x7f,0x63,0x46,0x0c,0x19,0x33,0x7f,0x00,
+ 0x3c,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,
+ 0x60,0x30,0x18,0x0c,0x06,0x03,0x01,0x00,
+ 0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,
+ 0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
+ 0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x3c,0x06,0x3e,0x66,0x3b,0x00,
+ 0x70,0x30,0x30,0x3e,0x33,0x33,0x6e,0x00,
+ 0x00,0x00,0x3c,0x66,0x60,0x66,0x3c,0x00,
+ 0x0e,0x06,0x06,0x3e,0x66,0x66,0x3b,0x00,
+ 0x00,0x00,0x3c,0x66,0x7e,0x60,0x3c,0x00,
+ 0x1c,0x36,0x30,0x78,0x30,0x30,0x78,0x00,
+ 0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x7c,
+ 0x70,0x30,0x36,0x3b,0x33,0x33,0x73,0x00,
+ 0x18,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
+ 0x06,0x00,0x06,0x06,0x06,0x66,0x66,0x3c,
+ 0x70,0x30,0x33,0x36,0x3c,0x36,0x73,0x00,
+ 0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,
+ 0x00,0x00,0x66,0x7f,0x7f,0x6b,0x63,0x00,
+ 0x00,0x00,0x7c,0x66,0x66,0x66,0x66,0x00,
+ 0x00,0x00,0x3c,0x66,0x66,0x66,0x3c,0x00,
+ 0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x78,
+ 0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x0f,
+ 0x00,0x00,0x6e,0x3b,0x33,0x30,0x78,0x00,
+ 0x00,0x00,0x3e,0x60,0x3c,0x06,0x7c,0x00,
+ 0x08,0x18,0x3e,0x18,0x18,0x1a,0x0c,0x00,
+ 0x00,0x00,0x66,0x66,0x66,0x66,0x3b,0x00,
+ 0x00,0x00,0x66,0x66,0x66,0x3c,0x18,0x00,
+ 0x00,0x00,0x63,0x6b,0x7f,0x7f,0x36,0x00,
+ 0x00,0x00,0x63,0x36,0x1c,0x36,0x63,0x00,
+ 0x00,0x00,0x66,0x66,0x66,0x3e,0x06,0x7c,
+ 0x00,0x00,0x7e,0x4c,0x18,0x32,0x7e,0x00,
+ 0x0e,0x18,0x18,0x70,0x18,0x18,0x0e,0x00,
+ 0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x00,
+ 0x70,0x18,0x18,0x0e,0x18,0x18,0x70,0x00,
+ 0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,
+ 0x3c,0x66,0x60,0x66,0x3c,0x0c,0x06,0x3c,
+ 0x00,0x66,0x00,0x66,0x66,0x66,0x3f,0x00,
+ 0x1c,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00,
+ 0x7e,0xc3,0x3c,0x06,0x3e,0x66,0x3f,0x00,
+ 0x66,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
+ 0x70,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
+ 0x18,0x18,0x3c,0x06,0x3e,0x66,0x3f,0x00,
+ 0x00,0x00,0x3c,0x60,0x60,0x3c,0x06,0x1c,
+ 0x7e,0xc3,0x3c,0x66,0x7e,0x60,0x3c,0x00,
+ 0xcc,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00,
+ 0x70,0x00,0x3c,0x66,0x7e,0x60,0x3c,0x00,
+ 0x66,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
+ 0x3e,0x63,0x1c,0x0c,0x0c,0x0c,0x1e,0x00,
+ 0x70,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
+ 0x63,0x1c,0x36,0x63,0x7f,0x63,0x63,0x00,
+ 0x18,0x18,0x00,0x3c,0x66,0x7e,0x66,0x00,
+ 0x1c,0x00,0xfc,0x60,0x78,0x60,0xfc,0x00,
+ 0x00,0x00,0x7f,0x0c,0x7f,0xcc,0x7f,0x00,
+ 0x1f,0x36,0x66,0x7f,0x66,0x66,0x67,0x00,
+ 0x3c,0x66,0x00,0x3c,0x66,0x66,0x3c,0x00,
+ 0x00,0x66,0x00,0x3c,0x66,0x66,0x3c,0x00,
+ 0x00,0x70,0x00,0x3c,0x66,0x66,0x3c,0x00,
+ 0x3c,0x66,0x00,0x66,0x66,0x66,0x3f,0x00,
+ 0x00,0x70,0x00,0x66,0x66,0x66,0x3f,0x00,
+ 0x00,0xcc,0x00,0xcc,0xcc,0x7c,0x0c,0xf8,
+ 0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00,
+ 0x66,0x00,0x66,0x66,0x66,0x66,0x3c,0x00,
+ 0x0c,0x0c,0x3f,0x60,0x60,0x3f,0x0c,0x0c,
+ 0x1c,0x36,0x32,0x78,0x30,0x73,0x7e,0x00,
+ 0x66,0x66,0x3c,0x7e,0x18,0x7e,0x18,0x18,
+ 0xf8,0xcc,0xcc,0xfa,0xc6,0xcf,0xc6,0xc7,
+ 0x0e,0x1b,0x18,0x3c,0x18,0x18,0xd8,0x70,
+ 0x0e,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
+ 0x1c,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
+ 0x00,0x0e,0x00,0x3c,0x66,0x66,0x3c,0x00,
+ 0x00,0x0e,0x00,0x66,0x66,0x66,0x3f,0x00,
+ 0x00,0x7c,0x00,0x7c,0x66,0x66,0x66,0x00,
+ 0x7e,0x00,0x66,0x76,0x7e,0x6e,0x66,0x00,
+ 0x1e,0x36,0x36,0x1f,0x00,0x3f,0x00,0x00,
+ 0x1c,0x36,0x36,0x1c,0x00,0x3e,0x00,0x00,
+ 0x18,0x00,0x18,0x30,0x60,0x66,0x3c,0x00,
+ 0x00,0x00,0x00,0x7e,0x60,0x60,0x00,0x00,
+ 0x00,0x00,0x00,0xfc,0x0c,0x0c,0x00,0x00,
+ 0xc3,0xc6,0xcc,0xde,0x33,0x66,0xcc,0x0f,
+ 0xc3,0xc6,0xcc,0xdb,0x37,0x6f,0xcf,0x03,
+ 0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,
+ 0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00,
+ 0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00,
+ 0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,
+ 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
+ 0xdb,0x77,0xdb,0xee,0xdb,0x77,0xdb,0xee,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,
+ 0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,
+ 0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,
+ 0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,
+ 0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,
+ 0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,
+ 0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,
+ 0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,
+ 0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
+ 0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,
+ 0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,
+ 0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,
+ 0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,
+ 0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,
+ 0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,
+ 0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,
+ 0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,
+ 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,
+ 0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,
+ 0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,
+ 0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,
+ 0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,
+ 0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,
+ 0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,
+ 0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,
+ 0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,
+ 0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+ 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
+ 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,
+ 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x3b,0x6e,0x64,0x6e,0x3b,0x00,
+ 0x00,0x3c,0x66,0x7c,0x66,0x7c,0x60,0x60,
+ 0x00,0x7e,0x66,0x60,0x60,0x60,0x60,0x00,
+ 0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,
+ 0x7e,0x66,0x30,0x18,0x30,0x66,0x7e,0x00,
+ 0x00,0x00,0x3f,0x6c,0x6c,0x6c,0x38,0x00,
+ 0x00,0x33,0x33,0x33,0x33,0x3e,0x30,0x60,
+ 0x00,0x3b,0x6e,0x0c,0x0c,0x0c,0x0c,0x00,
+ 0x7e,0x18,0x3c,0x66,0x66,0x3c,0x18,0x7e,
+ 0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,
+ 0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,
+ 0x0e,0x18,0x0c,0x3e,0x66,0x66,0x3c,0x00,
+ 0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,
+ 0x06,0x0c,0x7e,0xdb,0xdb,0x7e,0x60,0xc0,
+ 0x1c,0x30,0x60,0x7c,0x60,0x30,0x1c,0x00,
+ 0x3c,0x66,0x66,0x66,0x66,0x66,0x66,0x00,
+ 0x00,0x7e,0x00,0x7e,0x00,0x7e,0x00,0x00,
+ 0x18,0x18,0x7e,0x18,0x18,0x00,0x7e,0x00,
+ 0x30,0x18,0x0c,0x18,0x30,0x00,0x7e,0x00,
+ 0x0c,0x18,0x30,0x18,0x0c,0x00,0x7e,0x00,
+ 0x0e,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,
+ 0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,
+ 0x00,0x3b,0x6e,0x00,0x3b,0x6e,0x00,0x00,
+ 0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0c,0x0c,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
+ 0x0f,0x0c,0x0c,0x0c,0xec,0x6c,0x3c,0x1c,
+ 0x78,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,
+ 0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00,
+ 0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
diff --git a/src/target/firmware/display/ssd1783.c b/src/target/firmware/display/ssd1783.c
new file mode 100644
index 0000000..4e016e3
--- /dev/null
+++ b/src/target/firmware/display/ssd1783.c
@@ -0,0 +1,215 @@
+/* Solomon SSD1783 LCD Driver (Epson S1D15G10D08B000 clone) */
+
+/* (C) 2010 by Steve Markgraf <steve@steve-m.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+//#define DEBUG
+#include <debug.h>
+#include <delay.h>
+#include <uwire.h>
+#include <display/ssd1783.h>
+#include <calypso/clock.h>
+
+#define LCD_COLUMNS 98
+#define LCD_ROWS 67
+#define LCD_TOP_FREE_ROWS 3
+#define LCD_LEFT_FREE_COLS 0
+#define PIXEL_BYTES 3
+#define SSD1783_UWIRE_BITLEN 9
+#define SSD1783_DEV_ID 0
+#define FONT_HEIGHT 8
+#define FONT_WIDTH 8
+
+static const uint8_t rgb8_palette[] ={
+ 0x00, //P01 Intermediate red tone 000
+ 0x03, //P02 Intermediate red tone 001
+ 0x05, //P03 Intermediate red tone 010
+ 0x07, //P04 Intermediate red tone 011
+ 0x09, //P05 Intermediate red tone 100
+ 0x0b, //P06 Intermediate red tone 101
+ 0x0d, //P07 Intermediate red tone 110
+ 0x0f, //P08 Intermediate red tone 111
+ 0x00, //P09 Intermediate green tone 000
+ 0x03, //P10 Intermediate green tone 001
+ 0x05, //P11 Intermediate green tone 010
+ 0x07, //P12 Intermediate green tone 011
+ 0x09, //P13 Intermediate green tone 100
+ 0x0b, //P14 Intermediate green tone 101
+ 0x0d, //P15 Intermediate green tone 110
+ 0x0f, //P16 Intermediate green tone 111
+ 0x00, //P17 Intermediate blue tone 00
+ 0x05, //P18 Intermediate blue tone 01
+ 0x0a, //P19 Intermediate blue tone 10
+ 0x0f, //P20 Intermediate blue tone 11
+};
+
+void ssd1783_cmd_write(const uint8_t cmd)
+{
+ uint16_t cmd_out = cmd;
+ uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &cmd_out, NULL);
+}
+
+void ssd1783_data_write(const uint8_t data)
+{
+ uint16_t data_out = ((0x01 << 8) + data);
+ uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &data_out, NULL);
+}
+
+void ssd1783_init(void)
+{
+ unsigned int i;
+
+ calypso_reset_set(RESET_EXT, 0);
+ uwire_init();
+
+ /* Begin SSD1783 initialization sequence */
+ ssd1783_cmd_write(CMD_OSCON); /* Internal OSC on */
+ ssd1783_cmd_write(CMD_SLPOUT); /* Sleep out (Leave sleep mode) */
+
+ ssd1783_cmd_write(CMD_COMSCN); /* Common scan direction [1] */
+ ssd1783_data_write(0x01); /* Scan 1 -> 68, 132 <- 69 */
+ ssd1783_cmd_write(CMD_DATCTL); /* Data Scan Direction [3] */
+ ssd1783_data_write(0x00); /* Normal page address, normal rotation,
+ * scan direction in column direction */
+ ssd1783_data_write(0x00); /* RGB arrangement: RGB-RGB */
+ ssd1783_data_write(0x02); /* Gray-scale setup: 16 gray-scale Type A, 8-bit mode */
+
+ /* Initialize RGB8 palette for 8-Bit color mode */
+ ssd1783_cmd_write(CMD_RGBSET8); /* 256-color position set [20] */
+ for(i=0; i < sizeof(rgb8_palette); i++){
+ ssd1783_data_write(rgb8_palette[i]);
+ }
+
+ ssd1783_cmd_write(CMD_DISCTL); /* Display control [3] */
+ ssd1783_data_write(0xff); /* no clock division, F1, F2 switching period = field */
+ ssd1783_data_write(0x10); /* Drive duty, P24 = 1 */
+ ssd1783_data_write(0x01); /* FR inverse set, P30=1 */
+ ssd1783_cmd_write(CMD_SCSTART); /* Scroll start set [1] */
+ ssd1783_data_write(0x00); /* Start block address 0x00 */
+
+ /* Turn on the power regulator which generates VLCD */
+ ssd1783_cmd_write(CMD_PWRCTR); /* Power Control [1] */
+ ssd1783_data_write(0x0b); /* Booster, follower and regulator circuit on */
+
+ /* FIXME: put this in a separate function (ssd1783_set_contrast) */
+ ssd1783_cmd_write(CMD_VOLCTR); /* Electronic Volume Control [2] */
+ ssd1783_data_write(0x29); /* Set contrast */
+ ssd1783_data_write(0x05); /* Set contrast */
+
+ ssd1783_cmd_write(CMD_DISINV); /* Invert Display */
+ ssd1783_cmd_write(CMD_TMPGRD); /* Temperature gradient set */
+ ssd1783_data_write(0x00); /* default temperature gradient (-0.05% / °C) */
+ ssd1783_cmd_write(CMD_BIASSET); /* Set biasing ratio [1] */
+ ssd1783_data_write(0x03); /* 1/10 bias */
+ ssd1783_cmd_write(CMD_FREQSET); /* Set frequency and n-line inversion [2] */
+ ssd1783_data_write(0x08); /* frequency: 75Hz (POR) */
+ ssd1783_data_write(0x06); /* n-line inversion: 6 lines */
+ ssd1783_cmd_write(CMD_RESCMD); /* reserved command in datasheet? */
+ ssd1783_cmd_write(CMD_PWMSEL); /* Select PWM/FRC, Full/8 color mode [3] */
+ ssd1783_data_write(0x28); /* fixed */
+ ssd1783_data_write(0x2c); /* 5 bits PWM + 1 bit FRC (POR) */
+ ssd1783_data_write(0x05); /* Full color mode (0x45 would be 8 color powersaving) */
+
+ ssd1783_cmd_write(CMD_DISON); /* Display ON */
+ ssd1783_clrscr(); /* Clear the display */
+}
+
+void ssd1783_clrscr(void)
+{
+ uint16_t i;
+
+ /* Select the whole display area for clearing */
+ ssd1783_cmd_write(CMD_PASET); /* Page address set [2] */
+ ssd1783_data_write(0x00); /* Start page: 0x00 */
+ ssd1783_data_write(LCD_ROWS-1); /* End page */
+ ssd1783_cmd_write(CMD_CASET); /* Column address set [2] */
+ ssd1783_data_write(0x00); /* Start column: 0x00 */
+ ssd1783_data_write((LCD_COLUMNS/2)-1); /* End column (2 pixels per column) */
+ ssd1783_cmd_write(CMD_RAMWR); /* Write to memory */
+
+ /* Fill the display with white */
+ for(i=0; i < (LCD_ROWS * (LCD_COLUMNS/2) * PIXEL_BYTES); i++){
+ ssd1783_data_write(0xff);
+ }
+ ssd1783_cmd_write(CMD_NOP); /* Terminate RAMWR with NOP */
+}
+
+extern const unsigned char fontdata_r8x8_horiz[];
+
+/*
+ * Pixel format for 8-bit mode, 12-bit color, 2 Pixel per 3 byte
+ * D7, D6, D5, D4, D3, D2, D1, D0: RRRRGGGG (8 bits) 1st write
+ * D7, D6, D5, D4, D3, D2, D1, D0: BBBBRRRR (8 bits) 2nd write
+ * D7, D6, D5, D4, D3, D2, D1, D0: GGGGBBBB (8 bits) 3rd write
+*/
+
+void ssd1783_putchar(unsigned char c, int xpos, int ypos, int fColor, int bColor)
+{
+ int i, j;
+ uint8_t cols = FONT_WIDTH;
+ uint8_t rows = FONT_HEIGHT;
+ uint8_t row_slice;
+ uint8_t rowmask;
+ uint16_t pixel0; /* left pixel */
+ uint16_t pixel1; /* right pixel */
+
+ ssd1783_cmd_write(CMD_PASET);
+ ssd1783_data_write(xpos);
+ ssd1783_data_write(xpos + (FONT_HEIGHT-1));
+
+ ssd1783_cmd_write(CMD_CASET);
+ ssd1783_data_write(ypos);
+ ssd1783_data_write(ypos + ((FONT_WIDTH/2)-1));
+
+ ssd1783_cmd_write(CMD_RAMWR);
+
+ for (i = 0; i < rows; i++) {
+ row_slice = fontdata_r8x8_horiz[(FONT_WIDTH * c)+i];
+ printd("\nSSD1783 FontData=0x%02hx", row_slice);
+ rowmask = 0x80;
+ for (j = 0; j < cols; j += 2) {
+ if (!(row_slice & rowmask))
+ pixel0 = bColor;
+ else
+ pixel0 = fColor;
+ rowmask = rowmask >> 1;
+ if (!(row_slice & rowmask))
+ pixel1 = bColor;
+ else
+ pixel1 = fColor;
+ rowmask = rowmask >> 1;
+ /* Write the RGB-RGB pixel data */
+ ssd1783_data_write((pixel0 >> 4) & 0xff);
+ ssd1783_data_write(((pixel0 & 0x00f) << 4) | ((pixel1 >> 8) & 0x00f));
+ ssd1783_data_write(pixel1 & 0xff);
+ }
+ }
+ ssd1783_cmd_write(CMD_NOP);
+}
+
+void ssd1783_puts(const char *str, int txtline, int fColor, int bColor)
+{
+ int i;
+ for (i = 0; *str != 0x00; i += (FONT_WIDTH/2)) {
+ ssd1783_putchar(*str++, ((txtline*FONT_HEIGHT)+LCD_TOP_FREE_ROWS), (i + LCD_LEFT_FREE_COLS), fColor, bColor);
+ }
+}
diff --git a/src/target/firmware/include/display/ssd1783.h b/src/target/firmware/include/display/ssd1783.h
new file mode 100644
index 0000000..79a8186
--- /dev/null
+++ b/src/target/firmware/include/display/ssd1783.h
@@ -0,0 +1,63 @@
+#ifndef _SSD1783_H
+#define _SSD1783_H
+
+void ssd1783_cmd_write(const uint8_t cmd);
+void ssd1783_data_write(const uint8_t data);
+void ssd1783_init(void);
+void ssd1783_clrscr(void);
+void ssd1783_putchar(unsigned char c, int xpos, int ypos, int fColor, int bColor);
+void ssd1783_puts(const char *str, int txtline, int fColor, int bColor);
+
+/* Some basic colors */
+#define RED 0x0f00
+#define GREEN 0x00f0
+#define BLUE 0x000f
+#define YELLOW 0x0ff0
+#define MAGENTA 0x0f0f
+#define CYAN 0x00ff
+#define BLACK 0x0000
+#define WHITE 0x0fff
+
+/* Epson S1D15G10D08B000 commandset */
+#define CMD_DISON 0xaf // Display on
+#define CMD_DISOFF 0xae // Display off
+#define CMD_DISNOR 0xa6 // Normal display
+#define CMD_DISINV 0xa7 // Inverse display
+#define CMD_COMSCN 0xbb // Common scan direction
+#define CMD_DISCTL 0xca // Display control
+#define CMD_SLPIN 0x95 // Sleep in
+#define CMD_SLPOUT 0x94 // Sleep out
+#define CMD_PASET 0x75 // Page address set
+#define CMD_CASET 0x15 // Column address set
+#define CMD_DATCTL 0xbc // Data scan direction, etc.
+#define CMD_RGBSET8 0xce // 256-color position set
+#define CMD_RAMWR 0x5c // Writing to memory
+#define CMD_RAMRD 0x5d // Reading from memory
+#define CMD_PTLIN 0xa8 // Partial display in
+#define CMD_PTLOUT 0xa9 // Partial display out
+#define CMD_RMWIN 0xe0 // Read and modify write
+#define CMD_RMWOUT 0xee // End
+#define CMD_ASCSE 0xaa // Area scroll set
+#define CMD_SCSTART 0xab // Scroll start set
+#define CMD_OSCON 0xd1 // Internal oscillation on
+#define CMD_OSCOFF 0xd2 // Internal oscillation off
+#define CMD_PWRCTR 0x20 // Power control
+#define CMD_VOLCTR 0x81 // Electronic volume control
+#define CMD_VOLUP 0xd6 // Increment electronic control by 1
+#define CMD_VOLDOWN 0xd7 // Decrement electronic control by 1
+#define CMD_TMPGRD 0x82 // Temperature gradient set
+#define CMD_EPCTIN 0xcd // Control EEPROM
+#define CMD_EPCOUT 0xcc // Cancel EEPROM control
+#define CMD_EPMWR 0xfc // Write into EEPROM
+#define CMD_EPMRD 0xfd // Read from EEPROM
+#define CMD_EPSRRD1 0x7c // Read register 1
+#define CMD_EPSRRD2 0x7d // Read register 2
+#define CMD_NOP 0x25 // NOP instruction
+
+/* Extended SSD1783 commandset, partly (also has HW graphic functionalities) */
+#define CMD_BIASSET 0xfb // Set bias ratio
+#define CMD_FREQSET 0xf2 // Set frequency and n-line inversion
+#define CMD_RESCMD 0xa2 // reserved command
+#define CMD_PWMSEL 0xf7 // Select PWM/FRC, Full/8 color mode
+
+#endif