ReactOS  0.4.15-dev-489-g75a0787
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 
13 VOID
14 NTAPI
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 
41 BOOLEAN
42 NTAPI
44 {
45  UCHAR Value;
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 
57 INT
58 NTAPI
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 */
#define TRUE
Definition: types.h:120
GLint x0
Definition: linetemp.h:95
UCHAR KeyboardMatrixStatus[8]
Definition: hwsynkp.c:38
int32_t INT
Definition: typedefs.h:57
IN UCHAR Value
Definition: halp.h:394
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned char BOOLEAN
VOID NTAPI LlbHwOmap3TwlWrite1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress, IN UCHAR Value)
Definition: hwtwl40x.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NTAPI LlbHwKbdReady(VOID)
Definition: hwsynkp.c:43
INT NTAPI LlbHwKbdRead(VOID)
Definition: hwsynkp.c:59
VOID NTAPI LlbHwOmap3SynKpdInitialize(VOID)
Definition: hwsynkp.c:15
BOOLEAN LastState
Definition: hwsynkp.c:39
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15
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