annotate target-utils/lunadrv/sleep.c @ 962:e3706ce1d01c

CHANGES: document sms-pdu-decode -n option
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 00:01:42 +0000
parents 57f7db8c4f45
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
849
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements suspend and resume commands for entering
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * and exiting ILI9225G sleep mode. These commands are expected
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * to work the same on both HaoRan and Formike LCDs, but the
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * current measurement resistor that allows one to see the actual
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * power supply current drawn by the LCD is present only on lunalcd2
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * boards.
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 */
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "types.h"
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "luna.h"
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 void
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 cmd_suspend()
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 LCD_REG_WR(0x0007, 0); /* display off */
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 wait_ARM_cycles(DELAY_1MS * 50);
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 LCD_REG_WR(0x0010, 1); /* suspend mode */
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 }
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 void
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 cmd_resume()
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 LCD_REG_WR(0x0010, 0); /* out of suspend */
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 wait_ARM_cycles(DELAY_1MS * 50);
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 LCD_REG_WR(0x0007, 0x1017); /* display on */
a66095c7f35f lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
865
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
28
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
29 /*
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
30 * If we wish to run sans-UI firmware on an LCD-equipped board,
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
31 * we would like to put the ILI9225G controller into its lowest
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
32 * power mode, without doing anything else to it. The following
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
33 * reset-suspend command prototypes this functionality.
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
34 */
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
35
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
36 void
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
37 cmd_reset_suspend()
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
38 {
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
39 /* reset pulse */
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
40 CNTL_RST_REG |= EXT_RESET;
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
41 wait_ARM_cycles(DELAY_1MS * 10);
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
42 CNTL_RST_REG &= ~EXT_RESET;
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
43 /* datasheet says it needs 50 ms */
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
44 wait_ARM_cycles(DELAY_1MS * 50);
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
45 /* and straight into suspend mode */
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
46 LCD_REG_WR(0x0010, 1);
57f7db8c4f45 lunadrv: add reset-suspend command
Mychaela Falconia <falcon@freecalypso.org>
parents: 849
diff changeset
47 }