Sansa clip zip: update mkamsboot and fix various drivers to make it boot to the main firmware

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30853 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2011-10-29 17:08:05 +00:00
parent a8cde851fb
commit e90f961593
11 changed files with 53 additions and 47 deletions

View file

@ -45,7 +45,7 @@
#define LCD_WIDTH 96
#define LCD_HEIGHT 96
#define LCD_DEPTH 16 /* 65536 colours */
#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */
#define LCD_PIXELFORMAT RGB565
/* define this if you have LCD enable function */
#define HAVE_LCD_ENABLE
@ -114,6 +114,8 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
@ -189,9 +191,9 @@
/** Port-specific settings **/
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1 /* TODO */
#define MAX_BRIGHTNESS_SETTING 12 /* TODO */
#define DEFAULT_BRIGHTNESS_SETTING 6 /* TODO */
#define MIN_BRIGHTNESS_SETTING 0
#define MAX_BRIGHTNESS_SETTING 9
#define DEFAULT_BRIGHTNESS_SETTING 6
/* Default recording levels */
#define DEFAULT_REC_MIC_GAIN 23

View file

@ -25,11 +25,14 @@
#include "lcd.h"
#include "as3525v2.h"
#include "ascodec-target.h"
#include "lcd-target.h"
bool _backlight_init()
{
/* GPIO B1 controls backlight */
GPIOB_DIR |= (1 << 1);
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
GPIOB_PIN(1) = (1 << 1);
return true;
}
@ -37,13 +40,6 @@ bool _backlight_init()
void _backlight_on(void)
{
GPIOB_PIN(1) = (1 << 1);
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
sleep(1);
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
sleep(1);
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
#ifdef HAVE_LCD_ENABLE
lcd_enable(true);
#endif
@ -54,9 +50,11 @@ void _backlight_off(void)
#ifdef HAVE_LCD_ENABLE
lcd_enable(false);
#endif
GPIOB_PIN(1) = 0;
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
}
void _backlight_set_brightness(int brightness)
{
oled_brightness(brightness);
}

View file

@ -71,13 +71,13 @@ int button_read_device(void)
udelay(500);
if (GPIOC_PIN(3)) {
buttons |= BUTTON_LEFT;
buttons |= BUTTON_RIGHT;
}
if (GPIOC_PIN(4)) {
buttons |= BUTTON_SELECT;
}
if (GPIOC_PIN(5)) {
buttons |= BUTTON_RIGHT;
buttons |= BUTTON_UP;
}
/* key matrix buttons, second row */
@ -86,14 +86,14 @@ int button_read_device(void)
udelay(500);
if (GPIOC_PIN(3)) {
buttons |= BUTTON_UP;
}
if (GPIOC_PIN(4)) {
buttons |= BUTTON_HOME;
}
if (GPIOC_PIN(5)) {
if (GPIOC_PIN(4)) {
buttons |= BUTTON_DOWN;
}
if (GPIOC_PIN(5)) {
buttons |= BUTTON_LEFT;
}
/* deselect scan rows */
GPIOC_PIN(2) = 0;

View file

@ -51,12 +51,16 @@ static int lcd_hw_init(void)
SSP_IMSC &= ~0xF; /* disable interrupts */
SSP_DMACR &= ~0x3; /* disable DMA */
/* GPIO A3 is ??? but needs to be set */
GPIOA_DIR |= (1 << 3);
GPIOA_PIN(3) = (1 << 3);
/* configure GPIO B2 (lcd D/C#) as output */
GPIOB_DIR |= (1<<2);
/* configure GPIO B3 (lcd type detect) as input */
GPIOB_DIR &= ~(1<<3);
/* configure GPIO A5 (lcd reset#) as output and perform lcd reset */
GPIOA_DIR |= (1 << 5);
GPIOA_PIN(5) = 0;
@ -154,7 +158,7 @@ static void lcd_write_nibbles(uint8_t val)
/* initialises lcd type 1 */
static void lcd_init_type1(void)
{
static const uint8_t curve[256] = {
static const uint8_t curve[128] = {
/* 5-bit curve */
0, 5, 10, 15, 20, 25, 30, 35, 39, 43, 47, 51, 55, 59, 63, 67,
71, 75, 79, 83, 87, 91, 95, 99, 103, 105, 109, 113, 117, 121, 123, 127,
@ -242,7 +246,7 @@ static void lcd_init_type1(void)
lcd_write_dat(0x10);
lcd_write_cmd(0x3A);
for (i = 0; i < 256; i++) {
for (i = 0; i < 128; i++) {
lcd_write_nibbles(curve[i]);
}

View file

@ -376,11 +376,8 @@ static inline bool card_detect_target(void)
#if defined(HAVE_MULTIDRIVE)
#if defined(SANSA_FUZEV2)
return GPIOA_PIN(2);
#elif defined(SANSA_CLIPPLUS)
#elif defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
return !(GPIOA_PIN(2));
#elif defined(SANSA_CLIPZIP)
/* TODO for ClipZip: determine polarity of uSD detect */
return false;
#else
#error "microSD pin not defined for your target"
#endif
@ -398,14 +395,14 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, response))
return false;
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
GPIOB_PIN(5) = (drive == INTERNAL_AS3525) ? 1 << 5 : 0;
#endif
MCI_ARGUMENT = arg;
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
card_no = 1 << 16;
else
@ -565,7 +562,7 @@ static int sd_init_card(const int drive)
return -17;
/* Now that card is widebus make controller aware */
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
MCI_CTYPE |= 1<<1;
else
@ -575,7 +572,7 @@ static int sd_init_card(const int drive)
#endif /* ! BOOTLOADER */
/* Set low power mode */
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
MCI_CLKENA |= 1<<(1 + 16);
else
@ -673,7 +670,7 @@ static void init_controller(void)
int card_mask = (1 << hcon_numcards) - 1;
int pwr_mask;
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
pwr_mask = 1 << 1;
else
@ -738,7 +735,7 @@ int sd_init(void)
semaphore_init(&transfer_completion_signal, 1, 0);
semaphore_init(&command_completion_signal, 1, 0);
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
if (amsv2_variant == 1)
GPIOB_DIR |= 1 << 5;
#endif

View file

@ -184,7 +184,7 @@ static void check_model_variant(void)
c200v2_variant = !GPIOA_PIN(7);
GPIOA_DIR = saved_dir;
}
#elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
int amsv2_variant;
static void check_model_variant(void)

View file

@ -46,7 +46,7 @@
? (((uintptr_t)(a)) - IRAM_ORIG) \
: ((uintptr_t)(a))))
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
extern int amsv2_variant;
#endif