ReactOS 0.4.15-dev-8052-gc0e3179
hwsynkp.c File Reference
#include "precomp.h"
Include dependency graph for hwsynkp.c:

Go to the source code of this file.

Functions

VOID NTAPI LlbHwOmap3SynKpdInitialize (VOID)
 
BOOLEAN NTAPI LlbHwKbdReady (VOID)
 
INT NTAPI LlbHwKbdRead (VOID)
 

Variables

UCHAR KeyboardMatrixStatus [8]
 
BOOLEAN LastState = FALSE
 

Function Documentation

◆ LlbHwKbdRead()

INT NTAPI LlbHwKbdRead ( VOID  )

Definition at line 59 of file hwsynkp.c.

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}
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
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ LlbHwKbdReady()

BOOLEAN NTAPI LlbHwKbdReady ( VOID  )

Definition at line 43 of file hwsynkp.c.

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}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN LastState
Definition: hwsynkp.c:39
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ LlbHwOmap3SynKpdInitialize()

VOID NTAPI LlbHwOmap3SynKpdInitialize ( VOID  )

Definition at line 15 of file hwsynkp.c.

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}
VOID NTAPI LlbHwOmap3TwlWrite1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress, IN UCHAR Value)
Definition: hwtwl40x.c:61

Referenced by LlbHwInitialize().

Variable Documentation

◆ KeyboardMatrixStatus

UCHAR KeyboardMatrixStatus[8]

Definition at line 38 of file hwsynkp.c.

◆ LastState

BOOLEAN LastState = FALSE

Definition at line 39 of file hwsynkp.c.

Referenced by Ext2McbReaperThread(), and LlbHwKbdReady().