summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-05-04 18:00:22 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-05-04 18:00:22 +0000
commitffee0b5e94e565f94b7a312bcbee12d932b6e332 (patch)
tree11bcea325aba3ff18613db58ddf8f3831cfd878e /firmware
parent37a9a200b2ab93f02b8085e78aac91b8ff68419c (diff)
downloadrockbox-ffee0b5e94e565f94b7a312bcbee12d932b6e332.tar.gz
rockbox-ffee0b5e94e565f94b7a312bcbee12d932b6e332.zip
fuze+: move defines from .c to .h; implement button reading for volume up/down and power
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c19
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/button-target.h1
-rw-r--r--firmware/target/arm/imx233/system-imx233.c24
-rw-r--r--firmware/target/arm/imx233/system-target.h27
4 files changed, 45 insertions, 26 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
index 7f37d67d43..4882f243aa 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
@@ -19,6 +19,9 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "button-target.h" 21#include "button-target.h"
22#include "system.h"
23#include "system-target.h"
24#include "pinctrl-imx233.h"
22 25
23void button_init_device(void) 26void button_init_device(void)
24{ 27{
@@ -26,5 +29,19 @@ void button_init_device(void)
26 29
27int button_read_device(void) 30int button_read_device(void)
28{ 31{
29 return 0; 32 int res = 0;
33 if(!imx233_get_gpio_input_mask(1, 0x40000000))
34 res |= BUTTON_VOL_DOWN;
35 /* The imx233 uses the voltage on the PSWITCH pin to detect power up/down
36 * events as well as recovery mode. Since the power button is the power button
37 * and the volume up button is recovery, it is not possible to know whether
38 * power button is down when volume up is down (except if there is another
39 * method but volume up and power don't seem to be wired to GPIO pins). */
40 switch((HW_POWER_STS & HW_POWER_STS__PSWITCH_BM) >> HW_POWER_STS__PSWITCH_BP)
41 {
42 case 1: res |= BUTTON_POWER; break;
43 case 3: res |= BUTTON_VOL_UP; break;
44 default: break;
45 }
46 return res;
30} 47}
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
index b5d27bb176..81bbc34511 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
@@ -29,7 +29,6 @@ int button_read_device(void);
29 29
30/* Main unit's buttons */ 30/* Main unit's buttons */
31#define BUTTON_POWER 0x00000001 31#define BUTTON_POWER 0x00000001
32
33#define BUTTON_VOL_UP 0x00000002 32#define BUTTON_VOL_UP 0x00000002
34#define BUTTON_VOL_DOWN 0x00000004 33#define BUTTON_VOL_DOWN 0x00000004
35 34
diff --git a/firmware/target/arm/imx233/system-imx233.c b/firmware/target/arm/imx233/system-imx233.c
index bcccce194c..aedffd1cf6 100644
--- a/firmware/target/arm/imx233/system-imx233.c
+++ b/firmware/target/arm/imx233/system-imx233.c
@@ -30,30 +30,6 @@
30#include "lcd.h" 30#include "lcd.h"
31#include "backlight-target.h" 31#include "backlight-target.h"
32 32
33#define HW_POWER_BASE 0x80044000
34
35#define HW_POWER_RESET (*(volatile uint32_t *)(HW_POWER_BASE + 0x100))
36#define HW_POWER_RESET__UNLOCK 0x3E770000
37#define HW_POWER_RESET__PWD 0x1
38
39#define HW_ICOLL_BASE 0x80000000
40
41#define HW_ICOLL_VECTOR (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x0))
42
43#define HW_ICOLL_LEVELACK (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x10))
44#define HW_ICOLL_LEVELACK__LEVEL0 0x1
45
46#define HW_ICOLL_CTRL (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x20))
47#define HW_ICOLL_CTRL__IRQ_FINAL_ENABLE (1 << 16)
48#define HW_ICOLL_CTRL__ARM_RSE_MODE (1 << 18)
49
50#define HW_ICOLL_VBASE (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x40))
51#define HW_ICOLL_INTERRUPT(i) (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x120 + (i) * 0x10))
52#define HW_ICOLL_INTERRUPT__PRIORITY_BM 0x3
53#define HW_ICOLL_INTERRUPT__ENABLE 0x4
54#define HW_ICOLL_INTERRUPT__SOFTIRQ 0x8
55#define HW_ICOLL_INTERRUPT__ENFIQ 0x10
56
57#define default_interrupt(name) \ 33#define default_interrupt(name) \
58 extern __attribute__((weak, alias("UIRQ"))) void name(void) 34 extern __attribute__((weak, alias("UIRQ"))) void name(void)
59 35
diff --git a/firmware/target/arm/imx233/system-target.h b/firmware/target/arm/imx233/system-target.h
index 675adb448b..4d767b3a9f 100644
--- a/firmware/target/arm/imx233/system-target.h
+++ b/firmware/target/arm/imx233/system-target.h
@@ -30,6 +30,33 @@
30#define HW_DIGCTL_BASE 0x8001C000 30#define HW_DIGCTL_BASE 0x8001C000
31#define HW_DIGCTL_MICROSECONDS (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xC0)) 31#define HW_DIGCTL_MICROSECONDS (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xC0))
32 32
33#define HW_POWER_BASE 0x80044000
34#define HW_POWER_STS (*(volatile uint32_t *)(HW_POWER_BASE + 0xc0))
35#define HW_POWER_STS__PSWITCH_BP 20
36#define HW_POWER_STS__PSWITCH_BM (3 << 20)
37
38#define HW_POWER_RESET (*(volatile uint32_t *)(HW_POWER_BASE + 0x100))
39#define HW_POWER_RESET__UNLOCK 0x3E770000
40#define HW_POWER_RESET__PWD 0x1
41
42#define HW_ICOLL_BASE 0x80000000
43
44#define HW_ICOLL_VECTOR (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x0))
45
46#define HW_ICOLL_LEVELACK (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x10))
47#define HW_ICOLL_LEVELACK__LEVEL0 0x1
48
49#define HW_ICOLL_CTRL (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x20))
50#define HW_ICOLL_CTRL__IRQ_FINAL_ENABLE (1 << 16)
51#define HW_ICOLL_CTRL__ARM_RSE_MODE (1 << 18)
52
53#define HW_ICOLL_VBASE (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x40))
54#define HW_ICOLL_INTERRUPT(i) (*(volatile uint32_t *)(HW_ICOLL_BASE + 0x120 + (i) * 0x10))
55#define HW_ICOLL_INTERRUPT__PRIORITY_BM 0x3
56#define HW_ICOLL_INTERRUPT__ENABLE 0x4
57#define HW_ICOLL_INTERRUPT__SOFTIRQ 0x8
58#define HW_ICOLL_INTERRUPT__ENFIQ 0x10
59
33#define INT_SRC_USB_CTRL 11 60#define INT_SRC_USB_CTRL 11
34#define INT_SRC_TIMER(nr) (28 + (nr)) 61#define INT_SRC_TIMER(nr) (28 + (nr))
35#define INT_SRC_LCDIF_DMA 45 62#define INT_SRC_LCDIF_DMA 45