summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-01-05 15:20:41 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-01-21 18:52:28 +0100
commit69d0dae55bf3da2f356dbd03dba299c708133902 (patch)
treeff60084c40831c6f8f7b8806d54fe570c2d8955b
parentb3abcb807b7f6202158a47668af7f2505b6dd25e (diff)
downloadrockbox-69d0dae.tar.gz
rockbox-69d0dae.zip
Initial commit for the ZEN X-Fi Style
Change-Id: Ib25a357a7bafd2ef25f273cadff70fafbd8d4661
-rw-r--r--firmware/SOURCES6
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/config/creativezenxfistyle.h200
-rw-r--r--firmware/target/arm/imx233/creative-zen/backlight-zen.c8
-rw-r--r--firmware/target/arm/imx233/creative-zen/button-target.h8
-rw-r--r--firmware/target/arm/imx233/creative-zen/button-zen.c46
-rw-r--r--firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c311
-rw-r--r--firmware/target/arm/imx233/sdmmc-imx233.c7
-rw-r--r--rbutil/mkimxboot/dualboot.c11
-rw-r--r--rbutil/mkimxboot/dualboot.h1
-rw-r--r--rbutil/mkimxboot/dualboot/Makefile3
-rw-r--r--rbutil/mkimxboot/dualboot/dualboot.c14
-rw-r--r--rbutil/mkimxboot/mkimxboot.c6
-rwxr-xr-xtools/configure79
-rw-r--r--tools/scramble.c4
15 files changed, 665 insertions, 44 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 4e8567cf7e..15f42a4011 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1165,8 +1165,8 @@ target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
#endif /* CREATIVE_ZVx */
#if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC) \
- || defined(CREATIVE_ZENV)
- #ifndef BOOTLOADER
+ || defined(CREATIVE_ZENV) || defined(CREATIVE_ZENXFISTYLE)
+#ifndef BOOTLOADER
target/arm/imx233/fmradio-imx233.c
#endif
target/arm/imx233/creative-zen/backlight-zen.c
@@ -1176,6 +1176,8 @@ target/arm/imx233/creative-zen/lcd-zen.c
target/arm/imx233/creative-zen/lcd-zenmozaic.c
# elif defined(CREATIVE_ZENV)
target/arm/imx233/creative-zen/lcd-zenv.c
+# elif defined(CREATIVE_ZENXFISTYLE)
+target/arm/imx233/creative-zen/lcd-zenxfistyle.c
#endif
target/arm/imx233/creative-zen/button-zen.c
target/arm/imx233/creative-zen/debug-zen.c
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 89e0036947..b72aa33fa9 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -259,9 +259,10 @@
#define LCD_CREATIVEZEN 55 /* as used by the Creative ZEN (X-Fi) (LMS250GF03-001(S6D0139)) */
#define LCD_CREATIVEZENMOZAIC 56 /* as used by the Creative ZEN Mozaic (FGD0801) */
#define LCD_ILI9342C 57 /* another type of lcd used by HiFi E.T MA9/MA8 */
-#define LCD_CREATIVEZENV 58 /* as used by the Creativr Zen V (Plus) */
+#define LCD_CREATIVEZENV 58 /* as used by the Creative Zen V (Plus) */
#define LCD_SAMSUNGYPZ5 59 /* as used by Samsung YP-Z5 */
#define LCD_IHIFI 60 /* as used by IHIFI 760/960 */
+#define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */
/* LCD_PIXELFORMAT */
#define HORIZONTAL_PACKING 1
@@ -556,6 +557,8 @@ Lyre prototype 1 */
#include "config/ihifi760.h"
#elif defined(IHIFI960)
#include "config/ihifi960.h"
+#elif defined(CREATIVE_ZENXFISTYLE)
+#include "config/creativezenxfistyle.h"
#else
/* no known platform */
#endif
diff --git a/firmware/export/config/creativezenxfistyle.h b/firmware/export/config/creativezenxfistyle.h
new file mode 100644
index 0000000000..ad692debb4
--- /dev/null
+++ b/firmware/export/config/creativezenxfistyle.h
@@ -0,0 +1,200 @@
+/*
+ * This config file is for the Creative Zen X-Fi Style
+ */
+#define IMX233_SUBTARGET 3780
+#define IMX233_PACKAGE IMX233_BGA169
+#define IMX233_PARTITIONS IMX233_FREESCALE
+
+/* For Rolo and boot loader */
+#define MODEL_NUMBER 94
+#define MODEL_NAME "Creative Zen X-Fi Style"
+
+#define HW_SAMPR_CAPS SAMPR_CAP_ALL
+
+/* define this if you have recording possibility */
+#define HAVE_RECORDING
+
+#define REC_SAMPR_CAPS SAMPR_CAP_ALL
+
+/* Default recording levels */
+#define DEFAULT_REC_MIC_GAIN 23
+#define DEFAULT_REC_LEFT_GAIN 23
+#define DEFAULT_REC_RIGHT_GAIN 23
+
+/* Define bitmask of input sources - recordable bitmask can be defined
+ explicitly if different */
+#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
+
+/* define this if you have a bitmap LCD display */
+#define HAVE_LCD_BITMAP
+/* define this if you have a colour LCD */
+#define HAVE_LCD_COLOR
+
+#ifndef BOOTLOADER
+#define HAVE_ALBUMART
+
+/* define this to enable bitmap scaling */
+#define HAVE_BMP_SCALING
+
+/* define this to enable JPEG decoding */
+#define HAVE_JPEG
+
+/* Define this if a programmable hotkey is mapped */
+#define HAVE_HOTKEY
+
+/* define this if you have access to the quickscreen */
+#define HAVE_QUICKSCREEN
+
+
+/* define this if you would like tagcache to build on this target */
+#define HAVE_TAGCACHE
+
+/* define this if the target has volume keys which can be used in the lists */
+#define HAVE_VOLUME_IN_LIST
+
+/* define this if you have LCD enable function */
+#define HAVE_LCD_ENABLE
+
+/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
+ should be defined as well.
+#define HAVE_LCD_SLEEP
+#define HAVE_LCD_SLEEP_SETTING
+*/
+
+/* define this if you can flip your LCD
+#define HAVE_LCD_FLIP
+*/
+
+/* define this if you can invert the colours on your LCD
+#define HAVE_LCD_INVERT
+*/
+
+/* define this if you have a real-time clock */
+#define CONFIG_RTC RTC_IMX233
+
+/* define this if you have a real-time clock with alarm facilities */
+#define HAVE_RTC_ALARM
+
+#endif /* !BOOTLOADER */
+
+/* define this if you have an i.MX23 codec */
+#define HAVE_IMX233_CODEC
+
+#define CONFIG_TUNER STFM1000
+
+/* There is no hardware tone control */
+#define HAVE_SW_TONE_CONTROLS
+
+#define CONFIG_KEYPAD CREATIVE_ZEN_PAD
+#define HAVE_HEADPHONE_DETECTION
+
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
+/* Define this if you do software codec */
+#define CONFIG_CODEC SWCODEC
+
+/* LCD dimensions */
+#define LCD_WIDTH 320
+#define LCD_HEIGHT 240
+#define LCD_DEPTH 16 /* 65536 colours */
+#define LCD_PIXELFORMAT RGB565 /* rgb565 */
+
+/* Define this if you have a software controlled poweroff */
+#define HAVE_SW_POWEROFF
+
+/* Some Sansa Fuzes seem to be FAT16 formatted */
+#define HAVE_FAT16SUPPORT
+
+/* The number of bytes reserved for loadable codecs */
+#define CODEC_SIZE 0x100000
+
+/* The number of bytes reserved for loadable plugins */
+#define PLUGIN_BUFFER_SIZE 0x80000
+
+#define AB_REPEAT_ENABLE
+
+/* Define this for LCD backlight available */
+#define HAVE_BACKLIGHT
+#define HAVE_BACKLIGHT_BRIGHTNESS
+
+/* Main LCD backlight brightness range and defaults */
+#define MIN_BRIGHTNESS_SETTING 0
+#define MAX_BRIGHTNESS_SETTING 100
+#define DEFAULT_BRIGHTNESS_SETTING 50
+
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
+/* define this if you have a flash memory storage */
+#define HAVE_FLASH_STORAGE
+
+/* define this if the flash memory uses the SecureDigital Memory Card protocol */
+#define CONFIG_STORAGE STORAGE_SD
+
+/* todo */
+#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
+#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
+#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
+#define BATTERY_CAPACITY_INC 0 /* capacity increment */
+#define BATTERY_TYPES_COUNT 1 /* only one type */
+
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
+/* Charging implemented in a target-specific algorithm */
+#define CONFIG_CHARGING CHARGING_TARGET
+
+/* define this if the unit can be powered or charged via USB */
+#define HAVE_USB_POWER
+
+/* Define this if you have an IMX233*/
+#define CONFIG_CPU IMX233
+
+/* Define this if you want to use the IMX233 i2c interface */
+#define CONFIG_I2C I2C_IMX233
+
+/* define current usage levels (based on battery bench) */
+#define CURRENT_NORMAL 35
+#define CURRENT_BACKLIGHT 30
+#define CURRENT_RECORD CURRENT_NORMAL
+
+/* maximum charging current */
+#define CURRENT_MAX_CHG 200
+
+/* Define this to the CPU frequency */
+#define CPU_FREQ 454000000
+
+/* Type of LCD */
+#define CONFIG_LCD LCD_CREATIVEZENXFISTYLE
+
+/* Offset ( in the firmware file's header ) to the file CRC and data. These are
+ only used when loading the old format rockbox.e200 file */
+#define FIRMWARE_OFFSET_FILE_CRC 0x0
+#define FIRMWARE_OFFSET_FILE_DATA 0x8
+
+/* USB On-the-go */
+#define CONFIG_USBOTG USBOTG_ARC
+
+/* enable these for the experimental usb stack */
+#define HAVE_USBSTACK
+//#define USB_HANDLED_BY_OF
+#define USE_ROCKBOX_USB
+#define USB_VENDOR_ID 0x041e
+#define USB_PRODUCT_ID 0x200a
+#define HAVE_USB_HID_MOUSE
+#define HAVE_BOOTLOADER_USB_MODE
+
+/* The ZEN X-Fi Style actually interesting partition table does not use 512-byte sector
+ * (usually 2048 logical sector size) */
+#define MAX_LOG_SECTOR_SIZE 2048
+
+/* Define this if you have adjustable CPU frequency */
+#define HAVE_ADJUSTABLE_CPU_FREQ
+
+#define BOOTFILE_EXT "creative"
+#define BOOTFILE "rockbox." BOOTFILE_EXT
+#define BOOTDIR "/.rockbox"
+
+#define INCLUDE_TIMEOUT_API
+
+
diff --git a/firmware/target/arm/imx233/creative-zen/backlight-zen.c b/firmware/target/arm/imx233/creative-zen/backlight-zen.c
index 74e1e91a49..6d162817c8 100644
--- a/firmware/target/arm/imx233/creative-zen/backlight-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/backlight-zen.c
@@ -26,10 +26,14 @@
#include "backlight-target.h"
#include "uartdbg-imx233.h"
#include "pinctrl-imx233.h"
+#include "pwm-imx233.h"
void _backlight_set_brightness(int level)
{
-#ifdef CREATIVE_ZENV
+#if defined(CREATIVE_ZENXFISTYLE)
+ imx233_pwm_setup_simple(4, 24000, level);
+ imx233_pwm_enable(4, true);
+#elif defined(CREATIVE_ZENV)
lcd_set_contrast(level);
#else
unsigned val = (level + 200) * level / 1000;
@@ -47,7 +51,7 @@ void _backlight_set_brightness(int level)
bool _backlight_init(void)
{
-#ifndef CREATIVE_ZENV
+#if !defined(CREATIVE_ZENV) && !defined(CREATIVE_ZENXFISTYLE)
imx233_pinctrl_acquire(1, 12, "backlight_enable");
imx233_pinctrl_set_function(1, 12, PINCTRL_FUNCTION_GPIO);
imx233_pinctrl_enable_gpio(1, 12, true);
diff --git a/firmware/target/arm/imx233/creative-zen/button-target.h b/firmware/target/arm/imx233/creative-zen/button-target.h
index 7974ae42ad..65521d66e4 100644
--- a/firmware/target/arm/imx233/creative-zen/button-target.h
+++ b/firmware/target/arm/imx233/creative-zen/button-target.h
@@ -25,10 +25,16 @@
bool button_debug_screen(void);
+#if !defined(CREATIVE_ZENXFISTYLE)
#define HAS_BUTTON_HOLD
+#define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC
+#endif
+#if defined(CREATIVE_ZENXFISTYLE)
+#define IMX233_BUTTON_LRADC_CHANNEL 2
+#else
#define IMX233_BUTTON_LRADC_CHANNEL 0
-#define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC
+#endif
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
diff --git a/firmware/target/arm/imx233/creative-zen/button-zen.c b/firmware/target/arm/imx233/creative-zen/button-zen.c
index 8f20961a57..c0e7205675 100644
--- a/firmware/target/arm/imx233/creative-zen/button-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/button-zen.c
@@ -25,6 +25,14 @@
#include "power-imx233.h"
#include "button-lradc-imx233.h"
+#if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
+#define JACK_DET_BANK 2
+#define JACK_DET_PIN 8
+#elif defined(CREATIVE_ZENXFISTYLE)
+#define JACK_DET_BANK 2
+#define JACK_DET_PIN 7
+#endif
+
struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
{
#if defined(CREATIVE_ZEN)
@@ -84,6 +92,18 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
{2945, BUTTON_PLAYPAUSE},
{3400, 0},
{0, IMX233_BUTTON_LRADC_END},
+#elif defined(CREATIVE_ZENXFISTYLE)
+ {230, BUTTON_MENU},
+ {480, BUTTON_SHORTCUT},
+ {690, BUTTON_UP},
+ {920, BUTTON_LEFT},
+ {1120, BUTTON_RIGHT},
+ {1335, BUTTON_DOWN},
+ {1565, BUTTON_SELECT},
+ {2850, BUTTON_BACK},
+ {3110, BUTTON_PLAYPAUSE},
+ {3620, 0},
+ {0, IMX233_BUTTON_LRADC_END},
#else
#error wrong target
#endif
@@ -92,29 +112,43 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
void button_init_device(void)
{
imx233_button_lradc_init();
-#if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
- imx233_pinctrl_acquire(2, 8, "jack_detect");
- imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO);
- imx233_pinctrl_enable_gpio(2, 8, false);
+#ifdef HAVE_HEADPHONE_DETECTION
+ imx233_pinctrl_acquire(JACK_DET_BANK, JACK_DET_PIN, "jack_detect");
+ imx233_pinctrl_set_function(JACK_DET_BANK, JACK_DET_PIN, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(JACK_DET_BANK, JACK_DET_PIN, false);
+#endif
+#ifdef CREATIVE_ZENXFISTYLE
+ imx233_pinctrl_acquire(0, 11, "power_detect");
+ imx233_pinctrl_set_function(0, 11, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(0, 11, false);
#endif
}
+#ifdef HAS_BUTTON_HOLD
bool button_hold(void)
{
return imx233_button_lradc_hold();
}
+#endif
-#if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
+#ifdef HAVE_HEADPHONE_DETECTION
bool headphones_inserted(void)
{
- return !imx233_pinctrl_get_gpio(2, 8);
+ return !imx233_pinctrl_get_gpio(JACK_DET_BANK, JACK_DET_PIN);
}
#endif
int button_read_device(void)
{
int btn = 0;
+#ifdef CREATIVE_ZENXFISTYLE
+ /* The ZEN X-Fi Style uses a GPIO because both select and power are wired
+ * to PSWITCH resulting in slow and unreliable readings */
+ if(!imx233_pinctrl_get_gpio(0, 11))
+ btn |= BUTTON_POWER;
+#else
if(imx233_power_read_pswitch() == 1)
btn |= BUTTON_POWER;
+#endif
return imx233_button_lradc_read(btn);
}
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c b/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c
new file mode 100644
index 0000000000..5a4542ca67
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zen/lcd-zenxfistyle.c
@@ -0,0 +1,311 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2013 by Amaury Pouly
+ *
+ * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <sys/types.h> /* off_t */
+#include <string.h>
+#include "cpu.h"
+#include "system.h"
+#include "backlight-target.h"
+#include "lcd.h"
+#include "lcdif-imx233.h"
+#include "clkctrl-imx233.h"
+#include "pinctrl-imx233.h"
+#include "logf.h"
+
+#ifdef HAVE_LCD_ENABLE
+static bool lcd_on;
+#endif
+static int lcd_model;
+
+static inline uint32_t encode_16_to_18(uint32_t a)
+{
+ return ((a & 0xff) << 1) | (((a >> 8) & 0xff) << 10);
+}
+
+static void lcd_write_reg(uint32_t reg, uint32_t data)
+{
+ uint32_t old_reg = reg;
+ /* get back to 18-bit word length */
+ imx233_lcdif_set_word_length(18);
+ reg = encode_16_to_18(reg);
+ data = encode_16_to_18(data);
+
+ imx233_lcdif_pio_send(false, 1, &reg);
+ if(old_reg != 0x22)
+ imx233_lcdif_pio_send(true, 1, &data);
+}
+
+static void lcd_init_seq(void)
+{
+ if(lcd_model == 0)
+ {
+ lcd_write_reg(0xe3, 0x3008);
+ lcd_write_reg(0xe7, 0x12);
+ lcd_write_reg(0xef, 0x1231);
+ lcd_write_reg(0x01, 0x100);
+ lcd_write_reg(0x02, 0x700);
+ lcd_write_reg(0x03, 0x1028);
+ lcd_write_reg(0x04, 0);
+ lcd_write_reg(0x08, 0x207);
+ lcd_write_reg(0x09, 0);
+ lcd_write_reg(0x0a, 0);
+ lcd_write_reg(0x0c, 0);
+ lcd_write_reg(0x0d, 0);
+ lcd_write_reg(0x0f, 0);
+ lcd_write_reg(0x10, 0);
+ lcd_write_reg(0x11, 7);
+ lcd_write_reg(0x12, 0);
+ lcd_write_reg(0x13, 0);
+ mdelay(200);
+ lcd_write_reg(0x10, 0x1490);
+ lcd_write_reg(0x11, 0x227);
+ mdelay(50);
+ lcd_write_reg(0x12, 0x9c);
+ mdelay(50);
+ lcd_write_reg(0x13, 0xc00);
+ lcd_write_reg(0x29, 5);
+ lcd_write_reg(0x2b, 0xc);
+ lcd_write_reg(0x20, 0xef);
+ lcd_write_reg(0x21, 0);
+ lcd_write_reg(0x30, 6);
+ lcd_write_reg(0x31, 0x703);
+ lcd_write_reg(0x32, 0x206);
+ lcd_write_reg(0x35, 4);
+ lcd_write_reg(0x36, 0x1a05);
+ lcd_write_reg(0x37, 0x600);
+ lcd_write_reg(0x38, 0x307);
+ lcd_write_reg(0x39, 0x707);
+ lcd_write_reg(0x3c, 0x400);
+ lcd_write_reg(0x3d, 0x50f);
+ lcd_write_reg(0x50, 0);
+ lcd_write_reg(0x51, 0xef);
+ lcd_write_reg(0x52, 0);
+ lcd_write_reg(0x53, 0x13f);
+ lcd_write_reg(0x60, 0xa700);
+ lcd_write_reg(0x61, 1);
+ lcd_write_reg(0x6a, 0);
+ lcd_write_reg(0x80, 0);
+ lcd_write_reg(0x81, 0);
+ lcd_write_reg(0x82, 0);
+ lcd_write_reg(0x83, 0);
+ lcd_write_reg(0x84, 0);
+ lcd_write_reg(0x85, 0);
+ lcd_write_reg(0x90, 0x10);
+ lcd_write_reg(0x92, 0x600);
+ lcd_write_reg(0x07, 0x133);
+ }
+ else
+ {
+ lcd_write_reg(0x01, 0x100);
+ lcd_write_reg(0x02, 0x700);
+ lcd_write_reg(0x03, 0x1028);
+ lcd_write_reg(0x04, 0);
+ lcd_write_reg(0x08, 0x207);
+ lcd_write_reg(0x09, 0);
+ lcd_write_reg(0x0a, 0);
+ lcd_write_reg(0x0c, 0);
+ lcd_write_reg(0x0d, 0);
+ lcd_write_reg(0x0f, 0);
+ lcd_write_reg(0x10, 0);
+ lcd_write_reg(0x11, 7);
+ lcd_write_reg(0x12, 0);
+ lcd_write_reg(0x13, 0);
+ mdelay(200);
+ lcd_write_reg(0x10, 0x1290);
+ lcd_write_reg(0x11, 0x227);
+ mdelay(50);
+ lcd_write_reg(0x12, 0x9c);
+ mdelay(50);
+ lcd_write_reg(0x13, 0x1f00);
+ lcd_write_reg(0x29, 0x30);
+ lcd_write_reg(0x2b, 0xd);
+ lcd_write_reg(0x20, 0xef);
+ lcd_write_reg(0x21, 0);
+ lcd_write_reg(0x30, 0x404);
+ lcd_write_reg(0x31, 0x404);
+ lcd_write_reg(0x32, 0x404);
+ lcd_write_reg(0x37, 0x303);
+ lcd_write_reg(0x38, 0x303);
+ lcd_write_reg(0x39, 0x303);
+ lcd_write_reg(0x35, 0x103);
+ lcd_write_reg(0x3c, 0x301);
+ lcd_write_reg(0x36, 0x1e00);
+ lcd_write_reg(0x3d, 0xf);
+ lcd_write_reg(0x50, 0);
+ lcd_write_reg(0x51, 0xef);
+ lcd_write_reg(0x52, 0);
+ lcd_write_reg(0x53, 0x13f);
+ lcd_write_reg(0x60, 0xa700);
+ lcd_write_reg(0x61, 0);
+ lcd_write_reg(0x6a, 0);
+ lcd_write_reg(0x80, 0);
+ lcd_write_reg(0x81, 0);
+ lcd_write_reg(0x82, 0);
+ lcd_write_reg(0x83, 0);
+ lcd_write_reg(0x84, 0);
+ lcd_write_reg(0x85, 0);
+ lcd_write_reg(0x2b, 0xd);
+ mdelay(50);
+ lcd_write_reg(0x90, 0x17);
+ lcd_write_reg(0x92, 0);
+ lcd_write_reg(0x93, 3);
+ lcd_write_reg(0x95, 0x110);
+ lcd_write_reg(0x97, 0);
+ lcd_write_reg(0x98, 0);
+ lcd_write_reg(0x07, 0x133);
+ }
+}
+
+void lcd_init_device(void)
+{
+ /* clock at 24MHZ */
+ imx233_clkctrl_enable(CLK_PIX, false);
+ imx233_clkctrl_set_div(CLK_PIX, 1);
+ imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
+ imx233_clkctrl_enable(CLK_PIX, true);
+ imx233_lcdif_init();
+ imx233_lcdif_set_lcd_databus_width(18);
+ imx233_lcdif_enable_underflow_recover(true);
+ imx233_lcdif_setup_system_pins(18);
+ imx233_lcdif_set_timings(2, 2, 2, 2);
+
+ imx233_pinctrl_acquire(2, 8, "lcd_model");
+ imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(2, 8, false);
+ lcd_model = imx233_pinctrl_get_gpio(2, 8);
+
+ // reset device
+ imx233_lcdif_reset_lcd(true);
+ mdelay(50);
+ imx233_lcdif_reset_lcd(false);
+ mdelay(10);
+ imx233_lcdif_reset_lcd(true);
+
+ lcd_init_seq();
+#ifdef HAVE_LCD_ENABLE
+ lcd_on = true;
+#endif
+}
+
+#ifdef HAVE_LCD_ENABLE
+bool lcd_active(void)
+{
+ return lcd_on;
+}
+
+static void lcd_enable_seq(bool enable)
+{
+ if(!enable)
+ {
+ }
+ else
+ {
+ }
+}
+
+void lcd_enable(bool enable)
+{
+ if(lcd_on == enable)
+ return;
+
+ lcd_on = enable;
+
+ lcd_enable_seq(enable);
+ if(enable)
+ send_event(LCD_EVENT_ACTIVATION, NULL);
+}
+#endif
+
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
+
+/* NOTE the LCD is rotated: it's a 240x320 panel with (0,0) being the bottom-left
+ * corner when the player is hold in landscape mode. This means x and y axis and
+ * exchanged and the y axis is reversed. */
+
+void lcd_update_rect(int x, int y, int w, int h)
+{
+#ifdef HAVE_LCD_ENABLE
+ if(!lcd_on)
+ return;
+#endif
+ /* make sure the rectangle is included in the screen */
+ x = MIN(x, LCD_WIDTH);
+ y = MIN(y, LCD_HEIGHT);
+ w = MIN(w, LCD_WIDTH - x);
+ h = MIN(h, LCD_HEIGHT - y);
+
+ imx233_lcdif_wait_ready();
+ lcd_write_reg(0x50, LCD_HEIGHT - y - h);
+ lcd_write_reg(0x51, LCD_HEIGHT - y - 1);
+ lcd_write_reg(0x52, x);
+ lcd_write_reg(0x53, x + w - 1);
+ lcd_write_reg(0x20, LCD_HEIGHT - y - 1);
+ lcd_write_reg(0x21, x);
+ lcd_write_reg(0x22, 0);
+ imx233_lcdif_wait_ready();
+ imx233_lcdif_set_word_length(16);
+ imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */
+
+ /* there are two cases here:
+ * - either width = LCD_WIDTH and we can directly memcopy a part of lcd_framebuffer to FRAME
+ * and send it
+ * - either width != LCD_WIDTH and we have to build a contiguous copy of the rectangular area
+ * into FRAME before sending it (which is slower and doesn't use the hardware)
+ * In all cases, FRAME just acts as a temporary buffer.
+ * NOTE It's more interesting to do a copy to FRAME in all cases since in system mode
+ * the clock runs at 24MHz which provides barely 10MB/s bandwidth compared to >100MB/s
+ * for memcopy operations
+ */
+ if(w == LCD_WIDTH)
+ {
+ memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
+ }
+ else
+ {
+ for(int i = 0; i < h; i++)
+ memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
+ }
+ /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
+ * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
+ * field must be a multiple of 2. Furthermore, it seems the lcd controller doesn't
+ * really like when both w and h are even, probably because the writes to the GRAM
+ * are done on several words and the controller requires dummy writes.
+ * The workaround is to always make sure that we send a number of pixels which is
+ * a multiple of 4 so that both the lcdif and the controller are happy. If any
+ * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
+ * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
+ */
+ if(w % 2 == 1 || h % 2 == 1)
+ {
+ /* copy three pixel after the last one */
+ for(int i = 0; i < 3; i++)
+ *((fb_data *)FRAME + w * h + i) = *((fb_data *)FRAME + i);
+ /* WARNING we need to update w and h to reflect the pixel count BUT it
+ * has no relation to w * h (it can even be 2 * prime). Hopefully, w <= 240 and
+ * h <= 320 so w * h <= 76800 and (w * h + 3) / 4 <= 38400 which fits into
+ * a 16-bit integer (horizontal count). */
+ h = (w * h + 3) / 4;
+ w = 4;
+ }
+ imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
+}
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c
index 08eae021bc..8103e980d1 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -151,6 +151,13 @@ struct sdmmc_config_t sdmmc_config[] =
.ssp = 2,
.mode = SD_MODE,
}
+#elif defined(CREATIVE_ZENXFISTYLE)
+ {
+ .name = "internal/SD",
+ .flags = WINDOW,
+ .ssp = 2,
+ .mode = SD_MODE
+ },
#elif defined(SONY_NWZE370) || defined(SONY_NWZE360)
/* The Sony NWZ-E370 uses #B1P29 for power */
{
diff --git a/rbutil/mkimxboot/dualboot.c b/rbutil/mkimxboot/dualboot.c
index e2bbdae8a9..b991fe3f6e 100644
--- a/rbutil/mkimxboot/dualboot.c
+++ b/rbutil/mkimxboot/dualboot.c
@@ -89,3 +89,14 @@ unsigned char dualboot_nwze360[416] = {
0x3d, 0x59, 0x85, 0xe2, 0x09, 0x5d, 0x85, 0xe2, 0x03, 0x80, 0xa0, 0xe1, 0xda, 0xff, 0xff, 0xea,
0x00, 0x40, 0x04, 0x80, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xff, 0xff, 0x00, 0xc0, 0x01, 0x80
};
+unsigned char dualboot_zenxfistyle[136] = {
+ 0x10, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x00, 0xeb, 0x10, 0x80, 0xbd, 0xe8, 0x6c, 0x30, 0x9f, 0xe5,
+ 0xc0, 0x30, 0x93, 0xe5, 0x68, 0x30, 0x9f, 0xe5, 0x02, 0x21, 0xa0, 0xe3, 0x08, 0x20, 0x83, 0xe5,
+ 0x03, 0x21, 0x82, 0xe2, 0x08, 0x20, 0x83, 0xe5, 0xff, 0x24, 0x82, 0xe2, 0x78, 0x20, 0x83, 0xe5,
+ 0xc5, 0x24, 0x82, 0xe2, 0x24, 0x20, 0x83, 0xe5, 0x04, 0x20, 0xa0, 0xe3, 0x18, 0x20, 0x83, 0xe5,
+ 0x04, 0x20, 0x83, 0xe5, 0x03, 0x20, 0xa0, 0xe1, 0x10, 0x30, 0x92, 0xe5, 0x04, 0x00, 0x13, 0xe3,
+ 0xfc, 0xff, 0xff, 0x0a, 0x28, 0x30, 0x9f, 0xe5, 0x70, 0x30, 0x93, 0xe5, 0xff, 0x34, 0xc3, 0xe3,
+ 0x3f, 0x37, 0xc3, 0xe3, 0xcb, 0x3f, 0x43, 0xe2, 0x03, 0x30, 0x43, 0xe2, 0x63, 0x00, 0x53, 0xe3,
+ 0x00, 0x00, 0xa0, 0x93, 0x00, 0x00, 0x81, 0x85, 0x01, 0x00, 0xa0, 0x83, 0x1e, 0xff, 0x2f, 0xe1,
+ 0x00, 0x40, 0x04, 0x80, 0x00, 0x00, 0x05, 0x80
+};
diff --git a/rbutil/mkimxboot/dualboot.h b/rbutil/mkimxboot/dualboot.h
index 17ee1979fb..65793811c7 100644
--- a/rbutil/mkimxboot/dualboot.h
+++ b/rbutil/mkimxboot/dualboot.h
@@ -5,3 +5,4 @@ extern unsigned char dualboot_zenxfi2[96];
extern unsigned char dualboot_zenxfi3[56];
extern unsigned char dualboot_nwze370[416];
extern unsigned char dualboot_nwze360[416];
+extern unsigned char dualboot_zenxfistyle[136];
diff --git a/rbutil/mkimxboot/dualboot/Makefile b/rbutil/mkimxboot/dualboot/Makefile
index 500263c4bf..28e9643a3a 100644
--- a/rbutil/mkimxboot/dualboot/Makefile
+++ b/rbutil/mkimxboot/dualboot/Makefile
@@ -10,12 +10,13 @@ CFLAGS=-mcpu=arm926ej-s -std=gnu99 -I. -I$(REGS_PATH) -nostdlib -ffreestanding -
# 1) add x to the list in TARGETS
# 2) create a variable named OPT_x of the form:
# OPT_x=target specific defines
-TARGETS=fuzeplus zenxfi2 zenxfi3 nwze370 nwze360
+TARGETS=fuzeplus zenxfi2 zenxfi3 nwze370 nwze360 zenxfistyle
OPT_fuzeplus=-DSANSA_FUZEPLUS -DIMX233_SUBTARGET=3780
OPT_zenxfi2=-DCREATIVE_ZENXFI2 -DIMX233_SUBTARGET=3780
OPT_zenxfi3=-DCREATIVE_ZENXFI3 -DIMX233_SUBTARGET=3780
OPT_nwze370=-DSONY_NWZE370 -DIMX233_SUBTARGET=3780
OPT_nwze360=-DSONY_NWZE360 -DIMX233_SUBTARGET=3780
+OPT_zenxfistyle=-DCREATIVE_ZENXFISTYLE -DIMX233_SUBTARGET=3780
BOOTOBJS=$(patsubst %, dualboot_%.o, $(TARGETS))
BOOTBINS=$(patsubst %, dualboot_%.arm-bin, $(TARGETS))
diff --git a/rbutil/mkimxboot/dualboot/dualboot.c b/rbutil/mkimxboot/dualboot/dualboot.c
index 3cca59bb8a..e841b12d74 100644
--- a/rbutil/mkimxboot/dualboot/dualboot.c
+++ b/rbutil/mkimxboot/dualboot/dualboot.c
@@ -184,6 +184,20 @@ static int boot_decision(int context)
}
return decision;
}
+#elif defined(CREATIVE_ZENXFISTYLE)
+static int boot_decision(int context)
+{
+ setup_lradc(2); // setup LRADC channel 2 to read keys
+ /* make a decision */
+ int val = read_lradc(2);
+ /* boot to OF if left is hold
+ * NOTE: VDDIO is set to 3.1V initially and the resistor ladder is wired to
+ * VDDIO so these values are not the same as in the main binary which is
+ * calibrated for VDDIO=3.3V */
+ if(val >= 815 && val < 915)
+ return BOOT_OF;
+ return BOOT_ROCK;
+}
#else
#warning You should define a target specific boot decision function
static int boot_decision(int context)
diff --git a/rbutil/mkimxboot/mkimxboot.c b/rbutil/mkimxboot/mkimxboot.c
index 1761fc9cb2..3897216e16 100644
--- a/rbutil/mkimxboot/mkimxboot.c
+++ b/rbutil/mkimxboot/mkimxboot.c
@@ -199,7 +199,7 @@ static const struct imx_model_desc_t imx_models[] =
1, &zero_key, 0, 0x40000000 },
[MODEL_ZENXFI3] = {"Zen X-Fi3", dualboot_zenxfi3, sizeof(dualboot_zenxfi3), "zxf3", 83,
1, &zero_key, 0, 0x40000000 },
- [MODEL_ZENXFISTYLE] = {"Zen X-Fi Style", NULL, 0, "", -1,
+ [MODEL_ZENXFISTYLE] = {"Zen X-Fi Style", dualboot_zenxfistyle, sizeof(dualboot_zenxfistyle), "zxfs", 94,
1, &zero_key, 0, 0x40000000 },
[MODEL_ZENSTYLE] = {"Zen Style 100/300", NULL, 0, "", -1,
1, &zero_key, 0, 0x40000000 },
@@ -429,6 +429,10 @@ static enum imx_error_t patch_firmware(enum imx_model_t model,
return IMX_DONT_KNOW_HOW_TO_PATCH;
}
break;
+ case MODEL_ZENXFISTYLE:
+ /* The ZEN X-Fi Style uses the standard ____, host, play sections, patch after first
+ * call in ____ section. */
+ return patch_std_zero_host_play(1, model, type, sb_file, boot_fw);
default:
return IMX_DONT_KNOW_HOW_TO_PATCH;
}
diff --git a/tools/configure b/tools/configure
index 1ac644597e..0f897836c9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1308,35 +1308,36 @@ cat <<EOF
34) M3/M3L 71) M:Robe 100 51) Sansa e200R
52) Sansa c200
==Creative== ==Philips== 53) Sansa m200
- 90) Zen Vision:M 30GB 100) GoGear SA9200 54) Sansa c100
- 91) Zen Vision:M 60GB 101) GoGear HDD1630/ 55) Sansa Clip
- 92) Zen Vision HDD1830 56) Sansa e200v2
- 93) Zen X-Fi2 102) GoGear HDD6330 57) Sansa m200v4
- 94) Zen X-Fi3 58) Sansa Fuze
- 96) Zen X-Fi ==Meizu== 59) Sansa c200v2
- 97) Zen X-Mozaic 110) M6SL 60) Sansa Clipv2
- 98) Zen 111) M6SP 61) Sansa View
- 112) M3 62) Sansa Clip+
- ==Onda== 63) Sansa Fuze v2
- 120) VX747 ==Tatung== 64) Sansa Fuze+
- 121) VX767 150) Elio TPJ-1022 65) Sansa Clip Zip
- 122) VX747+ 66) Sansa Connect
- 123) VX777 ==Packard Bell==
- 160) Vibe 500 ==Logik==
- ==Samsung== 80) DAX 1GB MP3/DAB
- 140) YH-820 ==MPIO==
- 141) YH-920 170) HD200 ==Lyre project==
- 142) YH-925 171) HD300 130) Lyre proto 1
- 143) YP-S3 131) Mini2440
- 144) YP-Z5
- ==ROCKCHIP==
- ==Application== 180) rk27xx generic ==HiFiMAN==
- 200) SDL 190) HM-60x
- 201) Android ==HiFi E.T.== 191) HM-801
- 202) Nokia N8xx 210) MA9
- 203) Nokia N900 211) MA9C ==Sony==
- 204) Pandora 212) MA8 220) NWZ-E370/E380 series
- 205) Samsung YP-R0 213) MA8C 221) NWZ-E360 series
+ 89) Zen X-Fi Style 100) GoGear SA9200 54) Sansa c100
+ 90) Zen Vision:M 30GB 101) GoGear HDD1630/ 55) Sansa Clip
+ 91) Zen Vision:M 60GB HDD1830 56) Sansa e200v2
+ 92) Zen Vision 102) GoGear HDD6330 57) Sansa m200v4
+ 93) Zen X-Fi2 58) Sansa Fuze
+ 94) Zen X-Fi3 ==Meizu== 59) Sansa c200v2
+ 96) Zen X-Fi 110) M6SL 60) Sansa Clipv2
+ 97) Zen X-Mozaic 111) M6SP 61) Sansa View
+ 98) Zen 112) M3 62) Sansa Clip+
+ 63) Sansa Fuze v2
+ ==Onda== ==Tatung== 64) Sansa Fuze+
+ 120) VX747 150) Elio TPJ-1022 65) Sansa Clip Zip
+ 121) VX767 66) Sansa Connect
+ 122) VX747+ ==Packard Bell==
+ 123) VX777 160) Vibe 500 ==Logik==
+ 80) DAX 1GB MP3/DAB
+ ==Samsung== ==MPIO==
+ 140) YH-820 170) HD200 ==Lyre project==
+ 141) YH-920 171) HD300 130) Lyre proto 1
+ 142) YH-925 131) Mini2440
+ 143) YP-S3
+ 144) YP-Z5 ==ROCKCHIP==
+ 180) rk27xx generic ==HiFiMAN==
+ ==Application== 190) HM-60x
+ 200) SDL ==HiFi E.T.== 191) HM-801
+ 201) Android 210) MA9
+ 202) Nokia N8xx 211) MA9C ==Sony==
+ 203) Nokia N900 212) MA8 220) NWZ-E370/E380 series
+ 204) Pandora 213) MA8C 221) NWZ-E360 series
+ 205) Samsung YP-R0
206) Android MIPS
207) Android x86
@@ -2182,6 +2183,26 @@ fi
t_model="logikdax"
;;
+ 89|creativezenxfistyle)
+ target_id=94
+ modelname="creativezenxfistyle"
+ target="CREATIVE_ZENXFISTYLE"
+ memory=64
+ bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
+ bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
+ tool="$rootdir/tools/scramble -add=zxfs"
+ output="rockbox.creative"
+ bootoutput="bootloader-zenxfistyle.creative"
+ appextra="gui:recorder:radio"
+ plugins=""
+ swcodec="yes"
+ toolset=$scramblebitmaptools
+ t_cpu="arm"
+ t_manufacturer="imx233"
+ t_model="creative-zen"
+ arm926ejscc
+ ;;
+
90|zenvisionm30gb)
target_id=35
modelname="zenvisionm30gb"
diff --git a/tools/scramble.c b/tools/scramble.c
index ba335d2f2d..5378be2853 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -129,7 +129,7 @@ void usage(void)
"\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
"\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
"\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n"
- "\t zxfi, zmoz, zen, zenv, ypz5)\n");
+ "\t zxfi, zmoz, zen, zenv, ypz5, zxfs)\n");
printf("\nNo option results in Archos standard player/recorder format.\n");
exit(1);
@@ -380,6 +380,8 @@ int main (int argc, char** argv)
modelnum = 89;
else if (!strcmp(&argv[1][5], "zen")) /* Creative ZEN */
modelnum = 90;
+ else if (!strcmp(&argv[1][5], "zxfs")) /* Creative ZEN X-Fi Style */
+ modelnum = 94;
else {
fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
return 2;