summaryrefslogtreecommitdiffstats
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rwxr-xr-x[-rw-r--r--]firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c27
-rwxr-xr-x[-rw-r--r--]firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h20
2 files changed, 34 insertions, 13 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
index 2624eb3d82..1aa98819fe 100644..100755
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
@@ -27,11 +27,22 @@
#include "powermgmt.h"
#include "kernel.h"
+#ifdef ONDA_VX747
#define BTN_OFF (1 << 29)
#define BTN_VOL_DOWN (1 << 27)
#define BTN_HOLD (1 << 16)
#define BTN_MENU (1 << 1)
#define BTN_VOL_UP (1 << 0)
+#elif defined(ONDA_VX747P)
+#define BTN_OFF (1 << 29)
+#define BTN_VOL_DOWN (1 << 27)
+#define BTN_HOLD (1 << 22) /* on REG_GPIO_PXPIN(2) */
+#define BTN_MENU (1 << 20)
+#define BTN_VOL_UP (1 << 19)
+#else
+#error No buttons defined!
+#endif
+
#define BTN_MASK (BTN_OFF | BTN_VOL_DOWN | \
BTN_MENU | BTN_VOL_UP)
@@ -130,11 +141,19 @@ void button_init_device(void)
REG_SADC_CTRL = (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM));
REG_SADC_ENA = (SADC_ENA_TSEN | SADC_ENA_PBATEN);
+#ifdef ONDA_VX747
__gpio_as_input(32*3 + 29);
__gpio_as_input(32*3 + 27);
__gpio_as_input(32*3 + 16);
__gpio_as_input(32*3 + 1);
__gpio_as_input(32*3 + 0);
+#elif defined(ONDA_VX747P)
+ __gpio_as_input(32*3 + 29);
+ __gpio_as_input(32*3 + 27);
+ __gpio_as_input(32*3 + 20);
+ __gpio_as_input(32*3 + 19);
+ __gpio_as_input(32*2 + 22);
+#endif
mutex_init(&battery_mtx);
}
@@ -173,7 +192,13 @@ int button_read_device(int *data)
int ret = 0, tmp;
/* Filter button events out if HOLD button is pressed at firmware/ level */
- if((~REG_GPIO_PXPIN(3)) & BTN_HOLD)
+ if(
+#ifdef ONDA_VX747
+ (~REG_GPIO_PXPIN(3)) & BTN_HOLD
+#elif defined(ONDA_VX747P)
+ (~REG_GPIO_PXPIN(2)) & BTN_HOLD
+#endif
+ )
return 0;
tmp = (~REG_GPIO_PXPIN(3)) & BTN_MASK;
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h
index c681bdaa12..887d7415d0 100644..100755
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h
@@ -24,23 +24,19 @@
#include "config.h"
-#define __gpio_as_usb_detect() \
-do { \
- REG_GPIO_PXFUNS(3) = 0x10000000; \
- REG_GPIO_PXSELS(3) = 0x10000000; \
- REG_GPIO_PXPES(3) = 0x10000000; \
-} while (0)
-
#define GPIO_UDC_DETE (32 * 3 + 28)
#define IRQ_GPIO_UDC_DETE (IRQ_GPIO_0 + GPIO_UDC_DETE)
-static inline void usb_init_gpio(void)
-{
- __gpio_as_usb_detect();
- system_enable_irq(IRQ_UDC);
- __gpio_as_input(GPIO_UDC_DETE);
+#define USB_INIT_GPIO() \
+{ \
+ REG_GPIO_PXFUNS(3) = 0x10000000; \
+ REG_GPIO_PXSELS(3) = 0x10000000; \
+ REG_GPIO_PXPES(3) = 0x10000000; \
+ __gpio_as_input(GPIO_UDC_DETE); \
}
+#define USB_DRV_CONNECTED() (__gpio_get_pin(GPIO_UDC_DETE) == 1)
+
int usb_detect(void);
void usb_init_device(void);
bool usb_drv_connected(void);