diff --git a/COPYING b/COPYING index e3b6155..ade6400 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,5 @@ All code is licensed as follows, with these exceptions: - src/fatfs/* - - src/touch/ili9341.c - src/gotek/stm32_usbh_msc/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This is free and unencumbered software released into the public domain. @@ -48,18 +47,6 @@ by use of this software. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -All code within src/touch/ili9341.c is licensed as follows: --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -Adafruit invests time and resources providing this open source code, -please support Adafruit and open-source hardware by purchasing -products from Adafruit! - -Written by Limor Fried/Ladyada for Adafruit Industries. -Modified and adapted for STM32 by Keir Fraser -MIT license, all text above must be included in any redistribution --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - - All code within src/gotek/stm32_usbh_msc/* is licensed as follows: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Copyright (C) 2015 STMicroelectronics International N.V.. All rights reserved. diff --git a/Makefile b/Makefile index 94e0e1a..4c1d694 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ VER = v0.9.21a SUBDIRS += src bootloader reloader -.PHONY: all clean flash start serial gotek touch +.PHONY: all clean flash start serial gotek ifneq ($(RULES_MK),y) @@ -26,9 +26,6 @@ gotek: all mv BL.rld FF_Gotek-Bootloader-$(VER).rld mv RL.upd FF_Gotek-Reloader-$(VER).upd -touch: export touch=y -touch: all - HXC_FF_URL := https://www.github.com/keirf/HxC_FF_File_Selector HXC_FF_URL := $(HXC_FF_URL)/releases/download HXC_FF_VER := v1.71-ff diff --git a/Rules.mk b/Rules.mk index 84cd8d0..1bb4be5 100644 --- a/Rules.mk +++ b/Rules.mk @@ -28,9 +28,6 @@ ifeq ($(bootloader),y) FLAGS += -DBOOTLOADER=1 endif -FLAGS-$(gotek) += -DBUILD_GOTEK=1 -FLAGS-$(touch) += -DBUILD_TOUCH=1 - FLAGS += -MMD -MF .$(@F).d DEPS = .*.d diff --git a/bootloader/Bootloader.ld.S b/bootloader/Bootloader.ld.S index 7dad752..9483f62 100644 --- a/bootloader/Bootloader.ld.S +++ b/bootloader/Bootloader.ld.S @@ -2,10 +2,6 @@ #define FLASH_LEN 32K #define RAM_BASE 0x20000000 -#if BUILD_GOTEK #define RAM_LEN 64K -#elif BUILD_TOUCH -#define RAM_LEN 20K -#endif #include "../scripts/stm32f10x.ld.S" diff --git a/bootloader/Makefile b/bootloader/Makefile index d89cb5b..572b2fe 100644 --- a/bootloader/Makefile +++ b/bootloader/Makefile @@ -19,5 +19,4 @@ OBJS += flash_cfg.o OBJS-$(debug) += console.o SUBDIRS += fatfs -SUBDIRS-$(gotek) += gotek -SUBDIRS-$(touch) += touch +SUBDIRS += gotek diff --git a/bootloader/touch/Makefile b/bootloader/touch/Makefile deleted file mode 100644 index 7094223..0000000 --- a/bootloader/touch/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -RPATH = ../../src/touch - -OBJS += board.o -OBJS += backlight.o -OBJS += ili9341.o -OBJS += xpt2046.o -OBJS += font4x8.o -OBJS += font8x16.o -OBJS += sd_spi.o diff --git a/inc/decls.h b/inc/decls.h index 3002b58..2657d6f 100644 --- a/inc/decls.h +++ b/inc/decls.h @@ -27,7 +27,6 @@ #include "timer.h" #include "fs.h" #include "floppy.h" -#include "touch_panel.h" #include "config.h" /* diff --git a/inc/stm32f10x.h b/inc/stm32f10x.h index a37d20f..a19b5a6 100644 --- a/inc/stm32f10x.h +++ b/inc/stm32f10x.h @@ -125,11 +125,7 @@ void fpec_init(void); void fpec_page_erase(uint32_t flash_address); void fpec_write(const void *data, unsigned int size, uint32_t flash_address); -#if BUILD_GOTEK #define FLASH_PAGE_SIZE 2048 -#elif BUILD_TOUCH -#define FLASH_PAGE_SIZE 1024 -#endif /* * Local variables: diff --git a/inc/touch_panel.h b/inc/touch_panel.h deleted file mode 100644 index a90eadd..0000000 --- a/inc/touch_panel.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * touch_panel.h - * - * Interfaces to ILI9341 display driver, PWM-controlled backlight, and - * XPT2046 touch screen controller. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -/* TFT display dimensions with 8x16 characters */ -#define TFT_8x16_COLS 40 -#define TFT_8x16_ROWS 15 - -/* TFT display dimensions with 4x8 characters */ -#define TFT_4x8_COLS 80 -#define TFT_4x8_ROWS 24 - -#ifdef BUILD_TOUCH - -/* TFT LCD display */ -void tft_init(void); -void fill_rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t c); -void clear_screen(void); -void draw_string_8x16(uint16_t x, uint16_t y, const char *str); -void draw_string_4x8(uint16_t x, uint16_t y, const char *str); - -/* PWM backlight */ -void backlight_init(void); -void backlight_set(uint8_t level); - -/* Touch screen control */ -void touch_init(void); -bool_t touch_get_xy(uint16_t *px, uint16_t *py); - -#else - -static inline void tft_init(void) -{} -static inline void fill_rect( - uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t c) -{} -static inline void clear_screen(void) -{} -static inline void draw_string_8x16(uint16_t x, uint16_t y, const char *str) -{ - printk("%s\n", str); -} -static inline void draw_string_4x8(uint16_t x, uint16_t y, const char *str) -{ - printk("%s\n", str); -} - -static inline void backlight_init(void) -{} -static inline void backlight_set(uint8_t level) -{} - -static inline void touch_init(void) -{} -static inline bool_t touch_get_xy(uint16_t *px, uint16_t *py) -{ - return FALSE; -} - -#endif - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/inc/util.h b/inc/util.h index 1b02fe9..646f9aa 100644 --- a/inc/util.h +++ b/inc/util.h @@ -142,8 +142,6 @@ extern uint8_t display_mode; void speaker_init(void); void speaker_pulse(void); -#ifdef BUILD_GOTEK - /* Gotek: 3-digit 7-segment display */ void led_7seg_init(void); void led_7seg_write_string(const char *p); @@ -166,34 +164,8 @@ void usbh_msc_process(void); bool_t usbh_msc_connected(void); bool_t usbh_msc_readonly(void); -#else /* !BUILD_GOTEK */ - -static inline void led_7seg_init(void) {} -static inline void led_7seg_write_string(const char *p) {} -static inline void led_7seg_write_decimal(unsigned int val) {} -static inline void led_7seg_display_setting(bool_t enable) {} -static inline int led_7seg_nr_digits(void) { return 0; } - -static inline bool_t lcd_init(void) { return FALSE; } -static inline void lcd_clear(void) {} -static inline void lcd_write(int col, int row, int min, const char *str) {} -static inline void lcd_backlight(bool_t on) {}; -static inline void lcd_sync(void) {} - -static inline void usbh_msc_init(void) {} -static inline void usbh_msc_buffer_set(uint8_t *buf) {} -static inline void usbh_msc_process(void) {} -static inline bool_t usbh_msc_connected(void) { return FALSE; } - -#endif /* !BUILD_GOTEK */ - extern uint8_t board_id; -/* Touch board revisions */ -#define BRDREV_MM150 0 -#define BRDREV_TB160 1 -#define BRDREV_LC150 7 - /* Gotek board revisions */ #define BRDREV_Gotek_standard 0xf #define BRDREV_Gotek_enhanced 0x0 diff --git a/reloader/Makefile b/reloader/Makefile index d89cb5b..572b2fe 100644 --- a/reloader/Makefile +++ b/reloader/Makefile @@ -19,5 +19,4 @@ OBJS += flash_cfg.o OBJS-$(debug) += console.o SUBDIRS += fatfs -SUBDIRS-$(gotek) += gotek -SUBDIRS-$(touch) += touch +SUBDIRS += gotek diff --git a/reloader/touch/Makefile b/reloader/touch/Makefile deleted file mode 100644 index 7094223..0000000 --- a/reloader/touch/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -RPATH = ../../src/touch - -OBJS += board.o -OBJS += backlight.o -OBJS += ili9341.o -OBJS += xpt2046.o -OBJS += font4x8.o -OBJS += font8x16.o -OBJS += sd_spi.o diff --git a/src/FlashFloppy.ld.S b/src/FlashFloppy.ld.S index feac290..052ac7c 100644 --- a/src/FlashFloppy.ld.S +++ b/src/FlashFloppy.ld.S @@ -2,10 +2,6 @@ #define FLASH_LEN 96K #define RAM_BASE 0x20000000 -#if BUILD_GOTEK #define RAM_LEN 64K -#elif BUILD_TOUCH -#define RAM_LEN 20K -#endif #include "../scripts/stm32f10x.ld.S" diff --git a/src/Makefile b/src/Makefile index 729321b..7dc9c04 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,8 +20,7 @@ OBJS-$(debug) += console.o SUBDIRS += fatfs SUBDIRS += image -SUBDIRS-$(gotek) += gotek -SUBDIRS-$(touch) += touch +SUBDIRS += gotek flash_cfg.o: ff_cfg_defaults.h diff --git a/src/arena.c b/src/arena.c index f8aa133..2490386 100644 --- a/src/arena.c +++ b/src/arena.c @@ -9,11 +9,7 @@ * See the file COPYING for more details, or visit . */ -#if BUILD_GOTEK #define ram_kb 64 -#elif BUILD_TOUCH -#define ram_kb 20 -#endif #define ram_bytes (ram_kb*1024) diff --git a/src/floppy.c b/src/floppy.c index 7696a09..e19d81e 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -108,11 +108,7 @@ struct exti_irq { uint16_t pr_mask; /* != 0: irq- and exti-pending flags are cleared */ }; -#if BUILD_TOUCH -#include "touch/floppy.c" -#elif BUILD_GOTEK #include "gotek/floppy.c" -#endif #define pin_unset 17 const static uint8_t *fintf, fintfs[][outp_nr] = { diff --git a/src/timer.c b/src/timer.c index 3c25579..9c1597c 100644 --- a/src/timer.c +++ b/src/timer.c @@ -9,22 +9,11 @@ * See the file COPYING for more details, or visit . */ -#if BUILD_TOUCH - -/* TIM1_UP: IRQ 25. */ -void IRQ_25(void) __attribute__((alias("IRQ_timer"))); -#define TIMER_IRQ 25 -#define tim tim1 - -#elif BUILD_GOTEK - /* TIM4: IRQ 30. */ void IRQ_30(void) __attribute__((alias("IRQ_timer"))); #define TIMER_IRQ 30 #define tim tim4 -#endif - /* IRQ only on counter overflow, one-time enable. */ #define TIM_CR1 (TIM_CR1_URS | TIM_CR1_OPM) diff --git a/src/touch/Makefile b/src/touch/Makefile deleted file mode 100644 index 60de98b..0000000 --- a/src/touch/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -OBJS += board.o -OBJS += backlight.o -OBJS += ili9341.o -OBJS += xpt2046.o -OBJS += font4x8.o -OBJS += font8x16.o -OBJS += speaker.o -OBJS += sd_spi.o diff --git a/src/touch/backlight.c b/src/touch/backlight.c deleted file mode 100644 index 8c7c1e4..0000000 --- a/src/touch/backlight.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * backlight.c - * - * PWM-switch the TFT LED backlight. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -/* Must be a 5v-tolerant pin with a timer channel attached. */ -#define gpio_led gpiob -#define PIN_LED 10 - -/* Timer channel for above pin: Timer 2, channel 3. */ -#define tim tim2 -#define PWM_CCR ccr3 - -void backlight_init(void) -{ - /* Set up timer, switch backlight off. - * We switch a PNP transistor so PWM output is active low. */ - tim->arr = 999; /* count 0-999 inclusive */ - tim->psc = SYSCLK_MHZ - 1; /* tick at 1MHz */ - tim->ccmr2 = (TIM_CCMR2_CC3S(TIM_CCS_OUTPUT) | - TIM_CCMR2_OC3M(TIM_OCM_PWM2)); /* PWM2: low then high */ - tim->ccer = TIM_CCER_CC3E; - tim->PWM_CCR = tim->cr2 = tim->dier = 0; - tim->cr1 = TIM_CR1_CEN; - - /* Set up the output pin. */ - afio->mapr |= AFIO_MAPR_TIM2_REMAP_PARTIAL_2; - gpio_configure_pin(gpio_led, PIN_LED, AFO_opendrain(_2MHz)); -} - -/* Set brightness level: 0-10. */ -void backlight_set(uint8_t level) -{ - /* Logarithmic scale. */ - tim->PWM_CCR = (level < 2) ? level : 1u << level; -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/board.c b/src/touch/board.c deleted file mode 100644 index 07dc0fc..0000000 --- a/src/touch/board.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * touch/board.c - * - * Touch board-specific setup and management. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -void board_init(void) -{ - uint16_t id; - - /* Test whether PC13-15 are externally pulled low. We pull each line up to - * 3.3v via the internal weak pullup (<50k resistance). Load on each line - * is conservatively <50pF, allowing for LSE crystal load caps. Need to - * wait time T for input to reach 1.71v to read as HIGH. - * T = -RCln(1-Vthresh/Vcc) = -50k*50p*ln(1-1.71/3.3) ~= 1.9us. */ - gpioc->odr = 0xffffu; - gpioc->crh = 0x88888888u; /* PC8-15: Input with pull-up */ - delay_us(5); /* 1.9us is a tiny delay so fine to pad it some more */ - id = (gpioc->idr >> 13) & 7; /* ID should now be stable at PC[15:13] */ - - /* Analog Input: disables Schmitt Trigger Inputs hence zero load for any - * voltage at the input pin (and voltage build-up is clamped by protection - * diodes even if the pin floats). - * NB. STMF4xx spec states that Analog Input is not safe for 5v operation. - * It's unclear whether this might apply to STMF1xx devices too, so for - * safety's sake set Analog Input only on pins not driven to 5v. */ - gpioc->crh = gpioc->crl = 0; /* PC0-15: Analog Input */ - - /* Selective external pulldowns define a board identifier. - * Check if it's one we recognise and pull down any floating pins. */ - switch (board_id = id) { - case BRDREV_LC150: /* LC Tech */ - /* PB8/9: unused, floating. */ - gpio_configure_pin(gpiob, 8, GPI_pull_down); - gpio_configure_pin(gpiob, 9, GPI_pull_down); - /* PB2 = BOOT1: externally tied. */ - break; - case BRDREV_MM150: /* Maple Mini */ - /* PB1: LED connected to GND. */ - gpio_configure_pin(gpiob, 1, GPI_pull_down); - /* PB8 = Button, PB9 = USB DISConnect: both externally tied. */ - break; - case BRDREV_TB160: /* "Taobao" / Blue Pill / etc. */ - /* PA13/14: SW-debug, floating. */ - gpio_configure_pin(gpioa, 13, GPI_pull_down); - gpio_configure_pin(gpioa, 14, GPI_pull_down); - /* PB2 = BOOT1: externally tied. */ - break; - default: - printk("Unknown board ID %x\n", id); - ASSERT(0); - } -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/floppy.c b/src/touch/floppy.c deleted file mode 100644 index 030d0fb..0000000 --- a/src/touch/floppy.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * touch/floppy.c - * - * Touch-specific floppy-interface setup. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -#define O_FALSE 0 -#define O_TRUE 1 - -/* NB. All input pins must be 5v tolerant. */ -/* Bitmap of current states of input pins. */ -static uint8_t input_pins; - -/* Offsets within the input_pins bitmap. */ -#define inp_dir 0 -#define inp_step 3 -#define inp_sel0 4 -#define inp_sel1 5 -#define inp_wgate 6 -#define inp_side 7 - -/* Subset of output pins which are active (O_TRUE). */ -static uint16_t gpio_out_active; - -/* Outputs are buffered, thus do *not* need to be 5v tolerant. */ -#define gpio_out gpiob -#define pin_02 3 -static uint8_t pin_08; /* differs across board revisions */ -#define pin_26 5 -#define pin_28 11 -#define pin_34 12 - -#define gpio_data gpiob - -#define pin_wdata 6 /* must be 5v tolerant */ -#define tim_wdata (tim4) -#define dma_wdata (dma1->ch1) -#define dma_wdata_ch 1 -#define dma_wdata_irq 11 -void IRQ_11(void) __attribute__((alias("IRQ_wdata_dma"))); - -#define pin_rdata 7 -#define tim_rdata (tim4) -#define dma_rdata (dma1->ch7) -#define dma_rdata_ch 7 -#define dma_rdata_irq 17 -void IRQ_17(void) __attribute__((alias("IRQ_rdata_dma"))); - -/* Bind all EXTI IRQs */ -void IRQ_6(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI0 */ -void IRQ_7(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI1 */ -void IRQ_8(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI2 */ -void IRQ_9(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI3 */ -void IRQ_10(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI4 */ -void IRQ_23(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI9_5 */ -void IRQ_40(void) __attribute__((alias("IRQ_input_changed"))); /* EXTI15_10 */ -static const struct exti_irq exti_irqs[] = { - { 6, FLOPPY_IRQ_HI_PRI, 0 }, - { 7, FLOPPY_IRQ_HI_PRI, 0 }, - { 8, FLOPPY_IRQ_HI_PRI, 0 }, - { 9, FLOPPY_IRQ_HI_PRI, 0 }, - { 10, FLOPPY_IRQ_HI_PRI, 0 }, - { 23, FLOPPY_IRQ_HI_PRI, 0 }, - { 40, FLOPPY_IRQ_HI_PRI, 0 } -}; - -/* Updates the board-agnostic input_pins bitmask with current states of - * input pins, and returns mask of pins which have changed state. */ -static uint8_t (*input_update)(void); - -/* Default input pins: - * DIR = PA8, STEP=PA11, SELA=PA12, SELB=PA13, WGATE=PA14, SIDE=PA15 - */ -static uint8_t input_update_default(void) -{ - uint16_t pr; - - pr = exti->pr; - exti->pr = pr; - - input_pins = (gpioa->idr >> 8) & 0xf9; - - return (pr >> 8) & 0xf8; -} - -static void input_init_default(void) -{ - gpio_configure_pin(gpioa, 8+inp_sel0, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_sel1, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_dir, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_step, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_wgate, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_side, GPI_bus); - - /* PA[15:0] -> EXT[15:0] */ - afio->exticr1 = afio->exticr2 = afio->exticr3 = afio->exticr4 = 0x0000; - - exti->imr = exti->rtsr = exti->ftsr = - m(8+inp_step) | m(8+inp_sel0) | m(8+inp_sel1) - | m(8+inp_wgate) | m(8+inp_side); - - input_update = input_update_default; -} - -/* TB160 input pins as default except: - * SELB = PB8, WGATE = PB9. - */ -static uint8_t input_update_tb160(void) -{ - uint16_t pr; - - pr = exti->pr; - exti->pr = pr; - - input_pins = ((gpioa->idr >> 8) & 0x99) | ((gpiob->idr >> 3) & 0x60); - - return ((pr >> 8) & 0x98) | ((pr >> 3) & 0x60); -} - -static void input_init_tb160(void) -{ - gpio_configure_pin(gpioa, 8+inp_sel0, GPI_bus); - gpio_configure_pin(gpiob, 3+inp_sel1, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_dir, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_step, GPI_bus); - gpio_configure_pin(gpiob, 3+inp_wgate, GPI_bus); - gpio_configure_pin(gpioa, 8+inp_side, GPI_bus); - - /* PA[15:10,7:0] -> EXT[15:10,7:0], PB[9:8] -> EXT[9:8]. */ - afio->exticr1 = afio->exticr2 = afio->exticr4 = 0x0000; - afio->exticr3 = 0x0011; - - exti->imr = exti->rtsr = exti->ftsr = - m(8+inp_step) | m(8+inp_sel0) | m(3+inp_sel1) - | m(3+inp_wgate) | m(8+inp_side); - - input_update = input_update_tb160; -} - -static void board_floppy_init(void) -{ - switch (board_id) { - case BRDREV_LC150: - pin_08 = 4; - input_init_default(); - break; - case BRDREV_MM150: - pin_08 = 2; - input_init_default(); - break; - case BRDREV_TB160: - pin_08 = 1; - input_init_tb160(); - break; - } -} - -static void IRQ_input_changed(void) -{ - uint8_t inp, changed, sel; - struct drive *drv = &drive; - - changed = input_update(); - inp = input_pins; - sel = !(inp & m(inp_sel0)); - - /* DSKCHG asserts on any falling edge of STEP. We deassert on any edge. */ - if ((changed & m(inp_step)) && sel && (dma_rd != NULL)) - drive_change_output(drv, outp_dskchg, FALSE); - /* Handle step request. */ - if ((changed & inp & m(inp_step)) /* Rising edge on STEP */ - && sel /* Drive is selected */ - && !(drv->step.state & STEP_active)) { /* Not already mid-step */ - /* Latch the step direction and check bounds (0 <= cyl <= 255). */ - drv->step.inward = !(inp & m(inp_dir)); - if (drv->cyl != (drv->step.inward ? 255 : 0)) { - /* Valid step request for this drive: start the step operation. */ - drv->step.start = time_now(); - drv->step.state = STEP_started; - drive_change_output(drv, outp_trk0, FALSE); - if (dma_rd != NULL) - rdata_stop(); - IRQx_set_pending(FLOPPY_SOFTIRQ); - } - } - - /* Handle side change. */ - if (changed & m(inp_side)) { - drv->head = !(inp & m(inp_side)); - if (dma_rd != NULL) { - rdata_stop(); - } - } - - /* Handle write gate. */ - if ((changed & m(inp_wgate)) && (dma_wr != NULL) - && sel && drv->image->handler->write_track) { - if (inp & m(inp_wgate)) { - wdata_stop(); - } else { - rdata_stop(); - wdata_start(); - } - } - - drv->sel = sel; -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/font4x8.c b/src/touch/font4x8.c deleted file mode 100644 index e79e4fa..0000000 --- a/src/touch/font4x8.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * font4x8.c - * - * Small 4x8 font, code page 437. - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -const char font4x8[] = { - 0x00, 0x00, 0x00, 0x00, 0x69, 0xf9, 0x9f, 0x60, - 0x6f, 0x9f, 0xf9, 0x60, 0x0a, 0xee, 0xe4, 0x40, - 0x44, 0xee, 0xe4, 0x40, 0x44, 0xaa, 0x44, 0xe0, - 0x44, 0xee, 0xe4, 0xe0, 0x00, 0x4e, 0xe4, 0x00, - 0xff, 0xb1, 0x1b, 0xff, 0x00, 0x4a, 0xa4, 0x00, - 0xff, 0xb5, 0x5b, 0xff, 0xff, 0xb5, 0x5b, 0xff, - 0x04, 0xaa, 0x4e, 0x40, 0x75, 0x74, 0x4c, 0xc0, - 0x75, 0x55, 0x5f, 0xf0, 0x4d, 0x6f, 0x6b, 0x20, - 0x8c, 0xef, 0xec, 0x80, 0x13, 0x7f, 0x73, 0x10, - 0x6f, 0x66, 0x6f, 0x60, 0xaa, 0xaa, 0xa0, 0xa0, - 0x7b, 0xb7, 0x33, 0x30, 0x78, 0x69, 0x96, 0x1e, - 0x00, 0x00, 0x0f, 0xf0, 0x6f, 0x66, 0x6f, 0x6f, - 0x6f, 0x66, 0x66, 0x60, 0x66, 0x66, 0x6f, 0x60, - 0x00, 0x2f, 0xf2, 0x00, 0x00, 0x4f, 0xf4, 0x00, - 0x00, 0x00, 0x8f, 0x00, 0x00, 0x6f, 0x60, 0x00, - 0x06, 0x66, 0xff, 0xf0, 0x0f, 0xff, 0x66, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x40, 0x40, - 0xaa, 0xa0, 0x00, 0x00, 0x0a, 0xea, 0xea, 0x00, - 0x4e, 0x84, 0x2e, 0x40, 0xa2, 0x44, 0x48, 0xa0, - 0x4a, 0xa4, 0x5a, 0xe3, 0x62, 0x40, 0x00, 0x00, - 0x24, 0x88, 0x84, 0x20, 0x84, 0x22, 0x24, 0x80, - 0x0a, 0x4e, 0x4a, 0x00, 0x04, 0x4e, 0x44, 0x00, - 0x00, 0x00, 0x06, 0x24, 0x00, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0x04, 0x40, 0x22, 0x44, 0x48, 0x80, - 0x4a, 0xee, 0xaa, 0x40, 0x4c, 0x44, 0x44, 0xe0, - 0x4a, 0x24, 0x48, 0xe0, 0x4a, 0x24, 0x2a, 0x40, - 0x2a, 0xae, 0x22, 0x20, 0xe8, 0xc2, 0x2a, 0x40, - 0x4a, 0x8c, 0xaa, 0x40, 0xe2, 0x24, 0x48, 0x80, - 0x4a, 0xa4, 0xaa, 0x40, 0x4a, 0xa6, 0x2a, 0x40, - 0x04, 0x40, 0x04, 0x40, 0x04, 0x40, 0x04, 0x48, - 0x12, 0x48, 0x42, 0x10, 0x00, 0xe0, 0xe0, 0x00, - 0x84, 0x21, 0x24, 0x80, 0x4a, 0x24, 0x40, 0x40, - 0x4a, 0xae, 0xe8, 0x60, 0x4a, 0xae, 0xaa, 0xa0, - 0xca, 0xac, 0xaa, 0xc0, 0x4a, 0x88, 0x8a, 0x40, - 0xca, 0xaa, 0xaa, 0xc0, 0xe8, 0x8c, 0x88, 0xe0, - 0xe8, 0x8c, 0x88, 0x80, 0x4a, 0x8e, 0xaa, 0x40, - 0xaa, 0xae, 0xaa, 0xa0, 0xe4, 0x44, 0x44, 0xe0, - 0x22, 0x22, 0x2a, 0x40, 0xaa, 0xcc, 0xaa, 0xa0, - 0x88, 0x88, 0x88, 0xe0, 0xae, 0xee, 0xaa, 0xa0, - 0x2a, 0xee, 0xea, 0xa0, 0xea, 0xaa, 0xaa, 0xe0, - 0xca, 0xac, 0x88, 0x80, 0x4a, 0xaa, 0xaa, 0x42, - 0xca, 0xac, 0xaa, 0xa0, 0x4a, 0x84, 0x2a, 0x40, - 0xe4, 0x44, 0x44, 0x40, 0xaa, 0xaa, 0xaa, 0xe0, - 0xaa, 0xaa, 0xa4, 0x40, 0xaa, 0xaa, 0xee, 0xa0, - 0xaa, 0xe4, 0xea, 0xa0, 0xaa, 0xa4, 0x44, 0x40, - 0xe2, 0x44, 0x48, 0xe0, 0x64, 0x44, 0x44, 0x60, - 0x08, 0x84, 0x42, 0x20, 0x62, 0x22, 0x22, 0x60, - 0x04, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, - 0x64, 0x20, 0x00, 0x00, 0x00, 0xc2, 0x6a, 0x60, - 0x88, 0xca, 0xaa, 0xc0, 0x00, 0x4a, 0x8a, 0x40, - 0x22, 0x6a, 0xaa, 0x60, 0x00, 0x4a, 0xe8, 0x60, - 0x24, 0x4e, 0x44, 0x40, 0x00, 0x6a, 0xa6, 0x2c, - 0x88, 0xca, 0xaa, 0xa0, 0x40, 0xc4, 0x44, 0x40, - 0x20, 0x22, 0x22, 0xa4, 0x88, 0xaa, 0xca, 0xa0, - 0xc4, 0x44, 0x44, 0xe0, 0x00, 0xae, 0xea, 0xa0, - 0x00, 0xca, 0xaa, 0xa0, 0x00, 0x4a, 0xaa, 0x40, - 0x00, 0xca, 0xac, 0x88, 0x00, 0x6a, 0xa6, 0x23, - 0x00, 0xca, 0x88, 0x80, 0x00, 0x68, 0x42, 0xc0, - 0x04, 0xe4, 0x44, 0x20, 0x00, 0xaa, 0xaa, 0x60, - 0x00, 0xaa, 0xa4, 0x40, 0x00, 0xaa, 0xee, 0xa0, - 0x00, 0xaa, 0x4a, 0xa0, 0x00, 0xaa, 0xa6, 0x2c, - 0x00, 0xe2, 0x48, 0xe0, 0x24, 0x48, 0x44, 0x20, - 0x44, 0x40, 0x44, 0x40, 0x84, 0x42, 0x44, 0x80, - 0x5a, 0x00, 0x00, 0x00, 0x00, 0x44, 0xaa, 0xe0, - 0x4a, 0x88, 0x8a, 0x42, 0xa0, 0xaa, 0xaa, 0x60, - 0x24, 0x4a, 0xe8, 0x60, 0x4a, 0xc2, 0x6a, 0x60, - 0xa0, 0xc2, 0x6a, 0x60, 0x84, 0xc2, 0x6a, 0x60, - 0xee, 0xc2, 0x6a, 0x60, 0x00, 0x68, 0x86, 0x4c, - 0x4a, 0x4a, 0xe8, 0x60, 0xa0, 0x4a, 0xe8, 0x60, - 0x84, 0x4a, 0xe8, 0x60, 0xa0, 0x0c, 0x44, 0x40, - 0x4a, 0x0c, 0x44, 0x40, 0x84, 0x0c, 0x44, 0x40, - 0xa4, 0xaa, 0xea, 0xa0, 0xe4, 0xaa, 0xea, 0xa0, - 0x24, 0xe8, 0xc8, 0xe0, 0x08, 0x66, 0xcc, 0x20, - 0x7a, 0xaf, 0xaa, 0xb0, 0x4a, 0x4a, 0xaa, 0x40, - 0xa0, 0x4a, 0xaa, 0x40, 0x84, 0x4a, 0xaa, 0x40, - 0x4a, 0x0a, 0xaa, 0x60, 0x84, 0x0a, 0xaa, 0x60, - 0xa0, 0xaa, 0xa6, 0x2c, 0xa4, 0xaa, 0xaa, 0x40, - 0xa0, 0xaa, 0xaa, 0x40, 0x44, 0xa8, 0x8a, 0x44, - 0x4a, 0x8c, 0x88, 0xe0, 0xaa, 0x4e, 0x4e, 0x40, - 0xca, 0xca, 0xfa, 0x90, 0x25, 0x4e, 0x44, 0x80, - 0x24, 0xc2, 0x6a, 0x60, 0x24, 0x0c, 0x44, 0x40, - 0x24, 0x04, 0xaa, 0x40, 0x24, 0x0a, 0xaa, 0x60, - 0x5a, 0x0c, 0xaa, 0xa0, 0xe0, 0x2a, 0xee, 0xa0, - 0x6a, 0xa6, 0x0e, 0x00, 0x4a, 0xa4, 0x0e, 0x00, - 0x40, 0x44, 0x8a, 0x40, 0x00, 0x00, 0x74, 0x00, - 0x00, 0x00, 0xe2, 0x00, 0x44, 0xec, 0x24, 0xe0, - 0x44, 0xe2, 0xae, 0x20, 0x40, 0x44, 0x44, 0x40, - 0x05, 0x5a, 0x55, 0x00, 0x0a, 0xa5, 0xaa, 0x00, - 0x82, 0x82, 0x82, 0x82, 0xa5, 0xa5, 0xa5, 0xa5, - 0xd7, 0xd7, 0xd7, 0xd7, 0x44, 0x44, 0x44, 0x44, - 0x44, 0x4c, 0x44, 0x44, 0x44, 0xc4, 0xc4, 0x44, - 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x0e, 0xaa, 0xaa, - 0x00, 0xc4, 0xc4, 0x44, 0xaa, 0xa2, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0xe2, 0xaa, 0xaa, - 0xaa, 0xa2, 0xe0, 0x00, 0xaa, 0xae, 0x00, 0x00, - 0x44, 0xc4, 0xc0, 0x00, 0x00, 0x0c, 0x44, 0x44, - 0x44, 0x47, 0x00, 0x00, 0x44, 0x4f, 0x00, 0x00, - 0x00, 0x0f, 0x44, 0x44, 0x44, 0x47, 0x44, 0x44, - 0x00, 0x0f, 0x00, 0x00, 0x44, 0x4f, 0x44, 0x44, - 0x44, 0x74, 0x74, 0x44, 0xaa, 0xab, 0xaa, 0xaa, - 0xaa, 0xb8, 0xf0, 0x00, 0x00, 0xf8, 0xba, 0xaa, - 0xaa, 0xb0, 0xf0, 0x00, 0x00, 0xf0, 0xba, 0xaa, - 0xaa, 0xb8, 0xba, 0xaa, 0x00, 0xf0, 0xf0, 0x00, - 0xaa, 0xb0, 0xba, 0xaa, 0x44, 0xf0, 0xf0, 0x00, - 0xaa, 0xaf, 0x00, 0x00, 0x00, 0xf0, 0xf4, 0x44, - 0x00, 0x0f, 0xaa, 0xaa, 0xaa, 0xaf, 0x00, 0x00, - 0x44, 0x74, 0x70, 0x00, 0x00, 0x74, 0x74, 0x44, - 0x00, 0x0f, 0xaa, 0xaa, 0xaa, 0xaf, 0xaa, 0xaa, - 0x44, 0xf4, 0xf4, 0x44, 0x44, 0x4c, 0x00, 0x00, - 0x00, 0x07, 0x44, 0x44, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0xcc, - 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x05, 0xaa, 0x50, 0x4a, 0xca, 0xac, 0x88, - 0x0e, 0xa8, 0x88, 0x80, 0x0f, 0xaa, 0xaa, 0xa0, - 0xf9, 0x42, 0x49, 0xf0, 0x00, 0x7a, 0xaa, 0x40, - 0x05, 0x55, 0x56, 0x48, 0x05, 0xa2, 0x22, 0x20, - 0xe4, 0xaa, 0xa4, 0xe0, 0x69, 0x9f, 0x99, 0x60, - 0x06, 0x99, 0x96, 0xf0, 0x03, 0x42, 0x69, 0x60, - 0x00, 0x69, 0xf9, 0x60, 0x26, 0xae, 0xac, 0x80, - 0x06, 0x8e, 0x86, 0x00, 0x04, 0xaa, 0xaa, 0xa0, - 0x0e, 0x0e, 0x0e, 0x00, 0x44, 0xe4, 0x40, 0xe0, - 0x84, 0x24, 0x80, 0xe0, 0x24, 0x84, 0x20, 0xe0, - 0x02, 0x54, 0x44, 0x44, 0x44, 0x44, 0x44, 0x80, - 0x04, 0x0e, 0x04, 0x00, 0x05, 0xa0, 0x5a, 0x00, - 0x4a, 0xa4, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x32, 0x22, 0xa6, 0x40, - 0xca, 0xaa, 0x00, 0x00, 0xc2, 0x4e, 0x00, 0x00, - 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/font8x16.c b/src/touch/font8x16.c deleted file mode 100644 index 0bc2601..0000000 --- a/src/touch/font8x16.c +++ /dev/null @@ -1,533 +0,0 @@ -/* - * font8x16.c - * - * Standard VGA 8x16 font, code page 437. - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -const char font8x16[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, - 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, - 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, - 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, - 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, - 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, - 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, - 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, - 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, - 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, - 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, - 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, - 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, - 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, - 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, - 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, - 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, - 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, - 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, - 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, - 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, - 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, - 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, - 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, - 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, - 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, - 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, - 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, - 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, - 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, - 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, - 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, - 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, - 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, - 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, - 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, - 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, - 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, - 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, - 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, - 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, - 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, - 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, - 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, - 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, - 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, - 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, - 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, - 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, - 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, - 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, - 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, - 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, - 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, - 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, - 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, - 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, - 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, - 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, - 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x36, 0x32, 0x30, 0x78, 0x30, - 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, - 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, - 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, - 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, - 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, - 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, - 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, - 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, - 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, - 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, - 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, - 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, - 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x70, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, - 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x70, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, - 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x6c, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xfe, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, - 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x36, 0x36, - 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, - 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, - 0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, - 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, - 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, - 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, - 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, - 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, - 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, - 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, - 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, - 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0xe0, 0x62, 0x66, 0x6c, 0x18, 0x30, - 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00, - 0x00, 0x60, 0xe0, 0x62, 0x66, 0x6c, 0x18, 0x30, - 0x66, 0xce, 0x9a, 0x3f, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, - 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, - 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, - 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, - 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, - 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, - 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, - 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, - 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, - 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, - 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x18, - 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, - 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, - 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, - 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, - 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, - 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, - 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, - 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, - 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, - 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, - 0x18, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, - 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, - 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x7e, - 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, - 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, - 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x6c, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3c, 0x66, 0x0c, 0x18, 0x32, 0x7e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, - 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/ili9341.c b/src/touch/ili9341.c deleted file mode 100644 index 1fd32b9..0000000 --- a/src/touch/ili9341.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * ili9341.c - * - * Drive the ILI9341 TFT LCD driver IC. - * - * Programming this device requires some cryptic initialisation sequence - * which is taken from Adafruit's library. Therefore this file is licensed - * under the following still-generous MIT terms: - * - * """ - * Adafruit invests time and resources providing this open source code, - * please support Adafruit and open-source hardware by purchasing - * products from Adafruit! - * - * Written by Limor Fried/Ladyada for Adafruit Industries. - * Modified and adapted for STM32 by Keir Fraser - * MIT license, all text above must be included in any redistribution - * """ - */ - -#if 1 -/* Although ILI9341 is specified to run at only 10MHz for write cycles (and - * even less than that for read cycles, which we don't use), in practice parts - * seem to clock much faster and this success is echoed by other users. */ -#define SPI_BR_DIV SPI_CR1_BR_DIV2 /* 36MHz(!) */ -#define SPI_PIN_SPEED _50MHz -#else -/* 9MHz will do for now. Worried about signal quality, power requirements and - * bandwidth requirements. */ -#define SPI_BR_DIV SPI_CR1_BR_DIV8 /* 9MHz */ -#define SPI_PIN_SPEED _10MHz -#endif - -#define PIN_DCRS 1 -#define PIN_RESET 2 -#define PIN_CS 3 -#define set_pin(pin, val) gpio_write_pin(gpioa, pin, val) - -#define spi spi1 -/* 8-bit mode, MSB first, CPOL Low, CPHA Leading Edge. */ -#define SPI_CR1 (SPI_CR1_MSTR | /* master */ \ - SPI_CR1_SSM | SPI_CR1_SSI | /* software NSS */ \ - SPI_CR1_SPE | \ - SPI_BR_DIV) - -#define ILI9341_NOP 0x00 -#define ILI9341_SWRESET 0x01 -#define ILI9341_RDDID 0x04 -#define ILI9341_RDDST 0x09 -#define ILI9341_SLPIN 0x10 -#define ILI9341_SLPOUT 0x11 -#define ILI9341_PTLON 0x12 -#define ILI9341_NORON 0x13 -#define ILI9341_RDMODE 0x0A -#define ILI9341_RDMADCTL 0x0B -#define ILI9341_RDPIXFMT 0x0C -#define ILI9341_RDIMGFMT 0x0A -#define ILI9341_RDSELFDIAG 0x0F -#define ILI9341_INVOFF 0x20 -#define ILI9341_INVON 0x21 -#define ILI9341_GAMMASET 0x26 -#define ILI9341_DISPOFF 0x28 -#define ILI9341_DISPON 0x29 -#define ILI9341_CASET 0x2A -#define ILI9341_PASET 0x2B -#define ILI9341_RAMWR 0x2C -#define ILI9341_RAMRD 0x2E -#define ILI9341_PTLAR 0x30 -#define ILI9341_MADCTL 0x36 -#define ILI9341_PIXFMT 0x3A -#define ILI9341_FRMCTR1 0xB1 -#define ILI9341_FRMCTR2 0xB2 -#define ILI9341_FRMCTR3 0xB3 -#define ILI9341_INVCTR 0xB4 -#define ILI9341_DFUNCTR 0xB6 -#define ILI9341_PWCTR1 0xC0 -#define ILI9341_PWCTR2 0xC1 -#define ILI9341_PWCTR3 0xC2 -#define ILI9341_PWCTR4 0xC3 -#define ILI9341_PWCTR5 0xC4 -#define ILI9341_VMCTR1 0xC5 -#define ILI9341_VMCTR2 0xC7 -#define ILI9341_RDID1 0xDA -#define ILI9341_RDID2 0xDB -#define ILI9341_RDID3 0xDC -#define ILI9341_RDID4 0xDD -#define ILI9341_GMCTRP1 0xE0 -#define ILI9341_GMCTRN1 0xE1 - -#define BG_COL 0x0000u - -extern const char font4x8[]; -extern const char font8x16[]; - -static void spi_acquire(void) -{ - spi->cr1 = SPI_CR1; - set_pin(PIN_CS, 0); -} - -static void spi_release(void) -{ - spi_quiesce(spi); - set_pin(PIN_CS, 1); -} - -static void writecommand(uint8_t c) -{ - set_pin(PIN_DCRS, 0); - spi_acquire(); - spi_xmit8(spi, c); - spi_release(); -} - -static void writedata(uint8_t c) -{ - set_pin(PIN_DCRS, 1); - spi_acquire(); - spi_xmit8(spi, c); - spi_release(); -} - -static void set_addr_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) -{ - /* Column addr set */ - writecommand(ILI9341_CASET); - writedata(x0 >> 8); - writedata(x0 >> 0); - writedata(x1 >> 8); - writedata(x1 >> 0); - - /* Row addr set */ - writecommand(ILI9341_PASET); - writedata(y0 >> 8); - writedata(y0 >> 0); - writedata(y1 >> 8); - writedata(y1 >> 0); - - /* Write to RAM */ - writecommand(ILI9341_RAMWR); -} - -void fill_rect( - uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t c) -{ - unsigned int i; - set_addr_window(x, y, x+w-1, y+h-1); - set_pin(PIN_DCRS, 1); - spi_acquire(); - spi_16bit_frame(spi); - for (i = 0; i < w*h; i++) - spi_xmit16(spi, c); - spi_8bit_frame(spi); - spi_release(); -} - -void clear_screen(void) -{ - fill_rect(0, 0, 320, 240, BG_COL); -} - -static void draw_char_8x16(uint16_t x, uint16_t y, unsigned char c) -{ - uint8_t i, j; - - set_addr_window(x, y, x+7, y+15); - - set_pin(PIN_DCRS, 1); - spi_acquire(); - spi_16bit_frame(spi); - - for (j = 0; j < 16; j++) { - int8_t k = font8x16[c*16+j]; - for (i = 0; i < 8; i++) { - if (k < 0) { - spi_xmit16(spi, 0xffff); - } else { - spi_xmit16(spi, BG_COL); - } - k <<= 1; - } - } - - spi_8bit_frame(spi); - spi_release(); -} - -void draw_string_8x16(uint16_t x, uint16_t y, const char *str) -{ - y *= 16; /* 16px vertical spacing works well. */ - while (*str && (x < TFT_8x16_COLS)) { - char c = *str++; - draw_char_8x16(x*8, y, !(c & 0x80) ? c : 0); - x++; - } -} - -static void draw_char_4x8(uint16_t x, uint16_t y, unsigned char c) -{ - uint8_t i, j; - - set_addr_window(x, y, x+3, y+7); - - set_pin(PIN_DCRS, 1); - spi_acquire(); - spi_16bit_frame(spi); - - for (j = 0; j < 8; j++) { - int8_t k = font4x8[c*4+j/2]; - if (j&1) k <<= 4; - for (i = 0; i < 4; i++) { - if (k < 0) { - spi_xmit16(spi, 0xffff); - } else { - spi_xmit16(spi, BG_COL); - } - k <<= 1; - } - } - - spi_8bit_frame(spi); - spi_release(); -} - -void draw_string_4x8(uint16_t x, uint16_t y, const char *str) -{ - y *= 10; /* 10px vertical spacing works well. */ - while (*str && (x < TFT_4x8_COLS)) { - char c = *str++; - draw_char_4x8(x*4, y, !(c & 0x80) ? c : 0); - x++; - } -} - -/* Some cryptic command banging is required to set up the controller. - * Summarised here as , <# data bytes>, */ -const uint8_t init_seq[] = { - 0xef, 3, 0x03, 0x80, 0x02, - 0xcf, 3, 0x00, 0xc1, 0x30, - 0xed, 4, 0x64, 0x03, 0x12, 0x81, - 0xe8, 3, 0x85, 0x00, 0x78, - 0xcb, 5, 0x39, 0x2c, 0x00, 0x34, 0x02, - 0xf7, 1, 0x20, - 0xea, 2, 0x00, 0x00, - ILI9341_PWCTR1, 1, 0x23, - ILI9341_PWCTR2, 1, 0x10, - ILI9341_VMCTR1, 2, 0x3e, 0x28, - ILI9341_VMCTR2, 1, 0x86, - ILI9341_MADCTL, 1, 0x28, /* 0xe8 here flips the display */ - ILI9341_PIXFMT, 1, 0x55, - ILI9341_FRMCTR1, 2, 0x00, 0x18, - ILI9341_DFUNCTR, 3, 0x08, 0x82, 0x27, - 0xf2, 1, 0x00, /* 3Gamma Function Disable */ - ILI9341_GAMMASET, 1, 0x01, - ILI9341_GMCTRP1, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, - 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00, - ILI9341_GMCTRN1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, - 0xc1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f, - ILI9341_SLPOUT, 0, - 0 -}; - -void tft_init(void) -{ - const uint8_t *init_p; - uint8_t i; - - /* Turn on the clocks. */ - rcc->apb2enr |= RCC_APB2ENR_SPI1EN; - - /* Configure general-purpose I/Os. */ - gpio_configure_pin(gpioa, PIN_DCRS, GPO_pushpull(SPI_PIN_SPEED, HIGH)); - gpio_configure_pin(gpioa, PIN_RESET, GPO_pushpull(_2MHz, HIGH)); - gpio_configure_pin(gpioa, PIN_CS, GPO_pushpull(SPI_PIN_SPEED, HIGH)); - - /* Configure SPI I/Os. */ - gpio_configure_pin(gpioa, 5, AFO_pushpull(SPI_PIN_SPEED)); /* CK */ - gpio_configure_pin(gpioa, 6, GPI_pull_up); /* MISO */ - gpio_configure_pin(gpioa, 7, AFO_pushpull(SPI_PIN_SPEED)); /* MOSI */ - - /* Configure SPI. */ - spi->cr2 = 0; - spi->cr1 = SPI_CR1; - - /* Drain SPI I/O. */ - spi_quiesce(spi); - - /* Reset. */ - delay_ms(5); - set_pin(PIN_RESET, 0); - delay_ms(20); - set_pin(PIN_RESET, 1); - delay_ms(150); - - /* Initialise. */ - for (init_p = init_seq; *init_p; ) { - writecommand(*init_p++); - for (i = *init_p++; i != 0; i--) - writedata(*init_p++); - } - - /* Wait a short while after Sleep Out command. */ - delay_ms(5); - - /* Clear the display, then switch it on. */ - clear_screen(); - writecommand(ILI9341_DISPON); - delay_ms(100); /* wait for screen to refresh to black */ -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/sd_spi.c b/src/touch/sd_spi.c deleted file mode 100644 index e60949f..0000000 --- a/src/touch/sd_spi.c +++ /dev/null @@ -1,523 +0,0 @@ -/* - * sd_spi.c - * - * Drive SD memory card in SPI mode via STM32 built-in SPI interface. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -#include "../fatfs/diskio.h" - -#if 1 -/* We can now switch to Default Speed (25MHz). Closest we can get is 36Mhz/2 = - * 18MHz. */ -#define DEFAULT_SPEED_DIV SPI_CR1_BR_DIV2 /* 18MHz */ -#define SPI_PIN_SPEED _50MHz -#else -/* Best speed I can reliably achieve right now is 9Mbit/s. */ -#define DEFAULT_SPEED_DIV SPI_CR1_BR_DIV4 /* 9MHz */ -#define SPI_PIN_SPEED _10MHz -#endif - -#if 0 -#define TRC(f, a...) printk("SD: " f, ## a) -#else -#define TRC(f, a...) do { } while (0) -#endif - -#define CMD(n) (0x40 | (n)) -#define ACMD(n) (0xc0 | (n)) - -#define R1_MBZ (1u<<7) -#define R1_ParamErr (1u<<6) -#define R1_AddressErr (1u<<5) -#define R1_EraseSeqErr (1u<<4) -#define R1_CRCErr (1u<<3) -#define R1_IllegalCmd (1u<<2) -#define R1_EraseReset (1u<<1) -#define R1_IdleState (1u<<0) - -static DSTATUS status = STA_NOINIT; - -#define CT_MMC 0x01 -#define CT_SD1 0x02 /* SDC v1.xx */ -#define CT_SD2 0x03 /* SDC v2.xx */ -#define CT_BLOCK 0x04 /* Fixed-block interface */ -#define CT_SDHC (CT_BLOCK | CT_SD2) /* SDHC is v2.xx and fixed-block-size */ -static uint8_t cardtype; - -#define spi spi2 -#define PIN_CS 4 - -static void spi_acquire(void) -{ - gpio_write_pin(gpioa, PIN_CS, 0); -} - -static void spi_release(void) -{ - spi_quiesce(spi); - gpio_write_pin(gpioa, PIN_CS, 1); - /* Need a dummy transfer as SD deselect is sync'ed to the clock. */ - (void)spi_recv8(spi); - spi_quiesce(spi); -} - -static uint8_t wait_ready(void) -{ - stk_time_t start = stk_now(); - uint8_t res; - - /* Wait 500ms for card to be ready. */ - do { - res = spi_recv8(spi); - } while ((res != 0xff) && (stk_timesince(start) < stk_ms(500))); - - return res; -} - -/* CRC7 polynomial 0x09, as used to protect SD Commands. */ -static const uint8_t crc7_table[256] = { - 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, - 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, - 0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26, - 0x51, 0x58, 0x43, 0x4a, 0x75, 0x7c, 0x67, 0x6e, - 0x32, 0x3b, 0x20, 0x29, 0x16, 0x1f, 0x04, 0x0d, - 0x7a, 0x73, 0x68, 0x61, 0x5e, 0x57, 0x4c, 0x45, - 0x2b, 0x22, 0x39, 0x30, 0x0f, 0x06, 0x1d, 0x14, - 0x63, 0x6a, 0x71, 0x78, 0x47, 0x4e, 0x55, 0x5c, - 0x64, 0x6d, 0x76, 0x7f, 0x40, 0x49, 0x52, 0x5b, - 0x2c, 0x25, 0x3e, 0x37, 0x08, 0x01, 0x1a, 0x13, - 0x7d, 0x74, 0x6f, 0x66, 0x59, 0x50, 0x4b, 0x42, - 0x35, 0x3c, 0x27, 0x2e, 0x11, 0x18, 0x03, 0x0a, - 0x56, 0x5f, 0x44, 0x4d, 0x72, 0x7b, 0x60, 0x69, - 0x1e, 0x17, 0x0c, 0x05, 0x3a, 0x33, 0x28, 0x21, - 0x4f, 0x46, 0x5d, 0x54, 0x6b, 0x62, 0x79, 0x70, - 0x07, 0x0e, 0x15, 0x1c, 0x23, 0x2a, 0x31, 0x38, - 0x41, 0x48, 0x53, 0x5a, 0x65, 0x6c, 0x77, 0x7e, - 0x09, 0x00, 0x1b, 0x12, 0x2d, 0x24, 0x3f, 0x36, - 0x58, 0x51, 0x4a, 0x43, 0x7c, 0x75, 0x6e, 0x67, - 0x10, 0x19, 0x02, 0x0b, 0x34, 0x3d, 0x26, 0x2f, - 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, - 0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, - 0x6a, 0x63, 0x78, 0x71, 0x4e, 0x47, 0x5c, 0x55, - 0x22, 0x2b, 0x30, 0x39, 0x06, 0x0f, 0x14, 0x1d, - 0x25, 0x2c, 0x37, 0x3e, 0x01, 0x08, 0x13, 0x1a, - 0x6d, 0x64, 0x7f, 0x76, 0x49, 0x40, 0x5b, 0x52, - 0x3c, 0x35, 0x2e, 0x27, 0x18, 0x11, 0x0a, 0x03, - 0x74, 0x7d, 0x66, 0x6f, 0x50, 0x59, 0x42, 0x4b, - 0x17, 0x1e, 0x05, 0x0c, 0x33, 0x3a, 0x21, 0x28, - 0x5f, 0x56, 0x4d, 0x44, 0x7b, 0x72, 0x69, 0x60, - 0x0e, 0x07, 0x1c, 0x15, 0x2a, 0x23, 0x38, 0x31, - 0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79 -}; - -static uint8_t crc7(uint8_t *buf, uint8_t count) -{ - uint8_t crc = 0; - while (count--) - crc = crc7_table[(crc << 1) ^ *buf++]; - return crc; -} - -static uint8_t send_cmd(uint8_t cmd, uint32_t arg) -{ - uint8_t i, res, retry = 0; - uint8_t buf[6]; - - for (;;) { - - /* ACMDx == CMD55 + CMDx */ - if ((cmd & 0x80) && ((res = send_cmd(CMD(55), 0)) & ~R1_IdleState)) - return res; - - spi_acquire(); - - if ((res = wait_ready()) != 0xff) { - TRC("CMD(0x%02x,0x%08x): not ready\n", cmd, arg); - return 0xff; - } - - buf[0] = cmd & 0x7f; - buf[1] = arg >> 24; - buf[2] = arg >> 16; - buf[3] = arg >> 8; - buf[4] = arg >> 0; - buf[5] = (crc7(buf, 5) << 1) | 1; - - for (i = 0; i < 6; i++) - spi_xmit8(spi, buf[i]); - - /* Resync with receive stream. (We ignored rx bytes, above). */ - spi_quiesce(spi); - - /* Wait up to 80 clocks for a valid response (MSB clear). */ - for (i = 0; i < 10; i++) - if (!((res = spi_recv8(spi)) & R1_MBZ)) - break; - - /* Retry if no response or CRC error. */ - if (!(res & (R1_MBZ|R1_CRCErr)) || (++retry >= 3)) - break; - - /* Resync the SPI interface before retrying. */ - spi_release(); - } - - TRC("SD CMD(0x%02x,0x%08x): res=0x%02x\n", cmd, arg, res); - return res; -} - -static bool_t datablock_recv(BYTE *buff, uint16_t bytes) -{ - bool_t ok; - uint8_t token; - uint32_t start = stk_now(); - - /* Wait 100ms for data to be ready. */ - do { - token = spi_recv8(spi); - } while ((token == 0xff) && (stk_timesince(start) < stk_ms(100))); - if (token != 0xfe) /* valid data token? */ - return 0; - - spi_16bit_frame(spi); - - spi->crcpr = 0x1021; /* CRC-CCITT */ - spi->cr1 |= SPI_CR1_CRCEN; - - /* Grab the data. */ - while (bytes) { - uint16_t w = spi_recv16(spi); - *buff++ = w >> 8; - *buff++ = w; - bytes -= 2; - } - - /* Retrieve and check the CRC. */ - (void)spi_recv16(spi); - spi_quiesce(spi); - ok = !spi->rxcrcr; - spi->cr1 &= ~SPI_CR1_CRCEN; - - spi_8bit_frame(spi); - - return ok; -} - -static bool_t datablock_xmit(const BYTE *buff, uint8_t token) -{ - uint8_t res, wc = 0; - - if ((res = wait_ready()) != 0xff) - return FALSE; - - /* Send the token. */ - spi_xmit8(spi, token); - - /* If token is Stop Transmission, we're done. */ - if (token == 0xfd) - return TRUE; - - spi_16bit_frame(spi); - - spi->crcpr = 0x1021; /* CRC-CCITT */ - spi->cr1 |= SPI_CR1_CRCEN; - - /* Send the data. */ - do { - uint16_t w = (uint16_t)*buff++ << 8; - w |= *buff++; - spi_xmit16(spi, w); - } while (--wc); - - /* Send the CRC. */ - spi_quiesce(spi); - spi_xmit16(spi, spi->txcrcr); - spi->cr1 &= ~SPI_CR1_CRCEN; - - spi_8bit_frame(spi); - - /* Check Data Response token: Data accepted? */ - return (spi_recv8(spi) & 0x1f) == 0x05; -} - -static void dump_cid_info(void) -{ - uint8_t cid[16], crc; - uint16_t mo, yr; - - printk("Card ID: "); - - /* SEND_CID */ - if ((send_cmd(CMD(10), 0) != 0) || !datablock_recv(cid, 16)) { - printk("unavailable\n"); - goto out; - } - - crc = (crc7(cid, 15) << 1) | 1; - yr = 2000 + (uint8_t)(cid[14]>>4) + (uint8_t)(cid[13]<<4); - mo = cid[14] & 15; - printk("MID=0x%02x OID='%c%c' " - "PNM='%c%c%c%c%c' PRV=%u.%u " - "PSN=0x%02x%02x%02x%02x MDT=%u/%u CRC=%s\n", - cid[0], cid[1], cid[2], cid[3], cid[4], cid[5], cid[6], cid[7], - (uint8_t)(cid[8]>>4), (uint8_t)(cid[8]<<4), - cid[9], cid[10], cid[11], cid[12], mo, yr, - (crc == cid[15]) ? "good" : "bad"); - -out: - spi_release(); -} - -DSTATUS disk_initialize(BYTE pdrv) -{ - uint32_t start, cr1; - uint16_t rcv; - uint8_t i; - - if (pdrv) - return RES_PARERR; - - status |= STA_NOINIT; - - /* Turn on the clocks. */ - rcc->apb1enr |= RCC_APB1ENR_SPI2EN; - - /* Enable external I/O pins. */ - gpio_configure_pin(gpioa, PIN_CS, GPO_pushpull(SPI_PIN_SPEED, HIGH)); - gpio_configure_pin(gpiob, 13, AFO_pushpull(SPI_PIN_SPEED)); /* CK */ - gpio_configure_pin(gpiob, 14, GPI_pull_up); /* MISO */ - gpio_configure_pin(gpiob, 15, AFO_pushpull(SPI_PIN_SPEED)); /* MOSI */ - - /* Configure SPI: 8-bit mode, MSB first, CPOL Low, CPHA Leading Edge. */ - spi->cr2 = 0; - cr1 = (SPI_CR1_MSTR | /* master */ - SPI_CR1_SSM | SPI_CR1_SSI | /* software NSS */ - SPI_CR1_SPE); - spi->cr1 = cr1 | SPI_CR1_BR_DIV128; /* ~281kHz (<400kHz) */ - - /* Drain SPI I/O. */ - spi_quiesce(spi); - - /* Wait 80 cycles for card to ready itself. */ - for (i = 0; i < 10; i++) - (void)spi_recv8(spi); - - /* Reset, enter idle state (SPI mode). */ - if (send_cmd(CMD(0), 0) != R1_IdleState) - goto out; - - /* Enable CRC checking. Not all cards support this. */ - if ((send_cmd(CMD(59), 1) & ~R1_IllegalCmd) != R1_IdleState) - goto out; - - /* Send interface condition (2.7-3.6v, check bits). - * This also validates that the card responds to v2.00-only commands. */ - if (send_cmd(CMD(8), 0x1aa) == R1_IdleState) { - - /* Command was understood. We have a v2.00-compliant card. - * Get the 4-byte response and validate. */ - for (i = rcv = 0; i < 4; i++) - rcv = (rcv << 8) | spi_recv8(spi); - if ((rcv & 0x1ff) != 0x1aa) { - TRC("Bad CMD8 response 0x%04x\n", rcv); - goto out; - } - - /* Request SDHC/SDXC and start card initialisation. */ - start = stk_now(); - while (send_cmd(ACMD(41), 1u<<30)) { - if (stk_timesince(start) >= stk_ms(1000)) - goto out; /* initialisation timeout */ - } - - /* Read OCR register, check for SDSD/SDHC/SDXC configuration. */ - if (send_cmd(CMD(58), 0) != 0) - goto out; - rcv = spi_recv8(spi); /* Only care about first byte (bits 31:24) */ - for (i = 0; i < 3; i++) - (void)spi_recv8(spi); - if (!(rcv & 0x80)) { /* Bit 31: fail if card is still busy */ - TRC("OCR unexpected MSB 0x%02x\n", (uint8_t)rcv); - goto out; - } - cardtype = (rcv & 0x40) ? CT_SDHC : CT_SD2; /* Bit 30: SDHC? */ - - } else { - - /* No valid response to CMD. Must be a v1.xx SDC or MMC. - * Try initialisation with ACMD41. This will work if it's an SDC. */ - uint8_t cmd = ACMD(41); - cardtype = CT_SD1; - if (send_cmd(cmd, 0) & ~R1_IdleState) { - /* Must be MMC: Fall back to CMD1. */ - cmd = CMD(1); - cardtype = CT_MMC; - } - - /* Wait for card initialisation. */ - start = stk_now(); - while (send_cmd(cmd, 0)) { - if (stk_timesince(start) >= stk_ms(1000)) - goto out; /* initialisation timeout */ - } - - } - - /* Specify 512-byte block size. Unnecessary but harmless for SDHC. */ - if (send_cmd(CMD(16), 512) != 0) - goto out; - - /* We're done: All good. */ - status &= ~STA_NOINIT; - -out: - spi_release(); - - if (!(status & STA_NOINIT)) { - delay_us(10); /* XXX small delay here stops SPI getting stuck?? */ - spi->cr1 = cr1 | DEFAULT_SPEED_DIV; - printk("SD Card configured\n"); - dump_cid_info(); - } else { - /* Disable SPI. */ - spi->cr1 = 0; - rcc->apb1enr &= ~RCC_APB1ENR_SPI2EN; - /* Configure external I/O pins as pulled-up inputs. */ - gpio_configure_pin(gpioa, PIN_CS, GPI_pull_up); - gpio_configure_pin(gpiob, 13, GPI_pull_up); /* CK */ - gpio_configure_pin(gpiob, 14, GPI_pull_up); /* MISO */ - gpio_configure_pin(gpiob, 15, GPI_pull_up); /* MOSI */ - } - - return status; -} - -DSTATUS disk_status (BYTE pdrv) -{ - return pdrv ? STA_NOINIT : status; -} - -DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count) -{ - uint8_t retry = 0; - UINT todo; - BYTE *p; - - if (pdrv || !count) - return RES_PARERR; - if (status & STA_NOINIT) - return RES_NOTRDY; - - if (!(cardtype & CT_BLOCK)) - sector <<= 9; - - do { - todo = count; - p = buff; - - /* READ_{MULTIPLE,SINGLE}_BLOCK */ - if (send_cmd(CMD((count > 1) ? 18 : 17), sector) != 0) - continue; - - while (datablock_recv(p, 512) && --todo) - p += 512; - - /* STOP_TRANSMISSION */ - if (count > 1) - send_cmd(CMD(12), 0); - - spi_release(); - - } while (todo && (++retry < 3)); - - return todo ? RES_ERROR : RES_OK; -} - -DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) -{ - uint8_t retry = 0; - UINT todo; - const BYTE *p; - - if (pdrv || !count) - return RES_PARERR; - if (status & STA_NOINIT) - return RES_NOTRDY; - - if (!(cardtype & CT_BLOCK)) - sector <<= 9; - - do { - todo = count; - p = buff; - - if (count == 1) { - /* WRITE_BLOCK */ - if (send_cmd(CMD(24), sector) != 0) - continue; - /* Write 1 block */ - if (datablock_xmit(p, 0xfe)) - todo--; - } else { - /* SET_WR_BLK_ERASE_COUNT */ - if ((cardtype & (CT_SD1|CT_SD2)) - && (send_cmd(ACMD(23), count) != 0)) - continue; - /* WRITE_MULTIPLE_BLOCK */ - if (send_cmd(CMD(25), sector) != 0) - continue; - /* Write blocks */ - while (datablock_xmit(p, 0xfc) && --todo) - p += 512; - /* Stop Transmission token */ - if (!datablock_xmit(NULL, 0xfd)) - todo = 1; /* error */ - } - - spi_release(); - - } while (todo && (++retry < 3)); - - return todo ? RES_ERROR : RES_OK; -} - -DRESULT disk_ioctl(BYTE pdrv, BYTE ctrl, void *buff) -{ - DRESULT res = RES_ERROR; - - printk("ioctl %d %d\n", pdrv, ctrl); - - if (pdrv) - return RES_PARERR; - if (status & STA_NOINIT) - return RES_NOTRDY; - - switch (ctrl) { - case CTRL_SYNC: - spi_acquire(); - if (wait_ready() == 0xff) - res = RES_OK; - spi_release(); - break; - default: - res = RES_PARERR; - break; - } - - return res; -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/speaker.c b/src/touch/speaker.c deleted file mode 100644 index ea10f4b..0000000 --- a/src/touch/speaker.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * speaker.c - * - * PC speaker/buzzer control. - * - * We drive the speaker with pulses, the width of which determine volume. - * Single pulses generate a click. As the pulse frequency rises above ~50Hz, - * a tone is generated. Max frequency is limited by MAX_KHZ. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -/* MM150: Timer 3, channel 1, PB4 - * LC150: Timer 3, channel 4, PB1 */ -#define gpio_spk gpiob -#define tim tim3 - -#define MAX_KHZ 5 /* Limits highest frequency */ -#define TICK_MHZ 8 /* Controls volume range */ -#define ARR (TICK_MHZ*1000/MAX_KHZ-1) - -static void _speaker_pulse(unsigned int volume); - -void speaker_init(void) -{ - uint8_t pin_spk = (board_id == BRDREV_LC150) ? 1 : 4; - - /* PWM2 mode achieves a LOW-HIGH-LOW pulse in one-pulse mode, which is - * what we require to drive an NPN BJT with grounded emitter. */ - tim->psc = SYSCLK_MHZ/TICK_MHZ - 1; - tim->arr = ARR; - tim->ccmr1 = (TIM_CCMR1_CC1S(TIM_CCS_OUTPUT) | - TIM_CCMR1_OC1M(TIM_OCM_PWM2)); /* PWM2: low then high */ - tim->ccmr2 = (TIM_CCMR2_CC4S(TIM_CCS_OUTPUT) | - TIM_CCMR2_OC4M(TIM_OCM_PWM2)); /* PWM2: low then high */ - tim->ccer = TIM_CCER_CC1E|TIM_CCER_CC4E; - tim->cr2 = tim->dier = 0; - _speaker_pulse(0); /* ensures output LOW */ - - /* Set up the output pin. */ - afio->mapr |= AFIO_MAPR_TIM3_REMAP_PARTIAL; - gpio_configure_pin(gpio_spk, pin_spk, AFO_pushpull(_2MHz)); -} - -static void _speaker_pulse(unsigned int volume) -{ - volatile uint32_t *pwm_ccr = - (board_id == BRDREV_LC150) ? &tim->ccr4 : &tim->ccr1; - - /* Don't overlap pulses; limit the maximum frequency. */ - if (tim->cr1 & TIM_CR1_CEN) - return; - - /* Quadratic scaling of pulse width seems to give linear-ish volume. */ - *pwm_ccr = ARR + 1 - volume*volume; - tim->cr1 = TIM_CR1_OPM | TIM_CR1_CEN; -} - -void speaker_pulse(void) -{ - _speaker_pulse(ff_cfg.step_volume); -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/src/touch/xpt2046.c b/src/touch/xpt2046.c deleted file mode 100644 index 25ee324..0000000 --- a/src/touch/xpt2046.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * xpt2046.c - * - * Drive the XPT2046 resistive touch panel IC. - * - * Written & released by Keir Fraser - * - * This is free and unencumbered software released into the public domain. - * See the file COPYING for more details, or visit . - */ - -#define GPIO_IRQ gpiob -#define PIN_IRQ 0 -#define GPIO_CS gpioa -#define PIN_CS 0 - -/* We clock the SPI dead slow, giving plenty of settling time during - * sample acquisition. */ -#define spi spi1 -#define SPI_BR_DIV SPI_CR1_BR_DIV256 /* 281kHz, 3.6us cycle */ -/* 8-bit mode, MSB first, CPOL Low, CPHA Leading Edge. */ -#define SPI_CR1 (SPI_CR1_MSTR | /* master */ \ - SPI_CR1_SSM | SPI_CR1_SSI | /* software NSS */ \ - SPI_CR1_SPE | \ - SPI_BR_DIV) - -static void spi_acquire(void) -{ - spi->cr1 = SPI_CR1; - gpio_write_pin(GPIO_CS, PIN_CS, 0); -} - -static void spi_release(void) -{ - spi_quiesce(spi); - gpio_write_pin(GPIO_CS, PIN_CS, 1); -} - -static void get_xy_samples(uint8_t nr, uint16_t *px, uint16_t *py) -{ - uint16_t x, y; - spi_acquire(); - (void)spi_xchg8(spi, 0x90); - while (nr--) { - x = (uint16_t)spi_xchg8(spi, 0) << 8; - x |= spi_xchg8(spi, 0xd0); - y = (uint16_t)spi_xchg8(spi, 0) << 8; - y |= spi_xchg8(spi, nr ? 0x90 : 0); - *px++ = (x >> 3) & 0xfff; - *py++ = (y >> 3) & 0xfff; - } - spi_release(); -} - -bool_t touch_get_xy(uint16_t *px, uint16_t *py) -{ - uint16_t x[8], y[8]; - uint8_t i, j; - - /* Get raw samples. Ensure PENIRQ was active throughout. */ - if (gpio_read_pin(GPIO_IRQ, PIN_IRQ)) - return FALSE; - get_xy_samples(8, x, y); - if (gpio_read_pin(GPIO_IRQ, PIN_IRQ)) - return FALSE; - - /* Selection sort. Ignore the first sample; it's often an outlier. */ - for (i = 1; i < 7; i++) { - for (j = i+1; j < 8; j++) { - uint16_t t = x[i]; - if (t > x[j]) { - x[i] = x[j]; - x[j] = t; - } - t = y[i]; - if (t > y[j]) { - y[i] = y[j]; - y[j] = t; - } - } - } - - /* Check range of middle three values is tightly bounded. This is good for - * rejecting noisy readings when the panel is lightly touched or tapped. */ - if (((x[5]-x[3]) > 16) || ((y[5]-y[3]) > 16)) - return FALSE; - - /* Return the median. */ - *px = x[4]; - *py = y[4]; - - return TRUE; -} - -void touch_init(void) -{ - uint16_t x, y; - - /* Configure general-purpose I/Os. */ - gpio_configure_pin(GPIO_IRQ, PIN_IRQ, GPI_floating); - gpio_configure_pin(GPIO_CS, PIN_CS, GPO_pushpull(_2MHz, HIGH)); - - /* ILI9341 already initialised SPI pins and general config. */ - - /* Set PD0=PD1=0 (power-saving mode; PENIRQ active). */ - get_xy_samples(1, &x, &y); -} - -/* - * Local variables: - * mode: C - * c-file-style: "Linux" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */