Index: firmware/target/arm/philips/hdd6330/backlight-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/backlight-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/backlight-hdd6330.c (revision 0) @@ -0,0 +1,104 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Mark Arigo + * + * 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 "config.h" +#include "backlight-target.h" +#include "system.h" +#include "backlight.h" +#include "synaptics-mep.h" + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +static const int brightness_vals[16] = + {255,237,219,201,183,165,147,130,112,94,76,58,40,22,5,0}; + +void _backlight_set_brightness(int brightness) +{ + outl(0x80000000 | (brightness_vals[brightness-1] << 16), 0x7000a000); +} +#endif + +void _backlight_on(void) +{ + GPO32_VAL &= ~0x1000000; + GPO32_ENABLE &= ~0x1000000; +} + +void _backlight_off(void) +{ + GPO32_VAL |= 0x1000000; + GPO32_ENABLE |= 0x1000000; +} + +#ifdef HAVE_BUTTON_LIGHT + +#define BUTTONLIGHT_MASK 0x7f + +static unsigned short buttonight_brightness = DEFAULT_BRIGHTNESS_SETTING - 1; +static unsigned short buttonlight_status = 0; + +static void set_buttonlight(int brightness) +{ + int data[6]; + + if (syn_get_status()) + { + syn_int_enable(false); + + /* turn on all touchpad leds */ + data[0] = 0x05; + data[1] = 0x31; + data[2] = (brightness & 0xff) << 4; + data[3] = 0x00; + data[4] = 0x00; + data[5] = BUTTONLIGHT_MASK; + syn_send(data, 6); + + /* device responds with a single-byte ACK packet */ + syn_read(data, 2); + + syn_int_enable(true); + } +} + +void _buttonlight_on(void) +{ + if (!buttonlight_status) + { + set_buttonlight(buttonight_brightness); + buttonlight_status = 1; + } +} + +void _buttonlight_off(void) +{ + if (buttonlight_status) + { + set_buttonlight(0); + buttonlight_status = 0; + } +} + +void _buttonlight_set_brightness(int brightness) +{ + buttonight_brightness = brightness - 1; + set_buttonlight(buttonight_brightness); + buttonlight_status = 1; +} +#endif Property changes on: firmware/target/arm/philips/hdd6330/backlight-hdd6330.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/arm/philips/hdd6330/button-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/button-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/button-hdd6330.c (revision 0) @@ -0,0 +1,164 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Mark Arigo + * + * 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 "system.h" +#include "button.h" +#include "backlight.h" +#include "synaptics-mep.h" + +#define LOGF_ENABLE +#include "logf.h" + +#define MEP_BUTTON_HEADER 0x19 +#define MEP_BUTTON_ID 0x9 +#define MEP_ABSOLUTE_HEADER 0x0b + +static int int_btn = BUTTON_NONE; + +/* + * Generate a click sound from the player (not in headphones yet) + * TODO: integrate this with the "key click" option + */ +void button_click(void) +{ + GPO32_ENABLE |= 0x2000; + GPO32_VAL |= 0x2000; + udelay(1000); + GPO32_VAL &= ~0x2000; +} + +#ifndef BOOTLOADER +void button_init_device(void) +{ + if (!syn_get_status()) + { + logf("button_init_dev: touchpad not ready"); + } +} + +/* + * Button interrupt handler + */ +void button_int(void) +{ + int data[4]; + int val, id; + + int_btn = BUTTON_NONE; + + if (syn_get_status()) + { + /* disable interrupt while we read the touchpad */ + syn_int_enable(false); + + val = syn_read(data, 4); + if (val > 0) + { + val = data[0] & 0xff; /* packet header */ + id = (data[1] >> 4) & 0xf; /* packet id */ + + logf("syn_read:"); + logf(" data[0] = 0x%08x", data[0]); + logf(" data[1] = 0x%08x", data[1]); + logf(" data[2] = 0x%08x", data[2]); + logf(" data[3] = 0x%08x", data[3]); + + if ((val == MEP_BUTTON_HEADER) && (id == MEP_BUTTON_ID)) + { + /* Buttons packet */ + if (data[1] & 0x1) + int_btn |= BUTTON_LEFT; + if (data[1] & 0x2) + int_btn |= BUTTON_RIGHT; + + /* An Absolute packet should follow which we ignore */ + val = syn_read(data, 4); + logf(" int_btn = 0x%04x", int_btn); + } + else if (val == MEP_ABSOLUTE_HEADER) + { + /* Absolute packet - the finger is on the vertical strip. + Position ranges from 1-4095, with 1 at the bottom. */ + val = ((data[1] >> 4) << 8) | data[2]; /* position */ + + logf(" pos %d", val); + logf(" z %d", data[3]); + logf(" finger %d", data[1] & 0x1); + logf(" gesture %d", data[1] & 0x2); + logf(" RelPosVld %d", data[1] & 0x4); + + if(data[1] & 0x1) /* if finger on touch strip */ + { + if ((val > 0) && (val <= 1365)) + int_btn |= BUTTON_DOWN; + else if ((val > 1365) && (val <= 2730)) + int_btn |= BUTTON_SELECT; + else if ((val > 2730) && (val <= 4095)) + int_btn |= BUTTON_UP; + } + } + } + + /* re-enable interrupts */ + syn_int_enable(true); + } +} +#else +void button_init_device(void){} +#endif /* bootloader */ + +bool button_hold(void) +{ + return !(GPIOJ_INPUT_VAL & 0x8); +} + +/* + * Get button pressed from hardware + */ +int button_read_device(void) +{ + static int btn_old = BUTTON_NONE; + int btn = int_btn; + + /* Hold */ + if(button_hold()) + return BUTTON_NONE; + + /* Device buttons */ + if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; + if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; + if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; + if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW; + if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; + if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; + + if ((btn != btn_old) && (btn != BUTTON_NONE)) + button_click(); + + btn_old = btn; + + return btn; +} + +bool headphones_inserted(void) +{ + return (GPIOE_INPUT_VAL & 0x80) ? true : false; +} Property changes on: firmware/target/arm/philips/hdd6330/button-hdd6330.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/arm/philips/hdd6330/fmradio_i2c-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/fmradio_i2c-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/fmradio_i2c-hdd6330.c (revision 0) @@ -0,0 +1,44 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id:$ + * + * Copyright (C) 2009 by Mark Arigo + * + * 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 "config.h" + +#if (CONFIG_TUNER & TEA5767) +#include "i2c-pp.h" +#include "fmradio_i2c.h" + +/* The TEA5767 uses 5 bytes, but the pp-i2c will only read/write 4 bytes + at a time. The tuner doesn't like it when the i2c resets to send the 5th + byte. So, we can only read/write the first 4 bytes. Luckily, on read, + the 5th byte is reserved and on write we only use that for the deemphasis + bit (which we'll have to ignore). This is what the OF appears to do too. */ + +int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) +{ + (void)count; + return i2c_sendbytes(address, 4, buf); +} + +int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) +{ + (void)count; + return i2c_readbytes(address, -1, 4, buf); +} +#endif Index: firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S =================================================================== --- firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S (revision 0) +++ firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S (revision 0) @@ -0,0 +1,570 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: lcd-as-hdd1630.S 19997 2009-02-13 04:10:57Z lowlight $ + * + * Copyright (C) 2007-2008 by Michael Sevakis + * + * H10 20GB LCD assembly routines + * + * 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 "config.h" +#include "cpu.h" + +/**************************************************************************** + * void lcd_write_yuv_420_lines(unsigned char const * const src[3], + * int width, + * int stride); + * + * |R| |1.000000 -0.000001 1.402000| |Y'| + * |G| = |1.000000 -0.334136 -0.714136| |Pb| + * |B| |1.000000 1.772000 0.000000| |Pr| + * Scaled, normalized, rounded and tweaked to yield RGB 565: + * |R| |74 0 101| |Y' - 16| >> 9 + * |G| = |74 -24 -51| |Cb - 128| >> 8 + * |B| |74 128 0| |Cr - 128| >> 9 + * + * Write four RGB565 pixels in the following order on each loop: + * 1 3 + > down + * 2 4 \/ left + */ + .section .icode, "ax", %progbits + .align 2 + .global lcd_write_yuv420_lines + .type lcd_write_yuv420_lines, %function +lcd_write_yuv420_lines: + @ r0 = yuv_src + @ r1 = width + @ r2 = stride + stmfd sp!, { r4-r12, lr } @ save non-scratch + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p + @ r5 = yuv_src[1] = Cb_p + @ r6 = yuv_src[2] = Cr_p + @ + mov r0, #0x7000000c @ r0 = &LCD2_PORT = 0x70008a0c + add r0, r0, #0x8a00 @ + mov r14, #LCD2_DATA_MASK @ + @ + sub r2, r2, #1 @ Adjust stride because of increment +10: @ loop line @ + ldrb r7, [r4], #1 @ r7 = *Y'_p++; + ldrb r8, [r5], #1 @ r8 = *Cb_p++; + ldrb r9, [r6], #1 @ r9 = *Cr_p++; + @ + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*74 + add r12, r7, r7, asl #2 @ actually (Y' - 16)*37 and shift right + add r7, r12, r7, asl #5 @ by one less when adding - same for all + @ + sub r8, r8, #128 @ Cb -= 128 + sub r9, r9, #128 @ Cr -= 128 + @ + add r10, r9, r9, asl #1 @ r10 = Cr*51 + Cb*24 + add r10, r10, r10, asl #4 @ + add r10, r10, r8, asl #3 @ + add r10, r10, r8, asl #4 @ + @ + add r11, r9, r9, asl #2 @ r9 = Cr*101 + add r11, r11, r9, asl #5 @ + add r9, r11, r9, asl #6 @ + @ + add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 + mov r8, r8, asr #2 @ + add r9, r9, #256 @ r9 = rv = (r8 + 256) >> 9 + mov r9, r9, asr #9 @ + rsb r10, r10, #128 @ r10 = guv = (-r9 + 128) >> 8 + mov r10, r10, asr #8 @ + @ compute R, G, and B + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv + @ + orr r12, r3, r11 @ check if clamping is needed... + orr r12, r12, r7, asr #1 @ ...at all + cmp r12, #31 @ + bls 15f @ no clamp @ + cmp r3, #31 @ clamp b + mvnhi r3, r3, asr #31 @ + andhi r3, r3, #31 @ + cmp r11, #31 @ clamp r + mvnhi r11, r11, asr #31 @ + andhi r11, r11, #31 @ + cmp r7, #63 @ clamp g + mvnhi r7, r7, asr #31 @ + andhi r7, r7, #63 @ +15: @ no clamp @ + @ + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) + @ + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) + @ + orr r7, r14, r3, lsr #8 @ store pixel + orr r11, r14, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 + add r12, r7, r7, asl #2 @ + add r7, r12, r7, asl #5 @ + @ compute R, G, and B + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv + @ + orr r12, r3, r11 @ check if clamping is needed... + orr r12, r12, r7, asr #1 @ ...at all + cmp r12, #31 @ + bls 15f @ no clamp @ + cmp r3, #31 @ clamp b + mvnhi r3, r3, asr #31 @ + andhi r3, r3, #31 @ + cmp r11, #31 @ clamp r + mvnhi r11, r11, asr #31 @ + andhi r11, r11, #31 @ + cmp r7, #63 @ clamp g + mvnhi r7, r7, asr #31 @ + andhi r7, r7, #63 @ +15: @ no clamp @ + @ + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) + @ + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) + @ + orr r7, r14, r3, lsr #8 @ store pixel + orr r11, r14, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 + add r12, r7, r7, asl #2 @ + add r7, r12, r7, asl #5 @ + @ compute R, G, and B + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv + @ + orr r12, r3, r11 @ check if clamping is needed... + orr r12, r12, r7, asr #1 @ ...at all + cmp r12, #31 @ + bls 15f @ no clamp @ + cmp r3, #31 @ clamp b + mvnhi r3, r3, asr #31 @ + andhi r3, r3, #31 @ + cmp r11, #31 @ clamp r + mvnhi r11, r11, asr #31 @ + andhi r11, r11, #31 @ + cmp r7, #63 @ clamp g + mvnhi r7, r7, asr #31 @ + andhi r7, r7, #63 @ +15: @ no clamp @ + @ + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) + @ + orr r3, r3, r7, lsl #5 @ r3 = b | (g << 5) + orr r3, r3, r11, lsl #11 @ r3 |= (r << 11) + @ + orr r7, r14, r3, lsr #8 @ store pixel + orr r11, r14, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 + add r12, r7, r7, asl #2 @ + add r7, r12, r7, asl #5 @ + @ compute R, G, and B + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv + @ + orr r12, r3, r11 @ check if clamping is needed... + orr r12, r12, r7, asr #1 @ ...at all + cmp r12, #31 @ + bls 15f @ no clamp @ + cmp r3, #31 @ clamp b + mvnhi r3, r3, asr #31 @ + andhi r3, r3, #31 @ + cmp r11, #31 @ clamp r + mvnhi r11, r11, asr #31 @ + andhi r11, r11, #31 @ + cmp r7, #63 @ clamp g + mvnhi r7, r7, asr #31 @ + andhi r7, r7, #63 @ +15: @ no clamp @ + @ + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) + @ + orr r7, r14, r3, lsr #8 @ store pixel + orr r11, r14, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + subs r1, r1, #2 @ subtract block from width + bgt 10b @ loop line @ + @ + ldmfd sp!, { r4-r12, pc } @ restore registers and return + .ltorg @ dump constant pool + .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines + + +/**************************************************************************** + * void lcd_write_yuv_420_lines_odither(unsigned char const * const src[3], + * int width, + * int stride, + * int x_screen, + * int y_screen); + * + * |R| |1.000000 -0.000001 1.402000| |Y'| + * |G| = |1.000000 -0.334136 -0.714136| |Pb| + * |B| |1.000000 1.772000 0.000000| |Pr| + * Red scaled at twice g & b but at same precision to place it in correct + * bit position after multiply and leave instruction count lower. + * |R| |258 0 408| |Y' - 16| + * |G| = |149 -49 -104| |Cb - 128| + * |B| |149 258 0| |Cr - 128| + * + * Write four RGB565 pixels in the following order on each loop: + * 1 3 + > down + * 2 4 \/ left + * + * Kernel pattern (raw|use order): + * 5 3 4 2 row0 row2 > down + * 1 7 0 6 | 5 1 3 7 4 0 2 6 col0 left + * 4 2 5 3 | 4 0 2 6 5 1 3 7 col2 \/ + * 0 6 1 7 + */ + .section .icode, "ax", %progbits + .align 2 + .global lcd_write_yuv420_lines_odither + .type lcd_write_yuv420_lines_odither, %function +lcd_write_yuv420_lines_odither: + @ r0 = yuv_src + @ r1 = width + @ r2 = stride + @ r3 = x_screen + @ [sp] = y_screen + stmfd sp!, { r4-r12, lr } @ save non-scratch + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p + @ r5 = yuv_src[1] = Cb_p + @ r6 = yuv_src[2] = Cr_p + @ + ldr r0, [sp, #40] @ Line up pattern and kernel quadrant + eor r14, r3, r0 @ + and r14, r14, #0x2 @ + mov r14, r14, lsl #6 @ 0x00 or 0x80 + @ + mov r0, #0x7000000c @ r0 = &LCD2_PORT = 0x70008a0c + add r0, r0, #0x8a00 @ + @ + sub r2, r2, #1 @ Adjust stride because of increment +10: @ loop line @ + @ + ldrb r7, [r4], #1 @ r7 = *Y'_p++; + ldrb r8, [r5], #1 @ r8 = *Cb_p++; + ldrb r9, [r6], #1 @ r9 = *Cr_p++; + @ + eor r14, r14, #0x80 @ flip pattern quadrant + @ + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*149 + add r12, r7, r7, asl #2 @ + add r12, r12, r12, asl #4 @ + add r7, r12, r7, asl #6 @ + @ + sub r8, r8, #128 @ Cb -= 128 + sub r9, r9, #128 @ Cr -= 128 + @ + add r10, r8, r8, asl #4 @ r10 = guv = Cr*104 + Cb*49 + add r10, r10, r8, asl #5 @ + add r10, r10, r9, asl #3 @ + add r10, r10, r9, asl #5 @ + add r10, r10, r9, asl #6 @ + @ + mov r8, r8, asl #1 @ r8 = bu = Cb*258 + add r8, r8, r8, asl #7 @ + @ + add r9, r9, r9, asl #1 @ r9 = rv = Cr*408 + add r9, r9, r9, asl #4 @ + mov r9, r9, asl #3 @ + @ + @ compute R, G, and B + add r3, r8, r7 @ r3 = b' = Y + bu + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv + rsb r7, r10, r7 @ r7 = g' = Y + guv + @ + @ r8 = bu, r9 = rv, r10 = guv + @ + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256 + add r3, r12, r3, lsr #8 @ + @ + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 + add r11, r12, r11, lsr #8 @ + @ + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 + add r7, r12, r7, lsr #8 @ + @ + add r12, r14, #0x200 @ + @ + add r3, r3, r12 @ b = r3 + delta + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 + @ + orr r12, r3, r11, asr #1 @ check if clamping is needed... + orr r12, r12, r7 @ ...at all + movs r12, r12, asr #15 @ + beq 15f @ no clamp @ + movs r12, r3, asr #15 @ clamp b + mvnne r3, r12, lsr #15 @ + andne r3, r3, #0x7c00 @ mask b only if clamped + movs r12, r11, asr #16 @ clamp r + mvnne r11, r12, lsr #16 @ + movs r12, r7, asr #15 @ clamp g + mvnne r7, r12, lsr #15 @ +15: @ no clamp @ + @ + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) + @ + and r11, r11, #0xf800 @ pack pixel + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | + orr r3, r11, r3, lsr #10 @ (b >> 10) + @ + mov r11, #LCD2_DATA_MASK @ store pixel + orr r7, r11, r3, lsr #8 @ + orr r11, r11, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 + add r12, r7, r7, asl #2 @ + add r12, r12, r12, asl #4 @ + add r7, r12, r7, asl #6 @ + @ compute R, G, and B + add r3, r8, r7 @ r3 = b' = Y + bu + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv + rsb r7, r10, r7 @ r7 = g' = Y + guv + @ + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256 + add r3, r12, r3, lsr #8 @ + @ + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 + add r11, r12, r11, lsr #8 @ + @ + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 + add r7, r12, r7, lsr #8 @ + @ + @ This element is zero - use r14 @ + @ + add r3, r3, r14 @ b = r3 + delta + add r11, r11, r14, lsl #1 @ r = r11 + delta*2 + add r7, r7, r14, lsr #1 @ g = r7 + delta/2 + @ + orr r12, r3, r11, asr #1 @ check if clamping is needed... + orr r12, r12, r7 @ ...at all + movs r12, r12, asr #15 @ + beq 15f @ no clamp @ + movs r12, r3, asr #15 @ clamp b + mvnne r3, r12, lsr #15 @ + andne r3, r3, #0x7c00 @ mask b only if clamped + movs r12, r11, asr #16 @ clamp r + mvnne r11, r12, lsr #16 @ + movs r12, r7, asr #15 @ clamp g + mvnne r7, r12, lsr #15 @ +15: @ no clamp @ + @ + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) + @ + and r11, r11, #0xf800 @ pack pixel + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | + orr r3, r11, r3, lsr #10 @ (b >> 10) + @ + mov r11, #LCD2_DATA_MASK @ store pixel + orr r7, r11, r3, lsr #8 @ + orr r11, r11, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 + add r12, r7, r7, asl #2 @ + add r12, r12, r12, asl #4 @ + add r7, r12, r7, asl #6 @ + @ compute R, G, and B + add r3, r8, r7 @ r3 = b' = Y + bu + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv + rsb r7, r10, r7 @ r7 = g' = Y + guv + @ + @ r8 = bu, r9 = rv, r10 = guv + @ + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256 + add r3, r12, r3, lsr #8 @ + @ + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 + add r11, r12, r11, lsr #8 @ + @ + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 + add r7, r12, r7, lsr #8 @ + @ + add r12, r14, #0x100 @ + @ + add r3, r3, r12 @ b = r3 + delta + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 + @ + orr r12, r3, r11, asr #1 @ check if clamping is needed... + orr r12, r12, r7 @ ...at all + movs r12, r12, asr #15 @ + beq 15f @ no clamp @ + movs r12, r3, asr #15 @ clamp b + mvnne r3, r12, lsr #15 @ + andne r3, r3, #0x7c00 @ mask b only if clamped + movs r12, r11, asr #16 @ clamp r + mvnne r11, r12, lsr #16 @ + movs r12, r7, asr #15 @ clamp g + mvnne r7, r12, lsr #15 @ +15: @ no clamp @ + @ + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) + @ + and r11, r11, #0xf800 @ pack pixel + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | + orr r3, r11, r3, lsr #10 @ (b >> 10) + @ + mov r11, #LCD2_DATA_MASK @ store pixel + orr r7, r11, r3, lsr #8 @ + orr r11, r11, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 + add r12, r7, r7, asl #2 @ + add r12, r12, r12, asl #4 @ + add r7, r12, r7, asl #6 @ + @ compute R, G, and B + add r3, r8, r7 @ r3 = b' = Y + bu + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv + rsb r7, r10, r7 @ r7 = g' = Y + guv + @ + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256 + add r3, r12, r3, lsr #8 @ + @ + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 + add r11, r12, r11, lsr #8 @ + @ + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 + add r7, r12, r7, lsr #8 @ + @ + add r12, r14, #0x300 @ + @ + add r3, r3, r12 @ b = r3 + delta + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 + @ + orr r12, r3, r11, asr #1 @ check if clamping is needed... + orr r12, r12, r7 @ ...at all + movs r12, r12, asr #15 @ + beq 15f @ no clamp @ + movs r12, r3, asr #15 @ clamp b + mvnne r3, r12, lsr #15 @ + andne r3, r3, #0x7c00 @ mask b only if clamped + movs r12, r11, asr #16 @ clamp r + mvnne r11, r12, lsr #16 @ + movs r12, r7, asr #15 @ clamp g + mvnne r7, r12, lsr #15 @ +15: @ no clamp @ + @ + and r11, r11, #0xf800 @ pack pixel + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | + orr r3, r11, r3, lsr #10 @ (b >> 10) + @ + mov r11, #LCD2_DATA_MASK @ store pixel + orr r7, r11, r3, lsr #8 @ + orr r11, r11, r3 @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r7, [r0] @ +20: @ + ldr r3, [r0] @ + tst r3, #LCD2_BUSY_MASK @ + bne 20b @ + str r11, [r0] @ + @ + subs r1, r1, #2 @ subtract block from width + bgt 10b @ loop line @ + @ + ldmfd sp!, { r4-r12, pc } @ restore registers and return + .ltorg @ dump constant pool + .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither Index: firmware/target/arm/philips/hdd6330/lcd-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/lcd-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/lcd-hdd6330.c (revision 0) @@ -0,0 +1,392 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Mark Arigo + * + * 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 "config.h" +#include "cpu.h" +#include "lcd.h" +#include "kernel.h" +#include "system.h" + +/* The LCD registers appear to match controllers from Leadis Technology, + either the LDS176 (132x132 4k) or the LDS186 (128x160 65k). + These defines are from the LDS176 (I couldn't find the LDS186 datasheet. */ +#define NOP 0x00 +#define SWRESET 0x01 +#define BSTROFF 0x02 +#define BSTRON 0x03 +#define RDDID 0x04 +#define RDDST 0x09 +#define SLPIN 0x10 +#define SLPOUT 0x11 +#define PTLON 0x12 +#define NORON 0x13 +#define INVOFF 0x20 +#define INVON 0x21 +#define APOFF 0x22 +#define APON 0x23 +#define WRCNTR 0x25 +#define DISPOFF 0x28 +#define DISPON 0x29 +#define CASET 0x2a +#define RASET 0x2b +#define RAMWR 0x2c +#define RAMRD 0x2e +#define RGBSET 0x2d +#define PTLAR 0x30 +#define SCRLAR 0x33 +#define TEOFF 0x34 +#define TEON 0x35 +#define MADCTR 0x36 +#define VSCSAD 0x37 +#define IDMOFF 0x38 +#define IDMON 0x39 +#define COLMOD 0x3a +#define RDID1 0xda +#define RDID2 0xdb +#define RDID3 0xdc +#define CLKINT 0xb0 +#define CLKEXT 0xb1 +#define FRMSEL 0xb4 +#define FRM8SEL 0xb5 +#define TMPRNG 0xb6 +#define TMPHIS 0xb7 +#define TMPREAD 0xb8 +#define DISCTR 0xba +#define EPVOL 0xbb +#define EPWRIN 0xd1 +#define EPWROUT 0xd0 +#define RDEV 0xd4 +#define RDRR 0xd5 + +/* Display status */ +static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; +static unsigned mad_ctrl = 0; + +/* wait for LCD */ +static inline void lcd_wait_write(void) +{ + int i = 0; + while (LCD2_PORT & LCD2_BUSY_MASK) + { + if (i < 2000) + i++; + else + LCD2_PORT &= ~LCD2_BUSY_MASK; + } +} + +/* send LCD data */ +static void lcd_send_data(unsigned data) +{ + lcd_wait_write(); + LCD2_PORT = LCD2_DATA_MASK | (data & 0xff); +} + +/* send LCD command */ +static void lcd_send_cmd(unsigned cmd) +{ + lcd_wait_write(); + LCD2_PORT = LCD2_CMD_MASK | (cmd & 0xff); + lcd_wait_write(); +} + +static inline void lcd_send_pixel(unsigned pixel) +{ + lcd_send_data(pixel >> 8); + lcd_send_data(pixel); +} + +void lcd_init_device(void) +{ +#if 0 + /* this sequence from the OF bootloader */ + + DEV_EN2 |= 0x2000; + outl(inl(0x70000014) & ~0xf000000, 0x70000014); + outl(inl(0x70000014) | 0xa000000, 0x70000014); + DEV_INIT1 &= 0xc000; + DEV_INIT1 |= 0x8000; + MLCD_SCLK_DIV &= ~0x800; + CLCD_CLOCK_SRC |= 0xc0000000; + DEV_INIT2 &= ~0x400; + outl(inl(0x7000002c) | ((1<<4)<<24), 0x7000002c); + DEV_INIT2 &= ~((1<<4)<<24); + udelay(10000); + + DEV_INIT2 |= ((1<<4)<<24); + outl(0x220, 0x70008a00); + outl(0x1f00, 0x70008a04); + LCD2_BLOCK_CTRL = 0x10008080; + LCD2_BLOCK_CONFIG = 0xF00000; + + /* lcd power */ + GPIOJ_ENABLE |= 0x4; + GPIOJ_OUTPUT_VAL |= 0x4; + GPIOJ_OUTPUT_EN |= 0x4; + + lcd_send_cmd(SWRESET); + udelay(10000); + + lcd_send_cmd(WRCNTR); + lcd_send_data(0x3f); + + lcd_send_cmd(SLPOUT); + udelay(120000); + + lcd_send_cmd(INVOFF); + lcd_send_cmd(IDMOFF); + lcd_send_cmd(NORON); + + lcd_send_cmd(FRMSEL); + lcd_send_data(0x2); + lcd_send_data(0x6); + lcd_send_data(0x8); + lcd_send_data(0xd); + + lcd_send_cmd(FRM8SEL); + lcd_send_data(0x2); + lcd_send_data(0x6); + lcd_send_data(0x8); + lcd_send_data(0xd); + + lcd_send_cmd(TMPRNG); + lcd_send_data(0x19); + lcd_send_data(0x23); + lcd_send_data(0x2d); + + lcd_send_cmd(TMPHIS); + lcd_send_data(0x5); + + lcd_send_cmd(DISCTR); + lcd_send_data(0x7); + lcd_send_data(0x18); + + lcd_send_cmd(MADCTR); + lcd_send_data(0); + mad_ctrl = 0; + + lcd_send_cmd(COLMOD); + lcd_send_data(0x5); + + lcd_send_cmd(RGBSET); + lcd_send_data(0x1); + lcd_send_data(0x2); + lcd_send_data(0x3); + lcd_send_data(0x4); + lcd_send_data(0x5); + lcd_send_data(0x6); + lcd_send_data(0x7); + lcd_send_data(0x8); + lcd_send_data(0x9); + lcd_send_data(0xa); + lcd_send_data(0xb); + lcd_send_data(0xc); + lcd_send_data(0xd); + lcd_send_data(0xe); + lcd_send_data(0xf); + lcd_send_data(0x10); + lcd_send_data(0x11); + lcd_send_data(0x12); + lcd_send_data(0x13); + lcd_send_data(0x14); + lcd_send_data(0x15); + lcd_send_data(0x16); + lcd_send_data(0x17); + lcd_send_data(0x18); + lcd_send_data(0x19); + lcd_send_data(0x1a); + lcd_send_data(0x1b); + lcd_send_data(0x1c); + lcd_send_data(0x1d); + lcd_send_data(0x1e); + lcd_send_data(0x1f); + lcd_send_data(0x20); + lcd_send_data(0x21); + lcd_send_data(0x22); + lcd_send_data(0x23); + lcd_send_data(0x24); + lcd_send_data(0x25); + lcd_send_data(0x26); + lcd_send_data(0x27); + lcd_send_data(0x28); + lcd_send_data(0x29); + lcd_send_data(0x2a); + lcd_send_data(0x2b); + lcd_send_data(0x2c); + lcd_send_data(0x2d); + lcd_send_data(0x2e); + lcd_send_data(0x2f); + lcd_send_data(0x30); + + lcd_send_cmd(DISPON); +#endif +} + +/*** hardware configuration ***/ +int lcd_default_contrast(void) +{ + return DEFAULT_CONTRAST_SETTING; +} + +void lcd_set_contrast(int val) +{ + lcd_send_cmd(WRCNTR); + lcd_send_data(val); +} + +void lcd_set_invert_display(bool yesno) +{ + if (yesno) + lcd_send_cmd(INVON); + else + lcd_send_cmd(INVOFF); +} + +/* turn the display upside down (call lcd_update() afterwards) */ +void lcd_set_flip(bool yesno) +{ + if (yesno) + mad_ctrl |= ((1<<7) | (1<<6)); /* flip */ + else + mad_ctrl &= ~((1<<7) | (1<<6)); /* normal */ + + lcd_send_cmd(MADCTR); + lcd_send_data(mad_ctrl); +} + +void lcd_yuv_set_options(unsigned options) +{ + lcd_yuv_options = options; +} + +/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ +extern void lcd_write_yuv420_lines(unsigned char const * const src[3], + int width, int stride); + +extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], + int width, int stride, + int x_screen, int y_screen); + +/* Performance function to blit a YUV bitmap directly to the LCD */ +void lcd_blit_yuv(unsigned char * const src[3], + int src_x, int src_y, int stride, + int x, int y, int width, int height) +{ + unsigned char const * yuv_src[3]; + off_t z; + + /* Sorry, but width and height must be >= 2 or else */ + width &= ~1; + height >>= 1; + + z = stride*src_y; + yuv_src[0] = src[0] + z + src_x; + yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); + yuv_src[2] = src[2] + (yuv_src[1] - src[1]); + + /* Set vertical address mode */ + lcd_send_cmd(MADCTR); + lcd_send_data(mad_ctrl | (1<<5)); + + lcd_send_cmd(RASET); + lcd_send_data(x); + lcd_send_data(x + width - 1); + + if (lcd_yuv_options & LCD_YUV_DITHER) + { + do + { + lcd_send_cmd(CASET); + lcd_send_data(y); + lcd_send_data(y + 1); + + lcd_send_cmd(RAMWR); + + lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); + yuv_src[0] += stride << 1; /* Skip down two luma lines */ + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ + yuv_src[2] += stride >> 1; + y += 2; + } + while (--height > 0); + } + else + { + do + { + lcd_send_cmd(CASET); + lcd_send_data(y); + lcd_send_data(y + 1); + + lcd_send_cmd(RAMWR); + + lcd_write_yuv420_lines(yuv_src, width, stride); + yuv_src[0] += stride << 1; /* Skip down two luma lines */ + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ + yuv_src[2] += stride >> 1; + y += 2; + } + while (--height > 0); + } + + /* Restore the address mode */ + lcd_send_cmd(MADCTR); + lcd_send_data(mad_ctrl); +} + +/* Update the display. + This must be called after all other LCD functions that change the display. */ +void lcd_update(void) +{ + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); +} + +/* Update a fraction of the display. */ +void lcd_update_rect(int x, int y, int width, int height) +{ + const fb_data *addr; + + if (x + width >= LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height >= LCD_HEIGHT) + height = LCD_HEIGHT - y; + + if ((width <= 0) || (height <= 0)) + return; /* Nothing left to do. */ + + addr = &lcd_framebuffer[y][x]; + + lcd_send_cmd(CASET); + lcd_send_data(x); + lcd_send_data(x + width - 1); + + lcd_send_cmd(RASET); + lcd_send_data(y); + lcd_send_data(y + height - 1); + + lcd_send_cmd(RAMWR); + do { + int w = width; + do { + lcd_send_pixel(*addr++); + } while (--w > 0); + addr += LCD_WIDTH - width; + } while (--height > 0); +} Property changes on: firmware/target/arm/philips/hdd6330/lcd-hdd6330.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/arm/philips/hdd6330/power-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/power-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/power-hdd6330.c (revision 0) @@ -0,0 +1,118 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Mark Arigo + * + * 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 "config.h" +#include "cpu.h" +#include +#include "kernel.h" +#include "system.h" +#include "power.h" +#include "logf.h" +#include "usb.h" +#include "synaptics-mep.h" + +void power_init(void) +{ + /* power off bit */ + GPIOB_ENABLE |= 0x80; + GPIOB_OUTPUT_VAL |= 0x80; + GPIOB_OUTPUT_EN |= 0x80; + + /* charger inserted bit */ + GPIOE_ENABLE |= 0x20; + GPIOE_INPUT_VAL |= 0x20; + +#if CONFIG_TUNER + /* fm antenna? */ + GPIOE_ENABLE |= 0x40; + GPIOE_OUTPUT_EN |= 0x40; + GPIOE_OUTPUT_VAL &= ~0x40; /* off */ +#endif + +#ifndef BOOTLOADER + /* enable touchpad here because we need it for + both buttons and button lights */ + GPO32_ENABLE |= 0x80; + GPO32_VAL &= ~0x80; + udelay(1000); + + GPIOD_ENABLE |= 0x80; /* enable ACK */ + GPIOA_ENABLE |= (0x10 | 0x20); /* enable DATA, CLK */ + + GPIOD_OUTPUT_EN |= 0x80; /* set ACK */ + GPIOD_OUTPUT_VAL |= 0x80; /* high */ + + GPIOA_OUTPUT_EN &= ~0x20; /* CLK */ + + GPIOA_OUTPUT_EN |= 0x10; /* set DATA */ + GPIOA_OUTPUT_VAL |= 0x10; /* high */ + + syn_init(); +#endif +} + +unsigned int power_input_status(void) +{ + unsigned int status = POWER_INPUT_NONE; + + /* AC charger */ + if (GPIOE_INPUT_VAL & 0x20) + status |= POWER_INPUT_MAIN_CHARGER; + + /* Do nothing with USB for now + if (GPIOE_INPUT_VAL & 0x4) + status |= POWER_INPUT_USB_CHARGER; + */ + + return status; +} + +void ide_power_enable(bool on) +{ + (void)on; + /* We do nothing */ +} + +bool ide_powered(void) +{ + /* pretend we are always powered - we don't turn it off */ + return true; +} + +void power_off(void) +{ + /* power off bit */ + GPIOB_ENABLE |= 0x80; + GPIOB_OUTPUT_VAL &= ~0x80; + GPIOB_OUTPUT_EN |= 0x80; +} + +#if CONFIG_TUNER +bool tuner_power(bool status) +{ + if (status) + GPIOE_OUTPUT_VAL |= 0x40; + else + GPIOE_OUTPUT_VAL &= ~0x40; + + return status; +} +#endif Property changes on: firmware/target/arm/philips/hdd6330/power-hdd6330.c ___________________________________________________________________ Name: svn:executable + * Index: firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c =================================================================== --- firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c (revision 0) +++ firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c (revision 0) @@ -0,0 +1,72 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: powermgmt-hdd1630.c 19998 2009-02-13 04:25:09Z lowlight $ + * + * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese + * Revisions copyright (C) 2005 by Gerald Van Baren + * + * 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 "config.h" +#include "adc.h" +#include "powermgmt.h" + +#define SMLAL(lo, hi, x, y) \ + asm volatile ("smlal %0, %1, %2, %3" \ + : "+r" (lo), "+r" (hi) \ + : "%r" (x), "r" (y)) + +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 3550 +}; + +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 3500 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + { 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 }, +}; + +#if CONFIG_CHARGING +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short percent_to_volt_charge[11] = +{ + 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 +}; +#endif /* CONFIG_CHARGING */ + +#define BATTERY_SCALE_FACTOR 4200 +/* full-scale ADC readout (2^10) in millivolt */ + +/* Returns battery voltage from ADC [millivolts] */ +unsigned int battery_adc_voltage(void) +{ + /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ + + /* This may be overly complicated (pulled from the OF) */ + int lo = 0; + int val = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR; + + SMLAL(lo, val, 0x8a42f871, val); + val>>= 9; + val -= (val >> 31); + return val; +} Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (revision 21164) +++ firmware/export/config.h (working copy) @@ -110,6 +110,7 @@ #define SANSA_FUZE_PAD 36 #define LYRE_PROTO1_PAD 37 #define SAMSUNG_YH_PAD 38 +#define PHILIPS_HDD6330_PAD 39 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -187,6 +188,7 @@ #define LCD_FUZE 32 /* as used by the Sansa Fuze */ #define LCD_LYRE_PROTO1 33 /* as used by the Lyre */ #define LCD_YH925 34 /* as used by Samsung YH-925 (similar to the H10 20GB) */ +#define LCD_HDD6330 35 /* as used by the Philips HDD6330 */ /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 @@ -342,6 +344,8 @@ #include "config-sa9200.h" #elif defined(PHILIPS_HDD1630) #include "config-hdd1630.h" +#elif defined(PHILIPS_HDD6330) +#include "config-hdd6330.h" #elif defined(SANSA_C100) #include "config-c100.h" #elif defined(MEIZU_M6SL) Index: firmware/export/config-hdd6330.h =================================================================== --- firmware/export/config-hdd6330.h (revision 0) +++ firmware/export/config-hdd6330.h (revision 0) @@ -0,0 +1,204 @@ +/* + * This config file is for the Philips GoGear HDD63x0 + */ + +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 61 +#define MODEL_NAME "Philips GoGear HDD63x0" + +/* define this if you use an ATA controller */ +#define CONFIG_STORAGE STORAGE_ATA + +/* define this if you have recording possibility */ +#define HAVE_RECORDING + +/* Define bitmask of input sources - recordable bitmask can be defined + explicitly if different */ +#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) + +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* define the bitmask of recording sample rates */ +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* 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 + +/* define this if you want album art for this target */ +#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 you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you have access to the pitchscreen */ +#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* LCD dimensions */ +#define LCD_WIDTH 220 +#define LCD_HEIGHT 176 +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 byte-swapped */ + +#ifndef BOOTLOADER +/* Define this if your LCD can be enabled/disabled */ +/* #define HAVE_LCD_ENABLE */ + +/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE + * should be defined as well. + * We can currently put the lcd to sleep but it won't wake up properly */ +/* #define HAVE_LCD_SLEEP */ +/* #define HAVE_LCD_SLEEP_SETTING */ +#endif + +/* 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 IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ + +#define CONFIG_KEYPAD PHILIPS_HDD6330_PAD + +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* define this if you have a real-time clock. The HDD63x0 has a PCF8563 RTC, + but it's register compatible with the E8564. */ +#ifndef BOOTLOADER +#define CONFIG_RTC RTC_E8564 +#define HAVE_RTC_ALARM +#endif + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* 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 this if you have the WM8731 audio codec */ +#define HAVE_WM8731 + +/* WM8731 has no tone controls, so we use the software ones */ +#define HAVE_SW_TONE_CONTROLS + +/* TODO: #define AB_REPEAT_ENABLE 1 */ + +/* FM Tuner */ +#define CONFIG_TUNER TEA5767 +#define CONFIG_TUNER_XTAL 32768 + +/* define this if you have a disk storage, i.e. something + that needs spinups and can cause skips when shaked */ +#define HAVE_DISK_STORAGE + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS +/* #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING */ + +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 16 +#define DEFAULT_BRIGHTNESS_SETTING 13 /* match OF brightness */ + +/* define this if you have a light associated with the buttons */ +#define HAVE_BUTTON_LIGHT +#define HAVE_BUTTONLIGHT_BRIGHTNESS + +#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 630 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +/* Hardware controlled charging */ +#define CONFIG_CHARGING CHARGING_SIMPLE + +/* define this if the unit can be powered or charged via USB */ +#define HAVE_USB_POWER + +#ifndef SIMULATOR + +/* Define this if you have a PortalPlayer PP5020 */ +#define CONFIG_CPU PP5022 + +/* Define this if you want to use the PP5020 i2c interface */ +#define CONFIG_I2C I2C_PP5020 + +/* define this if the hardware can be powered off while charging */ +#define HAVE_POWEROFF_WHILE_CHARGING + +/* The start address index for ROM builds */ +#define ROM_START 0x00000000 + +/* The size of the flash ROM */ +#define FLASH_SIZE 0x100000 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 75000000 + +/* Type of LCD */ +#define CONFIG_LCD LCD_HDD1630 + +/* Define this if your LCD can set contrast */ +#define HAVE_LCD_CONTRAST + +#define MIN_CONTRAST_SETTING 0 +#define MAX_CONTRAST_SETTING 127 +#define DEFAULT_CONTRAST_SETTING 63 /* Match boot contrast */ + +/* We're able to shut off power to the HDD */ +#define HAVE_ATA_POWER_OFF + +/* 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 USE_ROCKBOX_USB +#define USB_VENDOR_ID 0x0471 +#define USB_PRODUCT_ID 0x014C + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +/* Define this if you have adjustable CPU frequency */ +#define HAVE_ADJUSTABLE_CPU_FREQ + +#define MI4_FORMAT +#define BOOTFILE_EXT "mi4" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define BOOTDIR "/.rockbox" + +#define ICODE_ATTR_TREMOR_NOT_MDCT + +#endif Index: apps/SOURCES =================================================================== --- apps/SOURCES (revision 21164) +++ apps/SOURCES (working copy) @@ -220,6 +220,8 @@ keymaps/keymap-sa9200.c #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD keymaps/keymap-hdd1630.c +#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD +keymaps/keymap-hdd6330.c #elif CONFIG_KEYPAD == IAUDIO67_PAD keymaps/keymap-iaudio67.c #elif CONFIG_KEYPAD == SANSA_C100_PAD @@ -235,3 +237,4 @@ #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD keymaps/keymap-yh8xx_yh9xx.c #endif +tdspeed.c Index: apps/keymaps/keymap-hdd6330.c =================================================================== --- apps/keymaps/keymap-hdd6330.c (revision 0) +++ apps/keymaps/keymap-hdd6330.c (revision 0) @@ -0,0 +1,361 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: keymap-hdd1630.c 21054 2009-05-23 14:42:54Z gevaerts $ + * + * Copyright (C) 2008 Mark Arigo + * + * 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. + * + ****************************************************************************/ + +/* Button Code Definitions for the toshiba gigabeat target */ +#include +#include +#include + +#include "config.h" +#include "action.h" +#include "button.h" +#include "settings.h" + +/* + * The format of the list is as follows + * { Action Code, Button code, Prereq button code } + * if there's no need to check the previous button's value, use BUTTON_NONE + * Insert LAST_ITEM_IN_LIST at the end of each mapping + */ + +/* CONTEXT_CUSTOM's used in this file... + +CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions) +CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens + i.e where up/down is inc/dec + CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec + +*/ + + +static const struct button_mapping button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, + + { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT }, + + { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_standard */ + + +static const struct button_mapping button_context_wps[] = { + { ACTION_WPS_PLAY, BUTTON_VIEW|BUTTON_REL, BUTTON_VIEW }, + { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + + { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_VIEW|BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_WPS_ABSETA_PREVDIR, BUTTON_VIEW|BUTTON_LEFT, BUTTON_NONE }, + { ACTION_WPS_ABRESET, BUTTON_VIEW|BUTTON_SELECT, BUTTON_NONE }, + + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + + { ACTION_WPS_PITCHSCREEN, BUTTON_VIEW|BUTTON_UP, BUTTON_VIEW }, + { ACTION_WPS_PITCHSCREEN, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW }, + + { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + { ACTION_WPS_ID3SCREEN, BUTTON_VIEW|BUTTON_MENU, BUTTON_NONE }, + { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST +}; /* button_context_wps */ + +static const struct button_mapping button_context_list[] = { + { ACTION_LISTTREE_PGUP, BUTTON_VIEW|BUTTON_UP, BUTTON_VIEW }, + { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_VIEW|BUTTON_UP }, + { ACTION_LISTTREE_PGUP, BUTTON_VIEW|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LISTTREE_PGDOWN, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW }, + { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_VIEW|BUTTON_DOWN }, + { ACTION_LISTTREE_PGDOWN, BUTTON_VIEW|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#ifdef HAVE_VOLUME_IN_LIST + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#endif + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + +static const struct button_mapping button_context_tree[] = { + { ACTION_TREE_WPS, BUTTON_VIEW|BUTTON_REL, BUTTON_VIEW }, + { ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE }, + { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_tree */ + +static const struct button_mapping button_context_listtree_scroll_with_combo[] = { + { ACTION_NONE, BUTTON_VIEW, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_VIEW|BUTTON_LEFT, BUTTON_VIEW }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_VIEW|BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_VIEW|BUTTON_LEFT, BUTTON_LEFT|BUTTON_REL }, + { ACTION_TREE_ROOT_INIT, BUTTON_VIEW|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_VIEW|BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_VIEW|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_VIEW|BUTTON_RIGHT, BUTTON_VIEW }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_VIEW|BUTTON_RIGHT }, + { ACTION_TREE_PGRIGHT, BUTTON_VIEW|BUTTON_RIGHT, BUTTON_RIGHT|BUTTON_REL }, + { ACTION_TREE_PGRIGHT, BUTTON_VIEW|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), +}; + +static const struct button_mapping button_context_listtree_scroll_without_combo[] = { + { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), +}; + +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_RESET, BUTTON_VIEW, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings */ + +static const struct button_mapping button_context_settings_right_is_inc[] = { + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_RESET, BUTTON_VIEW, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settingsgraphical */ + +static const struct button_mapping button_context_yesno[] = { + { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_yesno */ + +static const struct button_mapping button_context_colorchooser[] = { + { ACTION_STD_OK, BUTTON_VIEW|BUTTON_REL, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_colorchooser */ + +static const struct button_mapping button_context_eq[] = { + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_eq */ + +/** Bookmark Screen **/ +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_VIEW, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), +}; /* button_context_bmark */ + +static const struct button_mapping button_context_time[] = { + { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_VIEW, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), +}; /* button_context_time */ + +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE }, + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_quickscreen */ + +static const struct button_mapping button_context_pitchscreen[] = { + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_MENU, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_VIEW, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, + { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_pitchcreen */ + +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VIEW|BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VIEW|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VIEW|BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VIEW|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_KBD_PAGE_FLIP, BUTTON_VIEW|BUTTON_MENU, BUTTON_NONE }, + { ACTION_KBD_DONE, BUTTON_VIEW|BUTTON_REL, BUTTON_VIEW }, + { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_MORSE_INPUT, BUTTON_VIEW|BUTTON_POWER, BUTTON_NONE }, + { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +#if CONFIG_TUNER +static const struct button_mapping button_context_radio[] = { + { ACTION_FM_MENU, BUTTON_MENU | BUTTON_REL, BUTTON_MENU }, + { ACTION_FM_MODE, BUTTON_MENU | BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_FM_PRESET, BUTTON_VIEW, BUTTON_NONE }, + { ACTION_FM_PLAY, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT }, + { ACTION_FM_STOP, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) +}; +#endif + +#ifdef HAVE_USBSTACK +static const struct button_mapping button_context_usb_hid[] = { + { ACTION_USB_HID_PLAY, BUTTON_VIEW, BUTTON_NONE }, + { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, + { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_usb_hid */ +#endif + +const struct button_mapping* get_context_mapping(int context) +{ + switch (context) + { + case CONTEXT_STD: + return button_context_standard; + case CONTEXT_WPS: + return button_context_wps; + + case CONTEXT_LIST: + return button_context_list; + case CONTEXT_MAINMENU: + case CONTEXT_TREE: + if (global_settings.hold_lr_for_scroll_in_list) + return button_context_listtree_scroll_without_combo; + else + return button_context_listtree_scroll_with_combo; + case CONTEXT_CUSTOM|CONTEXT_TREE: + return button_context_tree; + + case CONTEXT_SETTINGS: + return button_context_settings; + case CONTEXT_CUSTOM|CONTEXT_SETTINGS: + return button_context_settings_right_is_inc; + + case CONTEXT_SETTINGS_COLOURCHOOSER: + return button_context_colorchooser; + case CONTEXT_SETTINGS_EQ: + return button_context_eq; + + case CONTEXT_SETTINGS_TIME: + return button_context_time; + + case CONTEXT_YESNOSCREEN: + return button_context_yesno; + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + case CONTEXT_KEYBOARD: + return button_context_keyboard; +#if CONFIG_TUNER + case CONTEXT_FM: + return button_context_radio; +#endif +#ifdef HAVE_USBSTACK + case CONTEXT_USB_HID: + return button_context_usb_hid; +#endif + } + return button_context_standard; +} Index: firmware/export/usb.h =================================================================== --- firmware/export/usb.h (revision 21164) +++ firmware/export/usb.h (working copy) @@ -84,6 +84,9 @@ #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD #define USBPOWER_BUTTON BUTTON_PLAYLIST #define USBPOWER_BTN_IGNORE BUTTON_POWER +#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD +#define USBPOWER_BUTTON BUTTON_SELECT +#define USBPOWER_BTN_IGNORE BUTTON_POWER #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD #define USBPOWER_BUTTON BUTTON_RIGHT #define USBPOWER_BTN_IGNORE BUTTON_LEFT Index: tools/configure =================================================================== --- tools/configure (revision 21164) +++ tools/configure (working copy) @@ -758,8 +758,9 @@ 90) Zen Vision:M 30GB 100) GoGear SA9200 56) Sansa e200v2 91) Zen Vision:M 60GB 101) GoGear HDD1630/ 57) Sansa m200v4 92) Zen Vision HDD1830 58) Sansa Fuze - 59) Sansa c200v2 - ==Onda== ==Meizu== 60) Sansa Clipv2 + 102) GoGear HDD6330 59) Sansa c200v2 + 60) Sansa Clipv2 + ==Onda== ==Meizu== 120) VX747 110) M6SL 121) VX767 111) M6SP ==Logik== 122) VX747+ 112) M3 80) DAX 1GB MP3/DAB @@ -1930,6 +1931,30 @@ t_model="hdd1630" ;; + 102|hdd6330) + target_id=61 + modelname="hdd6330" + target="-DPHILIPS_HDD6330" + memory=64 # supposedly + arm7tdmicc + tool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBOS" + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" + output="rockbox.mi4" + appextra="recorder:gui" + plugins="" + swcodec="yes" + boottool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBBL" + bootoutput="FWImage.ebn" + # toolset is the tools within the tools directory that we build for + # this particular target. + toolset=$scramblebitmaptools + # architecture, manufacturer and model for the target-tree build + t_cpu="arm" + t_manufacturer="philips" + t_model="hdd6330" + ;; + 110|meizum6sl) target_id=49 modelname="meizum6sl" Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 21164) +++ apps/debug_menu.c (working copy) @@ -1027,9 +1027,10 @@ (CONFIG_KEYPAD == SANSA_C200_PAD) # define DEBUG_CANCEL BUTTON_LEFT -/* This is temporary until the SA9200 touchpad works */ +/* This is temporary until the SA9200 and HDD6330 touchpads work */ #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \ - (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) + (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \ + (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) # define DEBUG_CANCEL BUTTON_POWER #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD) @@ -1230,7 +1231,7 @@ snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x", adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD)); lcd_puts(0, line++, buf); -#elif defined(PHILIPS_HDD1630) +#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) line++; snprintf(buf, sizeof(buf), "BATT: %03x UNK1: %03x", adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));