ReactOS 0.4.16-dev-92-g0c2cdca
hwsynkp.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/armllb/hw/omap3-zoom2/hwsynkp.c
5 * PURPOSE: LLB Synpatics Keypad Support for OMAP3 ZOOM 2
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9#include "precomp.h"
10
11/* FUNCTIONS ******************************************************************/
12
13VOID
16{
17 /* Set GPIO pin 8 on the TWL4030 as an output pin */
18 LlbHwOmap3TwlWrite1(0x49, 0x9B, 0xC0);
19
20 /* Set GPIO pin 8 signal on the TWL4030 ON. This powers the keypad backlight */
21 LlbHwOmap3TwlWrite1(0x49, 0xA4, 0xC0);
22
23 /* Set PENDDIS and COR on the the keypad interrupt controller */
24 LlbHwOmap3TwlWrite1(0x4A, 0xE9, 0x06);
25
26 /* Only falling edge detection for key pressed */
27 LlbHwOmap3TwlWrite1(0x4A, 0xE8, 0x01);
28
29 /* Unmask key-pressed events */
30 LlbHwOmap3TwlWrite1(0x4A, 0xE4, 0x0E);
31
32 /* Set the keypad control register to turn hardware sequencing and turn it on */
33 LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x0);
34 LlbHwOmap3TwlRead1(0x4A, 0xE3);
35 LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x43);
36}
37
40
44{
46
47 Value = LlbHwOmap3TwlRead1(0x4A, 0xE3);
48 if (!Value) return FALSE;
49
50 LastState ^= 1;
51 if (!LastState) return FALSE;
52
53 /* Return whether or not an interrupt is pending */
54 return TRUE;
55}
56
57INT
60{
61 UCHAR ActiveCol = 0, ActiveRow = 0, col, coldata, row;
62
63 for (col = 0; col < 8; col++)
64 {
65 coldata = LlbHwOmap3TwlRead1(0x4A, 0xDB + col);
66 if (coldata)
67 {
68 for (row = 0; row < 8; row++)
69 {
70 if (coldata == (1 << row))
71 {
72 ActiveRow = row;
73 ActiveCol = col;
74 break;
75 }
76 }
77 }
78 }
79
80 return ((ActiveCol << 4) | ActiveRow);
81}
82
83/* EOF */
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
BOOLEAN NTAPI LlbHwKbdReady(VOID)
Definition: hwsynkp.c:43
UCHAR KeyboardMatrixStatus[8]
Definition: hwsynkp.c:38
INT NTAPI LlbHwKbdRead(VOID)
Definition: hwsynkp.c:59
BOOLEAN LastState
Definition: hwsynkp.c:39
VOID NTAPI LlbHwOmap3SynKpdInitialize(VOID)
Definition: hwsynkp.c:15
VOID NTAPI LlbHwOmap3TwlWrite1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress, IN UCHAR Value)
Definition: hwtwl40x.c:61
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
unsigned char UCHAR
Definition: xmlstorage.h:181