diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-05-16 06:21:11 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-05-16 06:21:11 +0000 |
commit | cda664b701dcd97c3a05ff1a5fdcfb88f9524761 (patch) | |
tree | 05ffd1c395d145365fd73064d2cb25d9e3c836ad /firmware/target | |
parent | 16c8f060e6ec444f9af2d41f73543f2e92a016ca (diff) |
MC13783 (Gigabeat S PMIC): Complete the header file. Distinguish status, sense and mask bit defines to avoid conflicts within the definitions. Much care taken but give a double check before making new use of anything.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17534 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/adc-imx31.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c | 37 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/usb-imx31.c | 4 |
3 files changed, 22 insertions, 21 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/adc-imx31.c b/firmware/target/arm/imx31/gigabeat-s/adc-imx31.c index 27c6957184..d26d708da1 100644 --- a/firmware/target/arm/imx31/gigabeat-s/adc-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/adc-imx31.c @@ -102,5 +102,5 @@ void adc_init(void) mc13783_write(MC13783_ADC1, MC13783_ADEN); /* Enable the ADCDONE interrupt - notifications are dispatched by * event handler. */ - mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_ADCDONE); + mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_ADCDONEM); } diff --git a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c index ddf8d1360f..4f2bd9d931 100644 --- a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c @@ -74,18 +74,18 @@ static void mc13783_interrupt_thread(void) gpio_enable_event(MC13783_GPIO_NUM, MC13783_EVENT_ID); - if (pending[1] & MC13783_TODA) /* only needs to be polled on startup */ + if (pending[1] & MC13783_TODAI) /* only needs to be polled on startup */ mc13783_alarm_start(); /* Check initial states for events with a sense bit */ value = mc13783_read(MC13783_INTERRUPT_SENSE0); - usb_set_status(value & MC13783_USB4V4); - set_charger_inserted(value & MC13783_CHGDET); + usb_set_status(value & MC13783_USB4V4S); + set_charger_inserted(value & MC13783_CHGDETS); value = mc13783_read(MC13783_INTERRUPT_SENSE1); - button_power_set_state((value & MC13783_ONOFD1) == 0); + button_power_set_state((value & MC13783_ONOFD1S) == 0); #ifdef HAVE_HEADPHONE_DETECTION - set_headphones_inserted((value & MC13783_ONOFD2) == 0); + set_headphones_inserted((value & MC13783_ONOFD2S) == 0); #endif pending[0] = pending[1] = 0xffffff; @@ -93,8 +93,9 @@ static void mc13783_interrupt_thread(void) /* Enable desired PMIC interrupts - some are unmasked in the drivers that * handle a specific task */ - mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_CHGDET); - mc13783_clear(MC13783_INTERRUPT_MASK1, MC13783_ONOFD1 | MC13783_ONOFD2); + mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_CHGDETM); + mc13783_clear(MC13783_INTERRUPT_MASK1, MC13783_ONOFD1M | + MC13783_ONOFD2M); while (1) { @@ -116,20 +117,20 @@ static void mc13783_interrupt_thread(void) /* Handle ...PENDING0 */ /* Handle interrupts without a sense bit */ - if (pending[0] & MC13783_ADCDONE) + if (pending[0] & MC13783_ADCDONEI) adc_done(); /* Handle interrupts that have a sense bit that needs to * be checked */ - if (pending[0] & (MC13783_CHGDET | MC13783_USB4V4)) + if (pending[0] & (MC13783_CHGDETI | MC13783_USB4V4I)) { value = mc13783_read(MC13783_INTERRUPT_SENSE0); - if (pending[0] & MC13783_CHGDET) - set_charger_inserted(value & MC13783_CHGDET); + if (pending[0] & MC13783_CHGDETI) + set_charger_inserted(value & MC13783_CHGDETS); - if (pending[0] & MC13783_USB4V4) - usb_set_status(value & MC13783_USB4V4); + if (pending[0] & MC13783_USB4V4I) + usb_set_status(value & MC13783_USB4V4S); } } @@ -142,15 +143,15 @@ static void mc13783_interrupt_thread(void) /* Handle interrupts that have a sense bit that needs to * be checked */ - if (pending[1] & (MC13783_ONOFD1 | MC13783_ONOFD2)) + if (pending[1] & (MC13783_ONOFD1I | MC13783_ONOFD2I)) { value = mc13783_read(MC13783_INTERRUPT_SENSE1); - if (pending[1] & MC13783_ONOFD1) - button_power_set_state((value & MC13783_ONOFD1) == 0); + if (pending[1] & MC13783_ONOFD1I) + button_power_set_state((value & MC13783_ONOFD1S) == 0); #ifdef HAVE_HEADPHONE_DETECTION - if (pending[1] & MC13783_ONOFD2) - set_headphones_inserted((value & MC13783_ONOFD2) == 0); + if (pending[1] & MC13783_ONOFD2I) + set_headphones_inserted((value & MC13783_ONOFD2S) == 0); #endif } } diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c index a90384d35e..f12fd8f0b1 100644 --- a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c @@ -61,7 +61,7 @@ int usb_detect(void) /* Read the immediate state of the cable from the PMIC */ bool usb_plugged(void) { - return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4; + return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S; } void usb_init_device(void) @@ -73,7 +73,7 @@ void usb_init_device(void) /* Module will be turned off later after firmware init */ usb_drv_startup(); - mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_USB4V4); + mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_USB4V4M); } void usb_enable(bool on) |