diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-15 17:17:01 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-15 17:17:01 +0000 |
commit | ebb612fbcc87a9547a3603ef6188a26b0760a9aa (patch) | |
tree | f2f4432a08aa972dc786bf32fb7cbbfbf5474c5d /firmware/target/mips | |
parent | bd06769ba2cde7875cc06fb73a3d167f4c0bea04 (diff) | |
download | rockbox-ebb612fbcc87a9547a3603ef6188a26b0760a9aa.tar.gz rockbox-ebb612fbcc87a9547a3603ef6188a26b0760a9aa.zip |
Onda VX747:
1) Improve touchscreen handling
2) Add RTC driver
4) Add NAND Flash ID scanning
3) Other minor fixes
Nand_ID:
Add a generic NAND ID database (currently only containg Samsung chips)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18052 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c (renamed from firmware/target/mips/ingenic_jz47xx/ata-jz4740.c) | 28 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c | 33 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/system-jz4740.c | 8 |
3 files changed, 52 insertions, 17 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c index b907bb86df..ad053c7deb 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c @@ -23,6 +23,34 @@ #include "jz4740.h" #include "ata.h" +#define NAND_CMD_READ1_00 0x00 +#define NAND_CMD_READ1_01 0x01 +#define NAND_CMD_READ2 0x50 +#define NAND_CMD_READ_ID1 0x90 +#define NAND_CMD_READ_ID2 0x91 +#define NAND_CMD_RESET 0xFF +#define NAND_CMD_PAGE_PROGRAM_START 0x80 +#define NAND_CMD_PAGE_PROGRAM_STOP 0x10 +#define NAND_CMD_BLOCK_ERASE_START 0x60 +#define NAND_CMD_BLOCK_ERASE_CONFIRM 0xD0 +#define NAND_CMD_READ_STATUS 0x70 + +#define NANDFLASH_CLE 0x00008000 //PA[15] +#define NANDFLASH_ALE 0x00010000 //PA[16] + +#define NANDFLASH_BASE 0xB8000000 +#define REG_NAND_DATA (*((volatile unsigned char *) NANDFLASH_BASE)) +#define REG_NAND_CMD (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_CLE))) +#define REG_NAND_ADDR (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_ALE))) + +#define JZ_NAND_SET_CLE (NANDFLASH_BASE |= NANDFLASH_CLE) +#define JZ_NAND_CLR_CLE (NANDFLASH_BASE &= ~NANDFLASH_CLE) +#define JZ_NAND_SET_ALE (NANDFLASH_BASE |= NANDFLASH_ALE) +#define JZ_NAND_CLR_ALE (NANDFLASH_BASE &= ~NANDFLASH_ALE) + +#define JZ_NAND_SELECT (REG_EMC_NFCSR |= EMC_NFCSR_NFCE1 ) +#define JZ_NAND_DESELECT (REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE1)) + int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) { (void)start; diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c index 90dc0b83fb..950fc51d69 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c @@ -32,16 +32,16 @@ | BTN_MENU | BTN_OFF ) #define SADC_CFG_INIT ( \ - (2 << SADC_CFG_CLKOUT_NUM_BIT) | \ - SADC_CFG_XYZ1Z2 | \ - SADC_CFG_SNUM_5 | \ - (1 << SADC_CFG_CLKDIV_BIT) | \ - SADC_CFG_PBAT_HIGH | \ - SADC_CFG_CMD_INT_PEN ) + (2 << SADC_CFG_CLKOUT_NUM_BIT) | \ + SADC_CFG_XYZ1Z2 | \ + SADC_CFG_SNUM_5 | \ + (1 << SADC_CFG_CLKDIV_BIT) | \ + SADC_CFG_PBAT_HIGH | \ + SADC_CFG_CMD_INT_PEN ) bool button_hold(void) { - return (REG_GPIO_PXPIN(3) ^ BTN_HOLD ? 1 : 0); + return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0); } void button_init_device(void) @@ -54,7 +54,7 @@ void button_init_device(void) REG_SADC_CFG = SADC_CFG_INIT; REG_SADC_SAMETIME = 1; - REG_SADC_WAITTIME = 1000; //per 100 HZ + REG_SADC_WAITTIME = 1000; /* per 100 HZ */ REG_SADC_STATE &= (~REG_SADC_STATE); REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_TSRDYM)); REG_SADC_ENA = SADC_ENA_TSEN; // | REG_SADC_ENA;//SADC_ENA_TSEN | SADC_ENA_PBATEN | SADC_ENA_SADCINEN; @@ -66,14 +66,21 @@ static int touch_to_pixels(short x, short y) x -= 300; y -= 300; - x /= 3200 / LCD_WIDTH; - y /= 3600 / LCD_HEIGHT; - - return (x << 16) | y; + /* X & Y are switched */ + x /= 3200 / LCD_HEIGHT; + y /= 3600 / LCD_WIDTH; + + x = LCD_HEIGHT - x; + y = LCD_WIDTH - y; + + return (y << 16) | x; } int button_read_device(int *data) { + if(button_hold()) + return 0; + unsigned int key = ~REG_GPIO_PXPIN(3); int ret = 0; if(key & BTN_MASK) @@ -114,6 +121,8 @@ int button_read_device(int *data) REG_SADC_STATE = 0; //__intc_unmask_irq(IRQ_SADC); } + else + *data = 0; return ret; } diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index 4963cac517..ee50520243 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c @@ -22,19 +22,17 @@ #include "config.h" #include "jz4740.h" #include "mipsregs.h" +#include "panic.h" void intr_handler(void) { + _printf("Interrupt!"); return; } void except_handler(void* stack_ptr, unsigned int cause, unsigned int epc) { - (void)stack_ptr; - (void)cause; - (void)epc; - REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN; - while(1); + panicf("Exception occurred: [0x%x] at 0x%x (stack at 0x%x)", cause, epc, (unsigned int)stack_ptr); } void system_reboot(void) |