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 | |
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')
-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 @@ | |||
23 | #include "jz4740.h" | 23 | #include "jz4740.h" |
24 | #include "ata.h" | 24 | #include "ata.h" |
25 | 25 | ||
26 | #define NAND_CMD_READ1_00 0x00 | ||
27 | #define NAND_CMD_READ1_01 0x01 | ||
28 | #define NAND_CMD_READ2 0x50 | ||
29 | #define NAND_CMD_READ_ID1 0x90 | ||
30 | #define NAND_CMD_READ_ID2 0x91 | ||
31 | #define NAND_CMD_RESET 0xFF | ||
32 | #define NAND_CMD_PAGE_PROGRAM_START 0x80 | ||
33 | #define NAND_CMD_PAGE_PROGRAM_STOP 0x10 | ||
34 | #define NAND_CMD_BLOCK_ERASE_START 0x60 | ||
35 | #define NAND_CMD_BLOCK_ERASE_CONFIRM 0xD0 | ||
36 | #define NAND_CMD_READ_STATUS 0x70 | ||
37 | |||
38 | #define NANDFLASH_CLE 0x00008000 //PA[15] | ||
39 | #define NANDFLASH_ALE 0x00010000 //PA[16] | ||
40 | |||
41 | #define NANDFLASH_BASE 0xB8000000 | ||
42 | #define REG_NAND_DATA (*((volatile unsigned char *) NANDFLASH_BASE)) | ||
43 | #define REG_NAND_CMD (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_CLE))) | ||
44 | #define REG_NAND_ADDR (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_ALE))) | ||
45 | |||
46 | #define JZ_NAND_SET_CLE (NANDFLASH_BASE |= NANDFLASH_CLE) | ||
47 | #define JZ_NAND_CLR_CLE (NANDFLASH_BASE &= ~NANDFLASH_CLE) | ||
48 | #define JZ_NAND_SET_ALE (NANDFLASH_BASE |= NANDFLASH_ALE) | ||
49 | #define JZ_NAND_CLR_ALE (NANDFLASH_BASE &= ~NANDFLASH_ALE) | ||
50 | |||
51 | #define JZ_NAND_SELECT (REG_EMC_NFCSR |= EMC_NFCSR_NFCE1 ) | ||
52 | #define JZ_NAND_DESELECT (REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE1)) | ||
53 | |||
26 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) | 54 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) |
27 | { | 55 | { |
28 | (void)start; | 56 | (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 @@ | |||
32 | | BTN_MENU | BTN_OFF ) | 32 | | BTN_MENU | BTN_OFF ) |
33 | 33 | ||
34 | #define SADC_CFG_INIT ( \ | 34 | #define SADC_CFG_INIT ( \ |
35 | (2 << SADC_CFG_CLKOUT_NUM_BIT) | \ | 35 | (2 << SADC_CFG_CLKOUT_NUM_BIT) | \ |
36 | SADC_CFG_XYZ1Z2 | \ | 36 | SADC_CFG_XYZ1Z2 | \ |
37 | SADC_CFG_SNUM_5 | \ | 37 | SADC_CFG_SNUM_5 | \ |
38 | (1 << SADC_CFG_CLKDIV_BIT) | \ | 38 | (1 << SADC_CFG_CLKDIV_BIT) | \ |
39 | SADC_CFG_PBAT_HIGH | \ | 39 | SADC_CFG_PBAT_HIGH | \ |
40 | SADC_CFG_CMD_INT_PEN ) | 40 | SADC_CFG_CMD_INT_PEN ) |
41 | 41 | ||
42 | bool button_hold(void) | 42 | bool button_hold(void) |
43 | { | 43 | { |
44 | return (REG_GPIO_PXPIN(3) ^ BTN_HOLD ? 1 : 0); | 44 | return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0); |
45 | } | 45 | } |
46 | 46 | ||
47 | void button_init_device(void) | 47 | void button_init_device(void) |
@@ -54,7 +54,7 @@ void button_init_device(void) | |||
54 | REG_SADC_CFG = SADC_CFG_INIT; | 54 | REG_SADC_CFG = SADC_CFG_INIT; |
55 | 55 | ||
56 | REG_SADC_SAMETIME = 1; | 56 | REG_SADC_SAMETIME = 1; |
57 | REG_SADC_WAITTIME = 1000; //per 100 HZ | 57 | REG_SADC_WAITTIME = 1000; /* per 100 HZ */ |
58 | REG_SADC_STATE &= (~REG_SADC_STATE); | 58 | REG_SADC_STATE &= (~REG_SADC_STATE); |
59 | REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_TSRDYM)); | 59 | REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_TSRDYM)); |
60 | REG_SADC_ENA = SADC_ENA_TSEN; // | REG_SADC_ENA;//SADC_ENA_TSEN | SADC_ENA_PBATEN | SADC_ENA_SADCINEN; | 60 | 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) | |||
66 | x -= 300; | 66 | x -= 300; |
67 | y -= 300; | 67 | y -= 300; |
68 | 68 | ||
69 | x /= 3200 / LCD_WIDTH; | 69 | /* X & Y are switched */ |
70 | y /= 3600 / LCD_HEIGHT; | 70 | x /= 3200 / LCD_HEIGHT; |
71 | 71 | y /= 3600 / LCD_WIDTH; | |
72 | return (x << 16) | y; | 72 | |
73 | x = LCD_HEIGHT - x; | ||
74 | y = LCD_WIDTH - y; | ||
75 | |||
76 | return (y << 16) | x; | ||
73 | } | 77 | } |
74 | 78 | ||
75 | int button_read_device(int *data) | 79 | int button_read_device(int *data) |
76 | { | 80 | { |
81 | if(button_hold()) | ||
82 | return 0; | ||
83 | |||
77 | unsigned int key = ~REG_GPIO_PXPIN(3); | 84 | unsigned int key = ~REG_GPIO_PXPIN(3); |
78 | int ret = 0; | 85 | int ret = 0; |
79 | if(key & BTN_MASK) | 86 | if(key & BTN_MASK) |
@@ -114,6 +121,8 @@ int button_read_device(int *data) | |||
114 | REG_SADC_STATE = 0; | 121 | REG_SADC_STATE = 0; |
115 | //__intc_unmask_irq(IRQ_SADC); | 122 | //__intc_unmask_irq(IRQ_SADC); |
116 | } | 123 | } |
124 | else | ||
125 | *data = 0; | ||
117 | 126 | ||
118 | return ret; | 127 | return ret; |
119 | } | 128 | } |
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 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "jz4740.h" | 23 | #include "jz4740.h" |
24 | #include "mipsregs.h" | 24 | #include "mipsregs.h" |
25 | #include "panic.h" | ||
25 | 26 | ||
26 | void intr_handler(void) | 27 | void intr_handler(void) |
27 | { | 28 | { |
29 | _printf("Interrupt!"); | ||
28 | return; | 30 | return; |
29 | } | 31 | } |
30 | 32 | ||
31 | void except_handler(void* stack_ptr, unsigned int cause, unsigned int epc) | 33 | void except_handler(void* stack_ptr, unsigned int cause, unsigned int epc) |
32 | { | 34 | { |
33 | (void)stack_ptr; | 35 | panicf("Exception occurred: [0x%x] at 0x%x (stack at 0x%x)", cause, epc, (unsigned int)stack_ptr); |
34 | (void)cause; | ||
35 | (void)epc; | ||
36 | REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN; | ||
37 | while(1); | ||
38 | } | 36 | } |
39 | 37 | ||
40 | void system_reboot(void) | 38 | void system_reboot(void) |