Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[grifo,wiki] fix software power off

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
commit be8e6806744921c9d565dea0454b59621fc0a7c8 1 parent aefa62e
@hxw hxw authored
View
12 samo-lib/grifo/src/button.c
@@ -61,15 +61,17 @@ void Button_initialise(void)
REG_KINTSEL_SPPK01 = 0x04; // use P60..P62
- REG_INT_PP01L = 0x06; // P0 prority (for power button)
+ REG_INT_PP23L |= 0x60; // P03 prority (for power button)
- REG_PINTSEL_SPT03 = 0x00; // select P03 interrupt (the power button
+ REG_PINTSEL_SPT03 = 0x00; // select P03 interrupt (the power button)
- REG_PINTPOL_SPP07 = SPPT3; // P03 active high
+ REG_PINTPOL_SPP07 &= ~SPPT3; // P03 active low
- REG_PINTEL_SEPT07 = SEPT3; // P03 edge trigered
+ REG_PINTEL_SEPT07 |= SEPT3; // P03 edge trigered
- REG_INT_EK01_EP03 = EK0 | EP3; // enable KINT0 and Port0
+
+ REG_INT_FK01_FP03 = FK0 | FK1 | FP3; // clear all flags
+ REG_INT_EK01_EP03 = EK0 | EP3; // enable KINT0 and P03
Vector_set(VECTOR_Port_input_interrupt_3, Button_PowerInterrupt);
Vector_set(VECTOR_Key_input_interrupt_0, Button_KeyInterrupt);
View
31 samo-lib/grifo/src/vector.c
@@ -109,6 +109,37 @@ void Vector_initialise(void)
(void)Vector_set(VECTOR_Software_exception_2, panic_Software_exception_2);
(void)Vector_set(VECTOR_Software_exception_3, panic_Software_exception_3);
+
+ // set all interrupt controller registers to defined state
+ REG_INT_PI2S = 0;
+ REG_INT_EI2S = 0;
+
+ REG_INT_EK01_EP03 = 0;
+ REG_INT_EP47_ERTC_EAD = 0;
+ REG_INT_EP815 = 0;
+
+ REG_INT_PP01L = 0;
+ REG_INT_PP23L = 0;
+ REG_INT_PP45L = 0;
+ REG_INT_PP67L = 0;
+ REG_INT_PP89L = 0;
+ REG_INT_PP1011L = 0;
+ REG_INT_PP1213L = 0;
+ REG_INT_PP1415L = 0;
+
+ REG_PINTSEL_SPT03 = 0;
+ REG_PINTSEL_SPT47 = 0;
+ REG_PINTSEL_SPT811 = 0;
+ REG_PINTSEL_SPT1215 = 0;
+
+ REG_PINTPOL_SPP07 = ~0; // all 1s
+ REG_PINTPOL_SPP815 = ~0; // all 1s
+
+ REG_PINTEL_SEPT07 = ~0; // all 1s
+ REG_PINTEL_SEPT815 = ~0; // all 1s
+
+ REG_INT_FK01_FP03 = ~0; // clear all flags (1=>reset)
+
Interrupt_enable(state);
}
}
View
7 wiki/wikilib.c
@@ -468,10 +468,9 @@ static void handle_button_release(button_t keycode)
keyboard_key_reset_invert(KEYBOARD_RESET_INVERT_NOW, 0); // reset invert immediately
mode = keyboard_get_mode();
if (keycode == BUTTON_POWER) {
- if (history_list_save(HISTORY_SAVE_POWER_OFF))
- {
- delay_us(200000);
- }
+ history_list_save(HISTORY_SAVE_POWER_OFF);
+ delay_us(250000);
+ power_off();
} else if (keycode == BUTTON_SEARCH) {
article_buf_pointer = NULL;
/* back to search */
Please sign in to comment.
Something went wrong with that request. Please try again.